You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.2 KiB
CMake
95 lines
3.2 KiB
CMake
if (NOT MPI_C_FOUND)
|
|
find_package(MPI REQUIRED)
|
|
|
|
set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
|
|
set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS})
|
|
set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS})
|
|
set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS})
|
|
include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH})
|
|
endif()
|
|
|
|
if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
|
|
set(gfortran_compiler true)
|
|
endif()
|
|
|
|
include(CheckIncludeFile)
|
|
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA)
|
|
if(NOT HAVE_ALLOCA)
|
|
add_definitions(-DALLOCA_MISSING)
|
|
message(WARNING "Could not find <alloca.h>. Assuming functionality is provided elsewhere.")
|
|
endif()
|
|
|
|
set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}")
|
|
if(CMAKE_REQUIRED_INCLUDES)
|
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH})
|
|
else()
|
|
set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH})
|
|
endif()
|
|
set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}")
|
|
if(CMAKE_REQUIRED_FLAGS)
|
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS})
|
|
else()
|
|
set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS})
|
|
endif()
|
|
set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}")
|
|
if(CMAKE_REQUIRED_LIBRARIES)
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES})
|
|
else()
|
|
set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES})
|
|
endif()
|
|
|
|
set(MPI_HEADERS mpi.h)
|
|
include(CheckIncludeFiles)
|
|
CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT)
|
|
if(HAVE_MPI_EXT)
|
|
add_definitions(-DHAVE_MPI_EXT_H)
|
|
set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h)
|
|
endif()
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes})
|
|
set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags})
|
|
set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries})
|
|
|
|
#---------------------------------------------------
|
|
# Windows Intel MPI compatibility, see GH issue #435
|
|
#---------------------------------------------------
|
|
set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}")
|
|
if(CMAKE_REQUIRED_INCLUDES)
|
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH})
|
|
else()
|
|
set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH})
|
|
endif()
|
|
CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H)
|
|
|
|
include(CheckSymbolExists)
|
|
CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI)
|
|
if(HAVE_Intel_MPI AND WIN32)
|
|
add_definitions(-DUSE_GCC)
|
|
endif()
|
|
set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes})
|
|
|
|
set(PSBLAS_SO_VERSION 0)
|
|
if(gfortran_compiler)
|
|
if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)
|
|
set(PSBLAS_SO_VERSION 2)
|
|
elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0)
|
|
set(PSBLAS_SO_VERSION 1)
|
|
endif()
|
|
endif()
|
|
|
|
set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}")
|
|
set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}")
|
|
set(MPI_LIBS "")
|
|
foreach( lib IN LISTS MPI_Fortran_LIBRARIES)
|
|
set(MPI_LIBS "${MPI_LIBS} \"${lib}\"")
|
|
endforeach()
|
|
string(STRIP "${MPI_LIBS}" MPI_LIBS)
|
|
|
|
set(directory_list fileread hello kernel pargen torture util)
|
|
if (SERIAL_MPI)
|
|
set(directory_list ${directory_list} serial)
|
|
endif()
|
|
foreach(directory ${directory_list})
|
|
add_subdirectory("${directory}")
|
|
endforeach()
|