From 0611e04efc958434b76c54315839b4bb9c3e5f89 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Sun, 22 Oct 2023 22:27:21 -0600 Subject: [PATCH] cmake --- CMakeLists.txt | 23 +++++++++++++++-------- config.h.cmake.in | 8 +++++++- configure.ac | 28 +++++++++++++--------------- libnczarr/CMakeLists.txt | 7 ++++++- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbccb41f7..0b5ba77835 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -492,23 +492,30 @@ OPTION(ENABLE_PNETCDF "Build with parallel I/O for CDF-1, 2, and 5 files using P SET(ENABLE_CDF5 AUTO CACHE STRING "AUTO") OPTION(ENABLE_CDF5 "Enable CDF5 support" ON) -# Netcdf-4 support (i.e. libsrc4) is required by more than just HDF5 (e.g. NCZarr) -# So depending on what above formats are enabled, enable netcdf-4 -if(ENABLE_HDF5 OR ENABLE_HDF4 OR ENABLE_NCZARR) - SET(ENABLE_NETCDF_4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) - SET(ENABLE_NETCDF4 ON CACHE BOOL "Enable netCDF4 Alias" FORCE) -endif() +# Decide default Zarr Format for creation +OPTION(ENABLE_DEFAULT_ZARR_FORMAT_V3 "Specify the default Zarr format is V3" OFF) +IF(ENABLE_DEFAULT_ZARR_FORMAT_V3) +SET(DFALTZARRFORMAT 3 CACHE STRING "") +ELSE() +SET(DFALTZARRFORMAT 2 CACHE STRING "") +ENDIF() IF(ENABLE_NCZARR) SET(ENABLE_NCZARR_V3 ON CACHE BOOL "Enable Zarr V3" FORCE) # V3 is enabled if NCzarr is enabled ELSE() SET(ENABLE_NCZARR_V3 OFF CACHE BOOL "Enable Zarr V3" FORCE) -fi +ENDIF() + +# Netcdf-4 support (i.e. libsrc4) is required by more than just HDF5 (e.g. NCZarr) +# So depending on what above formats are enabled, enable netcdf-4 +if(ENABLE_HDF5 OR ENABLE_HDF4 OR ENABLE_NCZARR) + SET(ENABLE_NETCDF_4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) + SET(ENABLE_NETCDF4 ON CACHE BOOL "Enable netCDF4 Alias" FORCE) +endif() # enable|disable all forms of network access OPTION(ENABLE_REMOTE_FUNCTIONALITY "Enable|disable all forms remote data access (DAP, S3, etc)" ON) -MESSAGE(">>> ENABLE_REMOTE_FUNCTIONALITY=${ENABLE_REMOTE_FUNCTIONALITY}") if(NOT ENABLE_REMOTE_FUNCTIONALITY) MESSAGE(WARNING "ENABLE_REMOTE_FUNCTIONALITY=NO => ENABLE_DAP[4]=NO") SET(ENABLE_DAP OFF CACHE BOOL "ENABLE_REMOTE_FUNCTIONALITY=NO => ENABLE_DAP=NO" FORCE) diff --git a/config.h.cmake.in b/config.h.cmake.in index 04d876ff17..274ec63328 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -106,6 +106,9 @@ are set when opening a binary file on Windows. */ /* default chunk size in bytes */ #cmakedefine DEFAULT_CHUNK_SIZE ${DEFAULT_CHUNK_SIZE} +/* default zarr format*/ +#cmakedefine DFALTZARRFORMAT ${DFALTZARRFORMAT} + /* set this only when building a DLL under MinGW */ #cmakedefine DLL_EXPORT 1 @@ -148,6 +151,9 @@ are set when opening a binary file on Windows. */ /* if true, enable nczarr zip support */ #cmakedefine ENABLE_NCZARR_ZIP 1 +/* if true, enable nczarr V3 support */ +#cmakedefine ENABLE_NCZARR_V3 1 + /* if true, Allow dynamically loaded plugins */ #cmakedefine ENABLE_PLUGINS 1 @@ -161,7 +167,7 @@ are set when opening a binary file on Windows. */ #cmakedefine 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}" diff --git a/configure.ac b/configure.ac index d3801e483d..39b5d4e070 100644 --- a/configure.ac +++ b/configure.ac @@ -215,15 +215,20 @@ AC_ARG_ENABLE([nczarr], test "x$enable_nczarr" = xno || enable_nczarr=yes AC_MSG_RESULT($enable_nczarr) -# Decide default Zarr Format for creation -AC_MSG_CHECKING([which Zarr format is the default]) -AC_ARG_WITH([default-zarr-format], - [AS_HELP_STRING([--with-default-zarr-format=2|3], - [Specify the default Zarr format.])], - [DFALTZARRFORMAT=$with_default_zarr_format], [DFALTZARRFORMAT=2]) -AC_MSG_RESULT([${DFALTZARRFORMAT}]) +# Choose the default Zarr format +AC_MSG_CHECKING([whether Zarr format 3 is the default]) +AC_ARG_ENABLE([default-zarr-format_v3], + [AS_HELP_STRING([--enable-default-zarr-format_v3], + [Specify the default Zarr format.])]) +test "x$enable_default_zarr_format_v3" = xyes | enable_default_zarr_format_v3=no # V2 is the default by default +AC_MSG_RESULT([$enable_default_zarr_format_v3}]) +if test "x$enable_default_zarr_format_v3" = xyes; then + DFALTZARRFORMAT=3 + AC_DEFINE_UNQUOTED([DFALTZARRFORMAT], [3], [if true, Zarr format V3 is default]) +else + DFALTZARRFORMAT=2 +fi AC_SUBST([DFALTZARRFORMAT],[${DFALTZARRFORMAT}]) -AC_DEFINE_UNQUOTED([DFALTZARRFORMAT], [$DFALTZARRFORMAT], [the default Zarr format.]) # HDF5 | HDF4 | NCZarr => netcdf-4 if test "x$enable_hdf5" = xyes || test "x$enable_hdf4" = xyes || test "x$enable_nczarr" = xyes ; then @@ -727,13 +732,6 @@ if test "x$enable_nczarr" = xyes; then fi AM_CONDITIONAL(ENABLE_NCZARR, [test x$enable_nczarr = xyes]) -if test "x$enable_nczarr" = xyes; then - enable_nczarr_v3=yes - # V3 is enabled if NCzarr is enabled - AC_DEFINE([ENABLE_NCZARR_V3], [1], [if true, build NCZarr V3 client]) -fi -AM_CONDITIONAL(ENABLE_NCZARR_S3, [test x$enable_nczarr_V3 = xyes]) - ########## # Look for Standardized libraries ########## diff --git a/libnczarr/CMakeLists.txt b/libnczarr/CMakeLists.txt index 1a6c5e951d..b222df68db 100644 --- a/libnczarr/CMakeLists.txt +++ b/libnczarr/CMakeLists.txt @@ -9,6 +9,11 @@ # The source files for the HDF5 dispatch layer. SET(libnczarr_SOURCES +zinfer.c +zformat.c +zformat3.c +zformat2.c +zformat1.c zarr.c zattr.c zxcache.c @@ -27,12 +32,12 @@ zmap_file.c zodom.c zopen.c zprov.c -zsync.c ztype.c zutil.c zvar.c zwalk.c zdebug.c +zformat.h zarr.h zcache.h zchunking.h