Skip to content

Commit

Permalink
Merge pull request #180 from AlysonStahl-NOAA/as_parallel
Browse files Browse the repository at this point in the history
fixing parallel build
  • Loading branch information
AlysonStahl-NOAA authored Jul 31, 2024
2 parents 7eb2504 + e8f0246 commit e2b4f13
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ message(STATUS "Adding wgrib2, aux_probs subdirectories...")
add_subdirectory(wgrib2)
add_subdirectory(aux_progs)

if(MAKE_FTN_API AND NOT BUILD_LIB)
message(FATAL_ERROR "MAKE_FTN_API should only be on when building library")
endif()

if(BUILD_LIB)
message(STATUS "Adding wgrib2 library build...")
### Package config
Expand Down
2 changes: 1 addition & 1 deletion spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def url_for_version(self, version):
"fortran_api",
default=True,
description="Make wgrib2api which allows fortran code to read/write grib2",
when="@:3.1",
when="@3.3:",
)
# Not currently working for @3.2:
# variant("lib", default=True, description="Build library", when="@3.2:")
Expand Down
3 changes: 1 addition & 2 deletions wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ wgrib2_api.c wgrib2.c Wind_dir.c Wind_speed.c Wind_uv.c Write_sec.c
Wrt_grib.c wrtieee.c wxtext.c)

if(MAKE_FTN_API)
list(APPEND lib_src
ftn_api/fort_wgrib2.c ftn_api/wgrib2api.f90 ftn_api/wgrib2lowapi.f90 )
add_subdirectory(ftn_api)
endif()

add_subdirectory(gctpc)
Expand Down
9 changes: 5 additions & 4 deletions ftn_api/CMakeLists.txt → wgrib2/ftn_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# This is the CMake file for the ftn_api directory in the wgrib2
# project. This will only build if MAKE_FTN_API=ON and
# BUILD_LIB=ON
#
# Kyle Gerheiser

set(fortran_src
wgrib2api.f90
Expand All @@ -9,14 +13,11 @@ set(c_src
fort_wgrib2.c
)


add_library(wgrib2_api ${fortran_src} ${c_src})

set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}")
set_target_properties(wgrib2_api PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir})



target_include_directories(wgrib2_api
PUBLIC $<BUILD_INTERFACE:${module_dir}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}>)
Expand Down

0 comments on commit e2b4f13

Please sign in to comment.