vcpkg/ports/hdf5/portfile.cmake
Jack·Boos·Yu f23734d2b6 [hdf5] Fix static builds when building dynamic builds (#9043)
* [hdf5]Fix static builds when building dynamic builds.

* [hdf5]Remove duplicate code, fix zlib library name.

* [hdf5]Adapt links to different link types of szip.

* [hdf5] Fix hdf5-config.cmake.in
2020-01-06 14:13:34 -08:00

59 lines
2.0 KiB
CMake

vcpkg_fail_port_install(ON_TARGET "UWP")
vcpkg_download_distfile(ARCHIVE
URLS "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/CMake-hdf5-1.10.5.tar.gz"
FILENAME "CMake-hdf5-1.10.5.tar.gz"
SHA512 a25ea28d7a511f9184d97b5b8cd4c6d52dcdcad2bffd670e24a1c9a6f98b03108014a853553fa2b00d4be7523128b5fd6a4454545e3b17ff8c66fea16a09e962
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF hdf5
PATCHES
hdf5_config.patch
fix-generate.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
parallel HDF5_ENABLE_PARALLEL
cpp HDF5_BUILD_CPP_LIB
)
if ("parallel" IN_LIST FEATURES AND "cpp" IN_LIST FEATURES)
message(FATAL_ERROR "Feature Parallel and C++ options are mutually exclusive.")
endif()
file(REMOVE ${SOURCE_PATH}/config/cmake_ext_mod/FindSZIP.cmake)#Outdated; does not find debug szip
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/hdf5-1.10.5
DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DHDF5_BUILD_EXAMPLES=OFF
-DHDF5_BUILD_TOOLS=OFF
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON
-DHDF5_ENABLE_SZIP_SUPPORT=ON
-DHDF5_ENABLE_SZIP_ENCODING=ON
-DHDF5_INSTALL_DATA_DIR=share/hdf5/data
-DHDF5_INSTALL_CMAKE_DIR=share
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
#Linux build create additional scripts here. I dont know what they are doing so I am deleting them and hope for the best
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)