Merge pull request #2923 from DennisHeimbigner/optionchange.dmh

Convert the ENABLE_XXX options to NETCDF_ENABLE_XXX options for NCZarr
This commit is contained in:
Ward Fisher 2024-05-13 08:10:31 -07:00 committed by GitHub
commit 2960f56b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 58 additions and 30 deletions

View File

@ -382,13 +382,13 @@ if(MSVC)
endif()
# Option to build netCDF Version 2
OPTION (ENABLE_V2_API "Build netCDF Version 2." ON)
set(BUILD_V2 ${ENABLE_V2_API})
if(NOT ENABLE_V2_API)
OPTION (NETCDF_ENABLE_V2_API "Build netCDF Version 2." ON)
set(BUILD_V2 ${NETCDF_ENABLE_V2_API})
if(NOT NETCDF_ENABLE_V2_API)
set(NO_NETCDF_2 ON)
else(NOT ENABLE_V2_API)
else(NOT NETCDF_ENABLE_V2_API)
set(USE_NETCDF_2 TRUE)
endif(NOT ENABLE_V2_API)
endif(NOT NETCDF_ENABLE_V2_API)
# Option to build utilities
option(NETCDF_BUILD_UTILITIES "Build ncgen, ncgen3, ncdump." ON)
@ -1446,7 +1446,7 @@ endif()
# Enable tests
if(NETCDF_ENABLE_TESTS)
if(ENABLE_V2_API)
if(NETCDF_ENABLE_V2_API)
add_subdirectory(nctest)
endif()
add_subdirectory(nc_test)
@ -1622,7 +1622,7 @@ set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BU
is_disabled(BUILD_SHARED_LIBS enable_static)
is_enabled(BUILD_SHARED_LIBS enable_shared)
is_enabled(ENABLE_V2_API HAS_NC2)
is_enabled(NETCDF_ENABLE_V2_API HAS_NC2)
is_enabled(NETCDF_ENABLE_NETCDF_4 HAS_NC4)
is_enabled(NETCDF_ENABLE_HDF4 HAS_HDF4)
is_enabled(USE_HDF5 HAS_HDF5)
@ -1637,7 +1637,7 @@ is_enabled(NETCDF_ENABLE_BYTERANGE HAS_BYTERANGE)
is_enabled(NETCDF_ENABLE_DISKLESS HAS_DISKLESS)
is_enabled(USE_MMAP HAS_MMAP)
is_enabled(JNA HAS_JNA)
is_enabled(ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND)
is_enabled(NETCDF_ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND)
is_enabled(USE_CDF5 HAS_CDF5)
is_enabled(NETCDF_ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
is_enabled(HDF5_HAS_PAR_FILTERS HAS_PAR_FILTERS)

View File

@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
## 4.9.3 - TBD
* Convert the Zarr-related ENABLE_XXX options to NETCDF_ENABLE_XXX options (part of the cmake overhaul). See [Github #2923](https://github.com/Unidata/netcdf-c/issues/2923) for more information.
* Refactor macro `_FillValue` to `NC_FillValue` to avoid conflict with libc++ headers. See [Github #2858](https://github.com/Unidata/netcdf-c/issues/2858) for more information.
* Changed `cmake` build options to be prefaced with `NETCDF`, to bring things in to line with best practices. This will permit a number of overall quality of life improvements to netCDF, in terms of allowing it to be more easily integrated with upstream projects via `FetchContent()`, `subdirectory()`, etc. Currently, the naming convention in use thus far will still work, but will result in warning messages about deprecation, and instructions on how to update your workflow. See [Github #2895](https://github.com/Unidata/netcdf-c/pull/2895) for more information.
* Fix some problems in handling S3 urls with missing regions. See [Github #2819](https://github.com/Unidata/netcdf-c/pull/2819).

View File

@ -133,6 +133,9 @@ are set when opening a binary file on Windows. */
/* if true, enable client side filters */
#cmakedefine ENABLE_CLIENT_FILTERS 1
/* if true, enable filter testing */
#cmakedefine NETCDF_ENABLE_FILTER_TESTING 1
/* if true, enable strict null byte header padding. */
#cmakedefine USE_STRICT_NULL_BYTE_HEADER_PADDING 1
@ -167,7 +170,7 @@ are set when opening a binary file on Windows. */
#cmakedefine NETCDF_ENABLE_S3_INTERNAL 1
/* if true, enable S3 testing*/
#cmakedefine WITH_S3_TESTING "PUBLIC"
#cmakedefine WITH_S3_TESTING "${WITH_S3_TESTING}"
/* S3 Test Bucket */
#define S3TESTBUCKET "${S3TESTBUCKET}"
@ -199,6 +202,9 @@ are set when opening a binary file on Windows. */
/* Define to 1 if blosc library available. */
#cmakedefine HAVE_BLOSC 1
/* if true enable tests that access external servers */
#cmakedefine NETCDF_ENABLE_EXTERNAL_SERVER_TESTS 1
/* Define to 1 if you have hdf5_coll_metadata_ops */
#cmakedefine HDF5_HAS_COLL_METADATA_OPS 1
@ -397,6 +403,9 @@ are set when opening a binary file on Windows. */
/* Define to 1 if you have the `strlcpy' function. */
#cmakedefine HAVE_STRLCPY 1
/* Define to 1 if you have the `strlen' function. */
#cmakedefine HAVE_STRLEN 1
/* Define to 1 if you have the `strtoll' function. */
#cmakedefine HAVE_STRTOLL 1
@ -487,7 +496,7 @@ with zip */
#cmakedefine NETCDF_ENABLE_DOXYGEN 1
#cmakedefine NETCDF_ENABLE_INTERNAL_DOCS 1
#cmakedefine VALGRIND_TESTS 1
#cmakedefine ENABLE_CDMREMOTE 1
#cmakedefine NETCDF_ENABLE_CDMREMOTE 1
#cmakedefine USE_HDF5 1
#cmakedefine ENABLE_FILEINFO 1
#cmakedefine TEST_PARALLEL ${TEST_PARALLEL}
@ -570,6 +579,9 @@ with zip */
/* The size of `size_t', as computed by sizeof. */
#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T}
/* The size of `ssize_t', as computed by sizeof. */
#cmakedefine SIZEOF_SSIZE_T ${SIZEOF_SSIZE_T}
/* The size of `uint', as computed by sizeof. */
#cmakedefine SIZEOF_UINT ${SIZEOF_UINT}
@ -635,10 +647,10 @@ with zip */
#cmakedefine USE_STDIO 1
/* if true, multi-filters enabled*/
#cmakedefine ENABLE_MULTIFILTERS 1
#cmakedefine NETCDF_ENABLE_MULTIFILTERS 1
/* if true, enable nczarr blosc support */
#cmakedefine ENABLE_BLOSC 1
#cmakedefine NETCDF_ENABLE_BLOSC 1
/* Version number of package */
#cmakedefine VERSION "${netCDF_VERSION}"

View File

@ -1765,7 +1765,7 @@ if test "x$enable_pnetcdf" = xyes -o "x$enable_parallel4" = xyes; then
else
enable_parallel=no
fi
AM_CONDITIONAL(ENABLE_PARALLEL, [test x$enable_parallel = xyes ])
AM_CONDITIONAL(NETCDF_ENABLE_PARALLEL, [test x$enable_parallel = xyes ])
if test "x$hdf5_parallel" = xyes; then
# Provide more precise parallel control

View File

@ -13,13 +13,16 @@
#include <stdio.h>
#endif
#if defined(_WIN32) || defined(_MSC_VER)
extern errno_t rand_s(unsigned int *randomValue);
#endif
/* Support platform independent generation of 32-bit unsigned int random numbers */
int
main() {
unsigned int urnd = 0; /* range 0..2147483647 */
#if defined(WIN32) || defined(_MSC_VER)
#if defined(_WIN32) || defined(_MSC_VER)
(void)rand_s(&urnd);
#else
long rnd;

View File

@ -20,7 +20,7 @@
#include "netcdf.h"
#include "netcdf_filter.h"
#ifdef ENABLE_BLOSC
#ifdef NETCDF_ENABLE_BLOSC
#include <blosc.h>
#endif

View File

@ -930,7 +930,7 @@ nc4_open_file(const char *path, int mode, void* parameters, int ncid)
if(H5Pset_fapl_ros3(fapl_id, &fa) < 0)
BAIL(NC_EHDFERR);
} else
#endif /*ENABLE_ROS3*/
#endif /*NETCDF_ENABLE_ROS3*/
{/* Configure FAPL to use our byte-range file driver */
if (H5Pset_fapl_http(fapl_id) < 0)
BAIL(NC_EHDFERR);

View File

@ -42,7 +42,7 @@ extern int NC_HDF4_initialize(void);
extern int NC_HDF4_finalize(void);
#endif
#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
EXTERNL int NC_s3sdkinitialize(void);
EXTERNL int NC_s3sdkfinalize(void);
#endif
@ -105,7 +105,7 @@ nc_initialize()
#ifdef USE_HDF4
if((stat = NC_HDF4_initialize())) goto done;
#endif
#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
if((stat = NC_s3sdkinitialize())) goto done;
#endif
#ifdef NETCDF_ENABLE_NCZARR
@ -170,7 +170,7 @@ nc_finalize(void)
if((stat = NCZ_finalize())) failed = stat;
#endif
#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
if((stat = NC_s3sdkfinalize())) failed = stat;
#endif

View File

@ -104,7 +104,7 @@ load(NCPSharedLib* lib , const char* path0, int flags)
int errcode = GetLastError();
char* msg = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &msg, 0, NULL);
NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (char*)&msg, 0, NULL);
memset(lib->err.msg,0,sizeof(lib->err.msg));
if(msg)
strncpy(lib->err.msg,msg,sizeof(lib->err.msg));

View File

@ -100,4 +100,4 @@ if(HAVE_M4)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" DESTINATION "${CMAKE_INSTALL_MANDIR}/man3" COMPONENT documentation)
endif(NOT MSVC)
endif()
endif()

View File

@ -1803,7 +1803,7 @@ nc_set_log_level(int new_level)
#endif /* NC_HAS_PARALLEL4 */
LOG((1, "log_level changed to %d", nc_log_level));
#endif /*NC_HAS_LOGGING */
#endif /* LOGGING */
return NC_NOERR;
}

View File

@ -87,7 +87,7 @@ endif
TESTS += run_diskless.sh run_diskless5.sh run_inmemory.sh
if LARGE_FILE_TESTS
if ! ENABLE_PARALLEL
if ! NETCDF_ENABLE_PARALLEL
TESTS += run_diskless2.sh
endif
endif

View File

@ -79,6 +79,7 @@ endif
# Filter Tests (requires ncdump and ncgen and HDF5)
if USE_HDF5
if NETCDF_ENABLE_PLUGINS
if NETCDF_ENABLE_FILTER_TESTING
extradir =
check_PROGRAMS += test_filter test_filter_misc test_filter_order test_filter_repeat
@ -108,6 +109,7 @@ TESTS += tst_filterinstall.sh
endif
endif # NETCDF_ENABLE_FILTER_TESTING
endif # NETCDF_ENABLE_PLUGINS
endif # USE_HDF5
endif # NETCDF_BUILD_UTILITIES

View File

@ -39,6 +39,7 @@ IF(NETCDF_ENABLE_TESTS)
add_bin_env_test(ncdap test_vara)
ENDIF()
IF(NETCDF_ENABLE_EXTERNAL_SERVER_TESTS)
IF(NETCDF_ENABLE_DAP_REMOTE_TESTS)
IF(NETCDF_BUILD_UTILITIES)
@ -64,6 +65,7 @@ IF(NETCDF_ENABLE_TESTS)
add_bin_test(ncdap test_manyurls)
SET_TESTS_PROPERTIES(ncdap_test_manyurls PROPERTIES RUN_SERIAL TRUE)
ENDIF()
ENDIF()
IF(NETCDF_ENABLE_DAP_AUTH_TESTS)
##obsolete add_bin_test(ncdap t_auth)

View File

@ -47,6 +47,10 @@ if NETCDF_BUILD_UTILITIES
TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh testurl.sh tst_fillmismatch.sh tst_zero_len_var.sh
endif
if NETCDF_ENABLE_EXTERNAL_SERVER_TESTS
if NETCDF_ENABLE_DAP_REMOTE_TESTS
if NETCDF_BUILD_UTILITIES
# Remote servers
# iridl.ldeo.columbia.edu
TESTS += tst_encode.sh
@ -55,16 +59,17 @@ TESTS += tst_hyrax.sh
TESTS += test_partvar
if NETCDF_ENABLE_DAP_LONG_TESTS
# Various
TESTS += tst_longremote3.sh
tst_longremote3.log: tst_remote3.log
if NETCDF_ENABLE_EXTERNAL_SERVER_TESTS
endif
if NETCDF_ENABLE_DAP_LONG_TESTS
test_manyurls_SOURCES = test_manyurls.c manyurls.h
check_PROGRAMS += test_manyurls
test_manyurls.log: tst_longremote3.log
TESTS += test_manyurls
endif
endif
test_partvar_SOURCES = test_partvar.c
@ -84,6 +89,9 @@ check_PROGRAMS += test_partvar
check_PROGRAMS += t_misc
check_PROGRAMS += t_ncf330
endif
endif
if NETCDF_ENABLE_DAP_AUTH_TESTS
TESTS += testauth.sh
endif

View File

@ -70,7 +70,7 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.l ${CMAKE_CURRENT_SOURCE_DIR}
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
# Stuff to build if tests are enabled.
IF(ENABLE_TESTS)
IF(NETCDF_ENABLE_TESTS)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)

View File

@ -21,7 +21,7 @@ TEST_EXTENSIONS = .sh
AM_CPPFLAGS += -I${top_srcdir} -I${top_srcdir}/libnczarr
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
LDADD = ${top_builddir}/liblib/libnetcdf.la
LDADD += ${top_builddir}/liblib/libnetcdf.la
AM_CXXFLAGS =
# Set up the tests; do the .sh first, then .c
check_PROGRAMS =

View File

@ -89,12 +89,12 @@ buildplugin(nczmisc "zmisc")
buildplugin(nczhdf5filters "zhdf5filters" netcdf)
buildplugin(nczstdfilters "zstdfilters" netcdf)
if(ENABLE_BLOSC)
if(NETCDF_ENABLE_BLOSC)
set(h5blosc_SOURCES H5Zblosc.c)
buildplugin(h5blosc "h5blosc" netcdf;${Blosc_LIBRARIES})
endif()
if(ENABLE_ZSTD)
if(NETCDF_ENABLE_ZSTD)
set(h5zstd_SOURCES H5Zzstd.c H5Zzstd.h)
buildplugin(h5zstd "h5zstd" netcdf;${Zstd_LIBRARIES})
endif()