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

Find netCDF through cmake and remove netCDF tarball from repo #105

Closed
wants to merge 3 commits into from
Closed
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
11 changes: 7 additions & 4 deletions .github/workflows/Linux_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- {
options: "-DUSE_IPOLATES=1"
}
- {
options: "-DUSE_NETCDF4=ON"
}

steps:

Expand All @@ -40,7 +43,7 @@ jobs:
sudo apt-get install libpng-dev autotools-dev autoconf

- name: checkout-jasper
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: jasper-software/jasper
path: jasper
Expand All @@ -55,7 +58,7 @@ jobs:
make install

- name: checkout-sp
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: NOAA-EMC/NCEPLIBS-sp
path: sp
Expand Down Expand Up @@ -96,7 +99,7 @@ jobs:
make install

- name: checkout-ip2
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: NOAA-EMC/NCEPLIBS-ip2
path: ip2
Expand All @@ -112,7 +115,7 @@ jobs:
make install

- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: wgrib2

Expand Down
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ option(USE_AEC "Use AEC?" off)
option(MAKE_FTN_API "add ftn api?" off)
option(DISABLE_STAT "disable posix feature" off)
set(BUILD_COMMENTS "stock build")

option(BUILD_LIB "Build wgrib2 library?" on)
option(BUILD_SHARED_LIB "Build shared library?" off)


list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

#set default install path if not provided
# Set default install path if not provided.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"${CMAKE_BINARY_DIR}/install"
Expand All @@ -50,6 +48,7 @@ endif()

include(GNUInstallDirs)

# Set compiler flags.
message(STATUS "Setting compiler flags...")
if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_C_FLAGS "-g -traceback ${CMAKE_C_FLAGS} -DIFORT")
Expand All @@ -67,7 +66,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -O0")
endif()


message(STATUS "Checking if user wants to use NCEPLIBS-g2c...")
if(USE_G2CLIB)
if(USE_PNG)
Expand Down Expand Up @@ -129,12 +127,13 @@ if(USE_PNG)
find_package(PNG REQUIRED)
endif()

# write config.h
# Start to write config.h.
message(STATUS "Writing config.h...")
FILE(WRITE "wgrib2/config.h" "/* config.h generated by cmake */\n")
FILE(APPEND "wgrib2/config.h" "#ifndef _CONFIG_H\n")
FILE(APPEND "wgrib2/config.h" "#define _CONFIG_H\n")

# Add lines to config.h for each of the user options.
FOREACH(var IN ITEMS USE_NETCDF3 USE_NETCDF4 USE_HDF5 USE_REGEX USE_TIGGE USE_MYSQL
USE_IPOLATES USE_UDF USE_OPENMP USE_PROJ4 USE_WMO_VALIDATION DISABLE_TIMEZONE
DISABLE_ALARM USE_NAMES USE_G2CLIB USE_PNG USE_JASPER USE_OPENJPEG MAKE_FTN_API USE_AEC BUILD_COMMENTS)
Expand All @@ -151,16 +150,19 @@ FOREACH(var IN ITEMS USE_NETCDF3 USE_NETCDF4 USE_HDF5 USE_REGEX USE_TIGGE USE_MY
endif()
ENDFOREACH()

# Add some compiler information to config.h.
FILE(APPEND "wgrib2/config.h" "#define CC \"${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ID}\"\n")
FILE(APPEND "wgrib2/config.h" "#define FORTRAN \"${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_COMPILER_ID}\"\n")
FILE(APPEND "wgrib2/config.h" "#define CPPFLAGS \"${CMAKE_C_FLAGS}\"\n")
FILE(APPEND "wgrib2/config.h" "#define FFLAGS \"${CMAKE_Fortran_FLAGS}\"\n")
FILE(APPEND "wgrib2/config.h" "#endif\n")

# Compile the wgrib2 code.
message(STATUS "Adding wgrib2, aux_probs subdirectories...")
add_subdirectory(wgrib2)
add_subdirectory(aux_progs)

# Build wgrib2 library if desired.
if(BUILD_LIB)
message(STATUS "Adding wgrib2 library build...")
### Package config
Expand Down
Loading