Skip to content

Commit

Permalink
cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisHeimbigner committed Oct 23, 2023
1 parent 864687a commit 0611e04
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 25 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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}"
Expand Down
28 changes: 13 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
##########
Expand Down
7 changes: 6 additions & 1 deletion libnczarr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0611e04

Please sign in to comment.