diff options
Diffstat (limited to 'config/cmake_ext_mod')
-rw-r--r-- | config/cmake_ext_mod/HDFLibMacros.cmake | 126 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 2 |
2 files changed, 58 insertions, 70 deletions
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 #----------------------------------------------------------------------------- |