Skip to content

Commit

Permalink
CMake: bringing over some changes from WRF CMake changes. Tabs to spa…
Browse files Browse the repository at this point in the history
…ces and enforcing uniform style guide
  • Loading branch information
scrasmussen committed May 23, 2024
1 parent ae70e39 commit f93115a
Show file tree
Hide file tree
Showing 22 changed files with 412 additions and 387 deletions.
256 changes: 128 additions & 128 deletions CMakeLists.txt

Large diffs are not rendered by default.

291 changes: 151 additions & 140 deletions src/CMakeLists.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/CPL/NoahMP_cpl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_library(hydro_noahmp_cpl STATIC
module_hrldas_HYDRO.F
hrldas_drv_HYDRO.F
module_hrldas_HYDRO.F
hrldas_drv_HYDRO.F
)

target_link_libraries(hydro_noahmp_cpl PUBLIC hydro_mpp)
Expand Down
10 changes: 5 additions & 5 deletions src/Data_Rec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(hydro_data_rec STATIC
module_gw_gw2d_data.F90
module_rt_inc.F90
module_namelist_inc.F90
module_RT_data.F90
module_namelist.F90
module_gw_gw2d_data.F90
module_rt_inc.F90
module_namelist_inc.F90
module_RT_data.F90
module_namelist.F90
)
2 changes: 1 addition & 1 deletion src/Debug_Utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# build the version static library
add_library(hydro_debug_utils STATIC
debug_dump_variable.F90
debug_dump_variable.F90
)
18 changes: 10 additions & 8 deletions src/HYDRO_drv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# build the version static library
add_library(hydro_driver STATIC
module_HYDRO_drv.F90
module_HYDRO_drv.F90
)

target_link_libraries(hydro_driver PUBLIC hydro_mpp)
target_link_libraries(hydro_driver PUBLIC hydro_data_rec)
target_link_libraries(hydro_driver PUBLIC hydro_routing)
target_link_libraries(hydro_driver PUBLIC hydro_debug_utils)
target_link_libraries(hydro_driver PUBLIC
hydro_mpp
hydro_data_rec
hydro_routing
hydro_debug_utils
)

if (WRF_HYDRO_NUDGING STREQUAL "1")
target_link_libraries(hydro_driver PUBLIC hydro_nudging)
endif (WRF_HYDRO_NUDGING STREQUAL "1")
if(WRF_HYDRO_NUDGING STREQUAL "1")
target_link_libraries(hydro_driver PUBLIC hydro_nudging)
endif()
6 changes: 5 additions & 1 deletion src/IO/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# build the orchestrator static library
add_library(hydro_netcdf_layer STATIC
netcdf_layer.F90
)
)

target_link_libraries(hydro_netcdf_layer
MPI::MPI_Fortran
)
4 changes: 2 additions & 2 deletions src/Land_models/Noah/Noah/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(noah STATIC
module_sf_urban.F
module_sf_noahlsm.F
module_sf_urban.F
module_sf_noahlsm.F
)
10 changes: 5 additions & 5 deletions src/Land_models/Noah/Utility_routines/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(noah_util STATIC
kwm_string_utilities.F
module_date_utilities.F
module_model_constants.F
module_Noahlsm_utility.F
module_sfcdif_wrf.F
kwm_string_utilities.F
module_date_utilities.F
module_model_constants.F
module_Noahlsm_utility.F
module_sfcdif_wrf.F
)
8 changes: 4 additions & 4 deletions src/Land_models/NoahMP/Utility_routines/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_library(noahmp_util STATIC
kwm_string_utilities.F
module_date_utilities.F
module_model_constants.F
module_wrf_utilities.F
kwm_string_utilities.F
module_date_utilities.F
module_model_constants.F
module_wrf_utilities.F
)

target_link_libraries(noahmp_util PUBLIC hydro_mpp)
8 changes: 4 additions & 4 deletions src/Land_models/NoahMP/phys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
add_subdirectory("surfex")

add_library(noahmp_phys STATIC
module_sf_noahmpdrv.F
module_sf_noahmp_glacier.F
module_sf_noahmp_groundwater.F
module_sf_noahmplsm.F
module_sf_noahmpdrv.F
module_sf_noahmp_glacier.F
module_sf_noahmp_groundwater.F
module_sf_noahmplsm.F
)

target_link_libraries(noahmp_phys snowcro crocus_surfex)
12 changes: 6 additions & 6 deletions src/MPP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
add_library(hydro_mpp STATIC
CPL_WRF.F90
module_mpp_GWBUCKET.F90
module_mpp_ReachLS.F90
mpp_land.F90
hashtable.F90
CPL_WRF.F90
module_mpp_GWBUCKET.F90
module_mpp_ReachLS.F90
mpp_land.F90
hashtable.F90
)

