Skip to content

Commit

Permalink
add option to build with GTG code or stubs (#430)
Browse files Browse the repository at this point in the history
* add option to build with GTG code or stubs

* make IP optional depending on GTG option.

* GTG code depends on a file that only resides in the gtg repo

* fix a big boo-boo

* move sorc/post_gtg.fd to sorc/ncep_post.fd/post_gtg.fd and update build path to GTG

* correct the name of the submodule.  fix mixed indents

* move map_routines.F90 into the GTG src list
  • Loading branch information
aerorahul committed Jan 10, 2022
1 parent 98f7acd commit 8013830
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# USE CAUTION WHEN ADDING WILDCARDS, as some builds use different filename #
# conventions than others #
##############################################################################
build/
install/
build*/
install*/

*.[aox]
*.mod
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "sorc/post_gtg.fd"]
path = sorc/post_gtg.fd
url = https://github.com/NCAR/UPP_GTG
update = none
[submodule "post_gtg.fd"]
path = sorc/ncep_post.fd/post_gtg.fd
url = https://github.com/NCAR/UPP_GTG
update = none
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(OPENMP "use OpenMP threading" ON)
option(BUILD_POSTEXEC "Build NCEPpost executable" ON)
option(BUILD_WITH_WRFIO "Build NCEPpost with WRF-IO library" OFF)
option(BUILD_WITH_GTG "Build NCEPpost with NCAR/GTG" OFF)
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)

if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
Expand Down Expand Up @@ -47,7 +48,9 @@ find_package(bacio REQUIRED)
find_package(crtm REQUIRED)
find_package(g2 REQUIRED)
find_package(g2tmpl REQUIRED)
find_package(ip REQUIRED)
if(BUILD_WITH_GTG)
find_package(ip REQUIRED)
endif()

if(BUILD_POSTEXEC)
find_package(nemsio REQUIRED)
Expand Down
30 changes: 21 additions & 9 deletions sorc/ncep_post.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,12 @@ list(APPEND LIB_SRC
GPVS.f
grib2_module.f
GRIDSPEC.f
gtg_algo.F90
gtg_compute.F90
gtg_config.F90
gtg_ctlblk.F90
gtg_filter.F90
gtg_indices.F90
gtg_smoothseams.F90
ICAOHEIGHT.f
kinds_mod.F
LFMFLD.f
LFMFLD_GFS.f
LOOKUP.f
machine.f
map_routines.F90
MAPSSLP.f
MASKS_mod.f
MDL2AGL.f
Expand Down Expand Up @@ -137,6 +129,22 @@ list(APPEND LIB_SRC
xml_perl_data.f
ZENSUN.f)

list(APPEND GTG_LIB_SRC
gtg_algo.F90
gtg_compute.F90
gtg_config.F90
gtg_ctlblk.F90
gtg_filter.F90
gtg_indices.F90
gtg_smoothseams.F90
map_routines.F90)

if(BUILD_WITH_GTG)
list(TRANSFORM GTG_LIB_SRC PREPEND post_gtg.fd/)
endif()

list(APPEND LIB_SRC ${GTG_LIB_SRC})

list(APPEND EXE_SRC
ASSIGNNEMSIOVAR.f
GETNEMSNDSCATTER.f
Expand Down Expand Up @@ -200,10 +208,14 @@ target_link_libraries(${LIBNAME} PUBLIC
crtm::crtm
g2::g2_4
g2tmpl::g2tmpl
ip::ip_4
MPI::MPI_Fortran
NetCDF::NetCDF_Fortran)

if(BUILD_WITH_GTG)
target_link_libraries(${LIBNAME} PUBLIC
ip::ip_4)
endif()

if(OpenMP_Fortran_FOUND)
target_link_libraries(${LIBNAME} PUBLIC OpenMP::OpenMP_Fortran)
endif()
Expand Down

0 comments on commit 8013830

Please sign in to comment.