mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-03-19 17:30:27 +08:00
Merge pull request #2847 from K20shores/packaging
Use cmake netCDF with target_* for many options
This commit is contained in:
commit
5973f3d683
6
.github/workflows/run_tests_cdash.yml
vendored
6
.github/workflows/run_tests_cdash.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -126,7 +126,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
28
.github/workflows/run_tests_osx.yml
vendored
28
.github/workflows/run_tests_osx.yml
vendored
@ -16,11 +16,11 @@ jobs:
|
||||
|
||||
build-deps-osx:
|
||||
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -52,11 +52,11 @@ jobs:
|
||||
nc-autotools-osx:
|
||||
|
||||
needs: [ nc-cmake-tests-oneoff-osx-shared, nc-cmake-tests-oneoff-osx-static, nc-ac-tests-oneoff-osx ]
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
use_nc4: [ nc3, nc4 ]
|
||||
use_dap: [ dap_off, dap_on ]
|
||||
use_nczarr: [ nczarr_off, nczarr_on ]
|
||||
@ -158,11 +158,11 @@ jobs:
|
||||
nc-cmake-osx:
|
||||
|
||||
needs: [ nc-cmake-tests-oneoff-osx-shared, nc-cmake-tests-oneoff-osx-static, nc-ac-tests-oneoff-osx ]
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
use_nc4: [ nc3, nc4 ]
|
||||
use_dap: [ dap_off, dap_on ]
|
||||
use_nczarr: [ nczarr_off, nczarr_on ]
|
||||
@ -253,11 +253,11 @@ jobs:
|
||||
nc-ac-tests-oneoff-osx:
|
||||
|
||||
needs: build-deps-osx
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
@ -334,11 +334,11 @@ jobs:
|
||||
nc-cmake-tests-oneoff-osx-shared:
|
||||
|
||||
needs: build-deps-osx
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -375,7 +375,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -D ENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -D ENABLE_DAP_LONG_TESTS=TRUE -DENABLE_LIBXML2=FALSE
|
||||
|
||||
- name: Print Summary
|
||||
shell: bash -l {0}
|
||||
@ -408,11 +408,11 @@ jobs:
|
||||
nc-cmake-tests-oneoff-osx-static:
|
||||
|
||||
needs: build-deps-osx
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -450,7 +450,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -D ENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -D ENABLE_DAP_LONG_TESTS=TRUE -DENABLE_LIBXML2=FALSE -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
|
||||
- name: Print Summary
|
||||
shell: bash -l {0}
|
||||
|
4
.github/workflows/run_tests_s3.yml
vendored
4
.github/workflows/run_tests_s3.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -70,7 +70,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
22
.github/workflows/run_tests_ubuntu.yml
vendored
22
.github/workflows/run_tests_ubuntu.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -128,7 +128,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
@ -319,7 +319,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
@ -399,7 +399,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -440,7 +440,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_LIBXML2=FALSE
|
||||
|
||||
- name: Print Summary
|
||||
shell: bash -l {0}
|
||||
@ -479,7 +479,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -521,7 +521,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE -DBUILD_SHARED_LIBS=FALSE -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_LIBXML2=FALSE -DBUILD_SHARED_LIBS=FALSE -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
|
||||
- name: Print Summary
|
||||
shell: bash -l {0}
|
||||
@ -561,7 +561,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.14.0 ]
|
||||
hdf5: [ 1.14.3 ]
|
||||
|
||||
steps:
|
||||
|
||||
@ -638,7 +638,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [1.10.8, 1.12.2, 1.14.3 ]
|
||||
use_nc4: [ nc3, nc4 ]
|
||||
use_dap: [ dap_off, dap_on ]
|
||||
use_nczarr: [ nczarr_off, nczarr_on ]
|
||||
@ -802,7 +802,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.0 ]
|
||||
hdf5: [ 1.10.8, 1.12.2, 1.14.3 ]
|
||||
use_nc4: [ nc3, nc4 ]
|
||||
use_dap: [ dap_off, dap_on ]
|
||||
use_nczarr: [ nczarr_off, nczarr_on ]
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Set Project Properties
|
||||
##################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.12.0)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
#Project Name
|
||||
project(netCDF
|
||||
@ -33,6 +33,24 @@ if (NOT DEFINED NETCDF_IS_TOP_LEVEL)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
################################
|
||||
# The target
|
||||
################################
|
||||
|
||||
##
|
||||
# Default building shared libraries.
|
||||
# BUILD_SHARED_LIBS is provided by/used by
|
||||
# CMake directly.
|
||||
##
|
||||
option(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
add_library(netcdf)
|
||||
add_library(netCDF::netcdf ALIAS netcdf)
|
||||
|
||||
#####
|
||||
# Version Info:
|
||||
#
|
||||
@ -114,7 +132,7 @@ include(GNUInstallDirs)
|
||||
|
||||
if(MSVC)
|
||||
set(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
add_compile_options("/utf-8")
|
||||
target_compile_options(netcdf PUBLIC "/utf-8")
|
||||
endif()
|
||||
|
||||
# auto-configure style checks, other CMake modules.
|
||||
@ -205,16 +223,6 @@ include(GenerateExportHeader)
|
||||
# Compiler and Linker Configuration
|
||||
################################
|
||||
|
||||
##
|
||||
# Default building shared libraries.
|
||||
# BUILD_SHARED_LIBS is provided by/used by
|
||||
# CMake directly.
|
||||
##
|
||||
option(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
option(NC_FIND_SHARED_LIBS "Find dynamically-built versions of dependent libraries" ${BUILD_SHARED_LIBS})
|
||||
|
||||
##
|
||||
@ -276,17 +284,15 @@ if(MINGW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions()
|
||||
|
||||
# Suppress CRT Warnings.
|
||||
# Only necessary for Windows
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(netcdf PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# Support ANSI format specifiers for *printf on MINGW:
|
||||
if(MINGW)
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
target_compile_definitions(netcdf PRIVATE __USE_MINGW_ANSI_STDIO=1)
|
||||
endif()
|
||||
|
||||
#####
|
||||
@ -462,8 +468,8 @@ if(WIN32)
|
||||
option(ENABLE_DLL "Build a Windows DLL." ${BUILD_SHARED_LIBS})
|
||||
if(ENABLE_DLL)
|
||||
set(BUILD_DLL ON CACHE BOOL "")
|
||||
add_definitions(-DDLL_NETCDF)
|
||||
add_definitions(-DDLL_EXPORT)
|
||||
target_compile_definitions(netcdf PRIVATE DLL_EXPORT)
|
||||
target_compile_definitions(netcdf PUBLIC DLL_NETCDF)
|
||||
endif()
|
||||
endif()
|
||||
# Did the user specify a default minimum blocksize for posixio?
|
||||
@ -486,14 +492,13 @@ if(NOT ENABLE_NETCDF_4)
|
||||
set(ENABLE_LOGGING OFF)
|
||||
endif()
|
||||
if(ENABLE_LOGGING)
|
||||
add_definitions(-DLOGGING)
|
||||
add_definitions(-DENABLE_SET_LOG_LEVEL)
|
||||
target_compile_definitions(netcdf PRIVATE LOGGING ENABLE_SET_LOG_LEVEL)
|
||||
set(LOGGING ON)
|
||||
set(ENABLE_SET_LOG_LEVEL ON)
|
||||
endif()
|
||||
option(ENABLE_SET_LOG_LEVEL_FUNC "Enable definition of nc_set_log_level()." ON)
|
||||
if(ENABLE_NETCDF_4 AND NOT ENABLE_LOGGING AND ENABLE_SET_LOG_LEVEL_FUNC)
|
||||
add_definitions(-DENABLE_SET_LOG_LEVEL)
|
||||
target_compile_definitions(netcdf PRIVATE -DENABLE_SET_LOG_LEVEL)
|
||||
set(ENABLE_SET_LOG_LEVEL ON)
|
||||
endif()
|
||||
|
||||
@ -623,9 +628,14 @@ endif()
|
||||
# Try to enable NCZarr zip support
|
||||
option(ENABLE_NCZARR_ZIP "Enable NCZarr ZIP support." OFF)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# libdl is always available; built-in in Windows and OSX
|
||||
option(ENABLE_PLUGINS "Enable dynamically loaded plugins (default on)." ON)
|
||||
cmake_dependent_option(ENABLE_PLUGINS "Enable dynamically loaded plugins (default on)."
|
||||
ON "BUILD_SHARED_LIBS" OFF)
|
||||
MESSAGE(STATUS "ENABLE_PLUGINS: ${ENABLE_PLUGINS}")
|
||||
if(MINGW)
|
||||
message(STATUS "MINGW Detected, disabling plugins.")
|
||||
set(ENABLE_PLUGINS OFF CACHE BOOL "Disable plugins" FORCE)
|
||||
else()
|
||||
if(NOT WIN32)
|
||||
@ -634,6 +644,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_PLUGINS)
|
||||
set(USEPLUGINS yes)
|
||||
endif()
|
||||
@ -986,7 +997,7 @@ endif()
|
||||
|
||||
if(ENABLE_ZERO_LENGTH_COORD_BOUND)
|
||||
message(STATUS "Enabling a more relaxed check for NC_EINVALCOORDS")
|
||||
add_definitions(-DRELAX_COORD_BOUND)
|
||||
target_compile_definitions(netcdf PRIVATE RELAX_COORD_BOUND)
|
||||
endif()
|
||||
|
||||
# Enable Parallel Tests.
|
||||
@ -1003,7 +1014,7 @@ IF (ENABLE_PARALLEL_TESTS AND NOT USE_PARALLEL)
|
||||
endif()
|
||||
|
||||
# Enable special filter test; experimental when using cmake.
|
||||
option(ENABLE_FILTER_TESTING "Enable filter testing. Ignored if shared libraries or netCDF4 are not enabled" ON)
|
||||
option(ENABLE_FILTER_TESTING "Enable filter testing. Ignored if shared libraries or netCDF4 are not enabled" ${ENABLE_PLUGINS})
|
||||
|
||||
if(ENABLE_FILTER_TESTING)
|
||||
if(NOT ENABLE_HDF5 AND NOT ENABLE_NCZARR)
|
||||
@ -1017,12 +1028,12 @@ if(NOT BUILD_SHARED_LIBS)
|
||||
set(ENABLE_FILTER_TESTING OFF)
|
||||
endif()
|
||||
|
||||
option(ENABLE_NCZARR_FILTERS "Enable NCZarr filters" ON)
|
||||
option(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." ON)
|
||||
option(ENABLE_NCZARR_FILTERS "Enable NCZarr filters" ${ENABLE_PLUGINS})
|
||||
option(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." ${ENABLE_NCZARR_FILTERS})
|
||||
|
||||
# Constraints
|
||||
IF (NOT ENABLE_PLUGINS)
|
||||
message(WARNING "ENABLE_FILTER_TESTING requires shared libraries. Disabling.")
|
||||
if (NOT ENABLE_PLUGINS AND ENABLE_NCZARR_FILTERS)
|
||||
message(WARNING "ENABLE_NCZARR_FILTERS requires ENABLE_PLUGINS. Disabling.")
|
||||
set(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Enable NCZarr Filters." FORCE)
|
||||
endif()
|
||||
|
||||
@ -1398,15 +1409,12 @@ endif(ENABLE_BASH_SCRIPT_TESTING)
|
||||
# Create config.h file.
|
||||
configure_file("${netCDF_SOURCE_DIR}/config.h.cmake.in"
|
||||
"${netCDF_BINARY_DIR}/config.h")
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
include_directories(${netCDF_BINARY_DIR})
|
||||
# End autotools-style checks for config.h
|
||||
|
||||
#####
|
||||
# Set core names of the libraries.
|
||||
#####
|
||||
set(netCDF_LIB_CORENAME "netcdf")
|
||||
|
||||
#####
|
||||
# Set the true names of all the libraries, if customized by external project
|
||||
#####
|
||||
@ -1474,12 +1482,6 @@ if(ENABLE_PLUGINS)
|
||||
add_subdirectory(plugins)
|
||||
endif()
|
||||
|
||||
# For tests and utilities, we are no longer
|
||||
# exporting symbols but rather importing them.
|
||||
if(BUILD_DLL)
|
||||
REMOVE_DEFINITIONS(-DDLL_EXPORT)
|
||||
endif()
|
||||
|
||||
# Enable Utilities.
|
||||
if(BUILD_UTILITIES)
|
||||
include_directories(ncdump)
|
||||
@ -1716,14 +1718,14 @@ else()
|
||||
endif()
|
||||
|
||||
if(WITH_S3_TESTING STREQUAL PUBLIC)
|
||||
set(ENABLE_S3_TESTING "public")
|
||||
set(ENABLE_S3_TESTING "public")
|
||||
elseif(WITH_S3_TESTING)
|
||||
set(ENABLE_S3_TESTING "yes")
|
||||
set(ENABLE_S3_TESTALL "yes")
|
||||
set(ENABLE_S3_TESTING "yes")
|
||||
set(ENABLE_S3_TESTALL "yes")
|
||||
elseif(NOT WITH_S3_TESTING)
|
||||
set(ENABLE_S3_TESTING "no")
|
||||
set(ENABLE_S3_TESTING "no")
|
||||
else()
|
||||
set(ENABLE_S3_TESTING "no")
|
||||
set(ENABLE_S3_TESTING "no")
|
||||
endif()
|
||||
|
||||
# The Unidata testing S3 bucket
|
||||
@ -1858,7 +1860,6 @@ configure_package_config_file(
|
||||
INSTALL_DESTINATION "${ConfigPackageLocation}"
|
||||
)
|
||||
|
||||
add_library(netCDF::netcdf ALIAS netcdf)
|
||||
target_include_directories(netcdf
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
@ -37,6 +37,8 @@ This file contains a high-level description of this package's evolution. Release
|
||||
* Remove obsolete code. See [Github #2680](https://github.com/Unidata/netcdf-c/pull/2680).
|
||||
* [Bug Fix] Add a crude test to see if an NCZarr path looks like a valid NCZarr/Zarr file. See [Github #2658](https://github.com/Unidata/netcdf-c/pull/2658).
|
||||
* Fix 'make distcheck' error in run_interop.sh. See [Github #2631](https://github.com/Unidata/netcdf-c/pull/2631).
|
||||
* Bump cmake minimum version to 3.20.0 to support finding HDF5 with cmake's find_package
|
||||
* Refactor the cmake files to remove global include directories and compile definitions
|
||||
|
||||
## 4.9.2 - March 14, 2023
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
@ -6,7 +6,7 @@ environment:
|
||||
CONDA_INSTALL_LOCN: C:\\Miniconda-x64
|
||||
MSYS2_INSTALL_LOCN: C:\msys64
|
||||
MSYS2_BIN_LOCN: C:\msys64\usr\bin
|
||||
CMAKE_GENERATOR: "Visual Studio 15 Win64"
|
||||
CMAKE_GENERATOR: "Visual Studio 16"
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
@ -22,7 +22,11 @@ if(ENABLE_HDF4)
|
||||
if(NOT MFHDF_H_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "HDF4 Support specified, cannot find file mfhdf.h")
|
||||
else()
|
||||
include_directories(${MFHDF_H_INCLUDE_DIR})
|
||||
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${MFHDF_H_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
find_library(HDF4_DF_LIB NAMES df libdf hdf)
|
||||
@ -50,7 +54,11 @@ if(ENABLE_HDF4)
|
||||
else()
|
||||
set(HAVE_JPEGLIB_H ON CACHE BOOL "")
|
||||
set(HAVE_LIBJPEG TRUE )
|
||||
include_directories(${JPEGLIB_H_INCLUDE_DIR})
|
||||
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${JPEGLIB_H_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
find_library(JPEG_LIB NAMES jpeg libjpeg)
|
||||
@ -101,214 +109,41 @@ if(USE_HDF5)
|
||||
##
|
||||
set(HDF5_VERSION_REQUIRED 1.8.10)
|
||||
|
||||
|
||||
###
|
||||
# For now we assume that if we are building netcdf
|
||||
# as a shared library, we will use hdf5 as a shared
|
||||
# library. If we are building netcdf statically,
|
||||
# we will use a static library. This can be toggled
|
||||
# by explicitly modifying NC_FIND_SHARED_LIBS.
|
||||
##
|
||||
# Accommodate developers who have hdf5 libraries and
|
||||
# headers on their system, but do not have a the hdf
|
||||
# .cmake files. If this is the case, they should
|
||||
# specify HDF5_HL_LIBRARY, HDF5_LIBRARY, HDF5_INCLUDE_DIR manually.
|
||||
#
|
||||
# This script will attempt to determine the version of the HDF5 library programatically.
|
||||
##
|
||||
if(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
|
||||
set(HDF5_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY} )
|
||||
set(HDF5_C_LIBRARIES ${HDF5_C_LIBRARY} )
|
||||
set(HDF5_C_LIBRARY_hdf5 ${HDF5_C_LIBRARY} )
|
||||
set(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARY} )
|
||||
include_directories(${HDF5_INCLUDE_DIR})
|
||||
message(STATUS "Using HDF5 C Library: ${HDF5_C_LIBRARY}")
|
||||
message(STATUS "Using HDF5 HL LIbrary: ${HDF5_HL_LIBRARY}")
|
||||
if (EXISTS "${HDF5_INCLUDE_DIR}/H5pubconf.h")
|
||||
file(READ "${HDF5_INCLUDE_DIR}/H5pubconf.h" _hdf5_version_lines
|
||||
REGEX "#define[ \t]+H5_VERSION")
|
||||
string(REGEX REPLACE ".*H5_VERSION .*\"\(.*\)\".*" "\\1" _hdf5_version "${_hdf5_version_lines}")
|
||||
set(HDF5_VERSION "${_hdf5_version}" CACHE STRING "")
|
||||
set(HDF5_VERSION ${HDF5_VERSION} PARENT_SCOPE)
|
||||
unset(_hdf5_version)
|
||||
unset(_hdf5_version_lines)
|
||||
endif ()
|
||||
message(STATUS "Found HDF5 libraries version ${HDF5_VERSION}")
|
||||
###
|
||||
# If HDF5_VERSION is still empty, we have a problem.
|
||||
# Error out.
|
||||
###
|
||||
if("${HDF5_VERSION}" STREQUAL "")
|
||||
message(FATAL_ERR "Unable to determine HDF5 version. NetCDF requires at least version ${HDF5_VERSION_REQUIRED}. Please ensure that libhdf5 is installed and accessible.")
|
||||
endif()
|
||||
#if (MSVC)
|
||||
# if(NC_FIND_SHARED_LIBS)
|
||||
# set(HDF5_USE_STATIC_LIBRARIES OFF)
|
||||
# else()
|
||||
# set(HDF5_USE_STATIC_LIBRARIES ON)
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
###
|
||||
# Now that we know HDF5_VERSION isn't empty, we can check for minimum required version,
|
||||
# and toggle various options.
|
||||
###
|
||||
if(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED})
|
||||
message(FATAL_ERROR "netCDF requires at least HDF5 ${HDF5_VERSION_REQUIRED}. Found ${HDF5_VERSION}.")
|
||||
endif()
|
||||
#####
|
||||
# First, find the C and HL libraries.
|
||||
#####
|
||||
find_package(HDF5 ${HDF5_VERSION_REQUIRED} COMPONENTS C HL REQUIRED)
|
||||
|
||||
else(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) # We are seeking out HDF5 with Find Package.
|
||||
###
|
||||
# For now we assume that if we are building netcdf
|
||||
# as a shared library, we will use hdf5 as a shared
|
||||
# library. If we are building netcdf statically,
|
||||
# we will use a static library. This can be toggled
|
||||
# by explicitly modifying NC_FIND_SHARED_LIBS.
|
||||
##
|
||||
if(NC_FIND_SHARED_LIBS)
|
||||
set(NC_HDF5_LINK_TYPE "shared")
|
||||
set(NC_HDF5_LINK_TYPE_UPPER "SHARED")
|
||||
ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
|
||||
else(NC_FIND_SHARED_LIBS)
|
||||
set(NC_HDF5_LINK_TYPE "static")
|
||||
set(NC_HDF5_LINK_TYPE_UPPER "STATIC")
|
||||
ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB )
|
||||
endif(NC_FIND_SHARED_LIBS)
|
||||
|
||||
#####
|
||||
# First, find the C and HL libraries.
|
||||
#
|
||||
# This has been updated to reflect what is in the hdf5
|
||||
# examples, even though the previous version of what we
|
||||
# had worked.
|
||||
#####
|
||||
if(MSVC)
|
||||
set(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
|
||||
find_package(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE})
|
||||
else(MSVC)
|
||||
find_package(HDF5 COMPONENTS C HL REQUIRED)
|
||||
endif(MSVC)
|
||||
|
||||
##
|
||||
# Next, check the HDF5 version. This will inform which
|
||||
# HDF5 variables we need to munge.
|
||||
##
|
||||
|
||||
# Some versions of HDF5 set HDF5_VERSION_STRING instead of HDF5_VERSION
|
||||
if(HDF5_VERSION_STRING AND NOT HDF5_VERSION)
|
||||
set(HDF5_VERSION ${HDF5_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
|
||||
###
|
||||
# If HDF5_VERSION is undefined, attempt to determine it programatically.
|
||||
###
|
||||
if("${HDF5_VERSION}" STREQUAL "")
|
||||
message(STATUS "HDF5_VERSION not detected. Attempting to determine programatically.")
|
||||
IF (EXISTS "${HDF5_INCLUDE_DIR}/H5pubconf.h")
|
||||
file(READ "${HDF5_INCLUDE_DIR}/H5pubconf.h" _hdf5_version_lines
|
||||
REGEX "#define[ \t]+H5_VERSION")
|
||||
string(REGEX REPLACE ".*H5_VERSION .*\"\(.*\)\".*" "\\1" _hdf5_version "${_hdf5_version_lines}")
|
||||
set(HDF5_VERSION "${_hdf5_version}" CACHE STRING "")
|
||||
unset(_hdf5_version)
|
||||
unset(_hdf5_version_lines)
|
||||
message(STATUS "Found HDF5 libraries version ${HDF5_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
set(HDF5_VERSION ${HDF5_VERSION} CACHE STRING "")
|
||||
endif()
|
||||
|
||||
###
|
||||
# If HDF5_VERSION is still empty, we have a problem.
|
||||
# Error out.
|
||||
###
|
||||
if("${HDF5_VERSION}" STREQUAL "")
|
||||
message(FATAL_ERR "Unable to determine HDF5 version. NetCDF requires at least version ${HDF5_VERSION_REQUIRED}. Please ensure that libhdf5 is installed and accessible.")
|
||||
endif()
|
||||
|
||||
###
|
||||
# Now that we know HDF5_VERSION isn't empty, we can check for minimum required version,
|
||||
# and toggle various options.
|
||||
###
|
||||
|
||||
if(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED})
|
||||
message(FATAL_ERROR "netCDF requires at least HDF5 ${HDF5_VERSION_REQUIRED}. Found ${HDF5_VERSION}.")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
##
|
||||
# Include the HDF5 include directory.
|
||||
##
|
||||
if(HDF5_INCLUDE_DIRS AND NOT HDF5_INCLUDE_DIR)
|
||||
set(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_DIRS} )
|
||||
endif()
|
||||
message(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIR}")
|
||||
include_directories(${HDF5_INCLUDE_DIR})
|
||||
|
||||
###
|
||||
# This is the block where we figure out what the appropriate
|
||||
# variables are, and we ensure that we end up with
|
||||
# HDF5_C_LIBRARY, HDF5_HL_LIBRARY and HDF5_LIBRARIES.
|
||||
###
|
||||
if(MSVC)
|
||||
####
|
||||
# Environmental variables in Windows when using MSVC
|
||||
# are a hot mess between versions.
|
||||
####
|
||||
|
||||
##
|
||||
# HDF5 1.8.15 defined HDF5_LIBRARIES.
|
||||
##
|
||||
if(${HDF5_VERSION} VERSION_LESS "1.8.16")
|
||||
set(HDF5_C_LIBRARY hdf5 )
|
||||
set(HDF5_C_LIBRARY_hdf5 hdf5 )
|
||||
endif(${HDF5_VERSION} VERSION_LESS "1.8.16")
|
||||
|
||||
if(${HDF5_VERSION} VERSION_GREATER "1.8.15")
|
||||
if(NOT HDF5_LIBRARIES AND HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY AND HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY)
|
||||
set(HDF5_C_LIBRARY ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} )
|
||||
set(HDF5_C_LIBRARY_hdf5 ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} )
|
||||
set(HDF5_HL_LIBRARY ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} )
|
||||
|
||||
set(HDF5_LIBRARIES ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} )
|
||||
endif()
|
||||
endif(${HDF5_VERSION} VERSION_GREATER "1.8.15")
|
||||
|
||||
else(MSVC)
|
||||
|
||||
# Depending on the install, either HDF5_hdf_library or
|
||||
# HDF5_C_LIBRARIES may be defined. We must check for either.
|
||||
if(HDF5_C_LIBRARIES AND NOT HDF5_hdf5_LIBRARY)
|
||||
set(HDF5_hdf5_LIBRARY ${HDF5_C_LIBRARIES} )
|
||||
endif()
|
||||
|
||||
# Some versions of find_package set HDF5_C_LIBRARIES, but not HDF5_C_LIBRARY
|
||||
# We use HDF5_C_LIBRARY below, so need to make sure it is set.
|
||||
if(HDF5_C_LIBRARIES AND NOT HDF5_C_LIBRARY)
|
||||
set(HDF5_C_LIBRARY ${HDF5_C_LIBRARIES} )
|
||||
endif()
|
||||
|
||||
# Same issue as above...
|
||||
if(HDF5_HL_LIBRARIES AND NOT HDF5_HL_LIBRARY)
|
||||
set(HDF5_HL_LIBRARY ${HDF5_HL_LIBRARIES} )
|
||||
endif()
|
||||
|
||||
endif(MSVC)
|
||||
if(NOT HDF5_C_LIBRARY)
|
||||
set(HDF5_C_LIBRARY hdf5 )
|
||||
endif()
|
||||
|
||||
endif(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
|
||||
message(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIRS}")
|
||||
target_link_libraries(netcdf
|
||||
PRIVATE
|
||||
HDF5::HDF5
|
||||
)
|
||||
|
||||
find_package(Threads)
|
||||
|
||||
# There is a missing case in the above code so default it
|
||||
if(NOT HDF5_C_LIBRARY_hdf5 OR "${HDF5_C_LIBRARY_hdf5}" STREQUAL "" )
|
||||
set(HDF5_C_LIBRARY_hdf5 "${HDF5_C_LIBRARY}" )
|
||||
endif()
|
||||
|
||||
find_path(HAVE_HDF5_H hdf5.h PATHS ${HDF5_INCLUDE_DIR} NO_DEFAULT_PATH)
|
||||
if(NOT HAVE_HDF5_H)
|
||||
message(FATAL_ERROR "Compiling a test with hdf5 failed. Either hdf5.h cannot be found, or the log messages should be checked for another reason.")
|
||||
else(NOT HAVE_HDF5_H)
|
||||
include_directories(${HAVE_HDF5_H})
|
||||
endif(NOT HAVE_HDF5_H)
|
||||
|
||||
include(cmake/check_hdf5.cmake)
|
||||
set (CMAKE_REQUIRED_INCLUDES ${HDF5_INCLUDE_DIRS})
|
||||
|
||||
# Check to ensure that HDF5 was built with zlib.
|
||||
# This needs to be near the beginning since we
|
||||
# need to know whether to add "-lz" to the symbol
|
||||
# tests below.
|
||||
|
||||
include(check_hdf5)
|
||||
check_hdf5_feature(HAVE_HDF5_ZLIB H5_HAVE_ZLIB_H)
|
||||
if(NOT HAVE_HDF5_ZLIB)
|
||||
message(FATAL_ERROR "HDF5 was built without zlib. Rebuild HDF5 with zlib.")
|
||||
@ -341,38 +176,22 @@ if(USE_HDF5)
|
||||
set(HDF5_UTF8_PATHS OFF )
|
||||
endif()
|
||||
|
||||
message("-- HDF5_UTF8_PATHS (HDF5 version 1.10.6+): ${HDF5_UTF8_PATHS}")
|
||||
message(STATUS "-- HDF5_UTF8_PATHS (HDF5 version 1.10.6+): ${HDF5_UTF8_PATHS}")
|
||||
|
||||
# Find out if HDF5 was built with parallel support.
|
||||
# Do that by checking for the targets H5Pget_fapl_mpiposx and
|
||||
# H5Pget_fapl_mpio in ${HDF5_LIB}.
|
||||
set(HDF5_PARALLEL ${HDF5_IS_PARALLEL})
|
||||
|
||||
# H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12.
|
||||
# Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead.
|
||||
# CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
|
||||
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
|
||||
if(HDF5_IS_PARALLEL_MPIO)
|
||||
set(HDF5_PARALLEL ON)
|
||||
else()
|
||||
set(HDF5_PARALLEL OFF)
|
||||
endif()
|
||||
set(HDF5_PARALLEL ${HDF5_PARALLEL} )
|
||||
set(CMAKE_REQUIRED_LIBRARIES HDF5::HDF5)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
#Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
|
||||
|
||||
if(HDF5_PARALLEL)
|
||||
set(HDF5_CC h5pcc )
|
||||
else()
|
||||
set(HDF5_CC h5cc )
|
||||
endif()
|
||||
check_symbol_exists(H5Pset_all_coll_metadata_ops "hdf5.h" HDF5_HAS_COLL_METADATA_OPS)
|
||||
|
||||
# Check to see if H5Dread_chunk is available
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Dread_chunk "" HAS_READCHUNKS)
|
||||
check_symbol_exists(H5Dread_chunk "hdf5.h" HAS_READCHUNKS)
|
||||
|
||||
# Check to see if H5Pset_fapl_ros3 is available
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_fapl_ros3 "" HAS_HDF5_ROS3)
|
||||
check_symbol_exists(H5Pset_fapl_ros3 "hdf5.h" HAS_HDF5_ROS3)
|
||||
|
||||
# Check to see if this is hdf5-1.10.3 or later.
|
||||
if(HAS_READCHUNKS)
|
||||
@ -392,17 +211,6 @@ if(USE_HDF5)
|
||||
set(HDF5_HAS_PAR_FILTERS FALSE CACHE BOOL "" )
|
||||
set(HAS_PAR_FILTERS no CACHE STRING "" )
|
||||
endif()
|
||||
|
||||
find_path(HAVE_HDF5_H hdf5.h PATHS ${HDF5_INCLUDE_DIR} NO_DEFAULT_PATH)
|
||||
if(NOT HAVE_HDF5_H)
|
||||
message(FATAL_ERROR "Compiling a test with hdf5 failed. Either hdf5.h cannot be found, or the log messages should be checked for another reason.")
|
||||
else(NOT HAVE_HDF5_H)
|
||||
include_directories(${HAVE_HDF5_H})
|
||||
endif(NOT HAVE_HDF5_H)
|
||||
|
||||
#option to include HDF5 High Level header file (hdf5_hl.h) in case we are not doing a make install
|
||||
include_directories(${HDF5_HL_INCLUDE_DIR})
|
||||
|
||||
endif(USE_HDF5)
|
||||
|
||||
################################
|
||||
@ -410,9 +218,18 @@ endif(USE_HDF5)
|
||||
################################
|
||||
# See if we have libcurl
|
||||
find_package(CURL)
|
||||
ADD_DEFINITIONS(-DCURL_STATICLIB=1)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(netcdf
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${CURL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
|
||||
MESSAGE(STATUS "Found CURL_INCLUDE_DIRS: ${CURL_INCLUDE_DIRS}")
|
||||
# Define a test flag for have curl library
|
||||
if(CURL_LIBRARIES OR CURL_LIBRARY)
|
||||
set(FOUND_CURL TRUE)
|
||||
@ -517,7 +334,10 @@ find_package(ZLIB)
|
||||
|
||||
# Define a test flag for have zlib library
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
set(ENABLE_ZLIB TRUE)
|
||||
else()
|
||||
set(ENABLE_ZLIB FALSE)
|
||||
@ -563,7 +383,10 @@ endif()
|
||||
|
||||
IF (ENABLE_NCZARR_ZIP)
|
||||
find_package(Zip REQUIRED)
|
||||
include_directories(${Zip_INCLUDE_DIRS})
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${Zip_INCLUDE_DIRS}
|
||||
)
|
||||
endif ()
|
||||
|
||||
################################
|
||||
@ -578,7 +401,10 @@ if(ENABLE_S3)
|
||||
find_package(AWSSDK REQUIRED COMPONENTS s3;transfer)
|
||||
if(AWSSDK_FOUND)
|
||||
set(ENABLE_S3_AWS ON CACHE BOOL "S3 AWS" FORCE)
|
||||
include_directories(${AWSSDK_INCLUDE_DIR})
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${AWSSDK_INCLUDE_DIR}
|
||||
)
|
||||
else(AWSSDK_FOUND)
|
||||
set(ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
|
||||
endif(AWSSDK_FOUND)
|
||||
@ -608,7 +434,10 @@ if(ENABLE_LIBXML2)
|
||||
find_package(LibXml2)
|
||||
if(LibXml2_FOUND)
|
||||
set(HAVE_LIBXML2 TRUE)
|
||||
include_directories(${LIBXML2_INCLUDE_DIRS})
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${LIBXML2_INCLUDE_DIRS}
|
||||
)
|
||||
set(XMLPARSER "libxml2")
|
||||
else()
|
||||
set(HAVE_LIBXML2 FALSE)
|
||||
|
@ -150,14 +150,12 @@ macro(build_bin_test F)
|
||||
target_link_libraries(${F} netcdf ${ALL_TLL_LIBS})
|
||||
if(MSVC)
|
||||
set_target_properties(${F}
|
||||
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
)
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
PROPERTIES
|
||||
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -167,12 +165,11 @@ macro(add_bin_test_no_prefix F)
|
||||
add_test(${F} ${EXECUTABLE_OUTPUT_PATH}/${F})
|
||||
if(MSVC)
|
||||
set_property(TEST ${F} PROPERTY FOLDER "tests/")
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -181,12 +178,11 @@ macro(build_bin_test_no_prefix F)
|
||||
build_bin_test(${F})
|
||||
if(MSVC)
|
||||
#SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/")
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${F} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -207,12 +203,12 @@ macro(add_bin_test prefix F)
|
||||
)
|
||||
if(MSVC)
|
||||
set_property(TEST ${prefix}_${F} PROPERTY FOLDER "tests/")
|
||||
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${prefix}_${F}
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -283,12 +283,6 @@ are set when opening a binary file on Windows. */
|
||||
/* Define to 1 if you have libsz */
|
||||
#cmakedefine HAVE_SZ 1
|
||||
|
||||
/* Define to 1 if you have the <hdf5.h> header file. */
|
||||
#cmakedefine HAVE_HDF5_H 1
|
||||
|
||||
/* Define to 1 if you have the <hdf5.h> header file. */
|
||||
#cmakedefine HAVE_HDF5_HL_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `int64'. */
|
||||
#cmakedefine HAVE_INT64 1
|
||||
|
||||
|
24
docs/FAQ.md
24
docs/FAQ.md
@ -1944,23 +1944,12 @@ Not at this time; it is required to instead build first one version, and then th
|
||||
How can I specify linking against a particular library? {#partlib}
|
||||
-------------------------------------------------------
|
||||
|
||||
It depends on the library. To specify a custom `ZLib`, for example, you would do the following:
|
||||
|
||||
$ cmake [Source Directory] -DZLIB_LIBRARY=/path/to/my/zlib.lib
|
||||
|
||||
|
||||
`HDF5` is more complex, since it requires both the `hdf5` and `hdf5_hl` libraries. You would specify custom `HDF5` libraries as follows:
|
||||
|
||||
$ cmake [Source Directory] -DHDF5_C_LIBRARY=/path/to/hdf5.lib \
|
||||
-DHDF5_HL_LIBRARY=/path/to/hdf5_hl.lib \
|
||||
-DHDF5_INCLUDE_DIR=/path/to/hdf5/include
|
||||
|
||||
|
||||
Alternatively, you may specify:
|
||||
For most libraries, you can specify `<library name>_ROOT`. To specify
|
||||
custom `ZLib` and `HDF5`, for example, you would do the following:
|
||||
|
||||
$ cmake [Source Directory] \
|
||||
-DHDF5_LIBRARIES="/path/to/hdf5.lib;/path/to/hdf5_hl.lib" \
|
||||
-DHDF5_INCLUDE_DIRS=/path/to/hdf5/include/
|
||||
-DZLIB_ROOT=/path/to/zlib/install \
|
||||
-DHDF5_ROOT=/path/to/hdf5/install
|
||||
|
||||
|
||||
What if I want to link against multiple libraries in a non-standard location {#nonstdloc}
|
||||
@ -1982,11 +1971,8 @@ How can I specify a Parallel Build using HDF5 {#parallelhdf}
|
||||
|
||||
If cmake is having problems finding the parallel `HDF5` install, you can specify the location manually:
|
||||
|
||||
|
||||
$ cmake [Source Directory] -DENABLE_PARALLEL=ON \
|
||||
-DHDF5_C_LIBRARY=/usr/lib64/openmpi/lib/libhdf5.so \
|
||||
-DHDF5_HL_LIBRARY=/usr/lib64/openmpi/lib/libhdf5.hl.so \
|
||||
-DHDF5_INCLUDE_DIR=/usr/include/openmpi-x86_64 \
|
||||
-DHDF5_ROOT=/usr/lib64/openmpi/lib/
|
||||
|
||||
You will, of course, need to use the location of the libraries specific to your development environment.
|
||||
|
||||
|
@ -14,8 +14,7 @@ FOREACH(CTEST ${H5TESTS})
|
||||
ADD_EXECUTABLE(${CTEST} ${CTEST}.c)
|
||||
TARGET_LINK_LIBRARIES(${CTEST}
|
||||
netcdf
|
||||
${HDF5_HL_LIBRARIES}
|
||||
${HDF5_C_LIBRARIES}
|
||||
HDF5::HDF5 hdf5::hdf5_hl
|
||||
)
|
||||
ADD_TEST(${CTEST} ${EXECUTABLE_OUTPUT_PATH}/${CTEST})
|
||||
ENDFOREACH()
|
||||
|
@ -26,6 +26,18 @@ set_property(SOURCE ncd2dispatch.c
|
||||
|
||||
add_library(dap2 OBJECT ${dap2_SOURCES})
|
||||
|
||||
|
||||
target_link_libraries(dap2 PUBLIC ${CURL_LIBRARIES})
|
||||
target_include_directories(dap2 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(dap2
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(dap2 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
target_link_libraries(dap2 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
SET(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c)
|
||||
set(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c)
|
||||
|
||||
##
|
||||
# Turn off inclusion of particular files when using the cmake-native
|
||||
@ -20,10 +20,20 @@ set_property(SOURCE d4meta.c
|
||||
SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
add_library(dap4 OBJECT ${dap4_SOURCES})
|
||||
target_link_libraries(dap4 PUBLIC ${CURL_LIBRARIES})
|
||||
target_include_directories(dap4 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(dap4
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(dap4 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(dap4 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
###
|
||||
# Options related to the man page generation.
|
||||
@ -37,18 +47,18 @@ set(man_MANS netcdf.3)
|
||||
|
||||
set(ARGS_MANPAGE -DAPI=C)
|
||||
|
||||
IF (USE_HDF5)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
ENDIF(USE_HDF5)
|
||||
if (USE_HDF5)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
endif(USE_HDF5)
|
||||
|
||||
IF (BUILD_DAP)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
ENDIF(BUILD_DAP)
|
||||
if (BUILD_DAP)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
endif(BUILD_DAP)
|
||||
|
||||
IF (BUILD_PARALLEL)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
ENDIF(BUILD_PARALLEL)
|
||||
if (BUILD_PARALLEL)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
endif(BUILD_PARALLEL)
|
||||
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} dce.y CMakeLists.txt Makefile.am)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} dce.y CMakeLists.txt Makefile.am)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
@ -4,9 +4,18 @@
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
SET(libdispatch_SOURCES dcopy.c dfile.c ddim.c datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8.c dinternal.c doffsets.c ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c nc.c nclistmgr.c utf8proc.h utf8proc.c dpathmgr.c dutil.c drc.c dauth.c dreadonly.c dnotnc4.c dnotnc3.c dinfermodel.c
|
||||
daux.c dinstance.c dinstance_intern.c
|
||||
dcrc32.c dcrc32.h dcrc64.c ncexhash.c ncxcache.c ncjson.c ds3util.c dparallel.c dmissing.c)
|
||||
add_library(dispatch OBJECT)
|
||||
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
dcopy.c dfile.c ddim.c datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8.c dinternal.c doffsets.c ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c nc.c nclistmgr.c utf8proc.h utf8proc.c dpathmgr.c dutil.c drc.c dauth.c dreadonly.c dnotnc4.c dnotnc3.c dinfermodel.c
|
||||
daux.c dinstance.c dinstance_intern.c
|
||||
dcrc32.c dcrc32.h dcrc64.c ncexhash.c ncxcache.c ncjson.c ds3util.c dparallel.c dmissing.c
|
||||
)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(dispatch PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
##
|
||||
# Turn off inclusion of particular files when using the cmake-native
|
||||
@ -22,52 +31,74 @@ set_property(SOURCE dinstance_intern.c dinstance.c dvarput.c
|
||||
SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
# Netcdf-4 only functions. Must be defined even if not used
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} dgroup.c dvlen.c dcompound.c dtype.c denum.c dopaque.c dfilter.c)
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
dgroup.c dvlen.c dcompound.c dtype.c denum.c dopaque.c dfilter.c
|
||||
)
|
||||
|
||||
IF(BUILD_V2)
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} dv2i.c)
|
||||
ENDIF(BUILD_V2)
|
||||
if(BUILD_V2)
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
dv2i.c
|
||||
)
|
||||
endif(BUILD_V2)
|
||||
|
||||
IF(ENABLE_BYTERANGE)
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} dhttp.c)
|
||||
if(ENABLE_BYTERANGE)
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
dhttp.c
|
||||
)
|
||||
ENDIF(ENABLE_BYTERANGE)
|
||||
|
||||
IF(ENABLE_S3)
|
||||
IF(ENABLE_S3_INTERNAL)
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} ncs3sdk_h5.c nch5s3comms.c nch5s3comms.h nccurl_sha256.c nccurl_sha256.h nccurl_hmac.c nccurl_hmac.h nccurl_setup.h)
|
||||
ELSE()
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} ncs3sdk_aws.cpp awsincludes.h)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
if(ENABLE_S3_INTERNAL)
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
ncs3sdk_h5.c nch5s3comms.c nch5s3comms.h nccurl_sha256.c nccurl_sha256.h nccurl_hmac.c nccurl_hmac.h nccurl_setup.h
|
||||
)
|
||||
else()
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
ncs3sdk_aws.cpp awsincludes.h
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(REGEDIT)
|
||||
SET(libdispatch_SOURCES ${libdispatch_SOURCES} dreg.c)
|
||||
ENDIF(REGEDIT)
|
||||
if(REGEDIT)
|
||||
target_sources(dispatch
|
||||
PRIVATE
|
||||
dreg.c
|
||||
)
|
||||
endif(REGEDIT)
|
||||
|
||||
add_library(dispatch OBJECT ${libdispatch_SOURCES})
|
||||
IF(STATUS_PARALLEL)
|
||||
|
||||
if (USE_HDF5)
|
||||
target_link_libraries(dispatch PRIVATE HDF5::HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(dispatch PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
IF(ENABLE_NCZARR)
|
||||
if(ENABLE_NCZARR)
|
||||
target_include_directories(dispatch PUBLIC ../libnczarr)
|
||||
ENDIF(ENABLE_NCZARR)
|
||||
endif(ENABLE_NCZARR)
|
||||
|
||||
IF(ENABLE_S3)
|
||||
IF(ENABLE_S3_AWS)
|
||||
if(ENABLE_S3)
|
||||
if(ENABLE_S3_AWS)
|
||||
target_include_directories(dispatch PUBLIC ${AWSSDK_INCLUDE_DIRS})
|
||||
IF(NOT MSVC)
|
||||
if(NOT MSVC)
|
||||
target_compile_features(dispatch PUBLIC cxx_std_11)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
endif()
|
||||
else()
|
||||
target_include_directories(dispatch PUBLIC ../libncxml)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(ENABLE_TESTS)
|
||||
if(ENABLE_TESTS)
|
||||
BUILD_BIN_TEST(ncrandom)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
file(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
@ -5,12 +5,22 @@
|
||||
#
|
||||
# Ed Hartnett
|
||||
|
||||
# The source files for the HDF4 dispatch layer.
|
||||
SET(libhdf4_SOURCES hdf4dispatch.c hdf4file.c hdf4func.c hdf4var.c)
|
||||
|
||||
# Build the HDF4 dispatch layer as a library that will be included in
|
||||
# the netCDF library.
|
||||
add_library(netcdfhdf4 OBJECT ${libhdf4_SOURCES})
|
||||
|
||||
target_sources(netcdfhdf4
|
||||
PRIVATE
|
||||
hdf4dispatch.c
|
||||
hdf4file.c
|
||||
hdf4func.c
|
||||
hdf4var.c
|
||||
)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(netcdfhdf4 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
# Remember to package this file for CMake builds.
|
||||
ADD_EXTRA_DIST(${libhdf4_SOURCES} CMakeLists.txt)
|
||||
|
@ -5,23 +5,34 @@
|
||||
#
|
||||
# Ed Hartnett
|
||||
|
||||
# The source files for the HDF5 dispatch layer.
|
||||
SET(libnchdf5_SOURCES nc4hdf.c nc4info.c hdf5file.c hdf5attr.c
|
||||
hdf5dim.c hdf5grp.c hdf5type.c hdf5internal.c hdf5create.c hdf5open.c
|
||||
hdf5var.c nc4mem.c nc4memcb.c hdf5dispatch.c hdf5filter.c
|
||||
hdf5set_format_compatibility.c hdf5debug.c)
|
||||
|
||||
IF(ENABLE_BYTERANGE)
|
||||
SET(libnchdf5_SOURCES ${libnchdf5_SOURCES} H5FDhttp.c)
|
||||
ENDIF()
|
||||
|
||||
# Build the HDF5 dispatch layer as a library that will be included in
|
||||
# the netCDF library.
|
||||
add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES})
|
||||
add_library(netcdfhdf5 OBJECT)
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
# The source files for the HDF5 dispatch layer.
|
||||
target_sources(netcdfhdf5 PRIVATE
|
||||
nc4hdf.c nc4info.c hdf5file.c hdf5attr.c
|
||||
hdf5dim.c hdf5grp.c hdf5type.c hdf5internal.c hdf5create.c hdf5open.c
|
||||
hdf5var.c nc4mem.c nc4memcb.c hdf5dispatch.c hdf5filter.c
|
||||
hdf5set_format_compatibility.c hdf5debug.c
|
||||
)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(netcdfhdf5 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
if(ENABLE_BYTERANGE)
|
||||
target_sources(netcdfhdf5 PRIVATE
|
||||
H5FDhttp.c
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(netcdfhdf5 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
target_link_libraries(netcdfhdf5 PUBLIC HDF5::HDF5)
|
||||
|
||||
# Remember to package this file for CMake builds.
|
||||
ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt)
|
||||
add_extra_dist(${libnchdf5_SOURCES} CMakeLists.txt)
|
||||
|
@ -4,224 +4,212 @@
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
SET(liblib_LIBS dispatch netcdf3)
|
||||
|
||||
#####
|
||||
# Add target objects/modules based on options.
|
||||
#####
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:netcdf3>
|
||||
$<TARGET_OBJECTS:dispatch>
|
||||
)
|
||||
|
||||
IF(USE_NETCDF4)
|
||||
SET(liblib_LIBS ${liblib_LIBS} netcdf4)
|
||||
ENDIF()
|
||||
IF(USE_HDF5)
|
||||
SET(liblib_LIBS ${liblib_LIBS} netcdfhdf5)
|
||||
ENDIF()
|
||||
if(USE_NETCDF4)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:netcdf4>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(USE_PNETCDF)
|
||||
SET(liblib_LIBS ${liblib_LIBS} netcdfp)
|
||||
ENDIF()
|
||||
if(USE_HDF5)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:netcdfhdf5>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(USE_HDF4)
|
||||
SET(liblib_LIBS ${liblib_LIBS} netcdfhdf4)
|
||||
ENDIF()
|
||||
if(USE_PNETCDF)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:netcdfp>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_DAP2)
|
||||
SET(liblib_LIBS ${liblib_LIBS} oc2 dap2)
|
||||
ENDIF()
|
||||
if(USE_HDF4)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:netcdfhdf4>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_DAP4)
|
||||
SET(liblib_LIBS ${liblib_LIBS} dap4)
|
||||
SET(liblib_LIBS ${liblib_LIBS} ncxml)
|
||||
ENDIF()
|
||||
if(ENABLE_DAP2)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:oc2>
|
||||
$<TARGET_OBJECTS:dap2>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_NCZARR)
|
||||
SET(liblib_LIBS ${liblib_LIBS} nczarr)
|
||||
ENDIF()
|
||||
if(ENABLE_DAP4)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:dap4>
|
||||
$<TARGET_OBJECTS:ncxml>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_S3_INTERNAL)
|
||||
SET(liblib_LIBS ${liblib_LIBS} ncxml)
|
||||
ENDIF()
|
||||
if(ENABLE_NCZARR)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:nczarr>
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_PLUGINS)
|
||||
SET(liblib_LIBS ${liblib_LIBS} ncpoco)
|
||||
ENDIF()
|
||||
if(ENABLE_S3_INTERNAL)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:ncxml>
|
||||
)
|
||||
endif()
|
||||
|
||||
FOREACH(LIBS ${liblib_LIBS})
|
||||
SET(LARGS ${LARGS} $<TARGET_NAME_IF_EXISTS:${LIBS}>)
|
||||
ENDFOREACH()
|
||||
if(ENABLE_PLUGINS)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:ncpoco>
|
||||
)
|
||||
endif()
|
||||
|
||||
ADD_LIBRARY(netcdf nc_initialize.c )
|
||||
target_link_libraries( netcdf ${LARGS} )
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nc_initialize.c
|
||||
)
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
# TODO: Make PUBLIC when other dependencies have PUBLIC/PRIVATE specified
|
||||
target_link_libraries(netcdf MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(netcdf PUBLIC MPI::MPI_C)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
IF(TARGET MPI::MPI_C)
|
||||
target_link_libraries(netcdf MPI::MPI_C)
|
||||
ENDIF(TARGET MPI::MPI_C)
|
||||
|
||||
IF(MOD_NETCDF_NAME)
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES LIBRARY_OUTPUT_NAME ${NETCDF_LIB_NAME})
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES ARCHIVE_OUTPUT_NAME ${NETCDF_LIB_NAME})
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES RUNTIME_OUTPUT_NAME ${NETCDF_LIB_NAME})
|
||||
ENDIF()
|
||||
if(MOD_NETCDF_NAME)
|
||||
set_target_properties(netcdf
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${NETCDF_LIB_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make sure that netcdf.dll path does not include the build configuration
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ENDIF()
|
||||
#if(MSVC)
|
||||
# set_target_properties(netcdf PROPERTIES
|
||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
# RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
# RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
#endif()
|
||||
|
||||
#####
|
||||
# Add dependencies required for linking.
|
||||
#####
|
||||
|
||||
SET(TLL_LIBS "")
|
||||
set(TLL_LIBS "")
|
||||
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
|
||||
set(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
|
||||
|
||||
# Add extra dependencies specified via NC_EXTRA_DEPS
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS})
|
||||
set(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS})
|
||||
|
||||
IF(ENABLE_NCZARR_ZIP)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
||||
ENDIF()
|
||||
if(ENABLE_NCZARR_ZIP)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
||||
endif()
|
||||
|
||||
IF(Blosc_FOUND)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Blosc_LIBRARIES})
|
||||
ENDIF()
|
||||
IF(Zstd_FOUND)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Zstd_LIBRARIES})
|
||||
ENDIF()
|
||||
IF(Bz2_FOUND)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Bz2_LIBRARIES})
|
||||
ENDIF()
|
||||
IF(SZIP_FOUND)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Szip_LIBRARY})
|
||||
ENDIF()
|
||||
if(Blosc_FOUND)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Blosc_LIBRARIES})
|
||||
endif()
|
||||
if(Zstd_FOUND)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Zstd_LIBRARIES})
|
||||
endif()
|
||||
if(Bz2_FOUND)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Bz2_LIBRARIES})
|
||||
endif()
|
||||
if(SZIP_FOUND)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Szip_LIBRARY})
|
||||
endif()
|
||||
|
||||
IF(HAVE_LIBDL)
|
||||
SET(TLL_LIBS ${LIBDL} ${TLL_LIBS})
|
||||
ENDIF()
|
||||
if(HAVE_LIBDL)
|
||||
set(TLL_LIBS ${LIBDL} ${TLL_LIBS})
|
||||
endif()
|
||||
|
||||
IF(ENABLE_NCZARR_ZIP)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
||||
ENDIF()
|
||||
if(ENABLE_NCZARR_ZIP)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
||||
endif()
|
||||
|
||||
IF(USE_HDF5)
|
||||
IF(NOT MSVC)
|
||||
# Some version of cmake define HDF5_hdf5_LIBRARY instead of
|
||||
# HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES
|
||||
IF(HDF5_hdf5_LIBRARY AND NOT HDF5_C_LIBRARIES)
|
||||
SET(HDF5_C_LIBRARIES ${HDF5_hdf5_LIBRARY})
|
||||
ENDIF()
|
||||
IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARIES)
|
||||
SET(HDF5_HL_LIBRARIES ${HDF5_hdf5_hl_LIBRARY})
|
||||
ENDIF()
|
||||
# The order of the libraries is important here for static
|
||||
# builds:
|
||||
# Make sure that HDF5_C_LIBRARY appears *after*
|
||||
# HDF5_HL_LIBRARY.
|
||||
SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${HDF5_LIBRARIES} ${TLL_LIBS} ${Szip_LIBRARY})
|
||||
ELSE() # Windows CMake defines HDF5_LIBRARIES.
|
||||
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${Szip_LIBRARY})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
if(USE_HDF5)
|
||||
set(TLL_LIBS HDF5::HDF5 hdf5::hdf5_hl ${TLL_LIBS} ${Szip_LIBRARY})
|
||||
endif()
|
||||
|
||||
IF(FOUND_CURL)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
|
||||
ENDIF()
|
||||
if(FOUND_CURL)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
IF(USE_HDF4)
|
||||
SET(TLL_LIBS ${HDF4_MFHDF_LIB} ${HDF4_DF_LIB} ${TLL_LIBS})
|
||||
ENDIF()
|
||||
if(USE_HDF4)
|
||||
set(TLL_LIBS ${HDF4_LIBRARIES} ${TLL_LIBS})
|
||||
endif()
|
||||
|
||||
IF(ENABLE_PNETCDF AND PNETCDF)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
|
||||
ENDIF()
|
||||
if(ENABLE_PNETCDF AND PNETCDF)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
|
||||
endif()
|
||||
|
||||
|
||||
IF(ENABLE_S3)
|
||||
IF(ENABLE_S3_AWS)
|
||||
TARGET_LINK_DIRECTORIES(netcdf PUBLIC ${AWSSDK_LIB_DIR})
|
||||
SET(TLL_LIBS ${AWSSDK_LINK_LIBRARIES} ${TLL_LIBS})
|
||||
ELSEIF(ENABLE_S3_INTERNAL)
|
||||
IF(OPENSSL_FOUND)
|
||||
SET(TLL_LIBS ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} ${TLL_LIBS})
|
||||
ENDIF(OPENSSL_FOUND)
|
||||
ENDIF(ENABLE_S3_AWS)
|
||||
ENDIF(ENABLE_S3)
|
||||
if(ENABLE_S3)
|
||||
if(ENABLE_S3_AWS)
|
||||
target_link_directories(netcdf PUBLIC ${AWSSDK_LIB_DIR})
|
||||
set(TLL_LIBS ${AWSSDK_LINK_LIBRARIES} ${TLL_LIBS})
|
||||
elseif(ENABLE_S3_INTERNAL)
|
||||
if(OPENSSL_FOUND)
|
||||
set(TLL_LIBS ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} ${TLL_LIBS})
|
||||
endif(OPENSSL_FOUND)
|
||||
endif(ENABLE_S3_AWS)
|
||||
endif(ENABLE_S3)
|
||||
|
||||
IF(HAVE_LIBXML2)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${LIBXML2_LIBRARIES})
|
||||
ENDIF()
|
||||
if(HAVE_LIBXML2)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${LIBXML2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
IF(NOT WIN32)
|
||||
IF(NOT APPLE)
|
||||
IF(CMAKE_DL_LIBS)
|
||||
TARGET_LINK_LIBRARIES(netcdf ${CMAKE_DL_LIBS})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
if(NOT WIN32)
|
||||
if(NOT APPLE)
|
||||
if(CMAKE_DL_LIBS)
|
||||
target_link_libraries(netcdf PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(TLL_LIBS)
|
||||
LIST(REMOVE_DUPLICATES TLL_LIBS)
|
||||
ENDIF()
|
||||
if(TLL_LIBS)
|
||||
list(REMOVE_DUPLICATES TLL_LIBS)
|
||||
endif()
|
||||
|
||||
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
|
||||
target_link_libraries(netcdf PRIVATE ${TLL_LIBS})
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TLL_LIBS})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TLL_LIBS})
|
||||
if(MSVC)
|
||||
set_target_properties(netcdf PROPERTIES
|
||||
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
IF(NOT MSVC)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES LINK_FLAGS -shared)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLE_SHARED_LIBRARY_VERSION)
|
||||
SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
||||
if(ENABLE_SHARED_LIBRARY_VERSION)
|
||||
set_target_properties(netcdf PROPERTIES
|
||||
VERSION ${netCDF_LIB_VERSION}
|
||||
SOVERSION ${netCDF_SO_VERSION}
|
||||
)
|
||||
ENDIF(ENABLE_SHARED_LIBRARY_VERSION)
|
||||
endif(ENABLE_SHARED_LIBRARY_VERSION)
|
||||
|
||||
###
|
||||
# The INCLUDES directive was introduced in 2.8.12.
|
||||
# However, 2.8.11 is still the default on some
|
||||
# popular linux distributions. See
|
||||
# https://github.com/Unidata/netcdf-c/issues/135
|
||||
# for more information.
|
||||
###
|
||||
IF(${CMAKE_VERSION} VERSION_LESS 2.8.12)
|
||||
INSTALL(
|
||||
TARGETS netcdf EXPORT netCDFTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
ELSE()
|
||||
INSTALL(
|
||||
TARGETS netcdf EXPORT netCDFTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
ENDIF()
|
||||
install(
|
||||
TARGETS netcdf EXPORT netCDFTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
|
||||
SET(NC_LIBS ${NC_LIBS} PARENT_SCOPE)
|
||||
set(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
|
||||
set(NC_LIBS ${NC_LIBS} PARENT_SCOPE)
|
||||
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
file(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
@ -1,8 +1,15 @@
|
||||
SET(libncpoco_SOURCES ncpoco.c ncpoco.h)
|
||||
IF(MSVC)
|
||||
SET(libncpoco_SOURCES ${libncpoco_SOURCES} cp_win32.c)
|
||||
ELSE()
|
||||
SET(libncpoco_SOURCES ${libncpoco_SOURCES} cp_unix.c)
|
||||
ENDIF()
|
||||
set(libncpoco_SOURCES ncpoco.c ncpoco.h)
|
||||
|
||||
if(MSVC)
|
||||
set(libncpoco_SOURCES ${libncpoco_SOURCES} cp_win32.c)
|
||||
else()
|
||||
set(libncpoco_SOURCES ${libncpoco_SOURCES} cp_unix.c)
|
||||
endif()
|
||||
|
||||
add_library(ncpoco OBJECT ${libncpoco_SOURCES})
|
||||
ADD_EXTRA_DIST(${libncpoco_SOURCES} CMakeLists.txt)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(ncpoco PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
add_extra_dist(${libncpoco_SOURCES} CMakeLists.txt)
|
||||
|
@ -1,14 +1,26 @@
|
||||
IF(HAVE_LIBXML2)
|
||||
SET(libncxml_SOURCES ncxml_xml2.c)
|
||||
ELSE()
|
||||
SET(libncxml_SOURCES ncxml_tinyxml2.cpp tinyxml2.cpp tinyxml2.h)
|
||||
ENDIF()
|
||||
if(HAVE_LIBXML2)
|
||||
set(libncxml_SOURCES ncxml_xml2.c)
|
||||
else()
|
||||
set(libncxml_SOURCES ncxml_tinyxml2.cpp tinyxml2.cpp tinyxml2.h)
|
||||
endif()
|
||||
|
||||
add_library(ncxml OBJECT ${libncxml_SOURCES})
|
||||
TARGET_INCLUDE_DIRECTORIES(ncxml PUBLIC ./include)
|
||||
if(HAVE_LIBXML2)
|
||||
target_include_directories(ncxml
|
||||
PUBLIC
|
||||
./include
|
||||
PRIVATE
|
||||
${LIBXML2_INCLUDE_DIRS}
|
||||
)
|
||||
else()
|
||||
target_include_directories(ncxml
|
||||
PUBLIC
|
||||
./include
|
||||
)
|
||||
endif(HAVE_LIBXML2)
|
||||
|
||||
#IF(NOT MSVC)
|
||||
#target_compile_features(ncxml PUBLIC cxx_std_11)
|
||||
#ENDIF()
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(ncxml PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
ADD_EXTRA_DIST(CMakeLists.txt license.txt)
|
||||
add_extra_dist(CMakeLists.txt license.txt)
|
||||
|
@ -8,7 +8,7 @@
|
||||
#add_compile_options("/showincludes")
|
||||
|
||||
# The source files for the HDF5 dispatch layer.
|
||||
SET(libnczarr_SOURCES
|
||||
set(libnczarr_SOURCES
|
||||
zarr.c
|
||||
zattr.c
|
||||
zxcache.c
|
||||
@ -46,24 +46,32 @@ zfilter.h
|
||||
zdebug.h
|
||||
)
|
||||
|
||||
IF(ENABLE_NCZARR_ZIP)
|
||||
SET(libnczarr_SOURCES ${libnczarr_SOURCES} zmap_zip.c)
|
||||
ENDIF()
|
||||
if(ENABLE_NCZARR_ZIP)
|
||||
set(libnczarr_SOURCES ${libnczarr_SOURCES} zmap_zip.c)
|
||||
endif()
|
||||
|
||||
IF(ENABLE_S3)
|
||||
SET(libnczarr_SOURCES ${libnczarr_SOURCES} zmap_s3sdk.c)
|
||||
ENDIF()
|
||||
if(ENABLE_S3)
|
||||
set(libnczarr_SOURCES ${libnczarr_SOURCES} zmap_s3sdk.c)
|
||||
endif()
|
||||
|
||||
# Build the Zarr dispatch layer as a library that will be included in
|
||||
# the netCDF library.
|
||||
|
||||
add_library(nczarr OBJECT ${libnczarr_SOURCES})
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(nczarr PUBLIC ../libncpoco)
|
||||
target_include_directories(nczarr PUBLIC ../libncpoco)
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
if (USE_HDF5)
|
||||
target_link_libraries(nczarr PRIVATE HDF5::HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(nczarr PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(nczarr PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
# Remember to package this file for CMake builds.
|
||||
ADD_EXTRA_DIST(${libnczarr_SOURCES} CMakeLists.txt)
|
||||
|
@ -1,7 +1,7 @@
|
||||
## This is a CMake file, part of Unidata's netCDF package.
|
||||
# Copyright 2012-2018, see the COPYRIGHT file for more information.
|
||||
|
||||
SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c
|
||||
set(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c
|
||||
nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c)
|
||||
|
||||
##
|
||||
@ -18,73 +18,84 @@ set_property(SOURCE httpio.c posixio.c mmapio.c
|
||||
SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
# Process these files with m4.
|
||||
SET(m4_SOURCES attr ncx putget)
|
||||
set(m4_SOURCES attr ncx putget)
|
||||
foreach (f ${m4_SOURCES})
|
||||
GEN_m4(${f} dest)
|
||||
LIST(APPEND libsrc_SOURCES ${dest})
|
||||
list(APPEND libsrc_SOURCES ${dest})
|
||||
endforeach(f)
|
||||
|
||||
LIST(APPEND libsrc_SOURCES pstdint.h ncio.h ncx.h)
|
||||
list(APPEND libsrc_SOURCES pstdint.h ncio.h ncx.h)
|
||||
|
||||
LIST(APPEND libsrc_SOURCES memio.c)
|
||||
list(APPEND libsrc_SOURCES memio.c)
|
||||
|
||||
IF (BUILD_MMAP)
|
||||
LIST(APPEND libsrc_SOURCES mmapio.c)
|
||||
ENDIF( BUILD_MMAP)
|
||||
if (BUILD_MMAP)
|
||||
list(APPEND libsrc_SOURCES mmapio.c)
|
||||
endif( BUILD_MMAP)
|
||||
|
||||
IF (USE_FFIO)
|
||||
LIST(APPEND libsrc_SOURCES ffio.c)
|
||||
ELSEIF (USE_STDIO)
|
||||
if (USE_FFIO)
|
||||
list(APPEND libsrc_SOURCES ffio.c)
|
||||
elseif (USE_STDIO)
|
||||
IST(APPEND libsrc_SOURCES ncstdio.c)
|
||||
ELSE (USE_FFIO)
|
||||
LIST(APPEND libsrc_SOURCES posixio.c)
|
||||
ENDIF (USE_FFIO)
|
||||
else (USE_FFIO)
|
||||
list(APPEND libsrc_SOURCES posixio.c)
|
||||
ENDif (USE_FFIO)
|
||||
|
||||
IF (ENABLE_BYTERANGE)
|
||||
LIST(APPEND libsrc_SOURCES httpio.c)
|
||||
IF (ENABLE_S3)
|
||||
LIST(APPEND libsrc_SOURCES s3io.c)
|
||||
ENDIF(ENABLE_S3)
|
||||
ENDIF(ENABLE_BYTERANGE)
|
||||
if (ENABLE_BYTERANGE)
|
||||
list(APPEND libsrc_SOURCES httpio.c)
|
||||
if (ENABLE_S3)
|
||||
list(APPEND libsrc_SOURCES s3io.c)
|
||||
endif(ENABLE_S3)
|
||||
endif(ENABLE_BYTERANGE)
|
||||
|
||||
add_library(netcdf3 OBJECT ${libsrc_SOURCES})
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(netcdf3 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
if (ENABLE_BYTERANGE)
|
||||
target_include_directories(netcdf3 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(netcdf3
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
endif (ENABLE_BYTERANGE)
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(netcdf3 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
# The C API man page.
|
||||
|
||||
SET(MAN_FILES netcdf.3)
|
||||
set(MAN_FILES netcdf.3)
|
||||
|
||||
set(ARGS_MANPAGE -DAPI=C)
|
||||
|
||||
IF (USE_HDF5)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
ENDIF(USE_HDF5)
|
||||
if (USE_HDF5)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
endif(USE_HDF5)
|
||||
|
||||
IF (BUILD_DAP)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
ENDIF(BUILD_DAP)
|
||||
if (BUILD_DAP)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
endif(BUILD_DAP)
|
||||
|
||||
IF (BUILD_PARALLEL)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
ENDIF(BUILD_PARALLEL)
|
||||
if (BUILD_PARALLEL)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
endif(BUILD_PARALLEL)
|
||||
|
||||
# Generate the man page.
|
||||
IF(HAVE_M4)
|
||||
if(HAVE_M4)
|
||||
|
||||
FILE(GLOB libsrc_MANPAGE ${CMAKE_CURRENT_SOURCE_DIR}/../docs/netcdf.m4)
|
||||
FILE(COPY ${libsrc_MANPAGE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
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
|
||||
|
||||
COMMAND ${NC_M4} ${ARGS_MANPAGE} "${CMAKE_CURRENT_BINARY_DIR}/netcdf.m4" > "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
if(NOT MSVC)
|
||||
add_custom_target(manpage ALL
|
||||
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)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" DESTINATION "share/man/man3" COMPONENT documentation)
|
||||
endif(NOT MSVC)
|
||||
|
||||
ENDIF()
|
||||
endif()
|
@ -6,18 +6,22 @@
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
# Process these files with m4.
|
||||
|
||||
SET(libsrc4_SOURCES nc4dispatch.c nc4attr.c nc4dim.c nc4grp.c
|
||||
set(libsrc4_SOURCES nc4dispatch.c nc4attr.c nc4dim.c nc4grp.c
|
||||
nc4internal.c nc4type.c nc4var.c ncfunc.c ncindex.c nc4cache.c)
|
||||
|
||||
add_library(netcdf4 OBJECT ${libsrc4_SOURCES})
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
target_link_libraries(netcdf4 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(netcdf4 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(netcdf4 PUBLIC MPI::MPI_C)
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
# Files for make dist
|
||||
FILE(GLOB libsrc4_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
SET(CUR_EXTRA_DIST CMakeLists.txt Makefile.am)
|
||||
file(GLOB libsrc4_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
set(CUR_EXTRA_DIST CMakeLists.txt Makefile.am)
|
||||
ADD_EXTRA_DIST("${libsrc4_SOURCES}")
|
||||
ADD_EXTRA_DIST("${libsrc4_HEADERS}")
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
@ -34,14 +38,15 @@ set(man_MANS netcdf.3)
|
||||
|
||||
set(ARGS_MANPAGE -DAPI=C)
|
||||
|
||||
IF (USE_HDF5)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
ENDIF(USE_HDF5)
|
||||
if (USE_HDF5)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE)
|
||||
target_link_libraries(netcdf4 PRIVATE HDF5::HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
IF (BUILD_DAP)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
ENDIF(BUILD_DAP)
|
||||
if (BUILD_DAP)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE)
|
||||
endif(BUILD_DAP)
|
||||
|
||||
IF (BUILD_PARALLEL)
|
||||
SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
ENDIF(BUILD_PARALLEL)
|
||||
if (BUILD_PARALLEL)
|
||||
set(ARGS_MANPAGE ${ARGS_MANPAGE} -DPARALLEL_IO=TRUE)
|
||||
endif(BUILD_PARALLEL)
|
||||
|
@ -5,8 +5,12 @@
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
SET(libsrcp_SOURCES ncpdispatch.c)
|
||||
|
||||
add_library(netcdfp OBJECT ${libsrcp_SOURCES})
|
||||
|
||||
ADD_EXTRA_DIST(${libsrcp_SOURCES} CMakeLists.txt)
|
||||
target_sources(netcdfp PRIVATE ncpdispatch.c)
|
||||
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(netcdfp PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
add_extra_dist(${libsrcp_SOURCES} CMakeLists.txt)
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#endif
|
||||
#include "netcdf.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#endif
|
||||
#include "netcdf.h"
|
||||
|
@ -9,20 +9,20 @@
|
||||
# remove_definitions(-DDLL_NETCDF)
|
||||
#ENDIF()
|
||||
|
||||
SET(RCMERGE OFF)
|
||||
set(RCMERGE OFF)
|
||||
|
||||
IF(USE_X_GETOPT)
|
||||
SET(XGETOPTSRC "${CMAKE_CURRENT_SOURCE_DIR}/../libdispatch/XGetopt.c")
|
||||
ENDIF()
|
||||
if(USE_X_GETOPT)
|
||||
set(XGETOPTSRC "${CMAKE_CURRENT_SOURCE_DIR}/../libdispatch/XGetopt.c")
|
||||
endif()
|
||||
|
||||
SET(ncdump_FILES ncdump.c vardata.c dumplib.c indent.c nctime0.c utils.c nciter.c ${XGETOPTSRC})
|
||||
SET(nccopy_FILES nccopy.c nciter.c chunkspec.c utils.c dimmap.c list.c ${XGETOPTSRC})
|
||||
SET(ocprint_FILES ocprint.c ${XGETOPTSRC})
|
||||
SET(ncvalidator_FILES ncvalidator.c ${XGETOPTSRC})
|
||||
SET(printfqn_FILES printfqn.c ${XGETOPTSRC})
|
||||
SET(ncpathcvt_FILES ncpathcvt.c ${XGETOPTSRC})
|
||||
SET(ncfilteravail_FILES ncfilteravail.c ${XGETOPTSRC})
|
||||
SET(nchdf5version_FILES nchdf5version.c)
|
||||
set(ncdump_FILES ncdump.c vardata.c dumplib.c indent.c nctime0.c utils.c nciter.c ${XGETOPTSRC})
|
||||
set(nccopy_FILES nccopy.c nciter.c chunkspec.c utils.c dimmap.c list.c ${XGETOPTSRC})
|
||||
set(ocprint_FILES ocprint.c ${XGETOPTSRC})
|
||||
set(ncvalidator_FILES ncvalidator.c ${XGETOPTSRC})
|
||||
set(printfqn_FILES printfqn.c ${XGETOPTSRC})
|
||||
set(ncpathcvt_FILES ncpathcvt.c ${XGETOPTSRC})
|
||||
set(ncfilteravail_FILES ncfilteravail.c ${XGETOPTSRC})
|
||||
set(nchdf5version_FILES nchdf5version.c)
|
||||
|
||||
##
|
||||
# Turn off inclusion of particular files when using the cmake-native
|
||||
@ -37,37 +37,36 @@ set_property(SOURCE dumplib.c
|
||||
PROPERTY
|
||||
SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
ADD_EXECUTABLE(ncdump ${ncdump_FILES})
|
||||
ADD_EXECUTABLE(nccopy ${nccopy_FILES})
|
||||
ADD_EXECUTABLE(ncvalidator ${ncvalidator_FILES})
|
||||
ADD_EXECUTABLE(ncpathcvt ${ncpathcvt_FILES})
|
||||
ADD_EXECUTABLE(ncfilteravail ${ncfilteravail_FILES})
|
||||
add_executable(ncdump ${ncdump_FILES})
|
||||
add_executable(nccopy ${nccopy_FILES})
|
||||
add_executable(ncvalidator ${ncvalidator_FILES})
|
||||
add_executable(ncpathcvt ${ncpathcvt_FILES})
|
||||
add_executable(ncfilteravail ${ncfilteravail_FILES})
|
||||
|
||||
IF(USE_HDF5)
|
||||
ADD_EXECUTABLE(nc4print nc4print.c nc4printer.c)
|
||||
ADD_EXECUTABLE(printfqn ${printfqn_FILES})
|
||||
ADD_EXECUTABLE(nchdf5version ${nchdf5version_FILES})
|
||||
ENDIF(USE_HDF5)
|
||||
if(USE_HDF5)
|
||||
add_executable(nc4print nc4print.c nc4printer.c)
|
||||
target_link_libraries(nc4print netcdf ${ALL_TLL_LIBS})
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
ADD_EXECUTABLE(ocprint ${ocprint_FILES})
|
||||
ENDIF(ENABLE_DAP)
|
||||
add_executable(printfqn ${printfqn_FILES})
|
||||
target_link_libraries(printfqn netcdf ${ALL_TLL_LIBS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ncdump netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(nccopy netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(ncvalidator netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(ncpathcvt netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(ncfilteravail netcdf ${ALL_TLL_LIBS})
|
||||
add_executable(nchdf5version ${nchdf5version_FILES})
|
||||
target_link_libraries(nchdf5version netcdf ${ALL_TLL_LIBS})
|
||||
endif(USE_HDF5)
|
||||
|
||||
IF(USE_HDF5)
|
||||
TARGET_LINK_LIBRARIES(nc4print netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(printfqn netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(nchdf5version netcdf ${ALL_TLL_LIBS})
|
||||
ENDIF(USE_HDF5)
|
||||
if(ENABLE_DAP)
|
||||
add_executable(ocprint ${ocprint_FILES})
|
||||
endif(ENABLE_DAP)
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
TARGET_LINK_LIBRARIES(ocprint netcdf ${ALL_TLL_LIBS})
|
||||
ENDIF(ENABLE_DAP)
|
||||
target_link_libraries(ncdump netcdf ${ALL_TLL_LIBS})
|
||||
target_link_libraries(nccopy netcdf ${ALL_TLL_LIBS})
|
||||
target_link_libraries(ncvalidator netcdf ${ALL_TLL_LIBS})
|
||||
target_link_libraries(ncpathcvt netcdf ${ALL_TLL_LIBS})
|
||||
target_link_libraries(ncfilteravail netcdf ${ALL_TLL_LIBS})
|
||||
|
||||
if(ENABLE_DAP)
|
||||
target_link_libraries(ocprint netcdf ${ALL_TLL_LIBS})
|
||||
endif(ENABLE_DAP)
|
||||
|
||||
####
|
||||
# We have to do a little tweaking
|
||||
@ -76,14 +75,14 @@ ENDIF(ENABLE_DAP)
|
||||
# test scripts to work.
|
||||
####
|
||||
|
||||
IF(MSVC)
|
||||
if(MSVC)
|
||||
macro(setbinprops name)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${name}
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
setbinprops(ncdump)
|
||||
@ -92,99 +91,101 @@ IF(MSVC)
|
||||
setbinprops(ncpathcvt)
|
||||
setbinprops(ncfilteravail)
|
||||
|
||||
IF(USE_HDF5)
|
||||
if(USE_HDF5)
|
||||
setbinprops(printfqn)
|
||||
setbinprops(nchdf5version)
|
||||
ENDIF(USE_HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
if(ENABLE_DAP)
|
||||
setbinprops(ocprint)
|
||||
ENDIF(ENABLE_DAP)
|
||||
endif(ENABLE_DAP)
|
||||
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLE_TESTS)
|
||||
|
||||
ADD_EXECUTABLE(rewrite-scalar rewrite-scalar.c)
|
||||
ADD_EXECUTABLE(bom bom.c)
|
||||
ADD_EXECUTABLE(tst_dimsizes tst_dimsizes.c)
|
||||
ADD_EXECUTABLE(nctrunc nctrunc.c)
|
||||
if(RCMERGE)
|
||||
ADD_EXECUTABLE(tst_rcmerge tst_rcmerge.c)
|
||||
ADD_EXECUTABLE(tst_rcmerge tst_rcapi.c)
|
||||
endif()
|
||||
TARGET_LINK_LIBRARIES(rewrite-scalar netcdf)
|
||||
TARGET_LINK_LIBRARIES(bom netcdf)
|
||||
TARGET_LINK_LIBRARIES(tst_dimsizes netcdf)
|
||||
TARGET_LINK_LIBRARIES(nctrunc netcdf)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
|
||||
add_executable(rewrite-scalar rewrite-scalar.c)
|
||||
add_executable(bom bom.c)
|
||||
add_executable(tst_dimsizes tst_dimsizes.c)
|
||||
add_executable(nctrunc nctrunc.c)
|
||||
if(RCMERGE)
|
||||
TARGET_LINK_LIBRARIES(tst_rcmerge netcdf)
|
||||
TARGET_LINK_LIBRARIES(tst_rcapi netcdf)
|
||||
add_executable(tst_rcmerge tst_rcmerge.c)
|
||||
add_executable(tst_rcmerge tst_rcapi.c)
|
||||
endif()
|
||||
target_link_libraries(rewrite-scalar netcdf)
|
||||
target_link_libraries(bom netcdf)
|
||||
target_link_libraries(tst_dimsizes netcdf)
|
||||
target_link_libraries(nctrunc netcdf)
|
||||
if(RCMERGE)
|
||||
target_link_libraries(tst_rcmerge netcdf)
|
||||
target_link_libraries(tst_rcapi netcdf)
|
||||
endif()
|
||||
|
||||
IF(USE_HDF5)
|
||||
ADD_EXECUTABLE(tst_fileinfo tst_fileinfo.c)
|
||||
TARGET_LINK_LIBRARIES(tst_fileinfo netcdf)
|
||||
add_executable(tst_fileinfo tst_fileinfo.c)
|
||||
target_link_libraries(tst_fileinfo netcdf ${ALL_TLL_LIBS})
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(rewrite-scalar
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(bom
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(tst_dimsizes
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(nctrunc PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(nctrunc PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(nctrunc PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(nctrunc
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
IF(RCMERGE)
|
||||
SET_TARGET_PROPERTIES(tst_rcmerge PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_rcmerge PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_rcmerge PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_rcapi PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_rcapi PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_rcapi PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
if(RCMERGE)
|
||||
set_target_properties(tst_rcmerge
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set_target_properties(tst_rcapi
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
IF(USE_HDF5)
|
||||
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
ENDIF(USE_HDF5)
|
||||
ENDIF(MSVC)
|
||||
if(USE_HDF5)
|
||||
set_target_properties(tst_fileinfo
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif(USE_HDF5)
|
||||
endif(MSVC)
|
||||
|
||||
# Build support programs
|
||||
build_bin_test_no_prefix(tst_utf8)
|
||||
build_bin_test_no_prefix(tst_fillbug)
|
||||
IF(USE_HDF5)
|
||||
if(USE_HDF5)
|
||||
build_bin_test_no_prefix(tst_h_rdc0)
|
||||
build_bin_test_no_prefix(tst_unicode)
|
||||
build_bin_test_no_prefix(tst_vlen_data)
|
||||
@ -203,14 +204,14 @@ endif()
|
||||
# Add this test by hand, as it is also called from a script.
|
||||
# Editing the script would break autotools compatibility.
|
||||
build_bin_test_no_prefix(tst_special_atts)
|
||||
ENDIF(USE_HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
# Base tests
|
||||
# The tests are set up as a combination of shell scripts and executables that
|
||||
# must be run in a particular order. It is painful but will use macros to help
|
||||
# keep it from being too bad.
|
||||
|
||||
IF(HAVE_BASH)
|
||||
if(HAVE_BASH)
|
||||
|
||||
## Start adding tests in the appropriate order
|
||||
add_bin_test_no_prefix(ref_ctest)
|
||||
@ -235,11 +236,11 @@ endif()
|
||||
add_sh_test(ncdump tst_ctests)
|
||||
|
||||
add_sh_test(ncdump tst_null_byte_padding)
|
||||
IF(USE_STRICT_NULL_BYTE_HEADER_PADDING)
|
||||
if(USE_STRICT_NULL_BYTE_HEADER_PADDING)
|
||||
SET_TESTS_PROPERTIES(ncdump_tst_null_byte_padding PROPERTIES WILL_FAIL TRUE)
|
||||
ENDIF(USE_STRICT_NULL_BYTE_HEADER_PADDING)
|
||||
endif(USE_STRICT_NULL_BYTE_HEADER_PADDING)
|
||||
|
||||
IF(NOT MSVC AND NOT MINGW)
|
||||
if(NOT MSVC AND NOT MINGW)
|
||||
add_sh_test(ncdump tst_output)
|
||||
add_sh_test(ncdump tst_nccopy3)
|
||||
# Known failure on MSVC; the number of 0's padding
|
||||
@ -248,12 +249,12 @@ endif()
|
||||
add_sh_test(ncdump tst_netcdf4)
|
||||
endif()
|
||||
|
||||
SET_TESTS_PROPERTIES(ncdump_tst_nccopy3 PROPERTIES DEPENDS
|
||||
set_tests_properties(ncdump_tst_nccopy3 PROPERTIES DEPENDS
|
||||
"ncdump_tst_calendars;ncdump_run_utf8_tests;ncdump_tst_output;ncdump_tst_64bit;ncdump_run_tests;ncdump_tst_lengths")
|
||||
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
IF(USE_HDF5)
|
||||
if(USE_HDF5)
|
||||
add_sh_test(ncdump tst_formatx4)
|
||||
add_sh_test(ncdump_sh tst_fillbug)
|
||||
add_sh_test(ncdump_shell tst_h_scalar)
|
||||
@ -272,31 +273,31 @@ endif()
|
||||
add_sh_test(ncdump tst_nccopy4)
|
||||
add_sh_test(ncdump tst_calendars_nc4)
|
||||
|
||||
SET_TESTS_PROPERTIES(ncdump_tst_nccopy4 PROPERTIES DEPENDS "ncdump_run_ncgen_tests;ncdump_tst_output;ncdump_tst_ncgen4;ncdump_sh_tst_fillbug;ncdump_tst_netcdf4_4;ncdump_tst_h_scalar;tst_comp;tst_comp2;tst_nans;tst_opaque_data;tst_create_files;tst_special_atts")
|
||||
SET_TESTS_PROPERTIES(ncdump_tst_nccopy5 PROPERTIES DEPENDS "ncdump_tst_nccopy4")
|
||||
set_tests_properties(ncdump_tst_nccopy4 PROPERTIES DEPENDS "ncdump_run_ncgen_tests;ncdump_tst_output;ncdump_tst_ncgen4;ncdump_sh_tst_fillbug;ncdump_tst_netcdf4_4;ncdump_tst_h_scalar;tst_comp;tst_comp2;tst_nans;tst_opaque_data;tst_create_files;tst_special_atts")
|
||||
set_tests_properties(ncdump_tst_nccopy5 PROPERTIES DEPENDS "ncdump_tst_nccopy4")
|
||||
|
||||
ENDIF(USE_HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
# The following test script invokes
|
||||
# gcc directly.
|
||||
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
IF(ENABLE_LARGE_FILE_TESTS)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
if(ENABLE_LARGE_FILE_TESTS)
|
||||
add_sh_test(ncdump tst_iter)
|
||||
ENDIF(ENABLE_LARGE_FILE_TESTS)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
endif(ENABLE_LARGE_FILE_TESTS)
|
||||
endif(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
|
||||
###
|
||||
# This test fails on Visual Studio builds with bash.
|
||||
# It passes, but technically fails because the scientific
|
||||
# formatting omits a 0.
|
||||
###
|
||||
IF(EXTRA_TESTS)
|
||||
IF(USE_HDF5)
|
||||
IF(NOT MSVC AND NOT MINGW)
|
||||
if(EXTRA_TESTS)
|
||||
if(USE_HDF5)
|
||||
if(NOT MSVC AND NOT MINGW)
|
||||
add_sh_test(ncdump run_back_comp_tests)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(EXTRA_TESTS)
|
||||
endif()
|
||||
endif()
|
||||
endif(EXTRA_TESTS)
|
||||
|
||||
# The unicode tests
|
||||
if(NOT ISMINGW)
|
||||
@ -304,11 +305,11 @@ endif()
|
||||
add_sh_test(ncdump test_unicode_path)
|
||||
ENDIF()
|
||||
|
||||
IF(USE_CDF5)
|
||||
if(USE_CDF5)
|
||||
add_sh_test(ncdump test_keywords)
|
||||
ENDIF()
|
||||
|
||||
IF(USE_HDF5)
|
||||
if(USE_HDF5)
|
||||
add_sh_test(ncdump test_scope)
|
||||
ENDIF()
|
||||
|
||||
@ -316,43 +317,43 @@ endif()
|
||||
add_sh_test(ncdump test_rcmerge)
|
||||
endif()
|
||||
|
||||
ENDIF(HAVE_BASH)
|
||||
endif(HAVE_BASH)
|
||||
|
||||
ENDIF(ENABLE_TESTS)
|
||||
endif(ENABLE_TESTS)
|
||||
|
||||
#IF(MSVC)
|
||||
# SET_TARGET_PROPERTIES(ncdump
|
||||
# set_target_properties(ncdump
|
||||
# PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
# )
|
||||
# SET_TARGET_PROPERTIES(nccopy
|
||||
# set_target_properties(nccopy
|
||||
# PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
# )
|
||||
# SET_TARGET_PROPERTIES(ncvalidator
|
||||
# set_target_properties(ncvalidator
|
||||
# PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
# )
|
||||
# IF(ENABLE_DAP)
|
||||
# SET_TARGET_PROPERTIES(ocprint
|
||||
# set_target_properties(ocprint
|
||||
# PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
# )
|
||||
# ENDIF(ENABLE_DAP)
|
||||
#ENDIF()
|
||||
|
||||
INSTALL(TARGETS ncdump RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
INSTALL(TARGETS nccopy RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
install(TARGETS ncdump RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
install(TARGETS nccopy RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
|
||||
SET(MAN_FILES nccopy.1 ncdump.1)
|
||||
set(MAN_FILES nccopy.1 ncdump.1)
|
||||
|
||||
# Note, the L512.bin file is file containing exactly 512 bytes each of value 0.
|
||||
# It is used for creating hdf5 files with varying offsets for testing.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1 ${CMAKE_CURRENT_SOURCE_DIR}/L512.bin ${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest*.c )
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
||||
file(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1 ${CMAKE_CURRENT_SOURCE_DIR}/L512.bin ${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest*.c )
|
||||
file(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
||||
|
||||
ADD_SUBDIRECTORY(cdl)
|
||||
ADD_SUBDIRECTORY(expected)
|
||||
add_subdirectory(cdl)
|
||||
add_subdirectory(expected)
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
||||
|
||||
IF(NOT MSVC)
|
||||
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation)
|
||||
ENDIF()
|
||||
if(NOT MSVC)
|
||||
install(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation)
|
||||
endif()
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "ncpathmgr.h"
|
||||
#include "nclog.h"
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
#endif
|
||||
|
@ -8,11 +8,6 @@
|
||||
#include "ncpathmgr.h"
|
||||
#include "nclist.h"
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NCZARR
|
||||
#include "zincludes.h"
|
||||
#endif
|
||||
|
@ -9,11 +9,6 @@
|
||||
#include "ncpathmgr.h"
|
||||
#include "nclist.h"
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NCZARR
|
||||
#include "zincludes.h"
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
#endif
|
||||
|
@ -38,15 +38,10 @@ data:
|
||||
\endcode
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#include <hdf5.h>
|
||||
#endif
|
||||
|
||||
#include "netcdf.h"
|
||||
|
||||
/* The HDF assigned id for bzip compression */
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#endif
|
||||
|
||||
|
@ -12,7 +12,7 @@ Test support for multiple filters per variable
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_HDF5_H
|
||||
#ifdef USE_HDF5
|
||||
#include <hdf5.h>
|
||||
#endif
|
||||
|
||||
|
@ -4,14 +4,23 @@
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
SET(oc_SOURCES oc.c daplex.c dapparse.c dapy.c occompile.c occurlfunctions.c ocdata.c ocdebug.c ocdump.c ocinternal.c ocnode.c ochttp.c ocread.c ocutil.c xxdr.c)
|
||||
|
||||
set(oc_SOURCES oc.c daplex.c dapparse.c dapy.c occompile.c occurlfunctions.c ocdata.c ocdebug.c ocdump.c ocinternal.c ocnode.c ochttp.c ocread.c ocutil.c xxdr.c)
|
||||
|
||||
add_library(oc2 OBJECT ${oc_SOURCES})
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
if (ENABLE_DLL)
|
||||
target_compile_definitions(oc2 PRIVATE DLL_NETCDF DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(oc2 PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
endif(STATUS_PARALLEL)
|
||||
target_link_libraries(oc2 PUBLIC ${CURL_LIBRARIES})
|
||||
target_include_directories(oc2 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(oc2
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
|
||||
# Apparently fails under cmake
|
||||
#set(ocprint_FILES ocprint.c )
|
||||
@ -19,8 +28,8 @@ ENDIF(STATUS_PARALLEL)
|
||||
#TARGET_LINK_LIBRARIES(ocprint oc2 ${ALL_TLL_LIBS})
|
||||
|
||||
## 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)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} dap.y)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ocauth.html)
|
||||
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)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} dap.y)
|
||||
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ocauth.html)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
@ -4,73 +4,77 @@
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
SET(CMAKE_BUILD_TYPE "")
|
||||
set(CMAKE_BUILD_TYPE "")
|
||||
|
||||
IF(MSVC)
|
||||
SET(PLUGINEXT "dll")
|
||||
SET(PLUGINPRE "__nc")
|
||||
ELSE()
|
||||
SET(PLUGINPRE "lib__nc")
|
||||
if(MSVC)
|
||||
set(PLUGINEXT "dll")
|
||||
set(PLUGINPRE "__nc")
|
||||
else()
|
||||
set(PLUGINPRE "lib__nc")
|
||||
if(APPLE)
|
||||
SET(PLUGINEXT "dylib")
|
||||
ELSE()
|
||||
SET(PLUGINEXT "so")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
set(PLUGINEXT "dylib")
|
||||
else()
|
||||
set(PLUGINEXT "so")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FILE(READ H5Znoop.c NOOP_SOURCE)
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c "#define NOOP_INSTANCE 1\n")
|
||||
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c "${NOOP_SOURCE}")
|
||||
file(READ H5Znoop.c NOOP_SOURCE)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c "#define NOOP_INSTANCE 1\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c "${NOOP_SOURCE}")
|
||||
|
||||
SET(h5misc_SOURCES H5Zmisc.c H5Zutil.c h5misc.h)
|
||||
set(h5misc_SOURCES H5Zmisc.c H5Zutil.c h5misc.h)
|
||||
|
||||
SET(h5noop_SOURCES H5Znoop.c H5Zutil.c h5noop.h)
|
||||
SET_SOURCE_FILES_PROPERTIES(H5Znoop.c PROPERTIES COMPILE_OPTIONS -DNOOP_INSTANCE=0)
|
||||
set(h5noop_SOURCES H5Znoop.c H5Zutil.c h5noop.h)
|
||||
set_source_files_properties(H5Znoop.c PROPERTIES COMPILE_OPTIONS -DNOOP_INSTANCE=0)
|
||||
|
||||
SET(h5noop1_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c H5Zutil.c h5noop.h)
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c PROPERTIES COMPILE_OPTIONS -DNOOP_INSTANCE=1)
|
||||
set(h5noop1_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c H5Zutil.c h5noop.h)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/H5Znoop1.c PROPERTIES COMPILE_OPTIONS -DNOOP_INSTANCE=1)
|
||||
|
||||
SET(h5unknown_SOURCES H5Zunknown.c)
|
||||
set(h5unknown_SOURCES H5Zunknown.c)
|
||||
|
||||
SET(h5shuffle_SOURCES H5Zshuffle.c)
|
||||
SET(h5fletcher32_SOURCES H5Zfletcher32.c H5checksum.c)
|
||||
SET(h5deflate_SOURCES H5Zdeflate.c)
|
||||
set(h5shuffle_SOURCES H5Zshuffle.c)
|
||||
set(h5fletcher32_SOURCES H5Zfletcher32.c H5checksum.c)
|
||||
set(h5deflate_SOURCES H5Zdeflate.c)
|
||||
|
||||
SET(nczmisc_SOURCES NCZmisc.c)
|
||||
SET(nczhdf5filters_SOURCES NCZhdf5filters.c)
|
||||
SET(nczstdfilters_SOURCES NCZstdfilters.c)
|
||||
set(nczmisc_SOURCES NCZmisc.c)
|
||||
set(nczhdf5filters_SOURCES NCZhdf5filters.c)
|
||||
set(nczstdfilters_SOURCES NCZstdfilters.c)
|
||||
|
||||
IF(ENABLE_PLUGINS)
|
||||
if(ENABLE_PLUGINS)
|
||||
# LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
|
||||
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
MACRO(buildplugin TARGET TARGETLIB)
|
||||
SET(MANGLELIB "${PLUGINPRE}${TARGETLIB}")
|
||||
ADD_LIBRARY(${TARGET} MODULE ${${TARGET}_SOURCES})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LIBRARY_OUTPUT_NAME ${MANGLELIB})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES ARCHIVE_OUTPUT_NAME ${MANGLELIB})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES RUNTIME_OUTPUT_NAME ${MANGLELIB})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES PREFIX "") # Critical that this be set to ""
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SUFFIX ".${PLUGINEXT}")
|
||||
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${ALL_TLL_LIBS};${ARGN})
|
||||
IF(MSVC)
|
||||
macro(buildplugin TARGET TARGETLIB)
|
||||
set(MANGLELIB "${PLUGINPRE}${TARGETLIB}")
|
||||
add_library(${TARGET} MODULE ${${TARGET}_SOURCES})
|
||||
set_target_properties(${TARGET} PROPERTIES LIBRARY_OUTPUT_NAME ${MANGLELIB})
|
||||
set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_NAME ${MANGLELIB})
|
||||
set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_NAME ${MANGLELIB})
|
||||
set_target_properties(${TARGET} PROPERTIES PREFIX "") # Critical that this be set to ""
|
||||
set_target_properties(${TARGET} PROPERTIES SUFFIX ".${PLUGINEXT}")
|
||||
target_link_libraries(${TARGET} PUBLIC ${ALL_TLL_LIBS};${ARGN})
|
||||
if(MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /Zi)
|
||||
# Tell linker to include symbol data
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF")
|
||||
# Set file name & location
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_PDB_NAME ${TARGET} COMPILE_PDB_OUTPUT_DIR ${CMAKE_BINARY_DIR})
|
||||
IF(MPI_C_INCLUDE_PATH)
|
||||
if(MPI_C_INCLUDE_PATH)
|
||||
target_include_directories(${TARGET} PRIVATE ${MPI_C_INCLUDE_PATH})
|
||||
ENDIF(MPI_C_INCLUDE_PATH)
|
||||
ENDIF()
|
||||
endif(MPI_C_INCLUDE_PATH)
|
||||
endif()
|
||||
|
||||
IF(STATUS_PARALLEL)
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(${TARGET} PUBLIC MPI::MPI_C)
|
||||
ENDIF(STATUS_PARALLEL)
|
||||
ENDMACRO()
|
||||
endif(STATUS_PARALLEL)
|
||||
|
||||
if (USE_HDF5)
|
||||
target_link_libraries(${TARGET} PRIVATE HDF5::HDF5)
|
||||
endif(USE_HDF5)
|
||||
endmacro()
|
||||
|
||||
buildplugin(h5misc "h5misc" netcdf)
|
||||
buildplugin(h5noop "h5noop")
|
||||
@ -85,67 +89,67 @@ buildplugin(nczmisc "zmisc")
|
||||
buildplugin(nczhdf5filters "zhdf5filters" netcdf)
|
||||
buildplugin(nczstdfilters "zstdfilters" netcdf)
|
||||
|
||||
IF(ENABLE_BLOSC)
|
||||
SET(h5blosc_SOURCES H5Zblosc.c)
|
||||
buildplugin(h5blosc "h5blosc" netcdf;${Blosc_LIBRARIES})
|
||||
ENDIF()
|
||||
if(ENABLE_BLOSC)
|
||||
set(h5blosc_SOURCES H5Zblosc.c)
|
||||
buildplugin(h5blosc "h5blosc" netcdf;${Blosc_LIBRARIES})
|
||||
endif()
|
||||
|
||||
IF(ENABLE_ZSTD)
|
||||
SET(h5zstd_SOURCES H5Zzstd.c H5Zzstd.h)
|
||||
buildplugin(h5zstd "h5zstd" netcdf;${Zstd_LIBRARIES})
|
||||
ENDIF()
|
||||
if(ENABLE_ZSTD)
|
||||
set(h5zstd_SOURCES H5Zzstd.c H5Zzstd.h)
|
||||
buildplugin(h5zstd "h5zstd" netcdf;${Zstd_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Need our version of szip if libsz available and we are not using HDF5
|
||||
IF(HAVE_SZ)
|
||||
SET(h5szip_SOURCES H5Zszip.c H5Zszip.h)
|
||||
if(HAVE_SZ)
|
||||
set(h5szip_SOURCES H5Zszip.c H5Zszip.h)
|
||||
buildplugin(h5szip "h5szip" ${Szip_LIBRARIES})
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
IF(HAVE_LOCAL_BZ2)
|
||||
SET(h5bzip2_SOURCES H5Zbzip2.c blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c bzlib.h bzlib_private.h)
|
||||
buildplugin(h5bzip2 "h5bzip2")
|
||||
ELSE()
|
||||
SET(h5bzip2_SOURCES H5Zbzip2.c)
|
||||
buildplugin(h5bzip2 "h5bzip2" ${Bzip2_LIBRARIES})
|
||||
ENDIF()
|
||||
if(HAVE_LOCAL_BZ2)
|
||||
set(h5bzip2_SOURCES H5Zbzip2.c blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c bzlib.h bzlib_private.h)
|
||||
buildplugin(h5bzip2 "h5bzip2")
|
||||
else()
|
||||
set(h5bzip2_SOURCES H5Zbzip2.c)
|
||||
buildplugin(h5bzip2 "h5bzip2" ${Bzip2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
# Installation
|
||||
IF(ENABLE_PLUGIN_INSTALL)
|
||||
if(ENABLE_PLUGIN_INSTALL)
|
||||
|
||||
MACRO(installplugin PLUG)
|
||||
SET(INSTALLED_PLUGIN_LIB "${PLUGINPRE}${PLUG}.${PLUGINEXT}")
|
||||
MESSAGE(STATUS "Installing: ${INSTALLED_PLUGIN_LIB} into ${PLUGIN_INSTALL_DIR}")
|
||||
macro(installplugin PLUG)
|
||||
set(INSTALLED_PLUGIN_LIB "${PLUGINPRE}${PLUG}.${PLUGINEXT}")
|
||||
message(STATUS "Installing: ${INSTALLED_PLUGIN_LIB} into ${PLUGIN_INSTALL_DIR}")
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${INSTALLED_PLUGIN_LIB} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
ENDMACRO()
|
||||
endmacro()
|
||||
|
||||
install(DIRECTORY DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
IF(Bzip2_FOUND)
|
||||
installplugin(h5bzip2)
|
||||
ENDIF()
|
||||
IF(Zstd_FOUND)
|
||||
installplugin(h5zstd)
|
||||
ENDIF()
|
||||
IF(Blosc_FOUND)
|
||||
installplugin(h5blosc)
|
||||
ENDIF()
|
||||
IF(ENABLE_NCZARR)
|
||||
if(Bzip2_FOUND)
|
||||
installplugin(h5bzip2)
|
||||
endif()
|
||||
if(Zstd_FOUND)
|
||||
installplugin(h5zstd)
|
||||
endif()
|
||||
if(Blosc_FOUND)
|
||||
installplugin(h5blosc)
|
||||
endif()
|
||||
if(ENABLE_NCZARR)
|
||||
installplugin(h5fletcher32)
|
||||
installplugin(h5shuffle)
|
||||
installplugin(h5deflate)
|
||||
installplugin(zhdf5filters)
|
||||
installplugin(zstdfilters)
|
||||
IF(Szip_FOUND)
|
||||
installplugin(h5szip)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
if(Szip_FOUND)
|
||||
installplugin(h5szip)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ENDIF(ENABLE_PLUGIN_INSTALL)
|
||||
endif(ENABLE_PLUGIN_INSTALL)
|
||||
|
||||
ENDIF(ENABLE_PLUGINS)
|
||||
endif(ENABLE_PLUGINS)
|
||||
|
||||
# Copy some test files from current source dir to out-of-tree build dir.
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
|
||||
IF(MSVC)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
|
||||
ENDIF()
|
||||
file(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
|
||||
if(MSVC)
|
||||
file(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user