target_link_libraries(hydro_mpp ${MPI_Fortran_LIBRARIES})
target_link_libraries(hydro_mpp MPI::MPI_Fortran)
14 changes: 9 additions & 5 deletions src/OrchestratorLayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ add_library(hydro_orchestrator STATIC
config.F90
io_manager.F90
orchestrator.F90
)
)

add_dependencies(hydro_orchestrator hydro_netcdf_layer)
add_dependencies(hydro_orchestrator hydro_utils)
add_dependencies(hydro_orchestrator
hydro_netcdf_layer
hydro_utils
)

target_link_libraries(hydro_orchestrator PUBLIC hydro_netcdf_layer)
target_link_libraries(hydro_orchestrator PUBLIC hydro_utils)
target_link_libraries(hydro_orchestrator PUBLIC
hydro_netcdf_layer
hydro_utils
)
59 changes: 29 additions & 30 deletions src/Routing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
add_library(hydro_routing STATIC
module_UDMAP.F90
module_channel_routing.F90
module_date_utilities_rt.F90
module_GW_baseflow.F90
module_gw_gw2d.F90
module_HYDRO_io.F90
module_HYDRO_utils.F90
module_lsm_forcing.F90
module_noah_chan_param_init_rt.F90
module_NWM_io_dict.F90
module_NWM_io.F90
module_reservoir_routing.F90
module_RT.F90
Noah_distr_routing.F90
Noah_distr_routing_overland.F90
Noah_distr_routing_subsurface.F90
module_UDMAP.F90
module_channel_routing.F90
module_date_utilities_rt.F90
module_GW_baseflow.F90
module_gw_gw2d.F90
module_HYDRO_io.F90
module_HYDRO_utils.F90
module_lsm_forcing.F90
module_noah_chan_param_init_rt.F90
module_NWM_io_dict.F90
module_NWM_io.F90
module_reservoir_routing.F90
module_RT.F90
Noah_distr_routing.F90
Noah_distr_routing_overland.F90
Noah_distr_routing_subsurface.F90
)

target_link_libraries(hydro_routing PUBLIC hydro_mpp)
target_link_libraries(hydro_routing PUBLIC hydro_utils)
target_link_libraries(hydro_routing PUBLIC hydro_orchestrator)
target_link_libraries(hydro_routing PUBLIC hydro_routing_overland)
target_link_libraries(hydro_routing PUBLIC hydro_routing_subsurface)
#target_link_libraries(hydro_routing PUBLIC hydro_routing_groundwater)
#target_link_libraries(hydro_routing PUBLIC hydro_routing_groundwater_bucket)
#target_link_libraries(hydro_routing PUBLIC hydro_routing_groundwater_nhd)
#target_link_libraries(hydro_routing PUBLIC hydro_routing_groundwater_simple)
target_link_libraries(hydro_routing PUBLIC hydro_routing_reservoirs)
target_link_libraries(hydro_routing PUBLIC hydro_routing_reservoirs_levelpool)
target_link_libraries(hydro_routing PUBLIC hydro_routing_reservoirs_hybrid)
target_link_libraries(hydro_routing PUBLIC hydro_data_rec)
target_link_libraries(hydro_routing PUBLIC hydro_routing_reservoirs_rfc)
target_link_libraries(hydro_routing
MPI::MPI_Fortran
hydro_mpp
hydro_utils
hydro_orchestrator
hydro_routing_overland
hydro_routing_subsurface
hydro_routing_reservoirs
hydro_routing_reservoirs_levelpool
hydro_routing_reservoirs_hybrid
hydro_data_rec
hydro_routing_reservoirs_rfc
)
10 changes: 5 additions & 5 deletions src/Routing/Overland/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(hydro_routing_overland STATIC
module_overland_control.F90
module_overland_mass_balance.F90
module_overland_streams_and_lakes.F90
module_overland_routing_properties.F90
module_overland.F90
module_overland_control.F90
module_overland_mass_balance.F90
module_overland_streams_and_lakes.F90
module_overland_routing_properties.F90
module_overland.F90
)
8 changes: 4 additions & 4 deletions src/Routing/Reservoirs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_library(hydro_routing_reservoirs STATIC
module_reservoir.F90
module_reservoir_read_timeslice_data.F90
module_reservoir_read_rfc_time_series_data.F90
module_reservoir_utilities.F90
module_reservoir.F90
module_reservoir_read_timeslice_data.F90
module_reservoir_read_rfc_time_series_data.F90
module_reservoir_utilities.F90
)

