Merge remote-tracking branch 'upstream/main' into silence-libdispatch-warnings

This commit is contained in:
Ward Fisher 2024-04-17 15:41:56 -06:00
commit 7d111a75d9
23 changed files with 1685 additions and 1428 deletions

163
.github/workflows/main-cmake.yml vendored Normal file
View File

@ -0,0 +1,163 @@
name: NetCDF-C CMake CI - Windows
on: [pull_request, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
cmake_build_and_test:
strategy:
matrix:
name:
- "Windows MSVC"
hdf5:
- "1.14.3"
# Visual Studio + CMake
include:
- name: "Windows MSVC"
os: windows-latest
generator: "-G \"Visual Studio 17 2022\""
name: "${{ matrix.name }}"
runs-on: ${{ matrix.os }}
# Each step in the job.
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: ""
auto-activate-base: true
- name: Set up Paths and env
shell: bash -el {0}
run: |
echo "" >> ~/.bash_profile
cat ~/.bash_profile
- name: Dump Matrix Context
run: echo '${{ toJSON(matrix) }}'
#- run: echo "CMAKE_PREFIX_PATH=${env.CONDA_PREFIX}/Library" >> $GITHUB_ENV
#- run: echo "/c/Users/runneradmin/miniconda3/Library/lib:${GITHUB_PATH}" >> $GITHUB_ENV
#- run: echo ""
#- run: echo "CTEST_OUTPUT_ON_FAILURE=1" >> $GITHUB_ENV
# Grab miniconda and use it to install HDF5
- name: Install Dependencies using Miniconda
run: |
conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
conda config --add channels conda-forge
conda update conda
conda install hdf5=${{ matrix.hdf5 }} m2-m4 libxml2
shell: bash -el {0}
# Double-check something
- name: Check Miniconda
run: |
which h5dump
which m4
shell: bash -el {0}
# Check current directory
- name: Query Current Environment
run: |
ls
echo ""
echo "PATH: $PATH"
echo ""
env
echo ""
ls $CONDA_PREFIX/Library
echo ""
ls $CONDA_PREFIX/Library/include/
shell: bash -el {0}
- name: Perform out-of-directory configuration
shell: bash -el {0}
run: |
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}/Library" -DCMAKE_C_FLAGS="-I${CONDA_PREFIX}/Library/include" -DCMAKE_INSTALL_PREFIX=~/tmp -DNETCDF_ENABLE_FILTER_TESTING=OFF
if: ${{ success() }}
- name: View cache - configuration
shell: bash -el {0}
run: |
cd build
cmake -L .
if: ${{ success() }}
- name: Print Summary
shell: bash -el {0}
run: |
cd build
cat libnetcdf.settings
- name: Perform out-of-directory build - libnetcdf
shell: bash -el {0}
run: |
cd build
cmake --build . --config Release --target netcdf -j 4
- name: Perform out-of-directory install - libnetcdf
shell: bash -el {0}
run: |
cd build
cmake --build . --config Release --target install -j 4
if: ${{ success() }}
- name: View config.h - libnetcdf failure
shell: bash -el {0}
run: |
cd build
cat config.h
if: ${{ failure() }}
- name: Perform out-of-directory build - test suite
shell: bash -el {0}
run: |
cd build
cmake --build . --config Release -j 4
if: ${{ success() }}
- name: View config.h - tests failure failure
shell: bash -el {0}
run: |
cd build
cat config.h
if: ${{ failure() }}
- name: Prepare ctest Paths and env
shell: bash -el {0}
run: |
cat ~/.bash_profile
echo "" >> ~/.bash_profile
- name: Run ctest
shell: bash -el {0}
run: |
echo "Run ctest PATH: $PATH"
echo "Run ctest combined PATH: $PATH"
echo "Run ctest combined GITHUB_PATH: $PATH"
cd build
PATH=~/tmp/bin:$PATH ctest . -j 4 -E 'bom' --output-on-failure
- name: Verbose Output if CTest Failure
shell: bash -el {0}
run: |
cd build
PATH=~/tmp/bin:$PATH ctest . --rerun-failed --output-on-failure -VV
if: ${{ failure() }}

View File

