Skip to content

Commit

Permalink
Do not use FindMPI.cmake, instead giving MPI path manually; This lead…
Browse files Browse the repository at this point in the history
…s to working Windows installation.
  • Loading branch information
yumengch committed Jan 20, 2024
1 parent 877edc9 commit c5b1bfd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1,956 deletions.
30 changes: 3 additions & 27 deletions PDAFBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,13 @@ project(PDAF VERSION 2.1.0 LANGUAGES Fortran)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/..)

# Find MPI package
# use customised FindMPI.cmake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(MPI REQUIRED)
# Add the library target
# In windows, MPI.mod must be compiled by ourselves
if(WIN32)
add_library(mpimod STATIC ${MPI_Fortran_MODULE_DIR}/mpi.f90)
set_source_files_properties(${MPI_Fortran_MODULE_DIR}/mpi.f90 PROPERTIES COMPILE_OPTIONS "")
set_source_files_properties(${MPI_Fortran_MODULE_DIR}/mpi.f90 PROPERTIES COMPILE_OPTIONS "/Qdiag-disable:10448")
target_include_directories(mpimod PUBLIC ${MPI_Fortran_INCLUDE_PATH})
endif()

# # Customize compiler flags
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O3")
# if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none")
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
# elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Cray")
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -N 1023")
# elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
# if(WIN32)
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /4R8")
# set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} /Od")
# else()
# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8")
# set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -mkl")
# #KB For newer versions of CMake - this is the way to go
# enable_language(C)
# set(BLA_VENDOR Intel10_64lp_seq)
# #KB https://cmake.org/cmake/help/latest/module/FindBLAS.html
# endif()
# endif()

set(MOD_PDAF
PDAF_timer.F90
PDAF_memcount.F90
Expand Down Expand Up @@ -438,6 +413,7 @@ add_library(pdaf-var STATIC ${SRC_FILES})
target_include_directories(pdaf-var PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(pdaf-var PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(pdaf-var PUBLIC ${MPI_Fortran_INCLUDE_PATH})
target_include_directories(pdaf-var PUBLIC ${MPI_Fortran_MODULE_DIR})

set_target_properties(pdaf-var PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../lib
Expand Down
Loading

0 comments on commit c5b1bfd

Please sign in to comment.