add_subdirectory("Level_Pool")
Expand Down
6 changes: 3 additions & 3 deletions src/Routing/Reservoirs/Level_Pool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(hydro_routing_reservoirs_levelpool STATIC
module_levelpool.F90
module_levelpool_state.F90
module_levelpool_properties.F90
module_levelpool.F90
module_levelpool_state.F90
module_levelpool_properties.F90
)

add_dependencies(hydro_routing_reservoirs_levelpool hydro_routing_reservoirs)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(hydro_routing_reservoirs_hybrid STATIC
module_persistence_levelpool_hybrid.F90
module_persistence_levelpool_hybrid_state.F90
module_persistence_levelpool_hybrid_properties.F90
module_persistence_levelpool_hybrid.F90
module_persistence_levelpool_hybrid_state.F90
module_persistence_levelpool_hybrid_properties.F90
)

add_dependencies(hydro_routing_reservoirs_hybrid hydro_routing_reservoirs)
12 changes: 7 additions & 5 deletions src/Routing/Reservoirs/RFC_Forecasts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
add_library(hydro_routing_reservoirs_rfc STATIC
module_rfc_forecasts.F90
module_rfc_forecasts_state.F90
module_rfc_forecasts_properties.F90
module_rfc_forecasts.F90
module_rfc_forecasts_state.F90
module_rfc_forecasts_properties.F90
)

add_dependencies(hydro_routing_reservoirs_rfc hydro_routing_reservoirs)
add_dependencies(hydro_routing_reservoirs_rfc hydro_routing_reservoirs_levelpool)
add_dependencies(hydro_routing_reservoirs_rfc
hydro_routing_reservoirs
hydro_routing_reservoirs_levelpool
)
16 changes: 8 additions & 8 deletions src/Routing/Subsurface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
add_library(hydro_routing_subsurface STATIC
module_subsurface_input.F90
module_subsurface_output.F90
module_subsurface_static_data.F90
module_subsurface_grid_transform.F90
module_subsurface_properties.F90
module_subsurface_state.F90
module_subsurface.F90
module_subsurface_input.F90
module_subsurface_output.F90
module_subsurface_static_data.F90
module_subsurface_grid_transform.F90
module_subsurface_properties.F90
module_subsurface_state.F90
module_subsurface.F90
)

target_link_libraries(hydro_routing_subsurface PUBLIC hydro_routing_overland)
target_link_libraries(hydro_routing_subsurface PRIVATE hydro_routing_overland)
16 changes: 9 additions & 7 deletions src/nudging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# build the version static library
add_library(hydro_nudging STATIC
module_date_utils_nudging.F90
module_nudging_io.F90
module_nudging_utils.F90
module_stream_nudging.F90
module_date_utils_nudging.F90
module_nudging_io.F90
module_nudging_utils.F90
module_stream_nudging.F90
)

target_link_libraries(hydro_nudging PUBLIC hydro_mpp)
target_link_libraries(hydro_nudging PUBLIC hydro_data_rec)
target_link_libraries(hydro_nudging PUBLIC hydro_orchestrator)
target_link_libraries(hydro_nudging PRIVATE
hydro_mpp
hydro_data_rec
hydro_orchestrator
)
23 changes: 12 additions & 11 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# read version numbers for wrf_hydro_version and nwm_version from
# ../.version and ../.nwm_version
file (STRINGS "../.version" WRF_HYDRO_VERSION)
if (NWM_META AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.nwm_version)
file (STRINGS "../.nwm_version" NWM_VERSION)
else (NWM_META AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.nwm_version)
set(NWM_VERSION "undefined")
endif (NWM_META AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.nwm_version)
# ../.version and ../.nwm_version files

file(STRINGS "../.version" WRF_HYDRO_VERSION)
if(NWM_META AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.nwm_version)
file (STRINGS "../.nwm_version" NWM_VERSION)
else(NWM_META AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.nwm_version)
set(NWM_VERSION "undefined")
endif()

# add the preprocessor definitions for NWM_VERSION and WRF_HYDRO_VERSION
# needed to compile module_version.F90
add_definitions (-DNWM_VERSION="${NWM_VERSION}")
add_definitions (-DWRF_HYDRO_VERSION="${WRF_HYDRO_VERSION}")
add_definitions(-DNWM_VERSION="${NWM_VERSION}")
add_definitions(-DWRF_HYDRO_VERSION="${WRF_HYDRO_VERSION}")

# build the version static library
add_library(hydro_utils STATIC
module_version.F90
module_hydro_stop.F90
module_version.F90
module_hydro_stop.F90
)

0 comments on commit f93115a

Please sign in to comment.