From 4e645aeedf621b341c6b6d5665fecdd08314bda9 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 28 Feb 2023 19:06:50 -0600 Subject: 1.12 Add fetchcontent for compression libs and fix cmake config #2487 (#2493) * Add fetchcontent for compression libs and fix cmake config #2487 * Add CI test for FetchContent * Use LINK_COMP_LIBS instead of STATIC_LIBRARY for depends --- .github/workflows/codespell.yml | 2 +- .github/workflows/main.yml | 8 +- CMakeFilters.cmake | 123 +++-- CMakeLists.txt | 23 +- config/cmake/LIBAEC/CMakeLists.txt | 519 +++++++++++++++++++ config/cmake/LIBAEC/CPack.Info.plist.in | 26 + config/cmake/LIBAEC/config.h.in | 36 ++ config/cmake/LIBAEC/libaec-config-version.cmake.in | 42 ++ config/cmake/LIBAEC/libaec-config.cmake.in | 59 +++ config/cmake/ZLIB/CMakeLists.txt | 572 +++++++++++++++++++++ config/cmake/ZLIB/CPack.Info.plist.in | 26 + config/cmake/ZLIB/zconf.h.in | 536 +++++++++++++++++++ config/cmake/ZLIB/zlib-config-version.cmake.in | 42 ++ config/cmake/ZLIB/zlib-config.cmake.in | 58 +++ config/cmake/cacheinit.cmake | 15 +- config/cmake_ext_mod/HDFLibMacros.cmake | 126 ++--- config/cmake_ext_mod/HDFMacros.cmake | 2 + config/sanitizer/tools.cmake | 2 +- config/toolchain/GCC.cmake | 11 - config/toolchain/aarch64.cmake | 2 +- release_docs/INSTALL_CMake.txt | 48 +- release_docs/RELEASE.txt | 25 + 22 files changed, 2162 insertions(+), 141 deletions(-) create mode 100644 config/cmake/LIBAEC/CMakeLists.txt create mode 100644 config/cmake/LIBAEC/CPack.Info.plist.in create mode 100644 config/cmake/LIBAEC/config.h.in create mode 100644 config/cmake/LIBAEC/libaec-config-version.cmake.in create mode 100644 config/cmake/LIBAEC/libaec-config.cmake.in create mode 100644 config/cmake/ZLIB/CMakeLists.txt create mode 100644 config/cmake/ZLIB/CPack.Info.plist.in create mode 100644 config/cmake/ZLIB/zconf.h.in create mode 100644 config/cmake/ZLIB/zlib-config-version.cmake.in create mode 100644 config/cmake/ZLIB/zlib-config.cmake.in delete mode 100644 config/toolchain/GCC.cmake diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index ddd1700..1bd7ebc 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -12,4 +12,4 @@ jobs: - uses: codespell-project/actions-codespell@master with: skip: ./bin/trace,./hl/tools/h5watch/h5watch.c,./tools/test/h5jam/tellub.c,./config/sanitizer/LICENSE,./tools/test/h5repack/testfiles/*.dat - ignore_words_list: isnt,inout,nd,parms,parm,ba,offsetP,ser,ois,had,fiter,fo,clude,refere,minnum,offsetp,creat,ans:,eiter,lastr,ans,isn't,ifset,sur,trun,dne,tthe,hda,filname,te,htmp,minnum,ro,oce,ot + ignore_words_list: isnt,inout,nd,parms,parm,ba,offsetP,ser,ois,had,fiter,fo,clude,refere,minnum,offsetp,creat,ans:,eiter,lastr,ans,isn't,ifset,sur,trun,dne,tthe,hda,filname,te,htmp,minnum,ro,oce,ot,msdos diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4541473..80278ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,8 @@ jobs: cpp: ON fortran: OFF java: ON + libaecfc: ON + zlibfc: ON parallel: OFF mirror_vfd: OFF direct_vfd: OFF @@ -88,6 +90,8 @@ jobs: cpp: ON fortran: ON java: ON + libaecfc: ON + zlibfc: ON parallel: OFF mirror_vfd: ON direct_vfd: ON @@ -143,6 +147,8 @@ jobs: cpp: ON fortran: OFF java: ON + libaecfc: ON + zlibfc: ON parallel: OFF mirror_vfd: ON direct_vfd: OFF @@ -361,7 +367,7 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} -DHDF5_BUILD_CPP_LIB:BOOL=${{ matrix.cpp }} -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=${{ matrix.java }} -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} $GITHUB_WORKSPACE + cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} -DHDF5_BUILD_CPP_LIB:BOOL=${{ matrix.cpp }} -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=${{ matrix.java }} -DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} -DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} $GITHUB_WORKSPACE shell: bash if: (matrix.generator != 'autogen') && (! matrix.thread_safe.enabled) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 725390b..cac35d4 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -11,16 +11,44 @@ # option (USE_LIBAEC "Use AEC library as SZip Filter" OFF) option (USE_LIBAEC_STATIC "Use static AEC library " OFF) +option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0) +option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0) -include (ExternalProject) -include (FetchContent) +option (BUILD_ZLIB_WITH_FETCHCONTENT "Use FetchContent to use original source files" OFF) +if (BUILD_ZLIB_WITH_FETCHCONTENT) + set (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1) + if (NOT ZLIB_USE_LOCALCONTENT) + set (ZLIB_URL ${ZLIB_TGZ_ORIGPATH}/${ZLIB_TGZ_ORIGNAME}) + else () + set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_ORIGNAME}) + endif () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Filter ZLIB file is ${ZLIB_URL}") + endif () +endif () + +option (BUILD_SZIP_WITH_FETCHCONTENT "Use FetchContent to use original source files" OFF) +if (BUILD_SZIP_WITH_FETCHCONTENT) + # Only libaec library is usable + set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) + set (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) + if (NOT LIBAEC_USE_LOCALCONTENT) + set (SZIP_URL ${LIBAEC_TGZ_ORIGPATH}/${LIBAEC_TGZ_ORIGNAME}) + else () + set (SZIP_URL ${TGZPATH}/${LIBAEC_TGZ_ORIGNAME}) + endif () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Filter SZIP file is ${SZIP_URL}") + endif () +endif () +include (ExternalProject) #option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO") set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - option (ZLIB_USE_EXTERNAL "Use External Library Building for HDF5_ZLIB" 1) - option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) + set (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1) + set (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository") set (ZLIB_BRANCH ${ZLIB_GIT_BRANCH}) @@ -30,16 +58,20 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT if (NOT TGZPATH) set (TGZPATH ${HDF5_SOURCE_DIR}) endif () - set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) + if (NOT BUILD_ZLIB_WITH_FETCHCONTENT) + set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) + endif () if (NOT EXISTS "${ZLIB_URL}") set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Filter ZLIB file ${ZLIB_URL} not found") endif () endif () - set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) - if (USE_LIBAEC) - set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME}) + if (NOT BUILD_SZIP_WITH_FETCHCONTENT) + set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) + if (USE_LIBAEC) + set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME}) + endif () endif () if (NOT EXISTS "${SZIP_URL}") set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) @@ -63,20 +95,28 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) if (NOT ZLIB_FOUND) find_package (ZLIB) # Legacy find - if (ZLIB_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) - endif () endif () - endif () - if (ZLIB_FOUND) - set (H5_HAVE_FILTER_DEFLATE 1) - set (H5_HAVE_ZLIB_H 1) - set (H5_HAVE_LIBZ 1) - set (H5_ZLIB_HEADER "zlib.h") - set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + if (ZLIB_FOUND) + set (H5_HAVE_FILTER_DEFLATE 1) + set (H5_HAVE_ZLIB_H 1) + set (H5_HAVE_LIBZ 1) + set (H5_ZLIB_HEADER "zlib.h") + set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) + set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () else () - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + if (BUILD_ZLIB_WITH_FETCHCONTENT) + # Only tgz files available + ORIGINAL_ZLIB_LIBRARY ("TGZ") + set (H5_HAVE_FILTER_DEFLATE 1) + set (H5_HAVE_ZLIB_H 1) + set (H5_HAVE_LIBZ 1) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "HDF5_ZLIB is built from fetch content") + endif () + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) + elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) set (H5_HAVE_FILTER_DEFLATE 1) set (H5_HAVE_ZLIB_H 1) @@ -84,6 +124,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Filter HDF5_ZLIB is built") endif () + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) else () message (FATAL_ERROR " ZLib is Required for ZLib support in HDF5") endif () @@ -97,7 +138,6 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) if (H5_HAVE_FILTER_DEFLATE) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE") endif () - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Filter HDF5_ZLIB is ON") @@ -119,25 +159,40 @@ if (HDF5_ENABLE_SZIP_SUPPORT) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) endif () endif () - if (NOT SZIP_FOUND) find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) if (NOT SZIP_FOUND) find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - endif () + endif () + if (SZIP_FOUND) + set (H5_HAVE_FILTER_SZIP 1) + set (H5_HAVE_SZLIB_H 1) + set (H5_HAVE_LIBSZ 1) + set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) + set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) endif () endif () - endif () - if (SZIP_FOUND) - set (H5_HAVE_FILTER_SZIP 1) - set (H5_HAVE_SZLIB_H 1) - set (H5_HAVE_LIBSZ 1) - set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) else () - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + if (BUILD_SZIP_WITH_FETCHCONTENT) + # Only tgz files available + ORIGINAL_SZIP_LIBRARY ("TGZ" ${HDF5_ENABLE_SZIP_ENCODING}) + set (H5_HAVE_FILTER_SZIP 1) + set (H5_HAVE_SZLIB_H 1) + set (H5_HAVE_LIBSZ 1) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "SZIP is built from fetch content") + endif () + if (USE_LIBAEC) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "... with library AEC") + endif () + set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME}) + else () + set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) + endif () + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) + elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) set (H5_HAVE_FILTER_SZIP 1) set (H5_HAVE_SZLIB_H 1) @@ -153,11 +208,11 @@ if (HDF5_ENABLE_SZIP_SUPPORT) else () set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) endif () + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) else () message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") endif () endif () - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Filter SZIP is ON") diff --git a/CMakeLists.txt b/CMakeLists.txt index 73bf6bf..b038da0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,11 @@ if (POLICY CMP0083) cmake_policy (SET CMP0083 NEW) endif () +# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + #----------------------------------------------------------------------------- # Instructions for use : Normal Build # @@ -800,11 +805,11 @@ option (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_PACKAGE_EXTLIBS) set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) - if (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + if (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND AND NOT BUILD_ZLIB_WITH_FETCHCONTENT) PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) endif () - if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND AND NOT BUILD_SZIP_WITH_FETCHCONTENT) PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) endif () endif () @@ -889,20 +894,12 @@ endif () add_subdirectory (src) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - if (NOT ONLY_SHARED_LIBS) - add_dependencies (${HDF5_LIB_TARGET} HDF5_ZLIB) - endif () - if (BUILD_SHARED_LIBS) - add_dependencies (${HDF5_LIBSH_TARGET} HDF5_ZLIB) - endif () - endif () - if (SZIP_FOUND AND SZIP_USE_EXTERNAL) + if ((ZLIB_FOUND AND ZLIB_USE_EXTERNAL) OR (SZIP_FOUND AND SZIP_USE_EXTERNAL)) if (NOT ONLY_SHARED_LIBS) - add_dependencies (${HDF5_LIB_TARGET} SZIP) + add_dependencies (${HDF5_LIB_TARGET} ${LINK_COMP_LIBS}) endif () if (BUILD_SHARED_LIBS) - add_dependencies (${HDF5_LIBSH_TARGET} SZIP) + add_dependencies (${HDF5_LIBSH_TARGET} ${LINK_COMP_LIBS}) endif () endif () endif () diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt new file mode 100644 index 0000000..212c9bf --- /dev/null +++ b/config/cmake/LIBAEC/CMakeLists.txt @@ -0,0 +1,519 @@ +cmake_minimum_required (VERSION 3.10) +PROJECT (LIBAEC C) + +#----------------------------------------------------------------------------- +# Basic LIBAEC stuff here +#----------------------------------------------------------------------------- +set(CMAKE_C_STANDARD 99) + +set (LIBAEC_PACKAGE_EXT ${HDF_PACKAGE_EXT}) +set (HDF_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS}) +set (CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES}) +set (CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}) +set (PACKAGE_NAMESPACE ${HDF_PACKAGE_NAMESPACE}) +if (MINGW) + set (WINDOWS 1) # MinGW tries to imitate Windows +endif () +if (WINDOWS) + set (HAVE_SYS_STAT_H 1) + set (HAVE_SYS_TYPES_H 1) +endif () + +if (NOT WINDOWS) + TEST_BIG_ENDIAN (WORDS_BIGENDIAN) +endif () + +# Check for __builtin_clzll for faster decoding +check_c_source_compiles( + "int main(void)\n{return __builtin_clzll(1LL);}" + HAVE_DECL___BUILTIN_CLZLL) + +if(NOT HAVE_DECL___BUILTIN_CLZLL) + # With MSVC we can use _BitScanReverse64 + check_c_source_compiles( + "int main(void){unsigned long foo; unsigned __int64 bar=1LL; +return _BitScanReverse64(&foo, bar);}" + HAVE_BSR64) +endif() + +#----------------------------------------------------------------------------- +# Define some CMake variables for use later in the project +#----------------------------------------------------------------------------- +set (LIBAEC_RESOURCES_DIR ${HDF_RESOURCES_DIR}/LIBAEC) +set (LIBAEC_SRC_DIR ${LIBAEC_SOURCE_DIR}/src) +set (LIBAEC_INC_DIR ${LIBAEC_SOURCE_DIR}/include) + +#----------------------------------------------------------------------------- +# Set the core names of all the libraries +#----------------------------------------------------------------------------- +set (LIBAEC_LIB_CORENAME "aec") +set (SZIP_LIB_CORENAME "szaec") + +#----------------------------------------------------------------------------- +# Set the true names of all the libraries if customized by external project +#----------------------------------------------------------------------------- +set (LIBAEC_LIB_NAME "${LIBAEC_EXTERNAL_LIB_PREFIX}${LIBAEC_LIB_CORENAME}") +set (SZIP_LIB_NAME "${LIBAEC_EXTERNAL_LIB_PREFIX}${SZIP_LIB_CORENAME}") + +#----------------------------------------------------------------------------- +# Set the target names of all the libraries +#----------------------------------------------------------------------------- +set (LIBAEC_LIB_TARGET "${LIBAEC_LIB_CORENAME}-static") +set (SZIP_LIB_TARGET "${SZIP_LIB_CORENAME}-static") + +set (libaec_VERS_MAJOR 1) +set (libaec_VERS_MINOR 0) +set (libaec_VERS_RELEASE 6) + +#----------------------------------------------------------------------------- +set (LIBAEC_PACKAGE "libaec") +set (LIBAEC_PACKAGE_NAME "LIBAEC") +set (LIBAEC_PACKAGE_VERSION "${libaec_VERS_MAJOR}.${libaec_VERS_MINOR}") +set (LIBAEC_PACKAGE_VERSION_MAJOR "${libaec_VERS_MAJOR}.${libaec_VERS_MINOR}") +set (LIBAEC_PACKAGE_VERSION_MINOR "${libaec_VERS_RELEASE}") +set (LIBAEC_PACKAGE_STRING "${LIBAEC_PACKAGE_NAME} ${LIBAEC_PACKAGE_VERSION}") +set (LIBAEC_PACKAGE_TARNAME "${LIBAEC_PACKAGE_NAME}${LIBAEC_PACKAGE_EXT}") +set (LIBAEC_PACKAGE_URL "http://www.hdfgroup.org") +set (LIBAEC_PACKAGE_BUGREPORT "help@hdfgroup.org") +set (LIBAEC_PACKAGE_SOVERSION "${libaec_VERS_MAJOR}.${libaec_VERS_MINOR}.${libaec_VERS_RELEASE}") +set (LIBAEC_PACKAGE_SOVERSION_MAJOR "${libaec_VERS_MAJOR}") + + +HDF_DIR_PATHS(${LIBAEC_PACKAGE_NAME}) + +#----------------------------------------------------------------------------- +# Targets built within this project are exported at Install time for use +# by other projects +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXPORTED_TARGETS) + set (LIBAEC_EXPORTED_TARGETS "libaec-targets") +endif () + +#----------------------------------------------------------------------------- +# To include a library in the list exported by the project AT BUILD TIME, +# add it to this variable. This is NOT used by Make Install, but for projects +# which include SZIP as a sub-project within their build tree +#----------------------------------------------------------------------------- +set_global_variable (LIBAEC_LIBRARIES_TO_EXPORT "") + +#----------------------------------------------------------------------------- +# Mac OS X Options +#----------------------------------------------------------------------------- +if (LIBAEC_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") +endif () + +set (CMAKE_POSITION_INDEPENDENT_CODE ON) + +#----------------------------------------------------------------------------- +# When building utility executables that generate other (source) files : +# we make use of the following variables defined in the root CMakeLists. +# Certain systems may add /Debug or /Release to output paths +# and we need to call the executable from inside the CMake configuration +#----------------------------------------------------------------------------- +set (EXE_EXT "") +if (WIN32) + set (EXE_EXT ".exe") + add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + add_definitions (-D_CONSOLE) +endif () + +if (MSVC) + set (CMAKE_MFC_FLAG 0) +endif () + +set (MAKE_SYSTEM) +if (CMAKE_BUILD_TOOL MATCHES "make") + set (MAKE_SYSTEM 1) +endif () + +set (CFG_INIT "/${CMAKE_CFG_INTDIR}") +if (MAKE_SYSTEM) + set (CFG_INIT "") +endif () + +#----------------------------------------------------------------------------- +# Compiler specific flags : Shouldn't there be compiler tests for these +#----------------------------------------------------------------------------- +if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype") +endif () + +#----------------------------------------------------------------------------- +# This is in here to help some of the GCC based IDES like Eclipse +# and code blocks parse the compiler errors and warnings better. +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") +endif () + +#----------------------------------------------------------------------------- +# Generate the aec_config.h file containing user settings needed by compilation +#----------------------------------------------------------------------------- +configure_file (${LIBAEC_RESOURCES_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +#----------------------------------------------------------------------------- +# All libs/tests/examples need the main include directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${LIBAEC_BINARY_DIR} ${LIBAEC_SOURCE_DIR}/src ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + +#----------------------------------------------------------------------------- +# Define LIBAEC Library +#----------------------------------------------------------------------------- +set(LIBAEC_SRCS + ${LIBAEC_SRC_DIR}/encode.c + ${LIBAEC_SRC_DIR}/encode_accessors.c + ${LIBAEC_SRC_DIR}/decode.c +) + +set (LIBAEC_PUBLIC_HEADERS + ${LIBAEC_INC_DIR}/libaec.h +) + +add_library (${LIBAEC_LIB_TARGET} STATIC ${LIBAEC_SRCS} ${LIBAEC_PUBLIC_HEADERS}) +target_include_directories (${LIBAEC_LIB_TARGET} PUBLIC + "$" + "$" + "$" + "$") +TARGET_C_PROPERTIES (${LIBAEC_LIB_TARGET} STATIC) +target_link_libraries (${LIBAEC_LIB_TARGET} PRIVATE ${LINK_LIBS}) +H5_SET_LIB_OPTIONS (${LIBAEC_LIB_TARGET} ${LIBAEC_LIB_NAME} STATIC 0) +set_target_properties (${LIBAEC_LIB_TARGET} PROPERTIES + VERSION 0.0.12 SOVERSION 0 + PUBLIC_HEADER "${LIBAEC_PUBLIC_HEADERS}" + LINKER_LANGUAGE C + INTERFACE_INCLUDE_DIRECTORIES "$/include>" +) +set_global_variable (LIBAEC_LIBRARIES_TO_EXPORT ${LIBAEC_LIB_TARGET}) +set (install_targets ${LIBAEC_LIB_TARGET}) + +set(SZIP_SRCS + ${LIBAEC_SRC_DIR}/sz_compat.c +) + +set (SZIP_PUBLIC_HEADERS + ${LIBAEC_INC_DIR}/szlib.h +) + +add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) +target_include_directories (${SZIP_LIB_TARGET} PUBLIC "${LIBAEC_SOURCE_DIR};${LIBAEC_SOURCE_DIR}/include;${CMAKE_BINARY_DIR}") +TARGET_C_PROPERTIES (${SZIP_LIB_TARGET} STATIC) +target_link_libraries (${SZIP_LIB_TARGET} PRIVATE ${LIBAEC_LIB_TARGET}) +H5_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC 0) +set_target_properties (${SZIP_LIB_TARGET} PROPERTIES + VERSION 2.0.1 SOVERSION 2 + PUBLIC_HEADER "${SZIP_PUBLIC_HEADERS}" + LINKER_LANGUAGE C + INTERFACE_INCLUDE_DIRECTORIES "$/include>" +) +set_global_variable (LIBAEC_LIBRARIES_TO_EXPORT "${LIBAEC_LIBRARIES_TO_EXPORT};${SZIP_LIB_TARGET}") +set (install_targets ${install_targets} ${SZIP_LIB_TARGET}) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (LIBAEC_EXPORTED_TARGETS) + INSTALL_TARGET_PDB (${LIBAEC_LIB_TARGET} ${LIBAEC_INSTALL_BIN_DIR} libraries) + + install ( + TARGETS + ${install_targets} + EXPORT + ${LIBAEC_EXPORTED_TARGETS} + LIBRARY DESTINATION ${LIBAEC_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${LIBAEC_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${LIBAEC_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${LIBAEC_INSTALL_FWRK_DIR} COMPONENT libraries + PUBLIC_HEADER DESTINATION ${LIBAEC_INSTALL_INCLUDE_DIR} COMPONENT headers + ) +endif () + +include (CMakePackageConfigHelpers) + +#----------------------------------------------------------------------------- +# Check for Installation Utilities +#----------------------------------------------------------------------------- +if (WIN32) + set (PF_ENV_EXT "(x86)") + find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS") + if(NOT CPACK_WIX_ROOT) + file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + endif () + find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin") +endif () + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +#if (NOT LIBAEC_INSTALL_NO_DEVELOPMENT) +# install ( +# FILES ${PROJECT_BINARY_DIR}/aec_config.h +# DESTINATION ${LIBAEC_INSTALL_INCLUDE_DIR} +# COMPONENT headers +# ) +#endif () + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + install ( + EXPORT ${LIBAEC_EXPORTED_TARGETS} + DESTINATION ${LIBAEC_INSTALL_CMAKE_DIR} + FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Export all exported targets to the build tree for use by parent project +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + export ( + TARGETS ${LIBAEC_LIBRARIES_TO_EXPORT} ${LIBAEC_LIB_DEPENDENCIES} + FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + ) + export (PACKAGE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}) +endif () + +#----------------------------------------------------------------------------- +# Set includes needed for build +#----------------------------------------------------------------------------- +set (LIBAEC_INCLUDES_BUILD_TIME + ${LIBAEC_SRC_DIR} ${LIBAEC_INC_DIR} ${LIBAEC_BINARY_DIR} +) + +#----------------------------------------------------------------------------- +# Set variables needed for installation +#----------------------------------------------------------------------------- +set (LIBAEC_VERSION_STRING ${LIBAEC_PACKAGE_VERSION}) +set (LIBAEC_VERSION_MAJOR ${LIBAEC_PACKAGE_VERSION_MAJOR}) +set (LIBAEC_VERSION_MINOR ${LIBAEC_PACKAGE_VERSION_MINOR}) + +#----------------------------------------------------------------------------- +# Configure the libaec-config.cmake file for the build directory +#----------------------------------------------------------------------------- +set (INCLUDE_INSTALL_DIR ${LIBAEC_INSTALL_INCLUDE_DIR}) +set (SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LIBAEC_INSTALL_CMAKE_DIR}" ) +set (CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) +configure_package_config_file ( + ${LIBAEC_RESOURCES_DIR}/libaec-config.cmake.in + "${LIBAEC_BINARY_DIR}/${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${LIBAEC_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" +) + +#----------------------------------------------------------------------------- +# Configure the libaec-config.cmake file for the install directory +#----------------------------------------------------------------------------- +set (INCLUDE_INSTALL_DIR ${LIBAEC_INSTALL_INCLUDE_DIR}) +set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBAEC_INSTALL_CMAKE_DIR}" ) +set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}") +configure_package_config_file ( + ${LIBAEC_RESOURCES_DIR}/libaec-config.cmake.in + "${LIBAEC_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${LIBAEC_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR +) +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + install ( + FILES ${LIBAEC_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-config.cmake + DESTINATION ${LIBAEC_INSTALL_CMAKE_DIR} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Configure the libaec-config-version.cmake file for the install directory +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + configure_file ( + ${LIBAEC_RESOURCES_DIR}/libaec-config-version.cmake.in + ${LIBAEC_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-config-version.cmake @ONLY + ) + install ( + FILES ${LIBAEC_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-config-version.cmake + DESTINATION ${LIBAEC_INSTALL_CMAKE_DIR} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Add Document File(s) to CMake Install +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + install ( + FILES + ${LIBAEC_SOURCE_DIR}/README.md + ${LIBAEC_SOURCE_DIR}/INSTALL.md + ${LIBAEC_SOURCE_DIR}/CHANGELOG.md + DESTINATION ${LIBAEC_INSTALL_DATA_DIR} + COMPONENT documents + ) +endif () + +#----------------------------------------------------------------------------- +# Check for Installation Utilities +#----------------------------------------------------------------------------- +if (WIN32) + set (PF_ENV_EXT "(x86)") + find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS") + if(NOT CPACK_WIX_ROOT) + file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + endif() + find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin") +endif () + +#----------------------------------------------------------------------------- +# Set the cpack variables +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + set (CPACK_PACKAGE_VENDOR "HDF_Group") + set (CPACK_PACKAGE_NAME "${LIBAEC_PACKAGE_NAME}") + if (CDASH_LOCAL) + set (CPACK_PACKAGE_VERSION "${LIBAEC_PACKAGE_VERSION}") + else () + set (CPACK_PACKAGE_VERSION "${LIBAEC_PACKAGE_VERSION_STRING}") + endif () + set (CPACK_PACKAGE_VERSION_MAJOR "${LIBAEC_PACKAGE_VERSION_MAJOR}") + set (CPACK_PACKAGE_VERSION_MINOR "${LIBAEC_PACKAGE_VERSION_MINOR}") + set (CPACK_PACKAGE_VERSION_PATCH "") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") + set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.SZIP") + set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + set (CPACK_PACKAGE_RELOCATABLE TRUE) + set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "libaec - Adaptive Entropy Coding library by Deutsches Klimarechenzentrum GmbH") + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") + + set (CPACK_GENERATOR "TGZ") + if (WIN32) + set (CPACK_GENERATOR "ZIP") + + if (NSIS_EXECUTABLE) + list (APPEND CPACK_GENERATOR "NSIS") + endif () + # Installers for 32- vs. 64-bit CMake: + # - Root install directory (displayed to end user at installer-run time) + # - "NSIS package/display name" (text used in the installer GUI) + # - Registry key used to store info about the installation + set (CPACK_NSIS_PACKAGE_NAME "${LIBAEC_PACKAGE_STRING}") + if (CMAKE_CL_64) + set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION} (Win64)") + else () + set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + endif () + set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") + set (CPACK_NSIS_CONTACT "${LIBAEC_PACKAGE_BUGREPORT}") + set (CPACK_NSIS_MODIFY_PATH ON) + set (CPACK_NSIS_PACKAGE_NAME "LIBAEC ${LIBAEC_PACKAGE_VERSION}") + if (WIX_EXECUTABLE) + list (APPEND CPACK_GENERATOR "WIX") + endif () +#WiX variables + set (CPACK_WIX_UNINSTALL "1") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") + elseif (APPLE) + list (APPEND CPACK_GENERATOR "STGZ") + list (APPEND CPACK_GENERATOR "DragNDrop") + set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") + #set (CPACK_PACKAGE_ICON "${LIBAEC_RESOURCES_DIR}/hdf.icns") + + option (LIBAEC_PACK_MACOSX_FRAMEWORK "Package the LIBAEC Library in a Framework" OFF) + if (LIBAEC_PACK_MACOSX_FRAMEWORK AND LIBAEC_BUILD_FRAMEWORKS) + set (CPACK_BUNDLE_NAME "${LIBAEC_PACKAGE_STRING}") + set (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / + set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") + set (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}") + #----------------------------------------------------------------------------- + # Configure the Info.plist file for the install bundle + #----------------------------------------------------------------------------- + configure_file ( + ${LIBAEC_RESOURCES_DIR}/CPack.Info.plist.in + ${LIBAEC_BINARY_DIR}/CMakeFiles/Info.plist @ONLY + ) + configure_file ( + ${LIBAEC_RESOURCES_DIR}/PkgInfo.in + ${LIBAEC_BINARY_DIR}/CMakeFiles/PkgInfo @ONLY + ) + install ( + FILES ${LIBAEC_BINARY_DIR}/CMakeFiles/PkgInfo + DESTINATION .. + ) + endif () + else () + list (APPEND CPACK_GENERATOR "STGZ") + set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") + set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + + set (CPACK_DEBIAN_PACKAGE_SECTION "Libraries") + set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${LIBAEC_PACKAGE_BUGREPORT}") + +# list (APPEND CPACK_GENERATOR "RPM") + set (CPACK_RPM_PACKAGE_RELEASE "1") + set (CPACK_RPM_COMPONENT_INSTALL ON) + set (CPACK_RPM_PACKAGE_RELOCATABLE ON) + endif () + + # By default, do not warn when built on machines using only VS Express: + if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) + endif () + include (InstallRequiredSystemLibraries) + + set (CPACK_INSTALL_CMAKE_PROJECTS "${LIBAEC_BINARY_DIR};LIBAEC;libraries;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${LIBAEC_BINARY_DIR};LIBAEC;headers;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${LIBAEC_BINARY_DIR};LIBAEC;configinstall;/") + + set (CPACK_ALL_INSTALL_TYPES Full Developer User) + set (CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") + + set(CPACK_COMPONENTS_ALL libraries headers documents configinstall) + + include (CPack) + + cpack_add_component_group(Runtime) + + cpack_add_component_group(Documents + EXPANDED + DESCRIPTION "Release notes for libaec" + ) + + cpack_add_component_group(Development + EXPANDED + DESCRIPTION "All of the tools you'll need to develop applications" + ) + + cpack_add_component (libraries + DISPLAY_NAME "LIBAEC Libraries" + REQUIRED + GROUP Runtime + INSTALL_TYPES Full Developer User + ) + cpack_add_component (headers + DISPLAY_NAME "LIBAEC Headers" + DEPENDS libraries + GROUP Development + INSTALL_TYPES Full Developer + ) + cpack_add_component (documents + DISPLAY_NAME "LIBAEC Documents" + GROUP Documents + INSTALL_TYPES Full Developer + ) + cpack_add_component (configinstall + DISPLAY_NAME "LIBAEC CMake files" + DEPENDS libraries + GROUP Development + INSTALL_TYPES Full Developer User + ) + +endif () diff --git a/config/cmake/LIBAEC/CPack.Info.plist.in b/config/cmake/LIBAEC/CPack.Info.plist.in new file mode 100644 index 0000000..08d371b --- /dev/null +++ b/config/cmake/LIBAEC/CPack.Info.plist.in @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + @CPACK_PACKAGE_FILE_NAME@ + CFBundleIconFile + @CPACK_BUNDLE_ICON@ + CFBundleIdentifier + org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + @CPACK_PACKAGE_VERSIO@ + CFBundleShortVersionString + @CPACK_SHORT_VERSION_STRING@ + CSResourcesFileMapped + + + diff --git a/config/cmake/LIBAEC/config.h.in b/config/cmake/LIBAEC/config.h.in new file mode 100644 index 0000000..0442548 --- /dev/null +++ b/config/cmake/LIBAEC/config.h.in @@ -0,0 +1,36 @@ +#cmakedefine WORDS_BIGENDIAN +#cmakedefine01 HAVE_DECL___BUILTIN_CLZLL +#cmakedefine01 HAVE_BSR64 +#cmakedefine HAVE_SNPRINTF +#cmakedefine HAVE__SNPRINTF +#cmakedefine HAVE__SNPRINTF_S + +/* Name of package */ +#cmakedefine LIBAEC_PACKAGE "@LIBAEC_PACKAGE@" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine LIBAEC_PACKAGE_BUGREPORT "@LIBAEC_PACKAGE_BUGREPORT@" + +/* Define to the full name of this package. */ +#cmakedefine LIBAEC_PACKAGE_NAME "@LIBAEC_PACKAGE_NAME@" + +/* Define to the full name and version of this package. */ +#cmakedefine LIBAEC_PACKAGE_STRING "@LIBAEC_PACKAGE_STRING@" + +/* Define to the one symbol short name of this package. */ +#cmakedefine LIBAEC_PACKAGE_TARNAME "@LIBAEC_PACKAGE_TARNAME@" + +/* Define to the version of this package. */ +#cmakedefine LIBAEC_PACKAGE_VERSION "@LIBAEC_PACKAGE_VERSION@" + +/* Define to 1 if you have the ANSI C header files. */ +#cmakedefine STDC_HEADERS @STDC_HEADERS@ + +/* Version number of package */ +#define VERSION "@LIBAEC_PACKAGE_VERSION@" + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t diff --git a/config/cmake/LIBAEC/libaec-config-version.cmake.in b/config/cmake/LIBAEC/libaec-config-version.cmake.in new file mode 100644 index 0000000..4f0e7ae --- /dev/null +++ b/config/cmake/LIBAEC/libaec-config-version.cmake.in @@ -0,0 +1,42 @@ +#----------------------------------------------------------------------------- +# LIBAEC Version file for install directory +#----------------------------------------------------------------------------- + +set (PACKAGE_VERSION "@LIBAEC_VERSION_STRING@") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@LIBAEC_VERSION_MAJOR@") + + # exact match for version @LIBAEC_VERSION_MAJOR@.@LIBAEC_VERSION_MINOR@ + if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@LIBAEC_VERSION_MINOR@") + + # compatible with any version @LIBAEC_VERSION_MAJOR@.@LIBAEC_VERSION_MINOR@.x + set (PACKAGE_VERSION_COMPATIBLE TRUE) + + if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@LIBAEC_VERSION_RELEASE@") + set (PACKAGE_VERSION_EXACT TRUE) + + if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@LIBAEC_VERSION_SUBRELEASE@") + # not using this yet + endif () + endif () + else () + set (PACKAGE_VERSION_COMPATIBLE FALSE) + endif () + endif () +endif () + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() + diff --git a/config/cmake/LIBAEC/libaec-config.cmake.in b/config/cmake/LIBAEC/libaec-config.cmake.in new file mode 100644 index 0000000..36a116a --- /dev/null +++ b/config/cmake/LIBAEC/libaec-config.cmake.in @@ -0,0 +1,59 @@ +#----------------------------------------------------------------------------- +# LIBAEC Config file for compiling against LIBAEC build directory +#----------------------------------------------------------------------------- +@PACKAGE_INIT@ + +string(TOUPPER @LIBAEC_PACKAGE@ LIBAEC_PACKAGE_NAME) + +set (${LIBAEC_PACKAGE_NAME}_VALID_COMPONENTS static shared) + +#----------------------------------------------------------------------------- +# User Options +#----------------------------------------------------------------------------- +set (${LIBAEC_PACKAGE_NAME}_ENABLE_ENCODING @LIBAEC_ENABLE_ENCODING@) +set (${LIBAEC_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (${LIBAEC_PACKAGE_NAME}_EXPORT_LIBRARIES @LIBAEC_LIBRARIES_TO_EXPORT@) + +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +set (${LIBAEC_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") + +set (${LIBAEC_PACKAGE_NAME}_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") +set_and_check (${LIBAEC_PACKAGE_NAME}_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +set (${LIBAEC_PACKAGE_NAME}_VERSION_STRING @LIBAEC_VERSION_STRING@) +set (${LIBAEC_PACKAGE_NAME}_VERSION_MAJOR @LIBAEC_VERSION_MAJOR@) +set (${LIBAEC_PACKAGE_NAME}_VERSION_MINOR @LIBAEC_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already build LIBAEC as a subproject +#----------------------------------------------------------------------------- +if (NOT TARGET "@LIBAEC_PACKAGE@") + include (@PACKAGE_SHARE_INSTALL_DIR@/@LIBAEC_PACKAGE@@LIBAEC_PACKAGE_EXT@-targets.cmake) +endif () + +# Handle default component(static) : +if (NOT ${LIBAEC_PACKAGE_NAME}_FIND_COMPONENTS) + set (${LIBAEC_PACKAGE_NAME}_FIND_COMPONENTS static) + set (${LIBAEC_PACKAGE_NAME}_FIND_REQUIRED_static true) +endif () + +# Handle requested components: +list (REMOVE_DUPLICATES ${LIBAEC_PACKAGE_NAME}_FIND_COMPONENTS) +foreach (comp IN LISTS ${LIBAEC_PACKAGE_NAME}_FIND_COMPONENTS) + list (FIND ${LIBAEC_PACKAGE_NAME}_EXPORT_LIBRARIES "@LIBAEC_LIB_CORENAME@-${comp}" HAVE_COMP) + if (${HAVE_COMP} LESS 0) + set (${LIBAEC_PACKAGE_NAME}_${comp}_FOUND 0) + else () + set (${LIBAEC_PACKAGE_NAME}_${comp}_FOUND 1) + string(TOUPPER ${LIBAEC_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @LIBAEC_LIB_CORENAME@-${comp}) + endif () +endforeach () + +check_required_components (${LIBAEC_PACKAGE_NAME}) diff --git a/config/cmake/ZLIB/CMakeLists.txt b/config/cmake/ZLIB/CMakeLists.txt new file mode 100644 index 0000000..c74ecea --- /dev/null +++ b/config/cmake/ZLIB/CMakeLists.txt @@ -0,0 +1,572 @@ +cmake_minimum_required (VERSION 3.12) +PROJECT (ZLIB C) + +#----------------------------------------------------------------------------- +# Basic ZLIB stuff here +#----------------------------------------------------------------------------- +set (ZLIB_PACKAGE_EXT ${HDF_PACKAGE_EXT}) +set (HDF_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS}) +set (CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES}) +set (CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}) +set (PACKAGE_NAMESPACE ${HDF_PACKAGE_NAMESPACE}) +if (MINGW) + set (WINDOWS 1) # MinGW tries to imitate Windows +endif () +if (WINDOWS) + set (HAVE_STDDEF_H 1) + set (HAVE_SYS_TYPES_H 1) +endif () +# +# Check for unistd.h +# +check_include_file(unistd.h Z_HAVE_UNISTD_H) +CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY) +CHECK_FUNCTION_EXISTS (vsnprintf HAVE_VSNPRINTF) + +#----------------------------------------------------------------------------- +# Define some CMake variables for use later in the project +#----------------------------------------------------------------------------- +set (ZLIB_RESOURCES_DIR ${HDF_RESOURCES_DIR}/ZLIB) +set (ZLIB_SRC_DIR ${ZLIB_SOURCE_DIR}) + +#----------------------------------------------------------------------------- +# Set the core names of all the libraries +#----------------------------------------------------------------------------- +set (ZLIB_LIB_CORENAME "zlib") + +#----------------------------------------------------------------------------- +# Set the true names of all the libraries if customized by external project +#----------------------------------------------------------------------------- +set (ZLIB_LIB_NAME "${ZLIB_EXTERNAL_LIB_PREFIX}${ZLIB_LIB_CORENAME}") + +#----------------------------------------------------------------------------- +# Set the target names of all the libraries +#----------------------------------------------------------------------------- +set (ZLIB_LIB_TARGET "${ZLIB_LIB_CORENAME}-static") + +set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) + +#----------------------------------------------------------------------------- +# Generate the zconf.h file containing user settings needed by compilation +#----------------------------------------------------------------------------- +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) + +if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") + set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) +endif () + +#----------------------------------------------------------------------------- +# parse the full version number from zlib.h and include in ZLIB_VERS_INFO +#----------------------------------------------------------------------------- +file (READ ${ZLIB_SRC_DIR}/zlib.h _zlib_h_contents) +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VER_MAJOR[ \t]+([0-9]*).*$" + "\\1" ZLIB_VERS_MAJOR ${_zlib_h_contents}) +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VER_MINOR[ \t]+([0-9]*).*$" + "\\1" ZLIB_VERS_MINOR ${_zlib_h_contents}) +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VER_REVISION[ \t]+([0-9]*).*$" + "\\1" ZLIB_VERS_RELEASE ${_zlib_h_contents}) +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VER_SUBREVISION[ \t]+([0-9]*).*$" + "\\1" ZLIB_VERS_SUBRELEASE ${_zlib_h_contents}) +#message (STATUS "VERSION: ${ZLIB_VERS_MAJOR}.${ZLIB_VERS_MINOR}.${ZLIB_VERS_RELEASE}-${ZLIB_VERS_SUBRELEASE}") +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) +#message (STATUS "VERSION: ${ZLIB_FULL_VERSION}") + +#----------------------------------------------------------------------------- +set (ZLIB_PACKAGE "zlib") +set (ZLIB_PACKAGE_NAME "ZLIB") +set (ZLIB_PACKAGE_VERSION "${ZLIB_VERS_MAJOR}.${ZLIB_VERS_MINOR}") +set (ZLIB_PACKAGE_VERSION_MAJOR "${ZLIB_VERS_MAJOR}.${ZLIB_VERS_MINOR}") +set (ZLIB_PACKAGE_VERSION_MINOR "${ZLIB_VERS_RELEASE}") +set (ZLIB_PACKAGE_STRING "${ZLIB_PACKAGE_NAME} ${ZLIB_PACKAGE_VERSION}-${ZLIB_VERS_SUBRELEASE}") +set (ZLIB_PACKAGE_TARNAME "zlib") +set (ZLIB_PACKAGE_URL "http://www.hdfgroup.org") +set (ZLIB_PACKAGE_BUGREPORT "help@hdfgroup.org") +set (ZLIB_PACKAGE_SOVERSION "${ZLIB_VERS_MAJOR}.${ZLIB_VERS_MINOR}.${ZLIB_VERS_RELEASE}") +set (ZLIB_PACKAGE_SOVERSION_MAJOR "${ZLIB_VERS_MAJOR}") + + +HDF_DIR_PATHS(${ZLIB_PACKAGE_NAME}) + +#----------------------------------------------------------------------------- +# Targets built within this project are exported at Install time for use +# by other projects +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXPORTED_TARGETS) + set (ZLIB_EXPORTED_TARGETS "zlib-targets") +endif () + +#----------------------------------------------------------------------------- +# To include a library in the list exported by the project AT BUILD TIME, +# add it to this variable. This is NOT used by Make Install, but for projects +# which include zlib as a sub-project within their build tree +#----------------------------------------------------------------------------- +set_global_variable (ZLIB_LIBRARIES_TO_EXPORT "") + +set (CMAKE_POSITION_INDEPENDENT_CODE ON) + +#----------------------------------------------------------------------------- +# When building utility executables that generate other (source) files : +# we make use of the following variables defined in the root CMakeLists. +# Certain systems may add /Debug or /Release to output paths +# and we need to call the executable from inside the CMake configuration +#----------------------------------------------------------------------------- +set (EXE_EXT "") +if (WIN32) + set (EXE_EXT ".exe") + add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + add_definitions (-D_CONSOLE) + add_definitions (-D_CRT_NONSTDC_NO_DEPRECATE) +endif () + +if (MSVC) + set (CMAKE_MFC_FLAG 0) +endif () + +set (MAKE_SYSTEM) +if (CMAKE_BUILD_TOOL MATCHES "make") + set (MAKE_SYSTEM 1) +endif () + +set (CFG_INIT "/${CMAKE_CFG_INTDIR}") +if (MAKE_SYSTEM) + set (CFG_INIT "") +endif () + +#----------------------------------------------------------------------------- +# Compiler specific flags : Shouldn't there be compiler tests for these +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-strict-prototypes") +endif () +if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype -Wno-implicit-function-declaration") +endif () + +#----------------------------------------------------------------------------- +# This is in here to help some of the GCC based IDES like Eclipse +# and code blocks parse the compiler errors and warnings better. +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") +endif () + +#----------------------------------------------------------------------------- +# All libs/tests/examples need the main include directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${ZLIB_BINARY_DIR} ${ZLIB_SOURCE_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + +#============================================================================ +# zlib +#============================================================================ + +#----------------------------------------------------------------------------- +# Define zlib Library +#----------------------------------------------------------------------------- +set(ZLIB_PUBLIC_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h + zlib.h +) +set(ZLIB_PRIVATE_HDRS + crc32.h + deflate.h + gzguts.h + inffast.h + inffixed.h + inflate.h + inftrees.h + trees.h + zutil.h +) +set(ZLIB_SRCS + adler32.c + compress.c + crc32.c + deflate.c + gzclose.c + gzlib.c + gzread.c + gzwrite.c + inflate.c + infback.c + inftrees.c + inffast.c + trees.c + uncompr.c + zutil.c +) + +if(NOT MINGW) + set(ZLIB_DLL_SRCS + win32/zlib1.rc # If present will override custom build rule below. + ) +endif() + +if(CMAKE_COMPILER_IS_GNUCC) + if(ASM686) + set(ZLIB_ASMS contrib/asm686/match.S) + elseif (AMD64) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties (${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) + endif() +endif() + +if(MSVC) + if(ASM686) + enable_language(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx86/inffas32.asm + contrib/masmx86/match686.asm + ) + elseif (AMD64) + enable_language(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx64/gvmat64.asm + contrib/masmx64/inffasx64.asm + ) + endif() + + if(ZLIB_ASMS) + add_definitions(-DASMV -DASMINF) + endif() +endif() + +if(MINGW) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + COMMAND ${CMAKE_RC_COMPILER} + -D GCC_WINDRES + -I ${CMAKE_CURRENT_SOURCE_DIR} + -I ${CMAKE_CURRENT_BINARY_DIR} + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) +endif() + +add_library (${ZLIB_LIB_TARGET} STATIC ${ZLIB_SRCS} ${ZLIB_PRIVATE_HDRS} ${ZLIB_PUBLIC_HDRS}) +if (MSVC AND CMAKE_CL_64) + set_target_properties (${ZLIB_LIB_TARGET} PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") +endif () +target_include_directories(${ZLIB_LIB_TARGET} PRIVATE "${CMAKE_BINARY_DIR}") +TARGET_C_PROPERTIES (${ZLIB_LIB_TARGET} STATIC) +target_link_libraries (${ZLIB_LIB_TARGET} PRIVATE ${LINK_LIBS}) +H5_SET_LIB_OPTIONS (${ZLIB_LIB_TARGET} ${ZLIB_LIB_NAME} STATIC 0) +set_target_properties(${ZLIB_LIB_TARGET} PROPERTIES + PUBLIC_HEADER "${ZLIB_PUBLIC_HEADERS}" + LINKER_LANGUAGE C + INTERFACE_INCLUDE_DIRECTORIES "$/include>" +) +set_global_variable (ZLIB_LIBRARIES_TO_EXPORT ${ZLIB_LIB_TARGET}) +set (install_targets ${ZLIB_LIB_TARGET}) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (ZLIB_EXPORTED_TARGETS) + INSTALL_TARGET_PDB (${ZLIB_LIB_TARGET} ${ZLIB_INSTALL_BIN_DIR} libraries) + + install ( + TARGETS + ${install_targets} + EXPORT + ${ZLIB_EXPORTED_TARGETS} + LIBRARY DESTINATION ${ZLIB_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${ZLIB_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${ZLIB_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${ZLIB_INSTALL_FWRK_DIR} COMPONENT libraries + PUBLIC_HEADER DESTINATION ${ZLIB_INSTALL_INCLUDE_DIR} COMPONENT headers + ) +endif () + +include (CMakePackageConfigHelpers) + +#----------------------------------------------------------------------------- +# Check for Installation Utilities +#----------------------------------------------------------------------------- +if (WIN32) + set (PF_ENV_EXT "(x86)") + find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS") + if(NOT CPACK_WIX_ROOT) + file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + endif () + find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin") +endif () + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +if (NOT ZLIB_INSTALL_NO_DEVELOPMENT) + install ( + FILES ${PROJECT_BINARY_DIR}/zconf.h + DESTINATION ${ZLIB_INSTALL_INCLUDE_DIR} + COMPONENT headers + ) +endif () + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + install ( + EXPORT ${ZLIB_EXPORTED_TARGETS} + DESTINATION ${ZLIB_INSTALL_CMAKE_DIR} + FILE ${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Export all exported targets to the build tree for use by parent project +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + export ( + TARGETS ${ZLIB_LIBRARIES_TO_EXPORT} ${ZLIB_LIB_DEPENDENCIES} + FILE ${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + ) + export (PACKAGE ${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}) +endif () + +#----------------------------------------------------------------------------- +# Set includes needed for build +#----------------------------------------------------------------------------- +set (ZLIB_INCLUDES_BUILD_TIME + ${ZLIB_SRC_DIR} ${ZLIB_BINARY_DIR} +) + +#----------------------------------------------------------------------------- +# Set variables needed for installation +#----------------------------------------------------------------------------- +set (ZLIB_VERSION_STRING ${ZLIB_PACKAGE_VERSION}) +set (ZLIB_VERSION_MAJOR ${ZLIB_PACKAGE_VERSION_MAJOR}) +set (ZLIB_VERSION_MINOR ${ZLIB_PACKAGE_VERSION_MINOR}) + +#----------------------------------------------------------------------------- +# Configure the zlib-config.cmake file for the build directory +#----------------------------------------------------------------------------- +set (INCLUDE_INSTALL_DIR ${ZLIB_INSTALL_INCLUDE_DIR}) +set (SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ZLIB_INSTALL_CMAKE_DIR}" ) +set (CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) +configure_package_config_file ( + ${ZLIB_RESOURCES_DIR}/zlib-config.cmake.in + "${ZLIB_BINARY_DIR}/${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${ZLIB_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" +) + +#----------------------------------------------------------------------------- +# Configure the zlib-config.cmake file for the install directory +#----------------------------------------------------------------------------- +set (INCLUDE_INSTALL_DIR ${ZLIB_INSTALL_INCLUDE_DIR}) +set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${ZLIB_INSTALL_CMAKE_DIR}" ) +set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) +configure_package_config_file ( + ${ZLIB_RESOURCES_DIR}/zlib-config.cmake.in + "${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${ZLIB_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR +) +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + install ( + FILES ${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-config.cmake + DESTINATION ${ZLIB_INSTALL_CMAKE_DIR} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Configure the ZLIB-config-version.cmake file for the install directory +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + configure_file ( + ${ZLIB_RESOURCES_DIR}/zlib-config-version.cmake.in + ${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-config-version.cmake @ONLY + ) + install ( + FILES ${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${ZLIB_PACKAGE}${ZLIB_PACKAGE_EXT}-config-version.cmake + DESTINATION ${ZLIB_INSTALL_CMAKE_DIR} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Add Document File(s) to CMake Install +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + install ( + FILES + ${ZLIB_SOURCE_DIR}/FAQ + ${ZLIB_SOURCE_DIR}/README + ${ZLIB_SOURCE_DIR}/INDEX + DESTINATION ${ZLIB_INSTALL_DATA_DIR} + COMPONENT documents + ) +endif () + +#----------------------------------------------------------------------------- +# Check for Installation Utilities +#----------------------------------------------------------------------------- +if (WIN32) + set (PF_ENV_EXT "(x86)") + find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS") + if(NOT CPACK_WIX_ROOT) + file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + endif() + find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin") +endif () + +#----------------------------------------------------------------------------- +# Set the cpack variables +#----------------------------------------------------------------------------- +if (NOT ZLIB_EXTERNALLY_CONFIGURED) + set (CPACK_PACKAGE_VENDOR "HDF_Group") + set (CPACK_PACKAGE_NAME "${ZLIB_PACKAGE_NAME}") + if (CDASH_LOCAL) + set (CPACK_PACKAGE_VERSION "${ZLIB_PACKAGE_VERSION}") + else () + set (CPACK_PACKAGE_VERSION "${ZLIB_PACKAGE_VERSION_STRING}") + endif () + set (CPACK_PACKAGE_VERSION_MAJOR "${ZLIB_PACKAGE_VERSION_MAJOR}") + set (CPACK_PACKAGE_VERSION_MINOR "${ZLIB_PACKAGE_VERSION_MINOR}") + set (CPACK_PACKAGE_VERSION_PATCH "") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README") + set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") + set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") + set (CPACK_PACKAGE_RELOCATABLE TRUE) + set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "zlib Installation") + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") + + set (CPACK_GENERATOR "TGZ") + if (WIN32) + set (CPACK_GENERATOR "ZIP") + + if (NSIS_EXECUTABLE) + list (APPEND CPACK_GENERATOR "NSIS") + endif () + # Installers for 32- vs. 64-bit CMake: + # - Root install directory (displayed to end user at installer-run time) + # - "NSIS package/display name" (text used in the installer GUI) + # - Registry key used to store info about the installation + set (CPACK_NSIS_PACKAGE_NAME "${ZLIB_PACKAGE_STRING}") + if (CMAKE_CL_64) + set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION} (Win64)") + else () + set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + endif () + set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") + set (CPACK_NSIS_CONTACT "${ZLIB_PACKAGE_BUGREPORT}") + set (CPACK_NSIS_MODIFY_PATH ON) + set (CPACK_NSIS_PACKAGE_NAME "ZLIB ${ZLIB_PACKAGE_VERSION}") + if (WIX_EXECUTABLE) + list (APPEND CPACK_GENERATOR "WIX") + endif () +#WiX variables + set (CPACK_WIX_UNINSTALL "1") + set (CPACK_RESOURCE_FILE_LICENSE "${JPEG_BINARY_DIR}/README") + elseif (APPLE) + list (APPEND CPACK_GENERATOR "STGZ") + list (APPEND CPACK_GENERATOR "DragNDrop") + set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") + #set (CPACK_PACKAGE_ICON "${ZLIB_RESOURCES_DIR}/hdf.icns") + + option (ZLIB_PACK_MACOSX_FRAMEWORK "Package the ZLIB Library in a Framework" OFF) + if (ZLIB_PACK_MACOSX_FRAMEWORK AND ZLIB_BUILD_FRAMEWORKS) + set (CPACK_BUNDLE_NAME "${ZLIB_PACKAGE_STRING}") + set (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / + set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") + set (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}") + #----------------------------------------------------------------------------- + # Configure the Info.plist file for the install bundle + #----------------------------------------------------------------------------- + configure_file ( + ${ZLIB_RESOURCES_DIR}/CPack.Info.plist.in + ${ZLIB_BINARY_DIR}/CMakeFiles/Info.plist @ONLY + ) + configure_file ( + ${ZLIB_RESOURCES_DIR}/PkgInfo.in + ${ZLIB_BINARY_DIR}/CMakeFiles/PkgInfo @ONLY + ) + install ( + FILES ${ZLIB_BINARY_DIR}/CMakeFiles/PkgInfo + DESTINATION .. + ) + endif () + else () + list (APPEND CPACK_GENERATOR "STGZ") + set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") + set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + + set (CPACK_DEBIAN_PACKAGE_SECTION "Libraries") + set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${ZLIB_PACKAGE_BUGREPORT}") + +# list (APPEND CPACK_GENERATOR "RPM") + set (CPACK_RPM_PACKAGE_RELEASE "1") + set (CPACK_RPM_COMPONENT_INSTALL ON) + set (CPACK_RPM_PACKAGE_RELOCATABLE ON) + endif () + + # By default, do not warn when built on machines using only VS Express: + if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) + endif () + include (InstallRequiredSystemLibraries) + + set (CPACK_INSTALL_CMAKE_PROJECTS "${ZLIB_BINARY_DIR};ZLIB;libraries;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${ZLIB_BINARY_DIR};ZLIB;headers;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${ZLIB_BINARY_DIR};ZLIB;configinstall;/") + + set (CPACK_ALL_INSTALL_TYPES Full Developer User) + set (CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") + + set(CPACK_COMPONENTS_ALL libraries headers documents configinstall) + + include (CPack) + + cpack_add_component_group(Runtime) + + cpack_add_component_group(Documents + EXPANDED + DESCRIPTION "Release notes for zlib" + ) + + cpack_add_component_group(Development + EXPANDED + DESCRIPTION "All of the tools you'll need to develop applications" + ) + + cpack_add_component (libraries + DISPLAY_NAME "ZLIB Libraries" + REQUIRED + GROUP Runtime + INSTALL_TYPES Full Developer User + ) + cpack_add_component (headers + DISPLAY_NAME "ZLIB Headers" + DEPENDS libraries + GROUP Development + INSTALL_TYPES Full Developer + ) + cpack_add_component (documents + DISPLAY_NAME "ZLIB Documents" + GROUP Documents + INSTALL_TYPES Full Developer + ) + cpack_add_component (configinstall + DISPLAY_NAME "ZLIB CMake files" + DEPENDS libraries + GROUP Development + INSTALL_TYPES Full Developer User + ) + +endif () diff --git a/config/cmake/ZLIB/CPack.Info.plist.in b/config/cmake/ZLIB/CPack.Info.plist.in new file mode 100644 index 0000000..08d371b --- /dev/null +++ b/config/cmake/ZLIB/CPack.Info.plist.in @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + @CPACK_PACKAGE_FILE_NAME@ + CFBundleIconFile + @CPACK_BUNDLE_ICON@ + CFBundleIdentifier + org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + @CPACK_PACKAGE_VERSIO@ + CFBundleShortVersionString + @CPACK_SHORT_VERSION_STRING@ + CSResourcesFileMapped + + + diff --git a/config/cmake/ZLIB/zconf.h.in b/config/cmake/ZLIB/zconf.h.in new file mode 100644 index 0000000..a7f24cc --- /dev/null +++ b/config/cmake/ZLIB/zconf.h.in @@ -0,0 +1,536 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H +#cmakedefine Z_PREFIX +#cmakedefine Z_HAVE_UNISTD_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/config/cmake/ZLIB/zlib-config-version.cmake.in b/config/cmake/ZLIB/zlib-config-version.cmake.in new file mode 100644 index 0000000..38bcde8 --- /dev/null +++ b/config/cmake/ZLIB/zlib-config-version.cmake.in @@ -0,0 +1,42 @@ +#----------------------------------------------------------------------------- +# ZLIB Version file for install directory +#----------------------------------------------------------------------------- + +set (PACKAGE_VERSION "@ZLIB_VERSION_STRING@") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@ZLIB_VERSION_MAJOR@") + + # exact match for version @ZLIB_VERSION_MAJOR@.@ZLIB_VERSION_MINOR@ + if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@ZLIB_VERSION_MINOR@") + + # compatible with any version @ZLIB_VERSION_MAJOR@.@ZLIB_VERSION_MINOR@.x + set (PACKAGE_VERSION_COMPATIBLE TRUE) + + if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@ZLIB_VERSION_RELEASE@") + set (PACKAGE_VERSION_EXACT TRUE) + + if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@ZLIB_VERSION_SUBRELEASE@") + # not using this yet + endif () + endif () + else () + set (PACKAGE_VERSION_COMPATIBLE FALSE) + endif () + endif () +endif () + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() + diff --git a/config/cmake/ZLIB/zlib-config.cmake.in b/config/cmake/ZLIB/zlib-config.cmake.in new file mode 100644 index 0000000..307896b --- /dev/null +++ b/config/cmake/ZLIB/zlib-config.cmake.in @@ -0,0 +1,58 @@ +#----------------------------------------------------------------------------- +# ZLIB Config file for compiling against ZLIB build directory +#----------------------------------------------------------------------------- +@PACKAGE_INIT@ + +string(TOUPPER @ZLIB_PACKAGE@ ZLIB_PACKAGE_NAME) + +set (${ZLIB_PACKAGE_NAME}_VALID_COMPONENTS static shared) + +#----------------------------------------------------------------------------- +# User Options +#----------------------------------------------------------------------------- +set (${ZLIB_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (${ZLIB_PACKAGE_NAME}_EXPORT_LIBRARIES @ZLIB_LIBRARIES_TO_EXPORT@) + +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +set (${ZLIB_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") + +set (${ZLIB_PACKAGE_NAME}_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") +set_and_check (${ZLIB_PACKAGE_NAME}_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +set (${ZLIB_PACKAGE_NAME}_VERSION_STRING @ZLIB_VERSION_STRING@) +set (${ZLIB_PACKAGE_NAME}_VERSION_MAJOR @ZLIB_VERSION_MAJOR@) +set (${ZLIB_PACKAGE_NAME}_VERSION_MINOR @ZLIB_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already build ZLIB as a subproject +#----------------------------------------------------------------------------- +if (NOT TARGET "@ZLIB_PACKAGE@") + include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE@@ZLIB_PACKAGE_EXT@-targets.cmake) +endif () + +# Handle default component(static) : +if (NOT ${ZLIB_PACKAGE_NAME}_FIND_COMPONENTS) + set (${ZLIB_PACKAGE_NAME}_FIND_COMPONENTS static) + set (${ZLIB_PACKAGE_NAME}_FIND_REQUIRED_static true) +endif () + +# Handle requested components: +list (REMOVE_DUPLICATES ${ZLIB_PACKAGE_NAME}_FIND_COMPONENTS) +foreach (comp IN LISTS ${ZLIB_PACKAGE_NAME}_FIND_COMPONENTS) + list (FIND ${ZLIB_PACKAGE_NAME}_EXPORT_LIBRARIES "@ZLIB_LIB_CORENAME@-${comp}" HAVE_COMP) + if (${HAVE_COMP} LESS 0) + set (${ZLIB_PACKAGE_NAME}_${comp}_FOUND 0) + else () + set (${ZLIB_PACKAGE_NAME}_${comp}_FOUND 1) + string(TOUPPER ${ZLIB_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @ZLIB_LIB_CORENAME@-${comp}) + endif () +endforeach () + +check_required_components (${ZLIB_PACKAGE_NAME}) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index faa0533..41293ef 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -47,14 +47,21 @@ set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) + +set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE) +set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.2.13" CACHE STRING "Use ZLIB from original location" FORCE) +set (ZLIB_TGZ_ORIGNAME "zlib-1.2.13.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE) +set (ZLIB_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for ZLIB FetchContent" FORCE) + +set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) +set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE) set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) - -set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of HDF5_ZLIB package" FORCE) -set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) -set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) +set (LIBAEC_TGZ_ORIGPATH "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE) +set (LIBAEC_TGZ_ORIGNAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE) +set (LIBAEC_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE) ######################## # filter plugin options diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 740ddae..d2f2660 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -10,81 +10,72 @@ # help@hdfgroup.org. # #------------------------------------------------------------------------------- -macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) - # May need to build JPEG with PIC on x64 machines with gcc - # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works - +macro (ORIGINAL_ZLIB_LIBRARY compress_type) if (${compress_type} MATCHES "GIT") - EXTERNALPROJECT_ADD (JPEG - GIT_REPOSITORY ${JPEG_URL} - GIT_TAG ${JPEG_BRANCH} - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + FetchContent_Declare (HDF5_ZLIB + GIT_REPOSITORY ${ZLIB_URL} + GIT_TAG ${ZLIB_BRANCH} ) elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (JPEG - URL ${JPEG_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + FetchContent_Declare (HDF5_ZLIB + URL ${ZLIB_URL} + URL_HASH "" ) endif () - externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) + FetchContent_GetProperties(HDF5_ZLIB) + if(NOT zlib_POPULATED) + FetchContent_Populate(HDF5_ZLIB) -##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) -# Create imported target jpeg-static - add_library(${HDF_PACKAGE_NAMESPACE}jpeg-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-static "jpeg" STATIC "") - add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-static JPEG) - set (JPEG_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}jpeg-static") - set (JPEG_LIBRARIES ${JPEG_STATIC_LIBRARY}) + # Copy an additional/replacement files into the populated source + file(COPY ${HDF_RESOURCES_DIR}/ZLIB/CMakeLists.txt DESTINATION ${hdf5_zlib_SOURCE_DIR}) + + add_subdirectory(${hdf5_zlib_SOURCE_DIR} ${hdf5_zlib_BINARY_DIR}) + endif() + + add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) + set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") + set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) - set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src") - set (JPEG_FOUND 1) - set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR}) + set (ZLIB_INCLUDE_DIR_GEN "${hdf5_zlib_BINARY_DIR}") + set (ZLIB_INCLUDE_DIR "${hdf5_zlib_SOURCE_DIR}") + set (ZLIB_FOUND 1) + set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) endmacro () #------------------------------------------------------------------------------- -macro (PACKAGE_JPEG_LIBRARY compress_type) - add_custom_target (JPEG-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") - add_dependencies (JPEG-GenHeader-Copy JPEG) +macro (ORIGINAL_SZIP_LIBRARY compress_type encoding) + # Only libaec library is usable + if (${compress_type} MATCHES "GIT") + FetchContent_Declare (SZIP + GIT_REPOSITORY ${SZIP_URL} + GIT_TAG ${SZIP_BRANCH} + ) + elseif (${compress_type} MATCHES "TGZ") + FetchContent_Declare (SZIP + URL ${SZIP_URL} + URL_HASH "" + ) endif () + FetchContent_GetProperties(SZIP) + if(NOT szip_POPULATED) + FetchContent_Populate(SZIP) + + # Copy an additional/replacement files into the populated source + file(COPY ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt DESTINATION ${szip_SOURCE_DIR}) + + add_subdirectory(${szip_SOURCE_DIR} ${szip_BINARY_DIR}) + endif() + + set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) + add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static) + add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static) + set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") + set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) + + set (SZIP_INCLUDE_DIR_GEN "${szip_BINARY_DIR}") + set (SZIP_INCLUDE_DIR "${szip_SOURCE_DIR}/include") + set (SZIP_FOUND 1) + set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) endmacro () #------------------------------------------------------------------------------- @@ -105,7 +96,6 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} @@ -128,7 +118,6 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} @@ -137,7 +126,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) ) endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) - +# ##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target szip-static if (USE_LIBAEC) @@ -202,7 +191,6 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} @@ -224,7 +212,6 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} @@ -239,7 +226,6 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) ##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target zlib-static add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED) -# add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "") add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static HDF5_ZLIB) set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 863b7ba..7483f3c 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -479,8 +479,10 @@ macro (HDF_DIR_PATHS package_prefix) CACHE PATH "Install path prefix, prepended onto install directories." FORCE) set (CMAKE_GENERIC_PROGRAM_FILES) endif () + set (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0 CACHE PATH "" FORCE) endif () + include (FetchContent) #----------------------------------------------------------------------------- # Setup pre-3.14 FetchContent #----------------------------------------------------------------------------- diff --git a/config/sanitizer/tools.cmake b/config/sanitizer/tools.cmake index 242e33f..3a41ad4 100644 --- a/config/sanitizer/tools.cmake +++ b/config/sanitizer/tools.cmake @@ -90,7 +90,7 @@ find_program(CPPCHECK_EXE NAMES "cppcheck") mark_as_advanced(FORCE CPPCHECK_EXE) if(CPPCHECK_EXE) message(STATUS "cppcheck found: ${CPPCHECK_EXE}") - if(CPPECHECK) + if(CPPCHECK) set(CMAKE_CXX_CPPCHECK "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" ) diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake deleted file mode 100644 index c41d0ca..0000000 --- a/config/toolchain/GCC.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Uncomment the following line and the correct system name to use cross-compiling -#set(CMAKE_SYSTEM_NAME Linux) - -set(CMAKE_COMPILER_VENDOR "GCC") - -set(CMAKE_C_COMPILER cc) -set(CMAKE_CXX_COMPILER c++) -set(CMAKE_Fortran_COMPILER gfortran) - -# the following is used if cross-compiling -set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/aarch64.cmake b/config/toolchain/aarch64.cmake index adb8639..aa84a74 100644 --- a/config/toolchain/aarch64.cmake +++ b/config/toolchain/aarch64.cmake @@ -1,5 +1,5 @@ set(TOOLCHAIN_PREFIX aarch64-linux-gnu) -set(ANDROID_NDK /opt/android-ndk-r25b-linux/android-ndk-r25b) +set(ANDROID_NDK /opt/android-ndk-linux) set (CMAKE_SYSTEM_NAME Android) set (CMAKE_ANDROID_ARCH_ABI x86_64) #set (CMAKE_ANDROID_STANDALONE_TOOLCHAIN ${ANDROID_NDK}/build/cmake/andriod.toolchain.cmake) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 44d3203..31b7e46 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -297,8 +297,8 @@ IV. Further considerations B. Use source packages from an GIT server by adding the following CMake options: HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" - ZLIB_GIT_URL:STRING="http://some_location/zlib" - SZIP_GIT_URL:STRING="http://some_location/szip" + ZLIB_GIT_URL:STRING="https://some_location/zlib" + SZIP_GIT_URL:STRING="https://some_location/szip" where "some_location" is the URL to the GIT repository. Also set CMAKE_BUILD_TYPE to the configuration type. @@ -313,6 +313,29 @@ IV. Further considerations to the configuration type during configuration. See the settings in the config/cmake/cacheinit.cmake file HDF uses for testing. + D. Use original source packages from a compressed file by adding the following + CMake options: + BUILD_SZIP_WITH_FETCHCONTENT:BOOL=ON + LIBAEC_TGZ_ORIGNAME:STRING="szip_src.ext" + LIBAEC_TGZ_ORIGPATH:STRING="some_location" + + BUILD_ZLIB_WITH_FETCHCONTENT:BOOL=ON + ZLIB_TGZ_ORIGNAME:STRING="zlib_src.ext" + ZLIB_TGZ_ORIGPATH:STRING="some_location" + + HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" + where "some_location" is the URL or full path to the compressed + file and ext is the type of compression file. The individual filters are + enabled by setting the BUILD__WITH_FETCHCONTENT CMake variable to ON. + Also set CMAKE_BUILD_TYPE to the configuration type during configuration. + See the settings in the config/cmake/cacheinit.cmake file HDF uses for testing. + + The files can also be retrieved from a local path if necessary + TGZPATH:STRING="some_location" + by setting + ZLIB_USE_LOCALCONTENT:BOOL=ON + LIBAEC_USE_LOCALCONTENT:BOOL=ON + 3. If you plan to use compression plugins: A. Use source packages from an GIT server by adding the following CMake options: @@ -473,6 +496,7 @@ These five steps are described in detail below. * Visual Studio 15 2017 * Visual Studio 15 2017 Win64 * Visual Studio 16 2019 + * Visual Studio 17 2022 is: * SZIP_INCLUDE_DIR:PATH= @@ -497,13 +521,19 @@ These five steps are described in detail below. set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) + set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) + set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.2.13" CACHE STRING "Use ZLIB from original location" FORCE) + set (ZLIB_TGZ_ORIGNAME "zlib-1.2.13.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE) + set (ZLIB_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for ZLIB FetchContent" FORCE) + set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) + set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE) set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) - set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) - set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) - set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) + set (LIBAEC_TGZ_ORIGPATH "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE) + set (LIBAEC_TGZ_ORIGNAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE) + set (LIBAEC_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE) ####################### # filter plugin options ####################### @@ -838,6 +868,14 @@ if (WINDOWS) else () H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" endif () +if (BUILD_SZIP_WITH_FETCHCONTENT) + LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" + LIBAEC_TGZ_ORIGNAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" + LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" OFF +if (BUILD_ZLIB_WITH_FETCHCONTENT) + ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" + ZLIB_TGZ_ORIGNAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" + ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" OFF NOTE: The BUILD_STATIC_EXECS ("Build Static Executables") option is only valid diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index acbde91..05160fa 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,31 @@ New Features Configuration: ------------- + - Added new option to build libaec and zlib inline with CMake. + + Using the CMake FetchContent module, the external filters can populate + content at configure time via any method supported by the ExternalProject + module. Whereas ExternalProject_Add() downloads at build time, the + FetchContent module makes content available immediately, allowing the + configure step to use the content in commands like add_subdirectory(), + include() or file() operations. + + The HDF options (and defaults) for using this are: + BUILD_SZIP_WITH_FETCHCONTENT:BOOL=OFF + LIBAEC_USE_LOCALCONTENT:BOOL=OFF + BUILD_ZLIB_WITH_FETCHCONTENT:BOOL=OFF + ZLIB_USE_LOCALCONTENT:BOOL=OFF + + The CMake variables to control the path and file names: + LIBAEC_TGZ_ORIGPATH:STRING + LIBAEC_TGZ_ORIGNAME:STRING + ZLIB_TGZ_ORIGPATH:STRING + ZLIB_TGZ_ORIGNAME:STRING + + See the CMakeFilters.cmake and config/cmake/cacheinit.cmake files for usage. + + (ADB - 2023/02/21) + - Add new CMake configuration variable HDF5_USE_GNU_DIRS HDF5_USE_GNU_DIRS (default OFF) selects the use of GNU Coding Standard install -- cgit v0.12