netcdf-c/libsrc/CMakeLists.txt

78 lines
1.9 KiB
CMake
Raw Normal View History

## This is a CMake file, part of Unidata's netCDF package.
# Copyright 2012-2018, see the COPYRIGHT file for more information.
2020-08-12 05:46:18 +08:00
SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c
nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c)
# Process these files with m4.
2020-08-12 05:46:18 +08:00
SET(m4_SOURCES attr ncx putget)
2015-04-13 15:42:49 +08:00
foreach (f ${m4_SOURCES})
2020-08-12 05:46:18 +08:00
GEN_m4(${f} dest)
LIST(APPEND libsrc_SOURCES ${dest})
endforeach(f)
2012-07-14 00:37:14 +08:00
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES pstdint.h ncio.h ncx.h)
2012-07-14 00:37:14 +08:00
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES memio.c)
2012-07-14 00:37:14 +08:00
IF (BUILD_MMAP)
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES mmapio.c)
ENDIF( BUILD_MMAP)
2012-07-14 00:49:20 +08:00
IF (USE_FFIO)
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES ffio.c)
ELSEIF (USE_STDIO)
2020-08-12 05:46:18 +08:00
IST(APPEND libsrc_SOURCES ncstdio.c)
2012-07-17 06:31:35 +08:00
ELSE (USE_FFIO)
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES posixio.c)
2012-07-14 00:49:20 +08:00
ENDIF (USE_FFIO)
2012-07-11 01:45:28 +08:00
IF (ENABLE_BYTERANGE)
2020-08-12 05:46:18 +08:00
LIST(APPEND libsrc_SOURCES httpio.c)
IF (ENABLE_S3_SDK)
LIST(APPEND libsrc_SOURCES s3io.c)
ENDIF(ENABLE_S3_SDK)
ENDIF(ENABLE_BYTERANGE)
Provide byte-range reading of remote datasets re: issue https://github.com/Unidata/netcdf-c/issues/1251 Assume that you have the URL to a remote dataset which is a normal netcdf-3 or netcdf-4 file. This PR allows the netcdf-c to read that dataset's contents as a netcdf file using HTTP byte ranges if the remote server supports byte-range access. Originally, this PR was set up to access Amazon S3 objects, but it can also access other remote datasets such as those provided by a Thredds server via the HTTPServer access protocol. It may also work for other kinds of servers. Note that this is not intended as a true production capability because, as is known, this kind of access to can be quite slow. In addition, the byte-range IO drivers do not currently do any sort of optimization or caching. An additional goal here is to gain some experience with the Amazon S3 REST protocol. This architecture and its use documented in the file docs/byterange.dox. There are currently two test cases: 1. nc_test/tst_s3raw.c - this does a simple open, check format, close cycle for a remote netcdf-3 file and a remote netcdf-4 file. 2. nc_test/test_s3raw.sh - this uses ncdump to investigate some remote datasets. This PR also incorporates significantly changed model inference code (see the superceded PR https://github.com/Unidata/netcdf-c/pull/1259). 1. It centralizes the code that infers the dispatcher. 2. It adds support for byte-range URLs Other changes: 1. NC_HDF5_finalize was not being properly called by nc_finalize(). 2. Fix minor bug in ncgen3.l 3. fix memory leak in nc4info.c 4. add code to walk the .daprc triples and to replace protocol= fragment tag with a more general mode= tag. Final Note: Th inference code is still way too complicated. We need to move to the validfile() model used by netcdf Java, where each dispatcher is asked if it can process the file. This decentralizes the inference code. This will be done after all the major new dispatchers (PIO, Zarr, etc) have been implemented.
2019-01-02 09:27:36 +08:00
2015-04-13 15:42:49 +08:00
add_library(netcdf3 OBJECT ${libsrc_SOURCES})
2012-07-17 06:31:35 +08:00
IF(MPI_C_INCLUDE_PATH)
target_include_directories(netcdf3 PUBLIC ${MPI_C_INCLUDE_PATH})
ENDIF(MPI_C_INCLUDE_PATH)
2012-07-17 06:31:35 +08:00
# The C API man page.
2012-10-18 05:14:30 +08:00
SET(MAN_FILES netcdf.3)
2012-07-17 06:31:35 +08:00
set(ARGS_MANPAGE -DAPI=C)
IF (USE_HDF5)
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
ENDIF(USE_HDF5)
2012-07-17 06:31:35 +08:00
IF (BUILD_DAP)
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
2012-07-17 06:31:35 +08:00
ENDIF(BUILD_DAP)
IF (BUILD_PARALLEL)
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
2012-07-17 06:31:35 +08:00
ENDIF(BUILD_PARALLEL)
# Generate the man page.
IF(HAVE_M4)
FILE(GLOB libsrc_MANPAGE ${CMAKE_CURRENT_SOURCE_DIR}/../docs/netcdf.m4)
FILE(COPY ${libsrc_MANPAGE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
IF(NOT MSVC)
ADD_CUSTOM_TARGET(manpage ALL
2018-03-01 03:20:53 +08:00
COMMAND ${NC_M4} ${ARGS_MANPAGE} '${CMAKE_CURRENT_BINARY_DIR}/netcdf.m4' > '${CMAKE_CURRENT_BINARY_DIR}/netcdf.3'
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/netcdf.3 DESTINATION "share/man/man3" COMPONENT documentation)
ENDIF(NOT MSVC)
ENDIF()