diff options
Diffstat (limited to 'vcpkg/ports/hdf5')
| -rw-r--r-- | vcpkg/ports/hdf5/hdf5_config.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/hdf5/pkgconfig.patch | 71 | ||||
| -rw-r--r-- | vcpkg/ports/hdf5/portfile.cmake | 168 | ||||
| -rw-r--r-- | vcpkg/ports/hdf5/vcpkg-cmake-wrapper.cmake | 16 | ||||
| -rw-r--r-- | vcpkg/ports/hdf5/vcpkg-port-config.cmake | 4 | ||||
| -rw-r--r-- | vcpkg/ports/hdf5/vcpkg.json | 68 |
6 files changed, 349 insertions, 0 deletions
diff --git a/vcpkg/ports/hdf5/hdf5_config.patch b/vcpkg/ports/hdf5/hdf5_config.patch new file mode 100644 index 0000000..1cb57ef --- /dev/null +++ b/vcpkg/ports/hdf5/hdf5_config.patch @@ -0,0 +1,22 @@ +diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in +index 1a3fb7bbf2..79081ce040 100644 +--- a/config/cmake/hdf5-config.cmake.in ++++ b/config/cmake/hdf5-config.cmake.in +@@ -120,12 +114,17 @@ set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@) + # Don't include targets if this file is being picked up by another + # project which has already built hdf5 as a subproject + #----------------------------------------------------------------------------- ++include(CMakeFindDependencyMacro) + if (NOT TARGET "@HDF5_PACKAGE@") + if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) + include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) ++ elseif (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT) ++ find_dependency(ZLIB) + endif () + if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) + include (@PACKAGE_SHARE_INSTALL_DIR@/@LIBAEC_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) ++ elseif (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT) ++ find_dependency(libaec) + endif () + include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) + endif () diff --git a/vcpkg/ports/hdf5/pkgconfig.patch b/vcpkg/ports/hdf5/pkgconfig.patch new file mode 100644 index 0000000..12c5f03 --- /dev/null +++ b/vcpkg/ports/hdf5/pkgconfig.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake +index 5f2e1ea34..7258e4669 100644 +--- a/CMakeFilters.cmake ++++ b/CMakeFilters.cmake +@@ -126,7 +126,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) + endif () + set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) + set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) +- if (NOT WIN32) #windows has a list of names ++ if (0) + # 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) +diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake +index 3be3e6a6a..177a51e87 100644 +--- a/config/cmake/HDFMacros.cmake ++++ b/config/cmake/HDFMacros.cmake +@@ -483,7 +483,7 @@ macro (HDF_DIR_PATHS package_prefix) + endif () + + #set the default debug suffix for all library targets +- if(NOT CMAKE_DEBUG_POSTFIX) ++ if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + if (WIN32) + set (CMAKE_DEBUG_POSTFIX "_D") + else () +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5bf8e1f82..fe212a092 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1195,22 +1195,36 @@ if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKGCONFIG_LIBNAME "${PKGCONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") + endif () + +-#foreach (libs ${LINK_LIBS}) +-# set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") +-#endforeach () ++foreach (libs ${LINK_LIBS}) ++ set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") ++endforeach () + + # The settings for the compression libs depends on if they have pkconfig support + # Assuming they don't + foreach (libs ${LINK_COMP_LIBS}) + # set (_PKG_CONFIG_REQUIRES_PRIVATE "${_PKG_CONFIG_REQUIRES_PRIVATE} -l${libs}") ++ if(libs STREQUAL "ZLIB::ZLIB") ++ string(APPEND _PKG_CONFIG_REQUIRES_PRIVATE " zlib") ++ elseif(libs STREQUAL "libaec::sz") ++ string(APPEND _PKG_CONFIG_LIBS_PRIVATE " ${libaec_LIBRARY}") ++ elseif(libs STREQUAL "libaec::aec") ++ string(APPEND _PKG_CONFIG_LIBS_PRIVATE " ${SZIP_LIBRARY}") ++ else() + get_target_property (libname ${libs} OUTPUT_NAME) + set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libname}") ++ endif() + endforeach () ++if(UNIX AND H5_HAVE_PARALLEL) ++ foreach(_lib IN LISTS ${MPI_C_LIBRARIES}) ++ string(REPLACE " -l${_lib} " " " _PKG_CONFIG_LIBS_PRIVATE " ${_PKG_CONFIG_LIBS_PRIVATE} ") ++ endforeach() ++ string(APPEND _PKG_CONFIG_REQUIRES_PRIVATE " ompi-c") ++endif() + + #if (BUILD_STATIC_LIBS) + # set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKGCONFIG_LIBNAME}") + #endif () +-if (BUILD_SHARED_LIBS) ++if (1) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKGCONFIG_LIBNAME}") + endif () + diff --git a/vcpkg/ports/hdf5/portfile.cmake b/vcpkg/ports/hdf5/portfile.cmake new file mode 100644 index 0000000..08b58f6 --- /dev/null +++ b/vcpkg/ports/hdf5/portfile.cmake @@ -0,0 +1,168 @@ +# highfive should be updated together with hdf5 + +string(REPLACE "." "." hdf5_ref "hdf5_${VERSION}") +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO HDFGroup/hdf5 + REF "${hdf5_ref}" + SHA512 f3907abb530c4818cd9c0eb78b43073f3133260baa008ed52478e50e6bf9f1520365882acba21e0206e72c37c3e564d450def4edc3d2eef46275a41a2ad3f34b + HEAD_REF develop + PATCHES + hdf5_config.patch + pkgconfig.patch +) + +set(ALLOW_UNSUPPORTED OFF) +if ("parallel" IN_LIST FEATURES AND "cpp" IN_LIST FEATURES) + message(WARNING "Feature 'Parallel' and 'cpp' are mutually exclusive, enabling option ALLOW_UNSUPPORTED automatically to enable them both.") + set(ALLOW_UNSUPPORTED ON) +endif() + +if ("threadsafe" IN_LIST FEATURES AND + ("parallel" IN_LIST FEATURES + OR "fortran" IN_LIST FEATURES + OR "cpp" IN_LIST FEATURES) + ) + message(WARNING "Feture 'threadsafe' and other features are mutually exclusive, enabling feature ALLOW_UNSUPPORTED automatically to enable them both.") + set(ALLOW_UNSUPPORTED ON) +endif() + +if ("fortran" IN_LIST FEATURES) + message(WARNING "Feature 'fortran' is not yet officially supported within VCPKG. Build will most likly fail if ninja 1.10 and a Fortran compiler are not available.") +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + parallel HDF5_ENABLE_PARALLEL + tools HDF5_BUILD_TOOLS + tools HDF5_BUILD_HL_GIF_TOOLS + cpp HDF5_BUILD_CPP_LIB + szip HDF5_ENABLE_SZIP_SUPPORT + szip HDF5_ENABLE_SZIP_ENCODING + zlib HDF5_ENABLE_Z_LIB_SUPPORT + fortran HDF5_BUILD_FORTRAN + threadsafe HDF5_ENABLE_THREADSAFE + utils HDF5_BUILD_UTILS + map HDF5_ENABLE_MAP_API +) + +if("tools" IN_LIST FEATURES AND VCPKG_CRT_LINKAGE STREQUAL "static") + list(APPEND FEATURE_OPTIONS -DBUILD_STATIC_EXECS=ON) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + list(APPEND FEATURE_OPTIONS -DONLY_SHARED_LIBS=ON) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + ${FEATURE_OPTIONS} + -DBUILD_TESTING=OFF + -DHDF5_ALLOW_EXTERNAL_SUPPORT=NO + -DHDF5_BUILD_EXAMPLES=OFF + -DHDF5_INSTALL_DATA_DIR=share/hdf5/data + -DHDF5_INSTALL_CMAKE_DIR=share/hdf5 + -DHDF_PACKAGE_NAMESPACE:STRING=hdf5:: + -DHDF5_MSVC_NAMING_CONVENTION=OFF + -DALLOW_UNSUPPORTED=${ALLOW_UNSUPPORTED} + OPTIONS_RELEASE + -DCMAKE_DEBUG_POSTFIX= # For lib name in pkgconfig files +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup() + +set(debug_suffix debug) +if(VCPKG_TARGET_IS_WINDOWS) + set(debug_suffix D) +endif() + +vcpkg_fixup_pkgconfig() + +file(GLOB pc_files "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/*.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/*.pc") +foreach(file IN LISTS pc_files) + if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${file}" " -lhdf5" " -llibhdf5" IGNORE_UNCHANGED) + endif() + if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string("${file}" "/msmpi.lib\"" "/msmpi\"" IGNORE_UNCHANGED) + endif() +endforeach() + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-config.cmake" + [[${HDF5_PACKAGE_NAME}_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/bin"]] + [[${HDF5_PACKAGE_NAME}_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/tools/hdf5"]] +) +if("parallel" IN_LIST FEATURES AND NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-config.cmake" + [[..HDF5_PACKAGE_NAME._MPI_C_LIBRARIES "..VCPKG_IMPORT_PREFIX.(/lib/[^"]*)"]] + [[${HDF5_PACKAGE_NAME}_MPI_C_LIBRARIES optimized "${VCPKG_IMPORT_PREFIX}\1" debug "${VCPKG_IMPORT_PREFIX}/debug\1"]] + REGEX + ) +endif() + +set(HDF5_TOOLS "") +if("tools" IN_LIST FEATURES) + list(APPEND HDF5_TOOLS h5copy h5diff h5dump h5ls h5stat gif2h5 h52gif h5clear h5debug + h5format_convert h5jam h5unjam h5mkgrp h5repack h5repart h5watch h5import h5delete + h5perf_serial + ) + + if("parallel" IN_LIST FEATURES) + list(APPEND HDF5_TOOLS ph5diff) + endif() + + + if(NOT VCPKG_TARGET_IS_WINDOWS) + list(APPEND HDF5_TOOLS h5cc h5hlcc) + if("cpp" IN_LIST FEATURES) + list(APPEND HDF5_TOOLS h5c++ h5hlc++) + endif() + endif() + + if("parallel" IN_LIST FEATURES) + list(APPEND HDF5_TOOLS h5perf ) + if(NOT VCPKG_TARGET_IS_WINDOWS) + list(APPEND HDF5_TOOLS h5pcc) + endif() + endif() +endif() + +if ("utils" IN_LIST FEATURES) + list(APPEND HDF5_TOOLS mirror_server mirror_server_stop) +endif() + +if(HDF5_TOOLS) + vcpkg_copy_tools(TOOL_NAMES ${HDF5_TOOLS} AUTO_CLEAN) + foreach(tool h5cc h5pcc h5hlcc) + if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${tool}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/${tool}" "${CURRENT_INSTALLED_DIR}" "$(dirname \"$0\")/../.." IGNORE_UNCHANGED) + endif() + endforeach() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/h5fuse.sh") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/h5fuse.sh" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/h5fuse.sh") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/h5fuse.sh") + endif() +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +# Clean up +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) +if("parallel" IN_LIST FEATURES) + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/H5public.h" "#define H5public_H" "#define H5public_H\n#ifndef H5_BUILT_AS_DYNAMIC_LIB\n#define H5_BUILT_AS_DYNAMIC_LIB\n#endif\n") +endif() + +file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/data/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") diff --git a/vcpkg/ports/hdf5/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/hdf5/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000..83457df --- /dev/null +++ b/vcpkg/ports/hdf5/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,16 @@ +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0057 NEW)
+ if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS AND "HDF5" IN_LIST ARGS)
+ # The caller hasn't said "CONFIG", so they want the built-in FindHDF5.cmake behavior. Set configurations macros to ensure the built-in script finds us.
+ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ set(HDF5_USE_STATIC_LIBRARIES ON)
+ add_compile_definitions(H5_BUILT_AS_STATIC_LIB)
+ else()
+ set(HDF5_USE_STATIC_LIBRARIES OFF)
+ add_compile_definitions(H5_BUILT_AS_DYNAMIC_LIB)
+ endif()
+ endif()
+ cmake_policy(POP)
+endif()
+_find_package(${ARGS})
diff --git a/vcpkg/ports/hdf5/vcpkg-port-config.cmake b/vcpkg/ports/hdf5/vcpkg-port-config.cmake new file mode 100644 index 0000000..89fa5ac --- /dev/null +++ b/vcpkg/ports/hdf5/vcpkg-port-config.cmake @@ -0,0 +1,4 @@ +# This variable can be used for testing and for messages. +set(HDF5_WITH_PARALLEL [[ +HDF5 was built with parallel support. +]]) diff --git a/vcpkg/ports/hdf5/vcpkg.json b/vcpkg/ports/hdf5/vcpkg.json new file mode 100644 index 0000000..250cd63 --- /dev/null +++ b/vcpkg/ports/hdf5/vcpkg.json @@ -0,0 +1,68 @@ +{ + "name": "hdf5", + "version": "1.14.6", + "description": "HDF5 is a data model, library, and file format for storing and managing data", + "homepage": "https://www.hdfgroup.org/downloads/hdf5/", + "license": "BSD-3-Clause", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "szip", + "zlib" + ], + "features": { + "cpp": { + "description": "Builds cpp lib" + }, + "fortran": { + "description": "Build with fortran" + }, + "map": { + "description": "Build the map API" + }, + "parallel": { + "description": "parallel support for HDF5", + "supports": "!staticcrt", + "dependencies": [ + "mpi" + ] + }, + "szip": { + "description": "Build with szip", + "dependencies": [ + "libaec" + ] + }, + "threadsafe": { + "description": "thread safety for HDF5", + "supports": "!(static & windows)", + "dependencies": [ + { + "name": "pthreads", + "platform": "!windows" + } + ] + }, + "tools": { + "description": "Build hdf tools" + }, + "utils": { + "description": "Build HDF5 Utils" + }, + "zlib": { + "description": "Build with zlib", + "dependencies": [ + "zlib" + ] + } + } +} |