Skip to content

Commit

Permalink
Remove old EXTERNALPROJECT_ADD in favor of FETCH_CONTENT (HDFGroup#3624)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Oct 4, 2023
1 parent b166368 commit 283202b
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 258 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/intel-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE=config/toolchain/intel.cmake \
-DMKL_ROOT="/opt/intel/oneapi/mkl/latest" \
-DTBB_ROOT="/opt/intel/oneapi/tbb/latest" \
-DBUILD_SZIP_WITH_FETCHCONTENT=ON \
-DLIBAEC_USE_LOCALCONTENT=OFF \
-DBUILD_ZLIB_WITH_FETCHCONTENT=ON \
-DZLIB_USE_LOCALCONTENT=OFF \
-DHDF5_BUILD_FORTRAN=OFF \
$GITHUB_WORKSPACE
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ jobs:
-DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} \
-DHDF5_BUILD_JAVA=${{ matrix.java }} \
-DHDF5_BUILD_DOC=${{ matrix.docs }} \
-DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} \
-DLIBAEC_USE_LOCALCONTENT=${{ matrix.localaec }} \
-DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} \
-DZLIB_USE_LOCALCONTENT=${{ matrix.localzlib }} \
-DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \
-DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} \
Expand All @@ -213,9 +211,7 @@ jobs:
-DHDF5_BUILD_JAVA:BOOL=OFF \
-DHDF5_BUILD_HL_LIB:BOOL=OFF \
-DHDF5_BUILD_DOC=OFF \
-DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} \
-DLIBAEC_USE_LOCALCONTENT=${{ matrix.localaec }} \
-DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} \
-DZLIB_USE_LOCALCONTENT=${{ matrix.localzlib }} \
-DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \
-DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} \
Expand Down
59 changes: 18 additions & 41 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@ 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)

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 ()
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 ()

option (BUILD_SZIP_WITH_FETCHCONTENT "Use FetchContent to use original source files" OFF)
if (BUILD_SZIP_WITH_FETCHCONTENT)
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 ()
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 ()

include (ExternalProject)
Expand All @@ -55,18 +49,12 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT
if (NOT TGZPATH)
set (TGZPATH ${HDF5_SOURCE_DIR})
endif ()
if (NOT BUILD_ZLIB_WITH_FETCHCONTENT)
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
endif ()
if (ZLIB_USE_LOCALCONTENT)
if (NOT EXISTS "${ZLIB_URL}")
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
message (VERBOSE "Filter ZLIB file ${ZLIB_URL} not found")
endif ()
endif ()
if (NOT BUILD_SZIP_WITH_FETCHCONTENT)
set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME})
endif ()
if (LIBAEC_USE_LOCALCONTENT)
if (NOT EXISTS "${SZIP_URL}")
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
Expand Down Expand Up @@ -97,12 +85,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
endif ()
else ()
if (BUILD_ZLIB_WITH_FETCHCONTENT)
# Only tgz files available
ORIGINAL_ZLIB_LIBRARY ("TGZ")
message (VERBOSE "HDF5_ZLIB is built from fetch content")
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY})
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
message (VERBOSE "Filter HDF5_ZLIB is built")
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY})
Expand Down Expand Up @@ -153,13 +136,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
else ()
if (BUILD_SZIP_WITH_FETCHCONTENT)
# Only tgz files available
ORIGINAL_SZIP_LIBRARY ("TGZ" ${HDF5_ENABLE_SZIP_ENCODING})
message (VERBOSE "SZIP is built from fetch content")
message (VERBOSE "... with library AEC")
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING})
message (VERBOSE "Filter SZIP is built")
message (VERBOSE "... with library AEC")
Expand Down
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -855,13 +855,6 @@ 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 AND NOT BUILD_ZLIB_WITH_FETCHCONTENT)
PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
endif ()

if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND AND NOT BUILD_SZIP_WITH_FETCHCONTENT)
PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
endif ()
endif ()
endif ()

Expand Down
28 changes: 21 additions & 7 deletions CMakePlugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,41 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" 0)

