forked from NOAA-PSL/stochastic_physics
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (62 loc) · 2.39 KB
/
CMakeLists.txt
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
if(CCPP_32BIT)
message(STATUS "Compile stochastic_physics with 32-bit precision to match CCPP slow physics.")
add_definitions(-DCCPP_32BIT)
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 32")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-default-real-8 -fdefault-double-8")
endif()
else()
message(STATUS "Compile stochastic_physics with 64-bit precision to match CCPP slow physics.")
remove_definitions(-DCCPP_32BIT)
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 64")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
endif()
endif()
list(APPEND _stoch_phys_srcs
kinddef.F90
mpi_wrapper.F90
halo_exchange.fv3.F90
plumes.F90
mersenne_twister.F90
random_numbers.F90
stochy_namelist_def.F90
compns_stochy.F90
stochy_internal_state_mod.F90
spectral_transforms.F90
stochastic_physics.F90
stochy_patterngenerator.F90
stochy_data_mod.F90
get_stochy_pattern.F90
cellular_automata_global.F90
cellular_automata_sgs.F90
update_ca.F90
lndp_apply_perts.F90
)
add_library(stochastic_physics ${_stoch_phys_srcs})
add_dependencies(stochastic_physics fms)
if(32BIT)
target_compile_definitions(stochastic_physics PRIVATE INTERNAL_FILE_NML OVERLOAD_R4)
else()
target_compile_definitions(stochastic_physics PRIVATE INTERNAL_FILE_NML)
endif()
set_target_properties(stochastic_physics PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(stochastic_physics INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
$<INSTALL_INTERFACE:mod>)
target_link_libraries(stochastic_physics PUBLIC fms)
if(OPENMP)
target_link_libraries(stochastic_physics PRIVATE OpenMP::OpenMP_Fortran)
endif()
###############################################################################
### Install
###############################################################################
install(
TARGETS stochastic_physics
EXPORT stochastic_physics-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX})
install(EXPORT stochastic_physics-config
DESTINATION lib/cmake)