mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
Use only one find_package call for zlib. (#5280)
This commit is contained in:
parent
dbbc7122df
commit
2f4f6902cd
58
.github/workflows/main-cmake-spc.yml
vendored
58
.github/workflows/main-cmake-spc.yml
vendored
@ -354,6 +354,64 @@ jobs:
|
||||
run: ctest . --parallel 2 -C Debug -V
|
||||
working-directory: ${{ runner.workspace }}/build
|
||||
|
||||
build_system_zlib:
|
||||
name: "gcc system zlib"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# SETUP
|
||||
- name: Install Linux Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build doxygen graphviz
|
||||
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
|
||||
sudo apt install gcc-12 g++-12 gfortran-12 zlib1g-dev
|
||||
echo "CC=gcc-12" >> $GITHUB_ENV
|
||||
echo "CXX=g++-12" >> $GITHUB_ENV
|
||||
echo "FC=gfortran-12" >> $GITHUB_ENV
|
||||
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Get Sources
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
# CMAKE CONFIGURE
|
||||
- name: CMake Configure
|
||||
run: |
|
||||
mkdir "${{ runner.workspace }}/build"
|
||||
cd "${{ runner.workspace }}/build"
|
||||
cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \
|
||||
-G Ninja \
|
||||
--log-level=VERBOSE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||
-DHDF5_ENABLE_ALL_WARNINGS:BOOL=ON \
|
||||
-DHDF5_ENABLE_PARALLEL:BOOL=OFF \
|
||||
-DHDF5_BUILD_CPP_LIB:BOOL=ON \
|
||||
-DHDF5_BUILD_FORTRAN:BOOL=ON \
|
||||
-DHDF5_BUILD_JAVA:BOOL=ON \
|
||||
-DHDF5_BUILD_DOC:BOOL=OFF \
|
||||
-DHDF5_ENABLE_MIRROR_VFD:BOOL=ON \
|
||||
-DHDF5_ENABLE_DIRECT_VFD:BOOL=ON \
|
||||
-DHDF5_ENABLE_ROS3_VFD:BOOL=ON \
|
||||
-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="NO" \
|
||||
-DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON \
|
||||
-DZLIB_USE_LOCALCONTENT:BOOL=OFF \
|
||||
-DZLIB_USE_EXTERNAL:BOOL=OFF \
|
||||
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \
|
||||
-DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF \
|
||||
-DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \
|
||||
$GITHUB_WORKSPACE
|
||||
shell: bash
|
||||
|
||||
# BUILD
|
||||
- name: CMake Build
|
||||
run: cmake --build . --parallel 3 --config Debug
|
||||
working-directory: ${{ runner.workspace }}/build
|
||||
|
||||
# RUN TESTS
|
||||
- name: CMake Run Tests
|
||||
run: ctest . --parallel 2 -C Debug -V
|
||||
working-directory: ${{ runner.workspace }}/build
|
||||
|
||||
build_zlibng:
|
||||
name: "gcc use zlib-ng filter"
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -13,9 +13,13 @@ option (HDF5_USE_ZLIB_NG "Use zlib-ng library as zlib library" OFF)
|
||||
option (HDF5_USE_ZLIB_STATIC "Find static zlib library" OFF)
|
||||
option (HDF5_USE_LIBAEC_STATIC "Find static AEC library" OFF)
|
||||
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF)
|
||||
mark_as_advanced (ZLIB_USE_EXTERNAL)
|
||||
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF)
|
||||
mark_as_advanced (SZIP_USE_EXTERNAL)
|
||||
option (ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" OFF)
|
||||
mark_as_advanced (ZLIB_USE_LOCALCONTENT)
|
||||
option (LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" OFF)
|
||||
mark_as_advanced (LIBAEC_USE_LOCALCONTENT)
|
||||
|
||||
if (NOT ZLIB_USE_LOCALCONTENT)
|
||||
if (HDF5_USE_ZLIB_NG)
|
||||
@ -85,30 +89,35 @@ endif ()
|
||||
if(NOT DEFINED ZLIBNG_PACKAGE_NAME)
|
||||
set(ZLIBNG_PACKAGE_NAME "zlib-ng")
|
||||
endif ()
|
||||
option (HDF5_ENABLE_ZLIB_SUPPORT "Enable Zlib Filters" OFF)
|
||||
if (HDF5_ENABLE_ZLIB_SUPPORT)
|
||||
if (NOT H5_ZLIB_HEADER)
|
||||
if (NOT ZLIB_USE_EXTERNAL)
|
||||
option (HDF5_MODULE_MODE_ZLIB "Prefer module mode to find ZLIB" ON)
|
||||
mark_as_advanced (HDF5_MODULE_MODE_ZLIB)
|
||||
if (HDF5_USE_ZLIB_NG)
|
||||
set (HDF5_MODULE_MODE_ZLIB OFF CACHE BOOL "" FORCE)
|
||||
set (PACKAGE_NAME ${ZLIBNG_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
||||
else ()
|
||||
set (PACKAGE_NAME ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
||||
endif ()
|
||||
set(ZLIB_FOUND FALSE)
|
||||
if (HDF5_USE_ZLIB_STATIC)
|
||||
set(ZLIB_SEARCH_TYPE static)
|
||||
message (VERBOSE "Filter HDF5_ZLIB package name:${PACKAGE_NAME}")
|
||||
if (HDF5_MODULE_MODE_ZLIB)
|
||||
# Expect that the default shared library is expected with FindZLIB.cmake
|
||||
find_package (ZLIB MODULE)
|
||||
else ()
|
||||
set(ZLIB_SEARCH_TYPE shared)
|
||||
# Expect that a correctly built library with CMake config files is available
|
||||
if (HDF5_USE_ZLIB_STATIC)
|
||||
set(ZLIB_SEARCH_TYPE static)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
set(ZLIB_USE_STATIC_LIBS ${HDF5_USE_ZLIB_STATIC})
|
||||
endif()
|
||||
else ()
|
||||
set(ZLIB_SEARCH_TYPE shared)
|
||||
endif ()
|
||||
find_package (ZLIB NAMES ${PACKAGE_NAME} CONFIG OPTIONAL_COMPONENTS ${ZLIB_SEARCH_TYPE})
|
||||
endif ()
|
||||
# Search pure Config mode first
|
||||
find_package (ZLIB NAMES ${PACKAGE_NAME} OPTIONAL_COMPONENTS ${ZLIB_SEARCH_TYPE})
|
||||
if (NOT ZLIB_FOUND)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
set(ZLIB_USE_STATIC_LIBS ${HDF5_USE_ZLIB_STATIC})
|
||||
endif()
|
||||
find_package (ZLIB) # Legacy find
|
||||
endif ()
|
||||
set(H5_ZLIB_FOUND ${ZLIB_FOUND})
|
||||
set(H5_ZLIB_FOUND ZLIB_FOUND})
|
||||
if (H5_ZLIB_FOUND)
|
||||
if (HDF5_USE_ZLIB_NG)
|
||||
set (H5_ZLIB_HEADER "zlib-ng.h")
|
||||
@ -117,11 +126,13 @@ if (HDF5_ENABLE_ZLIB_SUPPORT)
|
||||
endif ()
|
||||
set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
|
||||
set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
||||
# The FindZLIB.cmake module does not set an OUTPUT_NAME
|
||||
# on the target. The target returned is: ZLIB::ZLIB
|
||||
get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE)
|
||||
string (REGEX REPLACE "^lib" "" libname ${libname})
|
||||
set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME ${libname})
|
||||
if (NOT WIN32) #windows has a list of names
|
||||
# The FindZLIB.cmake module does not set an OUTPUT_NAME
|
||||
# on the target. The target returned is: ZLIB::ZLIB
|
||||
get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE)
|
||||
string (REGEX REPLACE "^lib" "" libname ${libname})
|
||||
set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME ${libname})
|
||||
endif ()
|
||||
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ZLIB::ZLIB)
|
||||
endif ()
|
||||
else ()
|
||||
@ -161,7 +172,6 @@ set(H5_SZIP_FOUND FALSE)
|
||||
if(NOT DEFINED LIBAEC_PACKAGE_NAME)
|
||||
set(LIBAEC_PACKAGE_NAME "libaec")
|
||||
endif ()
|
||||
option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
|
||||
if (HDF5_ENABLE_SZIP_SUPPORT)
|
||||
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON)
|
||||
if (NOT SZIP_USE_EXTERNAL)
|
||||
|
@ -6,6 +6,11 @@ if (POLICY CMP0074)
|
||||
cmake_policy (SET CMP0074 NEW)
|
||||
endif ()
|
||||
|
||||
if (POLICY CMP0144)
|
||||
# <PACKAGENAME> is the upper-cased package name.
|
||||
cmake_policy (SET CMP0144 NEW)
|
||||
endif ()
|
||||
|
||||
if (POLICY CMP0083)
|
||||
# To control generation of Position Independent Executable (PIE) or not,
|
||||
# some flags are required at link time.
|
||||
|
@ -877,6 +877,7 @@ if (BUILD_TESTING)
|
||||
HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO"
|
||||
HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF
|
||||
HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF
|
||||
HDF5_MODULE_MODE_ZLIB "Prefer module mode to find ZLIB" ON
|
||||
HDF5_ENABLE_ZLIB_SUPPORT "Enable Zlib Filters" OFF
|
||||
|
||||
if (HDF5_USE_ZLIB_NG)
|
||||
|
@ -572,6 +572,15 @@ Bug Fixes since HDF5-2.0.0 release
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
- When using a system installed zlib library, the shared library is expected to
|
||||
be found in the system library path.
|
||||
|
||||
Setting the HDF5_MODULE_MODE_ZLIB option to OFF will force find_package to
|
||||
use config mode first. An installed zlib, or an alternate installed zlib
|
||||
library, is expected to have a correct zlib-config.cmake file for config mode.
|
||||
Current zlib installs usually do not have a zlib-config.cmake file, so the
|
||||
option is set to ON by default.
|
||||
|
||||
- Use pre-installed libaec compression library
|
||||
|
||||
The CMake logic for finding the libaec compression library has been
|
||||
|
Loading…
Reference in New Issue
Block a user