diff --git a/CMakeLists.txt b/CMakeLists.txt index 5527d2ba..ed6c3e55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,13 +287,20 @@ if (USE_PYTHON) endif (USE_PYTHON) ####################################################################### +add_library(netgen_mpi INTERFACE) +add_library(netgen_metis INTERFACE) if (USE_MPI) find_package(MPI REQUIRED) + target_include_directories(netgen_mpi INTERFACE ${MPI_CXX_INCLUDE_PATH}) + target_link_libraries(netgen_mpi INTERFACE ${MPI_mpi_LIBRARY} ${MPI_CXX_LIBRARIES} ) + target_compile_definitions(netgen_mpi INTERFACE PARALLEL ) + find_package(METIS REQUIRED) - add_definitions(-DPARALLEL -DMETIS) - include_directories(${MPI_CXX_INCLUDE_PATH}) - include_directories(${METIS_INCLUDE_DIR}) + target_include_directories(netgen_metis INTERFACE ${METIS_INCLUDE_DIR}) + target_link_libraries(netgen_metis INTERFACE ${METIS_LIBRARY} ) + target_compile_definitions(netgen_metis INTERFACE METIS ) endif (USE_MPI) +install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR}) ####################################################################### if (USE_OCC) diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index 74a470ef..a62c030c 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -39,6 +39,7 @@ if(USE_PYTHON) target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS}) target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES}) endif(USE_PYTHON) +target_link_libraries(ngcore PUBLIC netgen_mpi) install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp exception.hpp symboltable.hpp paje_trace.hpp utils.hpp profiler.hpp mpi_wrapper.hpp diff --git a/libsrc/core/mpi_wrapper.hpp b/libsrc/core/mpi_wrapper.hpp index 329fee57..b42c551e 100644 --- a/libsrc/core/mpi_wrapper.hpp +++ b/libsrc/core/mpi_wrapper.hpp @@ -6,6 +6,7 @@ #include #endif +#include "exception.hpp" namespace ngcore { @@ -191,7 +192,7 @@ namespace ngcore }; -#else +#else // PARALLEL class MPI_Comm { int nr; public: @@ -240,7 +241,7 @@ namespace ngcore void Bcast (T & s, int root = 0) const { ; } }; -#endif +#endif // PARALLEL @@ -252,5 +253,5 @@ namespace ngcore } -#endif +#endif // NGCORE_MPIWRAPPER_HPP diff --git a/libsrc/core/taskmanager.cpp b/libsrc/core/taskmanager.cpp index eca6e923..a411034b 100644 --- a/libsrc/core/taskmanager.cpp +++ b/libsrc/core/taskmanager.cpp @@ -10,6 +10,7 @@ #include #include "concurrentqueue.h" +#include "mpi_wrapper.hpp" #include "paje_trace.hpp" #include "profiler.hpp" #include "taskmanager.hpp" diff --git a/libsrc/meshing/CMakeLists.txt b/libsrc/meshing/CMakeLists.txt index 23f302a7..94268db0 100644 --- a/libsrc/meshing/CMakeLists.txt +++ b/libsrc/meshing/CMakeLists.txt @@ -23,7 +23,7 @@ endif(APPLE) target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen ) -target_link_libraries( mesh PRIVATE ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY}) +target_link_libraries( mesh PRIVATE netgen_metis ${ZLIB_LIBRARIES} ${PYTHON_LIBRARIES} ) if(NOT WIN32) install( TARGETS mesh ${NG_INSTALL_DIR}) endif(NOT WIN32)