set (PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGIN" 1)
if (NOT PLUGIN_USE_LOCALCONTENT)
set (PLUGIN_URL ${PLUGIN_TGZ_ORIGPATH}/${PLUGIN_TGZ_ORIGNAME})
else ()
if (NOT H5PL_TGZPATH)
set (H5PL_TGZPATH ${TGZPATH})
endif ()
set (PLUGIN_URL ${H5PL_TGZPATH}/${PLUGIN_TGZ_ORIGNAME})
endif ()
message (STATUS "Filter PLUGIN file is ${PLUGIN_URL}")

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 (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" 1)
set (PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGIN" 1)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
set (PLUGIN_URL ${PLUGIN_GIT_URL} CACHE STRING "Path to PLUGIN git repository")
set (PLUGIN_BRANCH ${PLUGIN_GIT_BRANCH})
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (NOT TGZPATH)
set (TGZPATH ${HDF5_SOURCE_DIR})
if (NOT H5PL_TGZPATH)
set (H5PL_TGZPATH ${TGZPATH})
endif ()
set (PLUGIN_URL ${TGZPATH}/${PLUGIN_TGZ_NAME})
if (NOT EXISTS "${PLUGIN_URL}")
set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE)
message (STATUS "Filter PLUGIN file ${PLUGIN_URL} not found")
if (PLUGIN_USE_LOCALCONTENT)
if (NOT EXISTS "${PLUGIN_URL}")
set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE)
message (VERBOSE "Filter PLUGIN file ${PLUGIN_URL} not found")
endif ()
endif ()
else ()
set (PLUGIN_USE_EXTERNAL 0)
message (VERBOSE "Filter PLUGIN not built")
endif ()
endif ()

Expand Down
26 changes: 14 additions & 12 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
"hidden": true,
"inherits": "ci-base",
"cacheVariables": {
"HDF5_ALLOW_EXTERNAL_SUPPORT": "NO",
"TGZPATH": {"type": "STRING", "value": "${sourceParentDir}/temp"}
"HDF5_ALLOW_EXTERNAL_SUPPORT": {"type": "STRING", "value": "TGZ"},
"TGZPATH": {"type": "PATH", "value": "${sourceParentDir}/temp"}
}
},
{
"name": "ci-CompressionVars",
"hidden": true,
"cacheVariables": {
"BUILD_ZLIB_WITH_FETCHCONTENT": "ON",
"ZLIB_PACKAGE_NAME": {"type": "STRING", "value": "zlib"},
"ZLIB_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/madler/zlib/releases/download/v1.2.13"},
"ZLIB_TGZ_ORIGNAME": {"type": "STRING", "value": "zlib-1.2.13.tar.gz"},
"BUILD_SZIP_WITH_FETCHCONTENT": "ON",
"LIBAEC_PACKAGE_NAME": {"type": "STRING", "value": "libaec"},
"LIBAEC_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6"},
"LIBAEC_TGZ_ORIGNAME": {"type": "STRING", "value": "libaec-1.0.6.tar.gz"}
Expand All @@ -41,8 +39,7 @@
"name": "ci-base-plugins",
"hidden": true,
"cacheVariables": {
"PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins.tar.gz"},
"PLUGIN_PACKAGE_NAME": {"type": "STRING", "value": "pl"},
"PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins-master.tar.gz"},
"BSHUF_TGZ_NAME": {"type": "STRING", "value": "bitshuffle.tar.gz"},
"BSHUF_PACKAGE_NAME": {"type": "STRING", "value": "bshuf"},
"BLOSC_TGZ_NAME": {"type": "STRING", "value": "c-blosc.tar.gz"},
Expand Down Expand Up @@ -73,21 +70,26 @@
"hidden": true,
"cacheVariables": {
"HDF5_ENABLE_PLUGIN_SUPPORT": "ON",
"PLUGIN_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5_plugins/archive/refs/tags"},
"H5PL_ALLOW_EXTERNAL_SUPPORT": {"type": "STRING", "value": "TGZ"},
"PLUGIN_PACKAGE_NAME": {"type": "STRING", "value": "pl"},
"PLUGIN_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5_plugins/releases/download/snapshots"},
"PLUGIN_TGZ_ORIGNAME": {"type": "STRING", "value": "hdf5_plugins-master.tar.gz"}
}
},
{
"name": "ci-StdPlugins",
"hidden": true,
"inherits": ["ci-base-plugins", "ci-PluginsVars", "ci-base-tgz"]
"inherits": ["ci-base-plugins", "ci-PluginsVars", "ci-base-tgz"],
"cacheVariables": {
"PLUGIN_USE_LOCALCONTENT": "OFF"
}
},
{
"name": "ci-ExamplesVars",
"hidden": true,
"cacheVariables": {
"HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-2.0.4.tar.gz"},
"HDF5_EXAMPLES_COMPRESSED_DIR": {"type": "STRING", "value": "${sourceParentDir}/temp"},
"HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-master.tar.gz"},
"HDF5_EXAMPLES_COMPRESSED_DIR": {"type": "PATH", "value": "${sourceParentDir}/temp"},
"EXAMPLES_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5-examples/archive/refs/tags/"},
"EXAMPLES_TGZ_ORIGNAME": {"type": "STRING", "value": "2.0.4.tar.gz"}
}
Expand All @@ -106,7 +108,7 @@
{
"name": "ci-StdShar",
"hidden": true,
"inherits": ["ci-StdCompression", "ci-StdExamples"],
"inherits": ["ci-StdCompression", "ci-StdExamples", "ci-StdPlugins"],
"cacheVariables": {
"HDF_PACKAGE_NAMESPACE": {"type": "STRING", "value": "hdf5::"},
"HDF5_INSTALL_MOD_FORTRAN": "NO",
Expand Down Expand Up @@ -181,7 +183,7 @@
"name": "ci-StdShar-GNUC",
"description": "GNUC Standard Build for x64 (Release)",
"configurePreset": "ci-StdShar-GNUC",
"verbose": false,
"verbose": true,
"inherits": [
"ci-x64-Release-GNUC"
]
Expand Down
2 changes: 1 addition & 1 deletion config/cmake-presets/hidden-presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"name": "ci-Fortran-Clang",
"hidden": true,
"cacheVariables": {
"CMAKE_Fortran_COMPILER": "gfortran"
"CMAKE_Fortran_COMPILER": {"type": "FILEPATH", "value": "gfortran"}
},
"condition": {
"type": "matches",
Expand Down
8 changes: 7 additions & 1 deletion config/cmake/HDF5PluginCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ set (H5PL_HDF5_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "HDF5 build folder"
set (H5PL_HDF5_DUMP_EXECUTABLE $<TARGET_FILE:h5dump-shared> CACHE STRING "HDF5 h5dump target" FORCE)
set (H5PL_HDF5_REPACK_EXECUTABLE $<TARGET_FILE:h5repack-shared> CACHE STRING "HDF5 h5repack target" FORCE)

set (H5PL_ALLOW_EXTERNAL_SUPPORT "${HDF5_ALLOW_EXTERNAL_SUPPORT}" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
if (NOT DEFINED H5PL_ALLOW_EXTERNAL_SUPPORT)
set (H5PL_ALLOW_EXTERNAL_SUPPORT "${HDF5_ALLOW_EXTERNAL_SUPPORT}" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
endif ()

if (NOT DEFINED H5PL_TGZPATH)
set (H5PL_TGZPATH "${TGZPATH}" CACHE PATH "PATH for finding plugin tgz file" FORCE)
endif ()

set (H5PL_GIT_URL "https://github.com/HDFGroup/hdf5_plugins.git" CACHE STRING "Use plugins from HDF Group repository" FORCE)
set (H5PL_GIT_BRANCH "master" CACHE STRING "" FORCE)
Expand Down
23 changes: 17 additions & 6 deletions config/cmake/HDF5PluginMacros.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# [email protected].
#
#-------------------------------------------------------------------------------
# Plugins must be built SHARED
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -85,16 +96,16 @@ macro (FILTER_OPTION plname)
if (ENABLE_${plname})
option (HDF_${plname}_USE_EXTERNAL "Use External Library Building for ${PLUGIN_NAME} plugin" 0)
mark_as_advanced (HDF_${plname}_USE_EXTERNAL)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
set (HDF_${plname}_USE_EXTERNAL 1 CACHE BOOL "Use External Library Building for ${PLUGIN_NAME} plugin" FORCE)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
set (HDF_${plname}_URL ${HDF_${plname}_GIT_URL})
set (HDF_${plname}_BRANCH ${HDF_${plname}_GIT_BRANCH})
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (NOT TGZPATH)
set (TGZPATH ${H5PL_SOURCE_DIR})
elseif (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (NOT H5PL_COMP_TGZPATH)
set (H5PL_COMP_TGZPATH ${H5PL_SOURCE_DIR}/libs)
endif ()
set (HDF_${plname}_URL ${TGZPATH}/${HDF_${plname}_TGZ_NAME})
set (HDF_${plname}_URL ${H5PL_COMP_TGZPATH}/${HDF_${plname}_TGZ_NAME})
endif ()
endif ()
add_subdirectory (${plname})
Expand Down
Loading

0 comments on commit 283202b

Please sign in to comment.