2018-12-07 06:40:43 +08:00
|
|
|
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
|
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
|
|
|
# 2015, 2016, 2017, 2018
|
|
|
|
# University Corporation for Atmospheric Research/Unidata.
|
|
|
|
|
|
|
|
# See netcdf-c/COPYRIGHT file for more info.
|
2017-03-09 08:01:10 +08:00
|
|
|
IF(BUILD_SHARED_LIBS AND WIN32)
|
|
|
|
remove_definitions(-DDLL_EXPORT)
|
|
|
|
remove_definitions(-DDLL_NETCDF)
|
|
|
|
ENDIF()
|
|
|
|
|
2023-04-10 03:10:41 +08:00
|
|
|
IF(USE_X_GETOPT)
|
|
|
|
SET(XGETOPTSRC "${CMAKE_CURRENT_SOURCE_DIR}/../libdispatch/XGetopt.c")
|
|
|
|
ENDIF()
|
|
|
|
|
This PR adds EXPERIMENTAL support for accessing data in the
cloud using a variant of the Zarr protocol and storage
format. This enhancement is generically referred to as "NCZarr".
The data model supported by NCZarr is netcdf-4 minus the user-defined
types and the String type. In this sense it is similar to the CDF-5
data model.
More detailed information about enabling and using NCZarr is
described in the document NUG/nczarr.md and in a
[Unidata Developer's blog entry](https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in).
WARNING: this code has had limited testing, so do use this version
for production work. Also, performance improvements are ongoing.
Note especially the following platform matrix of successful tests:
Platform | Build System | S3 support
------------------------------------
Linux+gcc | Automake | yes
Linux+gcc | CMake | yes
Visual Studio | CMake | no
Additionally, and as a consequence of the addition of NCZarr,
major changes have been made to the Filter API. NOTE: NCZarr
does not yet support filters, but these changes are enablers for
that support in the future. Note that it is possible
(probable?) that there will be some accidental reversions if the
changes here did not correctly mimic the existing filter testing.
In any case, previously filter ids and parameters were of type
unsigned int. In order to support the more general zarr filter
model, this was all converted to char*. The old HDF5-specific,
unsigned int operations are still supported but they are
wrappers around the new, char* based nc_filterx_XXX functions.
This entailed at least the following changes:
1. Added the files libdispatch/dfilterx.c and include/ncfilter.h
2. Some filterx utilities have been moved to libdispatch/daux.c
3. A new entry, "filter_actions" was added to the NCDispatch table
and the version bumped.
4. An overly complex set of structs was created to support funnelling
all of the filterx operations thru a single dispatch
"filter_actions" entry.
5. Move common code to from libhdf5 to libsrc4 so that it is accessible
to nczarr.
Changes directly related to Zarr:
1. Modified CMakeList.txt and configure.ac to support both C and C++
-- this is in support of S3 support via the awd-sdk libraries.
2. Define a size64_t type to support nczarr.
3. More reworking of libdispatch/dinfermodel.c to
support zarr and to regularize the structure of the fragments
section of a URL.
Changes not directly related to Zarr:
1. Make client-side filter registration be conditional, with default off.
2. Hack include/nc4internal.h to make some flags added by Ed be unique:
e.g. NC_CREAT, NC_INDEF, etc.
3. cleanup include/nchttp.h and libdispatch/dhttp.c.
4. Misc. changes to support compiling under Visual Studio including:
* Better testing under windows for dirent.h and opendir and closedir.
5. Misc. changes to the oc2 code to support various libcurl CURLOPT flags
and to centralize error reporting.
6. By default, suppress the vlen tests that have unfixed memory leaks; add option to enable them.
7. Make part of the nc_test/test_byterange.sh test be contingent on remotetest.unidata.ucar.edu being accessible.
Changes Left TO-DO:
1. fix provenance code, it is too HDF5 specific.
2020-06-29 08:02:47 +08:00
|
|
|
SET(ncgen_FILES bindata.c bytebuffer.c cdata.c cvt.c data.c
|
|
|
|
debug.c dump.c escapes.c f77data.c genbin.c
|
|
|
|
genc.c genchar.c generate.c generr.c genf77.c
|
|
|
|
genj.c genlib.c getfill.c jdata.c list.c
|
|
|
|
main.c ncgeny.c semantics.c
|
|
|
|
util.c bytebuffer.h data.h debug.h dump.h
|
|
|
|
generate.h generr.h genlib.h includes.h list.h
|
2023-04-10 03:10:41 +08:00
|
|
|
ncgen.h ncgeny.h util.h ${XGETOPTSRC})
|
This PR adds EXPERIMENTAL support for accessing data in the
cloud using a variant of the Zarr protocol and storage
format. This enhancement is generically referred to as "NCZarr".
The data model supported by NCZarr is netcdf-4 minus the user-defined
types and the String type. In this sense it is similar to the CDF-5
data model.
More detailed information about enabling and using NCZarr is
described in the document NUG/nczarr.md and in a
[Unidata Developer's blog entry](https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in).
WARNING: this code has had limited testing, so do use this version
for production work. Also, performance improvements are ongoing.
Note especially the following platform matrix of successful tests:
Platform | Build System | S3 support
------------------------------------
Linux+gcc | Automake | yes
Linux+gcc | CMake | yes
Visual Studio | CMake | no
Additionally, and as a consequence of the addition of NCZarr,
major changes have been made to the Filter API. NOTE: NCZarr
does not yet support filters, but these changes are enablers for
that support in the future. Note that it is possible
(probable?) that there will be some accidental reversions if the
changes here did not correctly mimic the existing filter testing.
In any case, previously filter ids and parameters were of type
unsigned int. In order to support the more general zarr filter
model, this was all converted to char*. The old HDF5-specific,
unsigned int operations are still supported but they are
wrappers around the new, char* based nc_filterx_XXX functions.
This entailed at least the following changes:
1. Added the files libdispatch/dfilterx.c and include/ncfilter.h
2. Some filterx utilities have been moved to libdispatch/daux.c
3. A new entry, "filter_actions" was added to the NCDispatch table
and the version bumped.
4. An overly complex set of structs was created to support funnelling
all of the filterx operations thru a single dispatch
"filter_actions" entry.
5. Move common code to from libhdf5 to libsrc4 so that it is accessible
to nczarr.
Changes directly related to Zarr:
1. Modified CMakeList.txt and configure.ac to support both C and C++
-- this is in support of S3 support via the awd-sdk libraries.
2. Define a size64_t type to support nczarr.
3. More reworking of libdispatch/dinfermodel.c to
support zarr and to regularize the structure of the fragments
section of a URL.
Changes not directly related to Zarr:
1. Make client-side filter registration be conditional, with default off.
2. Hack include/nc4internal.h to make some flags added by Ed be unique:
e.g. NC_CREAT, NC_INDEF, etc.
3. cleanup include/nchttp.h and libdispatch/dhttp.c.
4. Misc. changes to support compiling under Visual Studio including:
* Better testing under windows for dirent.h and opendir and closedir.
5. Misc. changes to the oc2 code to support various libcurl CURLOPT flags
and to centralize error reporting.
6. By default, suppress the vlen tests that have unfixed memory leaks; add option to enable them.
7. Make part of the nc_test/test_byterange.sh test be contingent on remotetest.unidata.ucar.edu being accessible.
Changes Left TO-DO:
1. fix provenance code, it is too HDF5 specific.
2020-06-29 08:02:47 +08:00
|
|
|
|
2024-01-23 04:37:35 +08:00
|
|
|
##
|
|
|
|
# Turn off inclusion of particular files when using the cmake-native
|
|
|
|
# option to turn on Unity Builds.
|
|
|
|
#
|
|
|
|
# For more information, see:
|
|
|
|
# * https://github.com/Unidata/netcdf-c/pull/2839/
|
|
|
|
# * https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
|
|
|
|
# * https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD_MODE.html#prop_tgt:UNITY_BUILD_MODE
|
|
|
|
##
|
2024-01-12 17:18:29 +08:00
|
|
|
set_property(SOURCE data.c
|
|
|
|
PROPERTY
|
|
|
|
SKIP_UNITY_BUILD_INCLUSION ON)
|
|
|
|
|
This PR adds EXPERIMENTAL support for accessing data in the
cloud using a variant of the Zarr protocol and storage
format. This enhancement is generically referred to as "NCZarr".
The data model supported by NCZarr is netcdf-4 minus the user-defined
types and the String type. In this sense it is similar to the CDF-5
data model.
More detailed information about enabling and using NCZarr is
described in the document NUG/nczarr.md and in a
[Unidata Developer's blog entry](https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in).
WARNING: this code has had limited testing, so do use this version
for production work. Also, performance improvements are ongoing.
Note especially the following platform matrix of successful tests:
Platform | Build System | S3 support
------------------------------------
Linux+gcc | Automake | yes
Linux+gcc | CMake | yes
Visual Studio | CMake | no
Additionally, and as a consequence of the addition of NCZarr,
major changes have been made to the Filter API. NOTE: NCZarr
does not yet support filters, but these changes are enablers for
that support in the future. Note that it is possible
(probable?) that there will be some accidental reversions if the
changes here did not correctly mimic the existing filter testing.
In any case, previously filter ids and parameters were of type
unsigned int. In order to support the more general zarr filter
model, this was all converted to char*. The old HDF5-specific,
unsigned int operations are still supported but they are
wrappers around the new, char* based nc_filterx_XXX functions.
This entailed at least the following changes:
1. Added the files libdispatch/dfilterx.c and include/ncfilter.h
2. Some filterx utilities have been moved to libdispatch/daux.c
3. A new entry, "filter_actions" was added to the NCDispatch table
and the version bumped.
4. An overly complex set of structs was created to support funnelling
all of the filterx operations thru a single dispatch
"filter_actions" entry.
5. Move common code to from libhdf5 to libsrc4 so that it is accessible
to nczarr.
Changes directly related to Zarr:
1. Modified CMakeList.txt and configure.ac to support both C and C++
-- this is in support of S3 support via the awd-sdk libraries.
2. Define a size64_t type to support nczarr.
3. More reworking of libdispatch/dinfermodel.c to
support zarr and to regularize the structure of the fragments
section of a URL.
Changes not directly related to Zarr:
1. Make client-side filter registration be conditional, with default off.
2. Hack include/nc4internal.h to make some flags added by Ed be unique:
e.g. NC_CREAT, NC_INDEF, etc.
3. cleanup include/nchttp.h and libdispatch/dhttp.c.
4. Misc. changes to support compiling under Visual Studio including:
* Better testing under windows for dirent.h and opendir and closedir.
5. Misc. changes to the oc2 code to support various libcurl CURLOPT flags
and to centralize error reporting.
6. By default, suppress the vlen tests that have unfixed memory leaks; add option to enable them.
7. Make part of the nc_test/test_byterange.sh test be contingent on remotetest.unidata.ucar.edu being accessible.
Changes Left TO-DO:
1. fix provenance code, it is too HDF5 specific.
2020-06-29 08:02:47 +08:00
|
|
|
# Obsolete
|
|
|
|
SET(OBSOLETE odom.c odom.h jdatastd.c jdatajni.c genjni.c cdfdata.c cmldata.c)
|
2017-03-09 08:01:10 +08:00
|
|
|
|
2020-05-19 09:36:28 +08:00
|
|
|
# don't add the automatically determined parts of the RPATH
|
|
|
|
# which point to directories outside the build tree to the install RPATH
|
|
|
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_EXECUTABLE(ncgen ${ncgen_FILES})
|
2012-08-11 05:44:00 +08:00
|
|
|
TARGET_LINK_LIBRARIES(ncgen netcdf ${ALL_TLL_LIBS})
|
2012-08-04 06:24:29 +08:00
|
|
|
|
This PR adds EXPERIMENTAL support for accessing data in the
cloud using a variant of the Zarr protocol and storage
format. This enhancement is generically referred to as "NCZarr".
The data model supported by NCZarr is netcdf-4 minus the user-defined
types and the String type. In this sense it is similar to the CDF-5
data model.
More detailed information about enabling and using NCZarr is
described in the document NUG/nczarr.md and in a
[Unidata Developer's blog entry](https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in).
WARNING: this code has had limited testing, so do use this version
for production work. Also, performance improvements are ongoing.
Note especially the following platform matrix of successful tests:
Platform | Build System | S3 support
------------------------------------
Linux+gcc | Automake | yes
Linux+gcc | CMake | yes
Visual Studio | CMake | no
Additionally, and as a consequence of the addition of NCZarr,
major changes have been made to the Filter API. NOTE: NCZarr
does not yet support filters, but these changes are enablers for
that support in the future. Note that it is possible
(probable?) that there will be some accidental reversions if the
changes here did not correctly mimic the existing filter testing.
In any case, previously filter ids and parameters were of type
unsigned int. In order to support the more general zarr filter
model, this was all converted to char*. The old HDF5-specific,
unsigned int operations are still supported but they are
wrappers around the new, char* based nc_filterx_XXX functions.
This entailed at least the following changes:
1. Added the files libdispatch/dfilterx.c and include/ncfilter.h
2. Some filterx utilities have been moved to libdispatch/daux.c
3. A new entry, "filter_actions" was added to the NCDispatch table
and the version bumped.
4. An overly complex set of structs was created to support funnelling
all of the filterx operations thru a single dispatch
"filter_actions" entry.
5. Move common code to from libhdf5 to libsrc4 so that it is accessible
to nczarr.
Changes directly related to Zarr:
1. Modified CMakeList.txt and configure.ac to support both C and C++
-- this is in support of S3 support via the awd-sdk libraries.
2. Define a size64_t type to support nczarr.
3. More reworking of libdispatch/dinfermodel.c to
support zarr and to regularize the structure of the fragments
section of a URL.
Changes not directly related to Zarr:
1. Make client-side filter registration be conditional, with default off.
2. Hack include/nc4internal.h to make some flags added by Ed be unique:
e.g. NC_CREAT, NC_INDEF, etc.
3. cleanup include/nchttp.h and libdispatch/dhttp.c.
4. Misc. changes to support compiling under Visual Studio including:
* Better testing under windows for dirent.h and opendir and closedir.
5. Misc. changes to the oc2 code to support various libcurl CURLOPT flags
and to centralize error reporting.
6. By default, suppress the vlen tests that have unfixed memory leaks; add option to enable them.
7. Make part of the nc_test/test_byterange.sh test be contingent on remotetest.unidata.ucar.edu being accessible.
Changes Left TO-DO:
1. fix provenance code, it is too HDF5 specific.
2020-06-29 08:02:47 +08:00
|
|
|
# Given a netcdf4 file, dump the actual chunk contents.
|
|
|
|
# Used to validate nczarr chunking code.
|
|
|
|
|
2015-01-28 04:57:51 +08:00
|
|
|
####
|
|
|
|
# We have to do a little tweaking
|
|
|
|
# to remove the Release/ and Debug/ directories
|
|
|
|
# in MSVC builds. This is required to get
|
|
|
|
# test scripts to work.
|
|
|
|
####
|
|
|
|
IF(MSVC)
|
2015-11-25 06:16:23 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2015-11-25 06:16:23 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
ENDIF()
|
|
|
|
|
2012-11-20 05:43:12 +08:00
|
|
|
INSTALL(TARGETS ncgen DESTINATION bin COMPONENT utilities)
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2013-01-16 06:43:09 +08:00
|
|
|
# Copy the input for the flex file (ncgen.l)
|
|
|
|
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.l ${CMAKE_CURRENT_SOURCE_DIR}/*.y)
|
|
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
|
|
|
|
|
2012-08-09 00:25:37 +08:00
|
|
|
# Stuff to build if tests are enabled.
|
2012-08-08 06:42:42 +08:00
|
|
|
IF(ENABLE_TESTS)
|
2014-04-22 00:56:57 +08:00
|
|
|
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
2015-11-25 06:16:23 +08:00
|
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
2017-05-25 04:25:22 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# The following tests were moved to ncdump/, to ensure
|
|
|
|
# that they are run in the proper order.
|
|
|
|
##
|
|
|
|
#add_sh_test(ncgen run_tests)
|
|
|
|
#IF(USE_NETCDF4)
|
|
|
|
# add_sh_test(ncgen run_nc4_tests)
|
|
|
|
#ENDIF()
|
2012-08-08 06:42:42 +08:00
|
|
|
ENDIF()
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2012-10-18 05:14:30 +08:00
|
|
|
SET(MAN_FILES ncgen.1)
|
2012-12-21 05:50:45 +08:00
|
|
|
IF(NOT MSVC)
|
2014-04-22 00:56:57 +08:00
|
|
|
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1"
|
|
|
|
COMPONENT documentation)
|
2012-12-21 05:50:45 +08:00
|
|
|
ENDIF()
|
2012-08-28 05:49:09 +08:00
|
|
|
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c)
|
|
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
|
|
|
|
2024-03-12 21:36:19 +08:00
|
|
|
# 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.
|
2023-12-11 18:56:16 +08:00
|
|
|
if (GENERATE_NCGEN)
|
|
|
|
find_program(FLEX flex REQUIRED)
|
|
|
|
find_program(BISON bison REQUIRED)
|
|
|
|
|
2024-03-12 21:36:19 +08:00
|
|
|
add_custom_command(
|
2023-12-11 18:56:16 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.h ${CMAKE_CURRENT_SOURCE_DIR}/ncgeny.c ${CMAKE_CURRENT_SOURCE_DIR}/ncgenl.c
|
2023-12-11 19:48:11 +08:00
|
|
|
DEPENDS ncgen.y ncgen.l
|
2023-12-11 18:56:16 +08:00
|
|
|
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"
|
2024-03-12 21:36:19 +08:00
|
|
|
|
|
|
|
# Fix the `#line` preprocessor directives with the correct source paths
|
2023-12-11 18:56:16 +08:00
|
|
|
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()
|
2013-01-16 06:43:09 +08:00
|
|
|
|
2013-06-04 00:42:04 +08:00
|
|
|
## Specify files to be distributed by 'make dist'
|
|
|
|
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
2017-03-21 04:28:38 +08:00
|
|
|
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenl.c ncgen.l internals.html c0.cdl c0_4.cdl ref_camrun.cdl ncf199.cdl tst_gattenum.cdl CMakeLists.txt Makefile.am ncgen.1)
|
2013-06-04 00:42:04 +08:00
|
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|