From d219dc432117eb67c067faca060f8725f1aeeed4 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 04:35:44 -0600 Subject: [PATCH 1/9] trying ip build --- .github/workflows/Linux_options.yml | 100 ++++++++++++++++++++++++++++ CMakeLists.txt | 10 +-- 2 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/Linux_options.yml diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml new file mode 100644 index 00000000..9e5b7810 --- /dev/null +++ b/.github/workflows/Linux_options.yml @@ -0,0 +1,100 @@ +# This is the Linux_options workflow for the wgrib2 project. This +# tests different wgrib2 build options. +# +# Ed Hartnett, 3/27/24 +name: Linux_options +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +# Cancel in-progress workflows when pushing to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + Linux_options: + runs-on: ubuntu-latest + env: + FC: gfortran + CC: gcc + + strategy: +# fail-fast: true + matrix: + config: + - { + options: "-DUSE_IPOLATES" + } + + steps: + + - name: install + run: | + sudo apt-get update + sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config + sudo apt-get install libpng-dev autotools-dev autoconf + + - name: checkout-jasper + uses: actions/checkout@v2 + with: + repository: jasper-software/jasper + path: jasper + ref: version-1.900.1 + + - name: build-jasper + if: steps.cache-jasper.outputs.cache-hit != 'true' + run: | + cd jasper + ./configure --prefix=$HOME/Jasper + make + make install + + - name: checkout-sp + uses: actions/checkout@v2 + with: + repository: NOAA-EMC/NCEPLIBS-sp + path: sp + ref: develop + + - name: build-sp + run: | + cd sp + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=~/sp -DBUILD_8=ON .. + make -j2 + make install + + - name: checkout-ip2 + uses: actions/checkout@v2 + with: + repository: NOAA-EMC/NCEPLIBS-ip2 + path: ip2 + ref: develop + + - name: build-ip2 + run: | + cd ip2 + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=~/ip2 -DCMAKE_PREFIX_PATH=~ + make -j2 + make install + + - name: checkout + uses: actions/checkout@v2 + with: + path: wgrib2 + + - name: build + run: | + cd wgrib2 + mkdir b + cd b + cmake ${{ matrix.config.options }} .. + make VERBOSE=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea4139c..f5c592f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(USE_HDF5 "Use HDF5?" off) option(USE_REGEX "Use Regex?" on) option(USE_TIGGE "Use tigge?" on) option(USE_MYSQL "Use MySQL?" off) -# option(USE_IPOLATES "iplib=0,1,3?" 3) +option(USE_IPOLATES "Use NCEPLIBS-ip interpolation library?" off) set(USE_IPOLATES 0) option(USE_UDF "Use UDF?" off) option(USE_OPENMP "Use OpenMP?" on) @@ -74,12 +74,12 @@ if(USE_NETCDF3 AND USE_NETCDF4) message(FATAL_ERROR "USE_NETCDF3 OR USE_NetCDF4, not both") endif() - -if(USE_IPOLATES EQUAL 1) +# If user wants to use NCEPLIBS-ip, find it and the sp library. +if(USE_IPOLATES) find_package(ip CONFIG REQUIRED) find_package(sp CONFIG REQUIRED) -elseif(USE_IPOLATES EQUAL 3) - find_package(ip2 CONFIG REQUIRED) +# elseif(USE_IPOLATES EQUAL 3) +# find_package(ip2 CONFIG REQUIRED) endif() if(USE_NETCDF4) From ec4416ab51a47a63e3c15bd46e4f3b808a12680a Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 04:40:06 -0600 Subject: [PATCH 2/9] trying ip build --- .github/workflows/Linux_options.yml | 2 +- CMakeLists.txt | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml index 9e5b7810..69ed9015 100644 --- a/.github/workflows/Linux_options.yml +++ b/.github/workflows/Linux_options.yml @@ -28,7 +28,7 @@ jobs: matrix: config: - { - options: "-DUSE_IPOLATES" + options: "-DUSE_IPOLATES=1" } steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index f5c592f2..28233ae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,7 @@ option(USE_HDF5 "Use HDF5?" off) option(USE_REGEX "Use Regex?" on) option(USE_TIGGE "Use tigge?" on) option(USE_MYSQL "Use MySQL?" off) -option(USE_IPOLATES "Use NCEPLIBS-ip interpolation library?" off) -set(USE_IPOLATES 0) +option(USE_IPOLATES "iplib=0,1,3?" 3) option(USE_UDF "Use UDF?" off) option(USE_OPENMP "Use OpenMP?" on) option(USE_PROJ4 "Use Proj4?" off) @@ -75,11 +74,11 @@ if(USE_NETCDF3 AND USE_NETCDF4) endif() # If user wants to use NCEPLIBS-ip, find it and the sp library. -if(USE_IPOLATES) +if(USE_IPOLATES EQUAL 1) find_package(ip CONFIG REQUIRED) find_package(sp CONFIG REQUIRED) -# elseif(USE_IPOLATES EQUAL 3) -# find_package(ip2 CONFIG REQUIRED) +elseif(USE_IPOLATES EQUAL 3) + find_package(ip2 CONFIG REQUIRED) endif() if(USE_NETCDF4) From a82edfa899094e71e712c0553e9008ed9ea3f47f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 04:45:06 -0600 Subject: [PATCH 3/9] trying ip build --- .github/workflows/Linux_options.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml index 69ed9015..9611cc2f 100644 --- a/.github/workflows/Linux_options.yml +++ b/.github/workflows/Linux_options.yml @@ -59,7 +59,7 @@ jobs: with: repository: NOAA-EMC/NCEPLIBS-sp path: sp - ref: develop + ref: v2.3.3 - name: build-sp run: | @@ -70,6 +70,31 @@ jobs: make -j2 make install + - name: cache-ip + id: cache-ip + uses: actions/cache@v3 + with: + path: ~/ip + key: ip-${{ runner.os }}-${{ matrix.ip-version }} + + - name: checkout-ip + if: steps.cache-ip.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: NOAA-EMC/NCEPLIBS-ip + path: ip + ref: v3.3.3 + + - name: build-ip + if: steps.cache-ip.outputs.cache-hit != 'true' + run: | + cd ip + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp + make -j2 + make install + - name: checkout-ip2 uses: actions/checkout@v2 with: @@ -96,5 +121,5 @@ jobs: cd wgrib2 mkdir b cd b - cmake ${{ matrix.config.options }} .. + cmake ${{ matrix.config.options }} -DCMAKE_PREFIX_PATH="~/sp;~/ip;~/ip2" .. make VERBOSE=1 From 5d5150458cf0a28285544d03c305aff05d212afe Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 04:53:13 -0600 Subject: [PATCH 4/9] trying ip build --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28233ae7..d84d4741 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,11 @@ elseif(USE_IPOLATES EQUAL 3) find_package(ip2 CONFIG REQUIRED) endif() +if(NOT USE_IPOLATES EQUAL 0) + list(APPEND definitions_list -DIPOLATES_LIB="ipolates_lib") +endif() +list(APPEND definitions_list -DUSE_IPOLATES=${USE_IPOLATES}) + if(USE_NETCDF4) find_package(NetCDF MODULE REQUIRED COMPONENTS C) list(APPEND definitions_list -DUSE_NETCDF4 -DUSE_HDF5 -DHDF5="hdf5") From 330f18c986caba8cd5d67760b02965afa4f3f087 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 05:14:02 -0600 Subject: [PATCH 5/9] trying ip build --- CMakeLists.txt | 25 ++-- wgrib2/CMakeLists.txt | 276 +++++++----------------------------------- 2 files changed, 60 insertions(+), 241 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d84d4741..c22e58d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ +# This is the main CMake build file for the wgrib2 project. +# +# Kyle Gerheiser, Edward Hartnett, Wesley Ebisuzaki + cmake_minimum_required(VERSION 3.12) project(wgrib2 VERSION 3.1.4 LANGUAGES Fortran C) - option(USE_NETCDF3 "Use NetCDF-3?" off) option(USE_NETCDF4 "Use NetCDF-4?" off) option(USE_HDF5 "Use HDF5?" off) @@ -42,6 +45,7 @@ endif() include(GNUInstallDirs) +message(STATUS "Setting compiler flags...") if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_C_FLAGS "-g -traceback ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_DEBUG "-O0") @@ -59,6 +63,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") endif() +message(STATUS "Checking if user wants to use NCEPLIBS-g2c...") if(USE_G2CLIB) if(USE_PNG) message(FATAL_ERROR "If USE_G2CLIB is on, USE_PNG must be off") @@ -74,6 +79,7 @@ if(USE_NETCDF3 AND USE_NETCDF4) endif() # If user wants to use NCEPLIBS-ip, find it and the sp library. +message(STATUS "Checking if the user want to use NCEPLIBS-ip...") if(USE_IPOLATES EQUAL 1) find_package(ip CONFIG REQUIRED) find_package(sp CONFIG REQUIRED) @@ -86,11 +92,13 @@ if(NOT USE_IPOLATES EQUAL 0) endif() list(APPEND definitions_list -DUSE_IPOLATES=${USE_IPOLATES}) +message(STATUS "Checking if the user want to use NetCDF...") if(USE_NETCDF4) find_package(NetCDF MODULE REQUIRED COMPONENTS C) list(APPEND definitions_list -DUSE_NETCDF4 -DUSE_HDF5 -DHDF5="hdf5") endif() +message(STATUS "Checking if the user wants to use Jasper...") if(USE_JASPER) list(APPEND definitions_list -DUSE_JASPER) find_package(Jasper REQUIRED) @@ -99,6 +107,7 @@ if(USE_JASPER) endif() endif() +message(STATUS "Checking if the user want to use OpenMP...") if(USE_OPENMP) find_package(OpenMP) if(OpenMP_CXX_FOUND) @@ -109,13 +118,14 @@ if(USE_OPENMP) # endif() endif() +message(STATUS "Checking of the user wants to use PNG...") if(USE_PNG) find_package(ZLIB REQUIRED) find_package(PNG REQUIRED) endif() - # 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") @@ -140,21 +150,14 @@ FILE(APPEND "wgrib2/config.h" "#define CC \"${CMAKE_C_COMPILER} ${CMAKE_C_COMPIL 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") - - - - +message(STATUS "Adding wgrib2, aux_probs subdirectories...") add_subdirectory(wgrib2) add_subdirectory(aux_progs) - if(BUILD_LIB) - + message(STATUS "Adding wgrib2 library build...") ### Package config include(CMakePackageConfigHelpers) set(CONFIG_INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index a4f168cd..6c9f5690 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -1,235 +1,51 @@ +# This is the CMake build file for the wgrib2 project, wgrib2 +# subdirectory. +# +# Kyle Gerheiser, Edward Hartnett, Wesley Ebisuzaki # sets lib_src -set(lib_src -AAIG.c -AAIGlong.c -addtime.c -aec_pk.c -Aerosol.c -Alarm.c -Alias.c -Ave_test.c -Ave_var.c -Bbox.c -bitstream.c -Box_ave.c -Check_pdt_size.c -Checksum.c -Cluster.c -cname.c -codetable_4_230.c -CodeTable.c -Code_Values.c -Code_Values_JMA.c -complex_pk.c -Config.c -copy.c -crc32.c -Cress_lola.c -Csv.c -Csv_long.c -cubed_sphere2ll.c -CubeFace2global.c -Cyclic.c -Data.c -decenc_openjpeg.c -dec_png_clone.c -Dump.c -Earth.c -Else.c -enc_jpeg2000_clone.c -End.c -Endif.c -Ensemble.c -Ens_processing.c -Ens_qc.c -EOF.c -Export_lonlat.c -ExtName.c -fatal_error.c -Fcst_ave.c -ffopen.c -Fi.c -File.c -Fix_CFSv2_fcst.c -Fix_ncep_2.c -Fix_ncep_3.c -Fix_ncep_4.c -Fix_ncep.c -Fix_undef.c -FlagTable.c -flt2ieee.c -flt2ieee_nan.c -Flush.c -fnlist.c -For.c -Ftime1.c -Ftime2.c -Ftime.c -Ftn_api.c -gaussian2ij.c -Gctpc.c -gctpc_ll2xy.c -GDT.c -geo.c -Geolocation.c -get_unixtime.c -Grads.c -Grib.c -Grib_out_irr2.c -Grib_out_irr.c -gribtab.c -Gribtable_used.c -Grid_def.c -Grid_id.c -grid_ident.c -Gridout.c -Help.c -Hybrid.c -ieee2flt.c -ieee2flt_nan.c -ieee_pk.c -If_delayed_error.c -If_rec.c -Import.c -Import_grib.c -Import_grib_fs.c -Import_lonlat.c -Import_netcdf.c -init.c -int8.c -intpower.c -Inv.c -Inv_no.c -Irr_grids.c -itoshort_a.c -JMA.c -jpeg_pk.c -Last.c -lat2ij.c -Latlon.c -Level.c -Limit.c -Lola.c -Lvl.c -Macro.c -manage_inv_out.c -Match.c -Match_fs.c -Match_inv.c -Mem_buffer.c -Merge.c -Misc.c -missing.c -mk_gdt.c -mk_kgds.c -Model_version_date.c -Mod_grib.c -Mysql.c -Mysql_dump.c -Mysql_speed.c -Names.c -ncep_grids.c -NCEP_norm.c -NCEP_uv.c -Ncpu.c -Ndate.c -Ndates.c -Netcdf.c -Netcdf_sup.c -New_grid.c -new_grid_lambertc.c -New_grid_order.c -openmp_util.c -parse_loop.c -parse_msg.c -pdt_len.c -Precision.c -Prob.c -Proj4.c -proj4_initialize.c -proj4_transform.c -PyInv.c -Range.c -rdieee_file.c -rd_inventory.c -rd_seq_grib.c -read_latlon.c -Reduced_gaussian_grid.c -Reset_delayed_error.c -rotll.c -RPN.c -save_string.c -Scaling_0001.c -Scan.c -Sec0.c -Sec1.c -Sec3.c -sec3_grids.c -Sec4.c -Sec5.c -Sec6.c -Sec_len.c -Set_byte.c -Set_date.c -Set_ensm_derived_fcst.c -Set_ens_num.c -Set_ftime1.c -Set_ftime2.c -Set_ftime_mode.c -Set_gds.c -Set_metadata.c -Set_pdt.c -Set_percentile.c -Set_prob.c -Set_sec_size.c -Set_ts_dates.c -setup_user_gribtable.c -Set_val.c -simple_pk.c -Small_grib.c -space_view2ij.c -space_view.c -SpatialProcessing.c -Spectral_bands.c -stagger.c -Status.c -string2time_unit.c -Submsg_uv.c -subtime.c -Summary.c -swap_buffer.c -test_sec.c -Tigge.c -Time_processing.c -Timer.c -Tosubmsg.c -Type_reftime.c -UDF.c -Undefine.c -units.c -Unix_time.c -Unmerge_fcst.c -unpk_0.c -unpk.c -unpk_complex.c -unpk_run_length.c -update_sec3.c -update_sec4.c -v1_v2_if.c -VerfTime.c -Warn_old_g2lib.c -Waves.c -wgrib2_api.c -wgrib2.c -Wind_dir.c -Wind_speed.c -Wind_uv.c -Write_sec.c -Wrt_grib.c -wrtieee.c -wxtext.c -) +set(lib_src AAIG.c AAIGlong.c addtime.c aec_pk.c Aerosol.c Alarm.c +Alias.c Ave_test.c Ave_var.c Bbox.c bitstream.c Box_ave.c +Check_pdt_size.c Checksum.c Cluster.c cname.c codetable_4_230.c +CodeTable.c Code_Values.c Code_Values_JMA.c complex_pk.c Config.c +copy.c crc32.c Cress_lola.c Csv.c Csv_long.c cubed_sphere2ll.c +CubeFace2global.c Cyclic.c Data.c decenc_openjpeg.c dec_png_clone.c +Dump.c Earth.c Else.c enc_jpeg2000_clone.c End.c Endif.c Ensemble.c +Ens_processing.c Ens_qc.c EOF.c Export_lonlat.c ExtName.c +fatal_error.c Fcst_ave.c ffopen.c Fi.c File.c Fix_CFSv2_fcst.c +Fix_ncep_2.c Fix_ncep_3.c Fix_ncep_4.c Fix_ncep.c Fix_undef.c +FlagTable.c flt2ieee.c flt2ieee_nan.c Flush.c fnlist.c For.c Ftime1.c +Ftime2.c Ftime.c Ftn_api.c gaussian2ij.c Gctpc.c gctpc_ll2xy.c GDT.c +geo.c Geolocation.c get_unixtime.c Grads.c Grib.c Grib_out_irr2.c +Grib_out_irr.c gribtab.c Gribtable_used.c Grid_def.c Grid_id.c +grid_ident.c Gridout.c Help.c Hybrid.c ieee2flt.c ieee2flt_nan.c +ieee_pk.c If_delayed_error.c If_rec.c Import.c Import_grib.c +Import_grib_fs.c Import_lonlat.c Import_netcdf.c init.c int8.c +intpower.c Inv.c Inv_no.c Irr_grids.c itoshort_a.c JMA.c jpeg_pk.c +Last.c lat2ij.c Latlon.c Level.c Limit.c Lola.c Lvl.c Macro.c +manage_inv_out.c Match.c Match_fs.c Match_inv.c Mem_buffer.c Merge.c +Misc.c missing.c mk_gdt.c mk_kgds.c Model_version_date.c Mod_grib.c +Mysql.c Mysql_dump.c Mysql_speed.c Names.c ncep_grids.c NCEP_norm.c +NCEP_uv.c Ncpu.c Ndate.c Ndates.c Netcdf.c Netcdf_sup.c New_grid.c +new_grid_lambertc.c New_grid_order.c openmp_util.c parse_loop.c +parse_msg.c pdt_len.c Precision.c Prob.c Proj4.c proj4_initialize.c +proj4_transform.c PyInv.c Range.c rdieee_file.c rd_inventory.c +rd_seq_grib.c read_latlon.c Reduced_gaussian_grid.c +Reset_delayed_error.c rotll.c RPN.c save_string.c Scaling_0001.c +Scan.c Sec0.c Sec1.c Sec3.c sec3_grids.c Sec4.c Sec5.c Sec6.c +Sec_len.c Set_byte.c Set_date.c Set_ensm_derived_fcst.c Set_ens_num.c +Set_ftime1.c Set_ftime2.c Set_ftime_mode.c Set_gds.c Set_metadata.c +Set_pdt.c Set_percentile.c Set_prob.c Set_sec_size.c Set_ts_dates.c +setup_user_gribtable.c Set_val.c simple_pk.c Small_grib.c +space_view2ij.c space_view.c SpatialProcessing.c Spectral_bands.c +stagger.c Status.c string2time_unit.c Submsg_uv.c subtime.c Summary.c +swap_buffer.c test_sec.c Tigge.c Time_processing.c Timer.c Tosubmsg.c +Type_reftime.c UDF.c Undefine.c units.c Unix_time.c Unmerge_fcst.c +unpk_0.c unpk.c unpk_complex.c unpk_run_length.c update_sec3.c +update_sec4.c v1_v2_if.c VerfTime.c Warn_old_g2lib.c Waves.c +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 ) From c09724f4c0a5e882b31eb12a97c2c28559591272 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 05:20:04 -0600 Subject: [PATCH 6/9] more ip work --- wgrib2/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index 6c9f5690..2ad0097f 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -120,7 +120,8 @@ if(BUILD_LIB) set(headers wgrib2_api.h wgrib2.h) target_link_libraries(wgrib2_lib PUBLIC gctpc) set_target_properties(wgrib2_lib PROPERTIES PUBLIC_HEADER "${headers}") - + target_compile_definitions(wgrib2_lib PUBLIC ${definitions_list}) + install( TARGETS wgrib2_lib EXPORT wgrib2_exports From a98ba54ce1f1c33d4ab76c6c9a1dd28fd4544eca Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 05:25:36 -0600 Subject: [PATCH 7/9] added -DGFORTRAN to build, didn't work --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c22e58d2..1b200476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,10 +47,10 @@ include(GNUInstallDirs) message(STATUS "Setting compiler flags...") if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_C_FLAGS "-g -traceback ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "-g -traceback ${CMAKE_C_FLAGS} -DIFORT") set(CMAKE_C_FLAGS_DEBUG "-O0") elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU)$") - set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS} -DGFORTRAN") set(CMAKE_C_FLAGS_DEBUG "-O0") endif() From 3632fafd24caf3f7c5bd03a8c09d9437f6465282 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 05:36:08 -0600 Subject: [PATCH 8/9] got build to succeed! --- wgrib2/CMakeLists.txt | 18 ++++++++++++++++++ wgrib2/New_grid.c | 1 + 2 files changed, 19 insertions(+) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index 2ad0097f..24013ec5 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -96,6 +96,21 @@ endif() if(USE_G2CLIB) endif() +if(USE_IPOLATES EQUAL 1) + target_link_libraries(obj_lib PUBLIC ip::ip_d) + target_link_libraries(obj_lib PUBLIC sp::sp_d) + + # Link to the Fortran runtime library for each compiler if using ip2. + # The wgrib2 exectuable is created using the C compiler and + # doesn't link the necessary Fortran library required for ip2. + if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + target_link_libraries(wgrib2_exe PRIVATE "-lifcore") + elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") + target_link_libraries(wgrib2_exe PRIVATE "-lgfortran") + endif() + +endif() + if(USE_IPOLATES EQUAL 3) target_link_libraries(obj_lib PUBLIC ip2::ip2_d) @@ -119,6 +134,9 @@ target_link_libraries(wgrib2_exe PRIVATE obj_lib) if(BUILD_LIB) set(headers wgrib2_api.h wgrib2.h) target_link_libraries(wgrib2_lib PUBLIC gctpc) + # if(USE_IPOLATES EQUAL 1) + # target_link_libraries(wgrib2_lib PRIVATE ip:ip_4 sp:sp_4) + # endif() set_target_properties(wgrib2_lib PROPERTIES PUBLIC_HEADER "${headers}") target_compile_definitions(wgrib2_lib PUBLIC ${definitions_list}) diff --git a/wgrib2/New_grid.c b/wgrib2/New_grid.c index 8247dea3..c27bd6ab 100644 --- a/wgrib2/New_grid.c +++ b/wgrib2/New_grid.c @@ -7,6 +7,7 @@ #include "grb2.h" #include "wgrib2.h" #include "fnlist.h" +#include "ipolates.h" /* * New_grid From 28fe1f7dd8c46f5103f94033c7067979e92cbd75 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 27 Mar 2024 05:37:35 -0600 Subject: [PATCH 9/9] reverted change --- wgrib2/New_grid.c | 1 - 1 file changed, 1 deletion(-) diff --git a/wgrib2/New_grid.c b/wgrib2/New_grid.c index c27bd6ab..8247dea3 100644 --- a/wgrib2/New_grid.c +++ b/wgrib2/New_grid.c @@ -7,7 +7,6 @@ #include "grb2.h" #include "wgrib2.h" #include "fnlist.h" -#include "ipolates.h" /* * New_grid