@ -21,7 +21,7 @@ jobs:
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -32,7 +32,7 @@ jobs:
###
- name: Cache libhdf5-${{ matrix.hdf5 }}
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -70,7 +70,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -81,7 +81,7 @@ jobs:
###
- name: Cache libhdf5-parallel-${{ matrix.hdf5 }}
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-parallel-${{ runner.os }}-${{ matrix.hdf5 }}
@ -129,7 +129,7 @@ jobs:
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
CDASH_TOKEN: ${{ secrets.CDASH_TOKEN }}
env:
@ -153,7 +153,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}

View File

@ -24,14 +24,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# libhdf5
###
- name: Cache libhdf5-${{ runner.os }}-${{ matrix.hdf5 }}
id: cache-hdf5-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -62,7 +62,7 @@ jobs:
use_nczarr: [ nczarr_off, nczarr_on ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# Set Environmental Variables
@ -94,7 +94,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -168,7 +168,7 @@ jobs:
use_nczarr: [ nczarr_off, nczarr_on ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# Set Environmental Variables
@ -200,7 +200,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -260,7 +260,7 @@ jobs:
hdf5: [ 1.12.2, 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# Set Environmental Variables
@ -277,7 +277,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -342,7 +342,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# Set Environmental Variables
@ -357,7 +357,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -416,7 +416,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
###
# Set Environmental Variables
@ -432,7 +432,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5-osx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}

View File

@ -26,7 +26,7 @@ jobs:
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -37,7 +37,7 @@ jobs:
###
- name: Cache libhdf5-${{ matrix.hdf5 }}
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -73,7 +73,7 @@ jobs:
hdf5: [ 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -94,7 +94,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}

View File

@ -21,7 +21,7 @@ jobs:
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -32,7 +32,7 @@ jobs:
###
- name: Cache libhdf5-${{ matrix.hdf5 }}
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -70,7 +70,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -81,7 +81,7 @@ jobs:
###
- name: Cache libhdf5-parallel-${{ matrix.hdf5 }}
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-parallel-${{ runner.os }}-${{ matrix.hdf5 }}
@ -131,7 +131,7 @@ jobs:
hdf5: [ 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -152,7 +152,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -226,7 +226,7 @@ jobs:
hdf5: [ 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -247,7 +247,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -322,7 +322,7 @@ jobs:
hdf5: [ 1.14.3 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -338,7 +338,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-parallel-${{ runner.os }}-${{ matrix.hdf5 }}
@ -403,7 +403,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -422,7 +422,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -483,7 +483,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -503,7 +503,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -565,7 +565,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -584,7 +584,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-parallel-${{ runner.os }}-${{ matrix.hdf5 }}
@ -699,7 +699,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}
@ -808,7 +808,7 @@ jobs:
use_nczarr: [ nczarr_off, nczarr_on ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install System dependencies
shell: bash -l {0}
@ -842,7 +842,7 @@ jobs:
- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}

View File

@ -28,7 +28,7 @@ jobs:
- name: Fix line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: cygwin/cygwin-install-action@v2
with:

View File

@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64

View File

@ -468,6 +468,7 @@ message(">>> NETCDF_ENABLE_REMOTE_FUNCTIONALITY=${NETCDF_ENABLE_REMOTE_FUNCTIONA
if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP[4]=NO")
set(NETCDF_ENABLE_DAP OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP=NO" FORCE)
set(NETCDF_ENABLE_DAP2 OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP2=NO" FORCE)
set(NETCDF_ENABLE_DAP4 OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP4=NO" FORCE)
endif()
@ -544,7 +545,7 @@ else()
endif()
# Option to support byte-range reading of remote datasets
option(NETCDF_ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." ON)
option(NETCDF_ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." ${NETCDF_ENABLE_DAP})
if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_BYTERANGE=NO")
set(NETCDF_ENABLE_BYTERANGE OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_BYTERANGE=NO" FORCE)

View File

@ -1,44 +0,0 @@
image: Visual Studio 2019
environment:
matrix:
- TARGET_ARCH: x64
CONDA_INSTALL_LOCN: C:\\Miniconda-x64
MSYS2_INSTALL_LOCN: C:\msys64
MSYS2_BIN_LOCN: C:\msys64\usr\bin
CMAKE_GENERATOR: "Visual Studio 16"
platform:
- x64
branches:
except:
# - /.*[.]dmh/
- /.*[.]wif/
# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
install:
- cmd: set SRC_DIR=%cd%
- cmd: set INSTALL_LOC=%SRC_DIR%\install
- cmd: set PATH=%PATH%;%MSYS2_BIN_LOCN%;%INSTALL_LOC%\bin;%INSTALL_LOC%\lib
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
- cmd: conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
- cmd: conda update conda
- cmd: conda install hdf5=1.8.18 curl hdf4
configuration: Release
build: off
# Run a custom script.
build_script:
- cmd: mkdir build
- cmd: cd build
- cmd: cmake .. -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_LOC% -DNETCDF_ENABLE_BASH_SCRIPT_TESTING=OFF -DNETCDF_ENABLE_FILTER_TESTING=OFF -DNETCDF_ENABLE_BYTERANGE=ON
- cmd: if errorlevel 1 exit 1
- cmd: cmake --build . --config Release -- /maxcpucount:4
test_script:
- cmd: cmake --build . --config Release --target install -- /maxcpucount:4

View File

@ -214,101 +214,110 @@ if(USE_HDF5)
endif(USE_HDF5)
################################
# Curl
# Curl Libraryies
# Only needed for DAP (DAP2 or DAP4)
# and NCZARR with S3 Support
################################
# See if we have libcurl
find_package(CURL)
#target_compile_options(netcdf
# PRIVATE
# -DCURL_STATICLIB=1
#)
#target_include_directories(netcdf
# PRIVATE
# ${CURL_INCLUDE_DIRS}
#)
if(CURL_FOUND)
set(FOUND_CURL TRUE)
target_link_libraries(netcdf
PRIVATE
CURL::libcurl
)
else()
set(FOUND_CURL FALSE)
set(NETCDF_ENABLE_DAP2 OFF)
set(NETCDF_ENABLE_DAP4 OFF)
set(NETCDF_ENABLE_BYTERANGE OFF)
set(NETCDF_ENABLE_S3 OFF)
endif(CURL_FOUND)
# Start disabling if curl not found
if(NOT FOUND_CURL)
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling")
set(NETCDF_ENABLE_REMOTE_FUNCTIONALITY OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling" FORCE )
endif()
set (CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
# Check to see if we have libcurl 7.66 or later
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {
#if LIBCURL_VERSION_NUM < 0x074200
choke me;
#endif
}" HAVE_LIBCURL_766)
IF (HAVE_LIBCURL_766)
# If libcurl version is >= 7.66, then can skip tests
# for these symbols which were added in an earlier version
set(HAVE_CURLOPT_USERNAME TRUE)
set(HAVE_CURLOPT_PASSWORD TRUE)
set(HAVE_CURLOPT_KEYPASSWD TRUE)
set(HAVE_CURLINFO_RESPONSE_CODE TRUE)
set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE)
set(HAVE_CURLOPT_BUFFERSIZE TRUE)
set(HAVE_CURLOPT_KEEPALIVE TRUE)
else()
# Check to see if CURLOPT_USERNAME is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)
# Check to see if CURLOPT_PASSWORD is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)
# Check to see if CURLOPT_KEYPASSWD is defined.
# It is present starting version 7.16.4.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)
# Check to see if CURLINFO_RESPONSE_CODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
# Check to see if CURLINFO_HTTP_CONNECTCODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE)
# Check to see if CURLOPT_BUFFERSIZE is defined.
# It is present starting version 7.59
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE)
# Check to see if CURLOPT_TCP_KEEPALIVE is defined.
# It is present starting version 7.25
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE)
if( (NETCDF_ENABLE_DAP AND (NETCDF_ENABLE_DAP2 OR NETCDF_ENABLE_DAP4 OR NETCDF_ENABLE_BYTERANGE_SUPPORT)) OR (NETCDF_ENABLE_NCZARR AND NETCDF_ENABLENCZARR_S3))
# See if we have libcurl
find_package(CURL)
#target_compile_options(netcdf
# PRIVATE
# -DCURL_STATICLIB=1
#)
#target_include_directories(netcdf
# PRIVATE
# ${CURL_INCLUDE_DIRS}
#)
if(CURL_FOUND)
set(FOUND_CURL TRUE)
target_link_libraries(netcdf
PRIVATE
CURL::libcurl
)
else()
set(FOUND_CURL FALSE)
set(NETCDF_ENABLE_DAP2 OFF)
set(NETCDF_ENABLE_DAP4 OFF)
set(NETCDF_ENABLE_BYTERANGE OFF)
set(NETCDF_ENABLE_S3 OFF)
endif(CURL_FOUND)
# Start disabling if curl not found
if(NOT FOUND_CURL)
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling")
set(NETCDF_ENABLE_REMOTE_FUNCTIONALITY OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling" FORCE )
endif()
set (CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
# Check to see if we have libcurl 7.66 or later
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {
#if LIBCURL_VERSION_NUM < 0x074200
choke me;
#endif
}" HAVE_LIBCURL_766)
IF (HAVE_LIBCURL_766)
# If libcurl version is >= 7.66, then can skip tests
# for these symbols which were added in an earlier version
set(HAVE_CURLOPT_USERNAME TRUE)
set(HAVE_CURLOPT_PASSWORD TRUE)
set(HAVE_CURLOPT_KEYPASSWD TRUE)
set(HAVE_CURLINFO_RESPONSE_CODE TRUE)
set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE)
set(HAVE_CURLOPT_BUFFERSIZE TRUE)
set(HAVE_CURLOPT_KEEPALIVE TRUE)
else()
# Check to see if CURLOPT_USERNAME is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)
# Check to see if CURLOPT_PASSWORD is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)
# Check to see if CURLOPT_KEYPASSWD is defined.
# It is present starting version 7.16.4.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)
# Check to see if CURLINFO_RESPONSE_CODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
# Check to see if CURLINFO_HTTP_CONNECTCODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE)
# Check to see if CURLOPT_BUFFERSIZE is defined.
# It is present starting version 7.59
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE)
# Check to see if CURLOPT_TCP_KEEPALIVE is defined.
# It is present starting version 7.25
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE)
endif()
endif()
################################
# End LibCurl stuff
################################
################################
# Math

View File

@ -69,7 +69,8 @@ char* strdup(const char*);
#ifndef HAVE_STRLCAT
#ifndef strlcat
size_t strlcat(char*,const char*,size_t);
#define strlcat nc_strlcat
size_t nc_strlcat(char*,const char*,size_t);
#endif
#endif

View File

@ -44,7 +44,7 @@ strdup(const char* s)
#endif
#ifndef WIN32
#if !defined(_MSC_VER) && !defined(WIN32)
#ifndef HAVE_STRLCPY
/*
@ -117,7 +117,7 @@ strlcpy(char *dst, const char* src, size_t dsize)
* If retval >= dsize, truncation occurred.
*/
size_t
strlcat(char* dst, const char* src, size_t dsize)
nc_strlcat(char* dst, const char* src, size_t dsize)
{
const char *odst = dst;
const char *osrc = src;

View File

@ -19,7 +19,7 @@
int
main() {
unsigned int urnd = 0; /* range 0..2147483647 */
#ifdef WIN32
#if defined(WIN32) || defined(_MSC_VER)
(void)rand_s(&urnd);
#else
long rnd;

View File

@ -148,7 +148,7 @@ if(USE_HDF5)
endif()
if(FOUND_CURL)
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl ${CURL_LIBRARIES})
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl)
endif()
if(USE_HDF4)

View File

@ -6,7 +6,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
# This shell script tests BOM support in ncgen
set -e
set -x
# add hack for sunos
export srcdir;
@ -28,7 +28,13 @@ echo "*** Generate a cdl file with leading UTF-8 BOM."
${execdir}/bom 8 >tst_bom8.cdl
cat tst_bom.cdl >> tst_bom8.cdl
echo ""
echo "Viewing tst_bom8.cdl:"
cat tst_bom8.cdl
echo ""
echo "*** Verify .nc file"
${NCGEN} -k nc3 -o tst_bom8.nc tst_bom8.cdl
${NCDUMP} -n tst_bom tst_bom8.nc > tmp_bom.cdl
diff -w tst_bom.cdl tmp_bom.cdl
@ -40,6 +46,11 @@ rm -f tmp_bom.cdl tst_bom8.* tst_bom16.*
echo "*** Generate a cdl file with leading UTF-16 BOM."
${execdir}/bom 16 >tst_bom16.cdl
cat tst_bom.cdl >> tst_bom16.cdl
echo ""
echo "Viewing tst_bom16.cdl:"
cat tst_bom16.cdl
echo ""
echo "*** Verify UTF-16 file fails"
if ${NCGEN} -k nc3 -o tst_bom16.nc tst_bom16.cdl ; then

View File

@ -14,23 +14,32 @@ SET(ncgen3_FILES main.c load.c escapes.c getfill.c init.c genlib.c ncgeny.c ${XG
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
IF(NOT EXISTS ${netCDF_SOURCE_DIR}/ncgen3/ncgeny.c AND NOT EXISTS
${netCDF_SOURCE_DIR}/ncgen3/ncgeny.h)
ADD_CUSTOM_COMMAND(
OUTPUT ncgentab.h
COMMAND flex -Pncg -8 ncgen.l
COMMAND rm -f ncgenl.c
COMMAND mv lex.ncg.c ncgenl.c
COMMAND bison -pncg -t -d ncgen.y
COMMAND rm -f ncgeny.c ncgeny.h
COMMAND mv ncgen.tab.c ncgeny.c
COMMAND mv ncgen.tab.h ncgeny.h
COMMAND mv ncgeny.h ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mv ncgeny.c ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mv ncgenl.c ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
# With this option enabled, automatically generate the parser source
# files from the yacc input files when they're changed. They don't
# change very often, so this option is off by default.
if (NETCDF_GENERATE_NCGEN)
find_program(FLEX flex REQUIRED)
find_program(BISON bison REQUIRED)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.h ${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.c ${CMAKE_CURRENT_SOURCE_DIR}/ncgenl.c
DEPENDS ncgen.y ncgen.l
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${FLEX} -Pncg -8 ncgen/ncgen.l
COMMAND mv lex.ncg.c "${CMAKE_CURRENT_SOURCE_DIR}/ncgenl.c"
COMMAND ${BISON} -pncg -t -d ncgen/ncgen.y
COMMAND mv ncgen.tab.c "${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.c"
COMMAND mv ncgen.tab.h "${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.h"
# Fix the `#line` preprocessor directives with the correct source paths
COMMAND sed -i s/ncgen.tab/ncgeny/ "${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.c"
COMMAND sed -i s/lex.ncg/ncgenl/ "${CMAKE_CURRENT_SOURCE_DIR}/ncgenl.c"
COMMAND sed -i s/ncgen.tab/ncgeny/ "${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.h"
VERBATIM
)
ENDIF()
endif()
ADD_EXECUTABLE(ncgen3 ${ncgen3_FILES})
TARGET_LINK_LIBRARIES(ncgen3 netcdf ${ALL_TLL_LIBS})

View File

@ -193,7 +193,7 @@ cstring(
return cp;
case NC_DOUBLE:
cp_size = 20;
cp_size = 24;
cp = (char *) emalloc (cp_size);
doublep = (double *)valp;
(void) snprintf(cp,cp_size,"%.16g",* (doublep + num));
@ -1866,13 +1866,13 @@ extern char*
decodify (
const char *name)
{
int count; /* number chars in newname */
size_t count; /* number chars in newname */
char *newname;
const char *cp;
char *sp;
static int init = 0;
static char* repls[256]; /* replacement string for each char */
static int lens[256]; /* lengths of replacement strings */
static size_t lens[256]; /* lengths of replacement strings */
static struct {
char c;
char *s;
@ -1911,7 +1911,7 @@ decodify (
{'/', "_SLASH_"} /* should not occur in names */
/* {'_', "_UNDERSCORE_"} */
};
static int idtlen;
static size_t idtlen;
static size_t hexlen;
int nctable = (sizeof(ctable))/(sizeof(ctable[0]));
size_t newlen;
@ -1924,12 +1924,12 @@ decodify (
for(i = 0; i < 128; i++) {
rp = emalloc(2);
rp[0] = i;
rp[0] = (char)i;
rp[1] = '\0';
repls[i] = rp;
}
for(i=0; i < nctable; i++) {
size_t j = ctable[i].c;
size_t j = (size_t)ctable[i].c;
free(repls[j]);
repls[j] = ctable[i].s;
}
@ -1950,9 +1950,9 @@ decodify (
while(*cp != '\0') { /* get number of extra bytes for newname */
size_t j;
if(*cp < 0) { /* handle signed or unsigned chars */
j = *cp + 256;
j = (size_t)*cp + 256;
} else {
j = *cp;
j = (size_t)*cp;
}
count += lens[j] - 1;
cp++;
@ -1976,9 +1976,9 @@ decodify (
size_t j, len;
/* cp is current position in name, sp is current position in newname */
if(*cp < 0) { /* j is table index for character *cp */
j = *cp + 256;
j = (size_t)*cp + 256;
} else {
j = *cp;
j = (size_t)*cp;
}
len = strlcat(sp, repls[j], newlen);
assert(len < newlen);

View File

@ -142,8 +142,8 @@ data:|DATA: {return (DATA);}
yyerror("netCDF name required");
return (DATA); /* generate syntax error */
}
netcdfname = (char *) emalloc(t-s+1);
(void) strncpy(netcdfname, s, t-s);
netcdfname = (char *) emalloc((size_t)(t-s+1));
(void) strncpy(netcdfname, s, (size_t)(t-s));
netcdfname[t-s] = '\0';
deescapify(netcdfname); /* so "\5foo" becomes "5foo", for example */
return (NETCDF);
@ -184,7 +184,7 @@ FloatInf|-?Inff { /* missing value (pre-2.4 backward compatibility) */
snprintf(errstr, sizeof(errstr),"bad byte constant: %s",(char*)yytext);
yyerror(errstr);
}
byte_val = ii;
byte_val = (signed char)ii;
if (ii != (int)byte_val) {
snprintf(errstr, sizeof(errstr),"byte constant out of range (-128,127): %s",(char*)yytext);
yyerror(errstr);

View File

@ -142,7 +142,7 @@ dimdecline: dimdecl
dimdecl: dimd '=' INT_CONST
{ if (int_val <= 0)
derror("dimension length must be positive");
dims[ndims].size = int_val;
dims[ndims].size = (size_t)int_val;
ndims++;
}
| dimd '=' DOUBLE_CONST
@ -629,10 +629,10 @@ const: CHAR_CONST
atype_code = NC_SHORT;
switch (valtype) {
case NC_CHAR:
*char_valp++ = short_val;
*char_valp++ = (char)short_val;
break;
case NC_BYTE:
*byte_valp++ = short_val;
*byte_valp++ = (signed char)short_val;
break;
case NC_SHORT:
*short_valp++ = short_val;
@ -655,19 +655,19 @@ const: CHAR_CONST
atype_code = NC_INT;
switch (valtype) {
case NC_CHAR:
*char_valp++ = int_val;
*char_valp++ = (char)int_val;
break;
case NC_BYTE:
*byte_valp++ = int_val;
*byte_valp++ = (signed char)int_val;
break;
case NC_SHORT:
*short_valp++ = int_val;
*short_valp++ = (short)int_val;
break;
case NC_INT:
*int_valp++ = int_val;
break;
case NC_FLOAT:
*float_valp++ = int_val;
*float_valp++ = (float)int_val;
break;
case NC_DOUBLE:
*double_valp++ = int_val;
@ -681,16 +681,16 @@ const: CHAR_CONST
atype_code = NC_FLOAT;
switch (valtype) {
case NC_CHAR:
*char_valp++ = float_val;
*char_valp++ = (char)float_val;
break;
case NC_BYTE:
*byte_valp++ = float_val;
*byte_valp++ = (signed char)float_val;
break;
case NC_SHORT:
*short_valp++ = float_val;
*short_valp++ = (short)float_val;
break;
case NC_INT:
*int_valp++ = float_val;
*int_valp++ = (int)float_val;
break;
case NC_FLOAT:
*float_valp++ = float_val;
@ -707,22 +707,22 @@ const: CHAR_CONST
atype_code = NC_DOUBLE;
switch (valtype) {
case NC_CHAR:
*char_valp++ = double_val;
*char_valp++ = (char)double_val;
break;
case NC_BYTE:
*byte_valp++ = double_val;
*byte_valp++ = (signed char)double_val;
break;
case NC_SHORT:
*short_valp++ = double_val;
*short_valp++ = (short)double_val;
break;
case NC_INT:
*int_valp++ = double_val;
*int_valp++ = (int)double_val;
break;
case NC_FLOAT:
if (double_val == NC_FILL_DOUBLE)
*float_valp++ = NC_FILL_FLOAT;
else
*float_valp++ = double_val;
*float_valp++ = (float)double_val;
break;
case NC_DOUBLE:
*double_valp++ = double_val;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -30,6 +31,10 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
# define YY_NCG_NCGEN_TAB_H_INCLUDED
/* Debug traces. */
@ -40,32 +45,37 @@
extern int ncgdebug;
#endif
/* Token type. */
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
NC_UNLIMITED_K = 258,
BYTE_K = 259,
CHAR_K = 260,
SHORT_K = 261,
INT_K = 262,
FLOAT_K = 263,
DOUBLE_K = 264,
IDENT = 265,
TERMSTRING = 266,
BYTE_CONST = 267,
CHAR_CONST = 268,
SHORT_CONST = 269,
INT_CONST = 270,
FLOAT_CONST = 271,
DOUBLE_CONST = 272,
DIMENSIONS = 273,
VARIABLES = 274,
NETCDF = 275,
DATA = 276,
FILLVALUE = 277
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
NC_UNLIMITED_K = 258, /* NC_UNLIMITED_K */
BYTE_K = 259, /* BYTE_K */
CHAR_K = 260, /* CHAR_K */
SHORT_K = 261, /* SHORT_K */
INT_K = 262, /* INT_K */
FLOAT_K = 263, /* FLOAT_K */
DOUBLE_K = 264, /* DOUBLE_K */
IDENT = 265, /* IDENT */
TERMSTRING = 266, /* TERMSTRING */
BYTE_CONST = 267, /* BYTE_CONST */
CHAR_CONST = 268, /* CHAR_CONST */
SHORT_CONST = 269, /* SHORT_CONST */
INT_CONST = 270, /* INT_CONST */
FLOAT_CONST = 271, /* FLOAT_CONST */
DOUBLE_CONST = 272, /* DOUBLE_CONST */
DIMENSIONS = 273, /* DIMENSIONS */
VARIABLES = 274, /* VARIABLES */
NETCDF = 275, /* NETCDF */
DATA = 276, /* DATA */
FILLVALUE = 277 /* FILLVALUE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Value type. */
@ -78,6 +88,8 @@ typedef int YYSTYPE;
extern YYSTYPE ncglval;
int ncgparse (void);
#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */

View File

@ -22,7 +22,7 @@ verifychunking() {
f=$1
shift
for t in "$@" ; do
x=`cat $f | tr -d "\t \r" | sed -e "/$t/p" -ed`
x=`cat $f | tr -d "[:space:]" | sed -e "/$t/p" -ed`
if test "x$x" = x ; then echo "$f: $t not found"; exit 1; fi
done
}
@ -71,9 +71,12 @@ fileargs tmp_pds
${NCCOPY} -M0 -4 -c "time/10,lat/15,lon/20" "$SRC" "$fileurl"
${NCDUMP} -n tmp_pds -hs "$fileurl" > tmp_pds.cdl
STORAGE=`cat tmp_pds.cdl | sed -e "/tas:_Storage/p" -ed | tr '"' "'" | tr -d "\t \r"`
test "x$STORAGE" = "xtas:_Storage='chunked';"
CHUNKSIZES=`cat tmp_pds.cdl | sed -e "/tas:_ChunkSizes/p" -ed | tr -d "\t \r"`
STORAGE=`cat tmp_pds.cdl | sed -e "/tas:_Storage/p" -ed | tr -d "[:space:]"`
echo "STORAGE: $STORAGE"
test "x$STORAGE" = "xtas:_Storage='chunked';" || test "x$STORAGE" = "xtas:_Storage=\"chunked\";"
CHUNKSIZES=`cat tmp_pds.cdl | sed -e "/tas:_ChunkSizes/p" -ed | tr -d "[:space:]"`
test "x$CHUNKSIZES" = "xtas:_ChunkSizes=10,15,20;"
}