forked from NOAA-EMC/fv3atm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
155 lines (132 loc) · 5.88 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
if(CCPP)
add_definitions(-DCCPP)
endif()
add_subdirectory(cpl)
add_subdirectory(gfsphysics)
add_subdirectory(ipd)
add_subdirectory(io)
###############################################################################
### fv3dycore
###############################################################################
if(NOT CCPP)
set(FAST_PHYSICS_SRCS_F90 atmos_cubed_sphere/model/fv_cmp.F90)
endif()
add_library(
fv3dycore
atmos_cubed_sphere/model/a2b_edge.F90
atmos_cubed_sphere/model/multi_gases.F90
atmos_cubed_sphere/model/boundary.F90
atmos_cubed_sphere/model/dyn_core.F90
atmos_cubed_sphere/model/fv_arrays.F90
${FAST_PHYSICS_SRCS_F90}
atmos_cubed_sphere/model/fv_control.F90
atmos_cubed_sphere/model/fv_dynamics.F90
atmos_cubed_sphere/model/fv_fill.F90
atmos_cubed_sphere/model/fv_grid_utils.F90
atmos_cubed_sphere/model/fv_mapz.F90
atmos_cubed_sphere/model/fv_nesting.F90
atmos_cubed_sphere/model/fv_regional_bc.F90
atmos_cubed_sphere/model/fv_sg.F90
atmos_cubed_sphere/model/fv_tracer2d.F90
atmos_cubed_sphere/model/fv_update_phys.F90
atmos_cubed_sphere/model/sw_core.F90
atmos_cubed_sphere/model/tp_core.F90
atmos_cubed_sphere/model/nh_core.F90
atmos_cubed_sphere/model/nh_utils.F90
atmos_cubed_sphere/tools/external_ic.F90
atmos_cubed_sphere/tools/external_sst.F90
atmos_cubed_sphere/tools/fv_diagnostics.F90
atmos_cubed_sphere/tools/fv_eta.F90
atmos_cubed_sphere/tools/fv_grid_tools.F90
atmos_cubed_sphere/tools/fv_io.F90
atmos_cubed_sphere/tools/fv_mp_mod.F90
atmos_cubed_sphere/tools/fv_nudge.F90
atmos_cubed_sphere/tools/fv_treat_da_inc.F90
atmos_cubed_sphere/tools/fv_iau_mod.F90
atmos_cubed_sphere/tools/fv_restart.F90
atmos_cubed_sphere/tools/fv_surf_map.F90
atmos_cubed_sphere/tools/fv_timing.F90
atmos_cubed_sphere//tools/init_hydro.F90
atmos_cubed_sphere/tools/sim_nc_mod.F90
atmos_cubed_sphere/tools/sorted_index.F90
atmos_cubed_sphere/tools/test_cases.F90
atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90
atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90
atmos_cubed_sphere/driver/fvGFS/atmosphere.F90
)
set_property(SOURCE atmos_cubed_sphere/model/nh_utils.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}")
set_property(SOURCE atmos_cubed_sphere/model/fv_mapz.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}")
set_target_properties(fv3dycore PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(fv3dycore PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>)
target_link_libraries(fv3dycore PRIVATE fms)
target_link_libraries(fv3dycore PRIVATE gfsphysics)
target_link_libraries(fv3dycore PRIVATE ipd)
target_link_libraries(fv3dycore PRIVATE esmf)
target_include_directories(fv3dycore PRIVATE atmos_cubed_sphere ${ESMF_MOD})
###############################################################################
### ccpp
###############################################################################
if(CCPP)
add_subdirectory(ccpp)
add_subdirectory(ccpp/driver)
add_dependencies(gfsphysics ccpp ccppphys)
add_dependencies(ccppdriver ccpp ccppphys)
add_dependencies(ccppphys ccpp)
target_include_directories(fv3dycore PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/framework/src)
target_include_directories(fv3dycore PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/driver)
target_link_libraries(ccppphys PRIVATE sp::sp_d)
target_link_libraries(ccppphys PRIVATE w3nco::w3nco_d)
endif()
###############################################################################
### stochastic_physics
###############################################################################
# When specifying an out-of-tree source a binary directory must be explicitly specified.
#add_subdirectory(../stochastic_physics stochastic_physics)
add_subdirectory(stochastic_physics)
###############################################################################
### fv3atm
###############################################################################
add_library(
fv3atm
atmos_model.F90
fv3_cap.F90
module_fv3_config.F90
module_fcst_grid_comp.F90
time_utils.F90
)
set_target_properties(fv3atm PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(fv3atm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>)
if(CCPP)
target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver/mod)
set(CCPP_LIBRARIES ccppdriver ccppphys ccpp)
add_dependencies(fv3atm ccppdriver ccppphys ccpp)
target_link_libraries(fv3atm PUBLIC ccppdriver ccppphys ccpp)
endif()
target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics)
target_compile_definitions(fv3atm PRIVATE -DESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR})
target_link_libraries(fv3atm PUBLIC fms)
target_link_libraries(fv3atm PUBLIC cpl)
target_link_libraries(fv3atm PUBLIC gfsphysics)
target_link_libraries(fv3atm PUBLIC ipd)
target_link_libraries(fv3atm PUBLIC io)
target_link_libraries(fv3atm PUBLIC fv3dycore)
target_link_libraries(fv3atm PUBLIC stochastic_physics)
target_link_libraries(fv3atm PUBLIC stochastic_physics_wrapper)
target_link_libraries(fv3atm PUBLIC
nemsio::nemsio w3emc::w3emc_d w3nco::w3nco_d sp::sp_d bacio::bacio_4)
if(INLINE_POST)
target_link_libraries(fv3atm PUBLIC nceppost::nceppost)
endif()
target_link_libraries(fv3atm PUBLIC esmf)
###############################################################################
### Install
###############################################################################
install(
TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper
EXPORT fv3atm-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX})
install(EXPORT fv3atm-config
DESTINATION lib/cmake
)