Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to build only application specific utilities (e.g. GFS) #777

Merged
merged 4 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,39 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# User options.
option(OPENMP "use OpenMP threading" ON)
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)

# Utilities to be built (Default: ALL)
option(ICEBLEND "Enable building emcsfc_ice_blend.fd" ON)
option(SNOW2MDL "Enable building emcsfc_snow2mdl.fd" ON)
option(GCYCLE "Enable building global_cycle.fd" ON)
option(FRENCTOOLS "Enable building fre-nctools.fd" ON)
option(GRIDTOOLS "Enable building grid_tools.fd" ON)
option(CHGRES "Enable building chgres_cube.fd" ON)
option(OROG_MASK_TOOLS "Enable building orog_mask_tools.fd" ON)
option(SFC_CLIMO_GEN "Enable building sfc_climo_gen.fd" ON)
option(VCOORD_GEN "Enable building vcoord_gen.fd" ON)
option(FVCOMTOOLS "Enable building fvcom_tools.fd" ON)
option(GBLEVENTS "Enable building gblevents.fd" ON)
option(CPLD_GRIDGEN "Enable building cpld_gridgen.fd" ON)
option(WEIGHT_GEN "Enable building weight_gen.fd" ON)

# Option to build application specific utilities
option(GFS "Enable building GFS-only utilities" OFF)

# When building the GFS, the following need not be built
if(GFS)
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
message(STATUS "Building utilities specific to the GFS")
set(FRENCTOOLS OFF CACHE BOOL "Disable building fre-nctools.fd" FORCE)
set(GRIDTOOLS OFF CACHE BOOL "Disable building grid_tools.fd" FORCE)
set(OROG_MASK_TOOLS OFF CACHE BOOL "Disable building orog_mask_tools.fd" FORCE)
set(SFC_CLIMO_GEN OFF CACHE BOOL "Disable building sfc_climo_gen.fd" FORCE)
set(VCOORD_GEN OFF CACHE BOOL "Disable building vcoord_gen.fd" FORCE)
set(FVCOMTOOLS OFF CACHE BOOL "Disable building fvcom_tools.fd" FORCE)
set(GBLEVENTS OFF CACHE BOOL "Disable building gblevents.fd" FORCE)
set(CPLD_GRIDGEN OFF CACHE BOOL "Disable building cpld_gridgen.fd" FORCE)
set(WEIGHT_GEN OFF CACHE BOOL "Disable building weight_gen.fd" FORCE)
endif()

SET(TEST_FILE_DIR "." CACHE STRING "Check this directory for test files before using FTP.")

# Set the build type.
Expand Down Expand Up @@ -80,7 +113,7 @@ find_package(sigio 2.3.0 REQUIRED)
if(ENABLE_DOCS)
find_package(Doxygen REQUIRED)
set(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
add_subdirectory(docs)
add_subdirectory(docs)
endif()

add_subdirectory(sorc)
Expand Down
17 changes: 6 additions & 11 deletions build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,21 @@ else
set -x
fi


# The unit test data download is part of the build system. Not all machines can
# access the EMC ftp site, so turn off the build (-DBUILD_TESTING=OFF) of the units tests accordingly.
# Those with access to the EMC ftp site are: Orion and Hera.

if [[ "$target" == "hera" || "$target" == "orion" || "$target" == "wcoss2" ]]; then
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=OFF"
#CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=ON"
#CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DENABLE_DOCS=ON -DBUILD_TESTING=ON"
else
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=OFF"
#CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DENABLE_DOCS=ON -DBUILD_TESTING=OFF"
fi
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=OFF"

# Allow users of this script to provide CMake options e.g. -DGFS=ON|OFF to build GFS specific utilities only
CMAKE_OPTS=${CMAKE_OPTS:-}

rm -fr ./build
mkdir ./build && cd ./build

cmake .. ${CMAKE_FLAGS}
cmake .. ${CMAKE_FLAGS} ${CMAKE_OPTS}

make -j 8 VERBOSE=1
make -j ${BUILD_JOBS:-8} VERBOSE=${BUILD_VERBOSE:-}
make install

#ctest
Expand Down
60 changes: 43 additions & 17 deletions sorc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,47 @@
# UFS_UTILS project.
#
# George Gayno
add_subdirectory(emcsfc_ice_blend.fd)
add_subdirectory(emcsfc_snow2mdl.fd)
if (OpenMP_FOUND)
add_subdirectory(global_cycle.fd)
add_subdirectory(lsm_routines.fd)
else()
message(STATUS "OpenMP is required for global_cycle.fd and was NOT found, skipping ...")
endif()
add_subdirectory(fre-nctools.fd)
add_subdirectory(grid_tools.fd)
add_subdirectory(chgres_cube.fd)
add_subdirectory(orog_mask_tools.fd)
add_subdirectory(sfc_climo_gen.fd)
add_subdirectory(vcoord_gen.fd)
add_subdirectory(fvcom_tools.fd)
add_subdirectory(gblevents.fd)
if(ICEBLEND)
add_subdirectory(emcsfc_ice_blend.fd)
endif()
if(SNOW2MDL)
add_subdirectory(emcsfc_snow2mdl.fd)
endif()
if(GCYCLE)
if (OpenMP_Fortran_FOUND)
add_subdirectory(global_cycle.fd)
add_subdirectory(lsm_routines.fd)
else()
message(STATUS "OpenMP is required for global_cycle.fd and was NOT found, skipping ...")
endif()
endif()
if(FRENCTOOLS)
add_subdirectory(fre-nctools.fd)
endif()
if(GRIDTOOLS)
add_subdirectory(grid_tools.fd)
endif()
if(CHGRES)
add_subdirectory(chgres_cube.fd)
endif()
if(OROG_MASK_TOOLS)
add_subdirectory(orog_mask_tools.fd)
endif()
if(SFC_CLIMO_GEN)
add_subdirectory(sfc_climo_gen.fd)
endif()
if(VCOORD_GEN)
add_subdirectory(vcoord_gen.fd)
endif()
if(FVCOMTOOLS)
add_subdirectory(fvcom_tools.fd)
endif()
if(GBLEVENTS)
add_subdirectory(gblevents.fd)
endif()
if(CPLD_GRIDGEN)
add_subdirectory(cpld_gridgen.fd)
add_subdirectory(weight_gen.fd)
endif()
if(WEIGHT_GEN)
add_subdirectory(weight_gen.fd)
endif()