1
- if (CCPP)
2
- add_definitions (-DCCPP)
1
+ # Call to CCPP code generator
2
+ if (DEBUG)
3
+ set (_ccpp_debug_arg "--debug" )
4
+ endif ()
5
+ if (DEFINED CCPP_SUITES)
6
+ set (_ccpp_suites_arg "--suites=${CCPP_SUITES} " )
7
+ message ("Calling CCPP code generator (ccpp_prebuild.py) for suites ${_ccpp_suites_arg} ..." )
8
+ else ()
9
+ message ("Calling CCPP code generator (ccpp_prebuild.py) for all available suites ..." )
10
+ endif ()
11
+ execute_process (COMMAND ${Python_EXECUTABLE}
12
+ "ccpp/framework/scripts/ccpp_prebuild.py"
13
+ "--config=ccpp/config/ccpp_prebuild_config.py"
14
+ "--builddir=${CMAKE_CURRENT_BINARY_DIR} " ${_ccpp_suites_arg} ${_ccpp_debug_arg}
15
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16
+ OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR} /ccpp_prebuild.out
17
+ ERROR_FILE ${CMAKE_CURRENT_BINARY_DIR} /ccpp_prebuild.err
18
+ RESULT_VARIABLE RC)
19
+ # Check return code from ccpp_prebuild.py
20
+ if (NOT RC EQUAL 0)
21
+ message (FATAL_ERROR "An error occured while running ccpp_prebuild.py, check ${CMAKE_CURRENT_BINARY_DIR} /ccpp_prebuild.{out,err}" )
3
22
endif ()
4
23
5
24
add_subdirectory (cpl)
6
- add_subdirectory (gfsphysics)
7
- add_subdirectory (ipd)
8
25
add_subdirectory (io)
9
26
10
27
###############################################################################
11
28
### fv3dycore
12
29
###############################################################################
13
- if (NOT CCPP)
14
- set (FAST_PHYSICS_SRCS_F90 atmos_cubed_sphere/model/fv_cmp.F90)
30
+ list (APPEND _fv3dycore_srcs
31
+ atmos_cubed_sphere/model/a2b_edge.F90
32
+ atmos_cubed_sphere/model/multi_gases.F90
33
+ atmos_cubed_sphere/model/boundary.F90
34
+ atmos_cubed_sphere/model/dyn_core.F90
35
+ atmos_cubed_sphere/model/fv_arrays.F90
36
+ atmos_cubed_sphere/model/fv_control.F90
37
+ atmos_cubed_sphere/model/fv_dynamics.F90
38
+ atmos_cubed_sphere/model/fv_fill.F90
39
+ atmos_cubed_sphere/model/fv_grid_utils.F90
40
+ atmos_cubed_sphere/model/fv_mapz.F90
41
+ atmos_cubed_sphere/model/fv_nesting.F90
42
+ atmos_cubed_sphere/model/fv_regional_bc.F90
43
+ atmos_cubed_sphere/model/fv_sg.F90
44
+ atmos_cubed_sphere/model/fv_tracer2d.F90
45
+ atmos_cubed_sphere/model/fv_update_phys.F90
46
+ atmos_cubed_sphere/model/sw_core.F90
47
+ atmos_cubed_sphere/model/tp_core.F90
48
+ atmos_cubed_sphere/model/nh_core.F90
49
+ atmos_cubed_sphere/model/nh_utils.F90
50
+ atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90
51
+ atmos_cubed_sphere/tools/coarse_grained_restart_files.F90
52
+ atmos_cubed_sphere/tools/coarse_graining.F90
53
+ atmos_cubed_sphere/tools/external_ic.F90
54
+ atmos_cubed_sphere/tools/external_sst.F90
55
+ atmos_cubed_sphere/tools/fv_diag_column.F90
56
+ atmos_cubed_sphere/tools/fv_diagnostics.F90
57
+ atmos_cubed_sphere/tools/fv_eta.F90
58
+ atmos_cubed_sphere/tools/fv_grid_tools.F90
59
+ atmos_cubed_sphere/tools/fv_io.F90
60
+ atmos_cubed_sphere/tools/fv_mp_mod.F90
61
+ atmos_cubed_sphere/tools/fv_nudge.F90
62
+ atmos_cubed_sphere/tools/fv_treat_da_inc.F90
63
+ atmos_cubed_sphere/tools/fv_iau_mod.F90
64
+ atmos_cubed_sphere/tools/fv_restart.F90
65
+ atmos_cubed_sphere/tools/fv_surf_map.F90
66
+ atmos_cubed_sphere/tools/fv_timing.F90
67
+ atmos_cubed_sphere//tools/init_hydro.F90
68
+ atmos_cubed_sphere/tools/sim_nc_mod.F90
69
+ atmos_cubed_sphere/tools/sorted_index.F90
70
+ atmos_cubed_sphere/tools/test_cases.F90
71
+ atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90
72
+ atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90
73
+ atmos_cubed_sphere/driver/fvGFS/atmosphere.F90)
74
+
75
+ add_library (fv3dycore ${_fv3dycore_srcs} )
76
+
77
+ list (APPEND _fv3dycore_defs_private SPMD
78
+ use_WRTCOMP
79
+ GFS_PHYS
80
+ GFS_TYPES
81
+ USE_GFSL63
82
+ MOIST_CAPPA
83
+ USE_COND)
84
+
85
+ if (MULTI_GASES)
86
+ list (APPEND _fv3dycore_defs_private MULTI_GASES)
15
87
endif ()
16
88
17
- add_library (
18
- fv3dycore
19
-
20
- atmos_cubed_sphere/model/a2b_edge.F90
21
- atmos_cubed_sphere/model/multi_gases.F90
22
- atmos_cubed_sphere/model/boundary.F90
23
- atmos_cubed_sphere/model/dyn_core.F90
24
- atmos_cubed_sphere/model/fv_arrays.F90
25
- ${FAST_PHYSICS_SRCS_F90}
26
- atmos_cubed_sphere/model/fv_control.F90
27
- atmos_cubed_sphere/model/fv_dynamics.F90
28
- atmos_cubed_sphere/model/fv_fill.F90
29
- atmos_cubed_sphere/model/fv_grid_utils.F90
30
- atmos_cubed_sphere/model/fv_mapz.F90
31
- atmos_cubed_sphere/model/fv_nesting.F90
32
- atmos_cubed_sphere/model/fv_regional_bc.F90
33
- atmos_cubed_sphere/model/fv_sg.F90
34
- atmos_cubed_sphere/model/fv_tracer2d.F90
35
- atmos_cubed_sphere/model/fv_update_phys.F90
36
- atmos_cubed_sphere/model/sw_core.F90
37
- atmos_cubed_sphere/model/tp_core.F90
38
- atmos_cubed_sphere/model/nh_core.F90
39
- atmos_cubed_sphere/model/nh_utils.F90
40
- atmos_cubed_sphere/tools/external_ic.F90
41
- atmos_cubed_sphere/tools/external_sst.F90
42
- atmos_cubed_sphere/tools/fv_diagnostics.F90
43
- atmos_cubed_sphere/tools/fv_eta.F90
44
- atmos_cubed_sphere/tools/fv_grid_tools.F90
45
- atmos_cubed_sphere/tools/fv_io.F90
46
- atmos_cubed_sphere/tools/fv_mp_mod.F90
47
- atmos_cubed_sphere/tools/fv_nudge.F90
48
- atmos_cubed_sphere/tools/fv_treat_da_inc.F90
49
- atmos_cubed_sphere/tools/fv_iau_mod.F90
50
- atmos_cubed_sphere/tools/fv_restart.F90
51
- atmos_cubed_sphere/tools/fv_surf_map.F90
52
- atmos_cubed_sphere/tools/fv_timing.F90
53
- atmos_cubed_sphere//tools/init_hydro.F90
54
- atmos_cubed_sphere/tools/sim_nc_mod.F90
55
- atmos_cubed_sphere/tools/sorted_index.F90
56
- atmos_cubed_sphere/tools/test_cases.F90
57
- atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90
58
- atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90
59
- atmos_cubed_sphere/driver/fvGFS/atmosphere.F90
60
- )
89
+ if (32BIT)
90
+ set (DYN32 ON CACHE BOOL "Enable support for 32bit fast physics in CCPP" )
91
+ list (APPEND _fv3dycore_defs_private OVERLOAD_R4
92
+ OVERLOAD_R8)
93
+ else ()
94
+ set (DYN32 OFF CACHE BOOL "Disable support for 32bit fast physics in CCPP" )
95
+ endif ()
96
+
97
+ list (APPEND _fv3dycore_defs_private CCPP)
98
+
99
+ if (OpenMP_Fortran_FOUND)
100
+ list (APPEND _fv3dycore_defs_private OPENMP)
101
+ endif ()
61
102
62
103
set_property (SOURCE atmos_cubed_sphere/model/nh_utils.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST} " )
63
104
set_property (SOURCE atmos_cubed_sphere/model/fv_mapz.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST} " )
64
105
65
106
set_target_properties (fv3dycore PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /mod)
66
- target_include_directories (fv3dycore PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /mod>)
67
-
68
- target_link_libraries (fv3dycore PRIVATE fms)
69
- target_link_libraries (fv3dycore PRIVATE gfsphysics)
70
- target_link_libraries (fv3dycore PRIVATE ipd)
71
- target_link_libraries (fv3dycore PRIVATE esmf)
72
107
73
- target_include_directories (fv3dycore PRIVATE atmos_cubed_sphere ${ESMF_MOD} )
108
+ target_compile_definitions (fv3dycore PRIVATE "${_fv3dycore_defs_private} " )
109
+ target_include_directories (fv3dycore PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /atmos_cubed_sphere
110
+ ${CMAKE_CURRENT_SOURCE_DIR} /atmos_cubed_sphere/tools
111
+ ${CMAKE_CURRENT_BINARY_DIR} /ccpp/driver/mod)
112
+ target_include_directories (fv3dycore INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /mod>
113
+ $<INSTALL_INTERFACE:mod>)
114
+
115
+ target_link_libraries (fv3dycore PUBLIC fms
116
+ ccppphys
117
+ ccppdata
118
+ esmf)
119
+ if (OpenMP_Fortran_FOUND)
120
+ target_link_libraries (fv3dycore PUBLIC OpenMP::OpenMP_Fortran)
121
+ endif ()
74
122
75
123
###############################################################################
76
- ### ccpp
124
+ ### CCPP
77
125
###############################################################################
78
- if (CCPP)
79
- add_subdirectory (ccpp)
80
- add_subdirectory (ccpp/driver)
81
-
82
- add_dependencies (gfsphysics ccpp ccppphys)
83
- add_dependencies (ccppdriver ccpp ccppphys)
84
- add_dependencies (ccppphys ccpp)
85
126
86
- target_include_directories (fv3dycore PRIVATE ${CMAKE_BINARY_DIR} /FV3/ccpp/framework /src)
87
- target_include_directories (fv3dycore PRIVATE ${CMAKE_BINARY_DIR} /FV3/ccpp/driver)
88
-
89
- target_link_libraries (ccppphys PRIVATE sp::sp_d)
90
- target_link_libraries (ccppphys PRIVATE w3nco::w3nco_d)
91
- endif ()
127
+ add_subdirectory (ccpp)
128
+ add_subdirectory (ccpp/data)
129
+ add_subdirectory (ccpp/driver)
130
+ add_dependencies (ccppphys ccpp)
131
+ add_dependencies (ccppdata ccpp ccppphys)
132
+ add_dependencies (ccppdriver ccpp ccppphys ccppdata)
133
+ add_dependencies (fv3dycore ccppdriver ccpp ccppphys ccppdata)
134
+ target_include_directories (fv3dycore PRIVATE ${CMAKE_CURRENT_BINARY_DIR} /ccpp/framework /src
135
+ ${CMAKE_CURRENT_BINARY_DIR} /ccpp/physics
136
+ ${CMAKE_CURRENT_BINARY_DIR} /ccpp/driver)
137
+ target_link_libraries (ccppphys PUBLIC sp::sp_d
138
+ w3nco::w3nco_d)
92
139
93
140
###############################################################################
94
141
### stochastic_physics
@@ -100,56 +147,63 @@ add_subdirectory(stochastic_physics)
100
147
###############################################################################
101
148
### fv3atm
102
149
###############################################################################
103
- add_library (
104
- fv3atm
150
+ add_library (fv3atm
151
+ atmos_model.F90
152
+ fv3_cap.F90
153
+ module_fv3_config.F90
154
+ module_fcst_grid_comp.F90
155
+ time_utils.F90)
105
156
106
- atmos_model.F90
107
- fv3_cap.F90
108
- module_fv3_config.F90
109
- module_fcst_grid_comp.F90
110
- time_utils.F90
111
- )
157
+ list (APPEND _fv3atm_defs_private GFS_PHYS
158
+ INTERNAL_FILE_NML
159
+ ESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR} )
112
160
113
161
set_target_properties (fv3atm PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /mod)
114
- target_include_directories (fv3atm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /mod>)
162
+ target_include_directories (fv3atm INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /mod>
163
+ $<INSTALL_INTERFACE:mod>)
164
+
165
+ list (APPEND _fv3atm_defs_private CCPP)
166
+ target_include_directories (fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} /ccpp/physics
167
+ ${CMAKE_CURRENT_BINARY_DIR} /ccpp/driver/mod)
168
+ set (CCPP_LIBRARIES ccppdriver ccppdata ccppphys ccpp)
169
+ add_dependencies (fv3atm ccppdriver ccppdata ccppphys ccpp)
170
+ target_link_libraries (fv3atm PUBLIC ccppdriver ccppdata ccppphys ccpp)
115
171
116
- if (CCPP)
117
- target_include_directories (fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} /ccpp/driver/mod)
118
- set (CCPP_LIBRARIES ccppdriver ccppphys ccpp)
119
- add_dependencies (fv3atm ccppdriver ccppphys ccpp)
120
- target_link_libraries (fv3atm PUBLIC ccppdriver ccppphys ccpp)
121
- endif ()
122
172
target_include_directories (fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} /stochastic_physics)
123
- target_compile_definitions (fv3atm PRIVATE -DESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR} )
124
-
125
- target_link_libraries (fv3atm PUBLIC fms)
126
- target_link_libraries (fv3atm PUBLIC cpl)
127
- target_link_libraries (fv3atm PUBLIC gfsphysics)
128
- target_link_libraries (fv3atm PUBLIC ipd)
129
- target_link_libraries (fv3atm PUBLIC io)
130
- target_link_libraries (fv3atm PUBLIC fv3dycore)
131
- target_link_libraries (fv3atm PUBLIC stochastic_physics)
132
- target_link_libraries (fv3atm PUBLIC stochastic_physics_wrapper)
133
-
134
- target_link_libraries (fv3atm PUBLIC
135
- nemsio::nemsio w3emc::w3emc_d w3nco::w3nco_d sp::sp_d bacio::bacio_4)
173
+ target_include_directories (fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} /../stochastic_physics)
174
+ target_compile_definitions (fv3atm PRIVATE "${_fv3atm_defs_private} " )
175
+
176
+ target_link_libraries (fv3atm PUBLIC fv3dycore
177
+ cpl
178
+ io
179
+ stochastic_physics
180
+ stochastic_physics_wrapper)
181
+
182
+ target_link_libraries (fv3atm PUBLIC nemsio::nemsio
183
+ w3emc::w3emc_d
184
+ w3nco::w3nco_d
185
+ sp::sp_d
186
+ bacio::bacio_4
187
+ esmf)
188
+
136
189
if (INLINE_POST)
137
- target_link_libraries (fv3atm PUBLIC nceppost::nceppost )
190
+ target_link_libraries (fv3atm PUBLIC upp::upp )
138
191
endif ()
139
192
140
- target_link_libraries (fv3atm PUBLIC esmf)
193
+ if (OpenMP_Fortran_FOUND)
194
+ target_link_libraries (fv3atm PUBLIC OpenMP::OpenMP_Fortran)
195
+ endif ()
141
196
142
197
###############################################################################
143
198
### Install
144
199
###############################################################################
145
200
install (
146
- TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper
201
+ TARGETS fv3atm fv3dycore io ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper
147
202
EXPORT fv3atm-config
148
203
LIBRARY DESTINATION lib
149
204
ARCHIVE DESTINATION lib)
205
+
150
206
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /mod DESTINATION ${CMAKE_INSTALL_PREFIX} )
151
207
152
208
install (EXPORT fv3atm-config
153
- DESTINATION lib/cmake
154
- )
155
-
209
+ DESTINATION lib/cmake)
0 commit comments