mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Remove direct mpi linkage, fix library names
This commit is contained in:
parent
282298e78f
commit
4fafa582dc
@ -335,14 +335,10 @@ if (USE_PYTHON)
|
||||
endif (USE_PYTHON)
|
||||
|
||||
#######################################################################
|
||||
add_library(netgen_mpi INTERFACE)
|
||||
add_library(netgen_metis INTERFACE)
|
||||
if (USE_MPI)
|
||||
set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
|
||||
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)
|
||||
target_include_directories(netgen_metis INTERFACE ${METIS_INCLUDE_DIR})
|
||||
@ -357,7 +353,7 @@ if (USE_MPI)
|
||||
message(STATUS "Found mpi4py: ${MPI4PY_INCLUDE_DIR}")
|
||||
endif(USE_MPI4PY AND USE_PYTHON)
|
||||
endif (USE_MPI)
|
||||
install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR})
|
||||
install(TARGETS netgen_metis ${NG_INSTALL_DIR})
|
||||
|
||||
#######################################################################
|
||||
add_library(occ_libs INTERFACE IMPORTED)
|
||||
|
@ -141,6 +141,10 @@ if(USE_MPI)
|
||||
set(MPICH_INCLUDE_DIR ${MPI_C_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
if(MPI_C_LIBRARY_VERSION_STRING MATCHES "Intel.*")
|
||||
set(INTEL_MPI_INCLUDE_DIR ${MPI_C_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
if(OPENMPI_INCLUDE_DIR)
|
||||
build_mpi_variant(openmpi ${OPENMPI_INCLUDE_DIR})
|
||||
endif()
|
||||
|
@ -72,8 +72,10 @@ void InitMPI(std::optional<std::filesystem::path> mpi_lib_path) {
|
||||
vendor = "Open MPI";
|
||||
else if (version.substr(0, 5) == "MPICH")
|
||||
vendor = "MPICH";
|
||||
else if (version.substr(0, 5) == "Microsoft MPI")
|
||||
else if (version.substr(0, 13) == "Microsoft MPI")
|
||||
vendor = "Microsoft MPI";
|
||||
else if (version.substr(0, 12) == "Intel(R) MPI")
|
||||
vendor = "Intel MPI";
|
||||
else
|
||||
throw std::runtime_error(
|
||||
std::string("Unknown MPI version: " + version));
|
||||
@ -102,7 +104,9 @@ void InitMPI(std::optional<std::filesystem::path> mpi_lib_path) {
|
||||
else if (vendor == "MPICH")
|
||||
ng_lib_name = "ng_mpich";
|
||||
else if (vendor == "Microsoft MPI")
|
||||
ng_lib_name = "ng_msmpi";
|
||||
ng_lib_name = "ng_microsoft_mpi";
|
||||
else if (vendor == "Intel MPI")
|
||||
ng_lib_name = "ng_intel_mpi";
|
||||
else
|
||||
throw std::runtime_error("Unknown MPI vendor: " + vendor);
|
||||
|
||||
|
@ -37,7 +37,7 @@ endif(USE_GUI)
|
||||
if(USE_PYTHON)
|
||||
add_library(ngpy SHARED netgenpy.cpp)
|
||||
target_link_libraries( ngpy PUBLIC nglib PRIVATE "$<BUILD_INTERFACE:netgen_python>" )
|
||||
target_link_libraries( ngpy PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns )
|
||||
target_link_libraries( ngpy PRIVATE ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns )
|
||||
if(APPLE)
|
||||
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
|
||||
elseif(WIN32)
|
||||
|
@ -11,7 +11,7 @@ if(EMSCRIPTEN)
|
||||
target_include_directories(nglib PUBLIC $<TARGET_PROPERTY:ngcore,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
else(EMSCRIPTEN)
|
||||
target_link_libraries(nglib PUBLIC ngcore)
|
||||
target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns )
|
||||
target_link_libraries( nglib PRIVATE ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns )
|
||||
endif(EMSCRIPTEN)
|
||||
|
||||
install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR})
|
||||
|
Loading…
Reference in New Issue
Block a user