From d9fe6bc22d9fd040ebfb41b6b2842a217b344793 Mon Sep 17 00:00:00 2001 From: Robert Chisholm Date: Fri, 14 Jul 2023 15:24:18 +0100 Subject: [PATCH] CMake: Add FLAMEGPU_ENABLE_MPI option. --- src/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a3d23a99..bd7684a84 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -86,6 +86,9 @@ option(FLAMEGPU_RTC_DISK_CACHE "Enable caching of RTC kernels to disk by default # Option to enable/disable logging of dynamic RTC files to disk option(FLAMEGPU_RTC_EXPORT_SOURCES "Export RTC source files to disk at runtime" OFF) +# Option to enable/disable MPI support +option(FLAMEGPU_ENABLE_MPI "Enable MPI support for distributed ensembles" OFF) + # Option to make put glm on the include path option(FLAMEGPU_ENABLE_GLM "Experimental: Make GLM available to flamegpu2 projects on the include path" OFF) mark_as_advanced(FLAMEGPU_ENABLE_GLM) @@ -510,6 +513,17 @@ if (FLAMEGPU_VISUALISATION) target_compile_definitions(${PROJECT_NAME} PUBLIC FLAMEGPU_VISUALISATION) endif() +if (FLAMEGPU_ENABLE_MPI) + find_package(MPI REQUIRED) + if (MPI_CXX_FOUND) + # This sets up include directories and lib + target_link_libraries(${PROJECT_NAME} PUBLIC MPI::MPI_CXX) + else() + message(FATAL_ERROR "MPI C++ Support was not found!") + endif() +endif() + + # Make GLM accessible via include. PUBLIC so this is usable by downstream projects # @todo - make the vis cmake/glm create a target to use. if (FLAMEGPU_ENABLE_GLM)