-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathset_precompiled_libraries.cmake
74 lines (70 loc) · 3.02 KB
/
set_precompiled_libraries.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
set(PRECOMPILED_DIR "${PROJECT_SOURCE_DIR}/precompiled_libraries")
if (SEMBA_FDTD_ENABLE_MTLN)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-gcc/lapack/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.a)
set(BLAS_LIB ${LAPACK_DIR}libblas.a)
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC")
set(LAPACK_DIR "/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/lib/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.a)
set(BLAS_LIB ${LAPACK_DIR}libblas.a)
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-intel/lapack/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.a)
set(BLAS_LIB ${LAPACK_DIR}libblas.a)
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-intelLLVM/lapack/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.a)
set(BLAS_LIB ${LAPACK_DIR}libblas.a)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set(LAPACK_DIR "${PRECOMPILED_DIR}/windows-intel/lapack/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.lib)
set(BLAS_LIB ${LAPACK_DIR}libblas.lib)
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
set(LAPACK_DIR "${PRECOMPILED_DIR}/windows-intelLLVM/lapack/")
set(LAPACK_LIB ${LAPACK_DIR}liblapack.lib)
set(BLAS_LIB ${LAPACK_DIR}libblas.lib)
endif()
endif()
if(NOT LAPACK_DIR)
message(FATAL_ERROR "lapack libraries for this platform and/or compiler have not been found.")
endif()
MESSAGE(STATUS "Using lapack libraries at: " ${LAPACK_DIR})
endif()
if (SEMBA_FDTD_ENABLE_HDF AND NOT HDF5_FOUND)
if (NOT HDF5_ROOT)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC")
# System libraries. Install with sudo apt install libhdf5-dev hdf5-tools
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
set(HDF5_DIR ${PRECOMPILED_DIR}/linux-intel/hdf5/cmake/)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
set(HDF5_DIR ${PRECOMPILED_DIR}/windows-intel/hdf5/cmake/)
endif()
endif()
endif()
add_definitions(-DCompileWithHDF)
set(HDF5_USE_STATIC_LIBRARIES TRUE)
find_package(HDF5 REQUIRED COMPONENTS Fortran HL)
if (HDF5_FOUND)
message(STATUS "hdf5 found at: ${HDF5_Fortran_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "hdf5 libraries for this platform and/or compiler have not been found.")
endif()
endif()
if (SEMBA_FDTD_ENABLE_MPI)
add_definitions(-DCompileWithMPI)
find_package(MPI REQUIRED COMPONENTS Fortran)
if (MPI_FOUND)
message(STATUS "MPI found at: ${MPI_Fortran_INCLUDE_DIRS}")
endif()
add_definitions(${MPI_Fortran_COMPILE_OPTIONS})
include_directories(${MPI_Fortran_INCLUDE_DIRS})
link_directories(${MPI_Fortran_LIBRARIES})
add_compile_options (${MPI_Fortran_COMPILER_FLAGS})
endif()