[hdf5] add tools and fortran feature (#9864)

* [hdf5] add tools and fortran feature

* change fortran feature to state requirements
This commit is contained in:
Alexander Neumann 2020-03-29 03:41:08 +02:00 committed by GitHub
parent f933c30226
commit b79f7675aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 109 additions and 12 deletions

View File

@ -1,5 +1,5 @@
Source: hdf5
Version: 1.10.5-10
Version: 1.10.5-12
Homepage: https://www.hdfgroup.org/downloads/hdf5/
Description: HDF5 is a data model, library, and file format for storing and managing data
Default-Features: szip, zlib
@ -12,6 +12,9 @@ Build-Depends: mpi
Feature: cpp
Description: Builds cpp lib
Feature: tools
Description: Build hdf tools
Feature: szip
Description: Build with szip
Build-Depends: szip
@ -19,3 +22,8 @@ Build-Depends: szip
Feature: zlib
Description: Build with zlib
Build-Depends: zlib
Feature: fortran
Description: Build with fortran
Build-Depends:

View File

@ -0,0 +1,15 @@
diff --git a/hdf5-1.10.5/hl/src/H5LDprivate.h b/hdf5-1.10.5/hl/src/H5LDprivate.h
index b52928b53..5f02ea781 100644
--- a/hdf5-1.10.5/hl/src/H5LDprivate.h
+++ b/hdf5-1.10.5/hl/src/H5LDprivate.h
@@ -40,8 +40,8 @@ typedef struct H5LD_memb_t {
* #2: these two routines are too specific to be made as public routines
* Decide to do #3 at this point of time after some discussion.
*/
-void H5LD_clean_vector(H5LD_memb_t *listv[]);
-int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]);
+H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
#endif /* end _H5LDprivate_H */

View File

@ -8,7 +8,7 @@ index 3bd9e1d..7f6699c 100644
if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
- include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND NOT TARGET "zlib")
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND NOT TARGET ZLIB::ZLIB)
+ find_package(ZLIB REQUIRED)
endif ()
- if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")

View File

@ -12,23 +12,36 @@ vcpkg_extract_source_archive_ex(
REF hdf5
PATCHES
hdf5_config.patch
fix-generate.patch
fix-generate.patch # removes the build of static targets in shared builds
static-targets.patch # maps the internal static tagets to the shared targets if building as a dynamic library
export-private.patch # exports two additional functions in shared builds to make hl/tools/h5watch build in shared builds.
)
if ("parallel" IN_LIST FEATURES AND "cpp" IN_LIST FEATURES)
message(FATAL_ERROR "Feature Parallel and C++ options are mutually exclusive.")
endif()
if ("fortran" IN_LIST FEATURE)
message(WARNING "Fortran is not yet official 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
FEATURES # <- Keyword FEATURES is required because INVERTED_FEATURES are being used
parallel HDF5_ENABLE_PARALLEL
tools HDF5_BUILD_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
)
file(REMOVE ${SOURCE_PATH}/config/cmake_ext_mod/FindSZIP.cmake)#Outdated; does not find debug szip
if(FEATURES MATCHES "tools" AND VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND FEATURE_OPTIONS -DBUILD_STATIC_EXECS=ON)
endif()
find_library(SZIP_RELEASE NAMES libsz libszip szip sz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(SZIP_DEBUG NAMES libsz libszip szip sz libsz_D libszip_D szip_D sz_D szip_debug PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
@ -40,7 +53,6 @@ vcpkg_configure_cmake(
${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DHDF5_BUILD_EXAMPLES=OFF
-DHDF5_BUILD_TOOLS=OFF
-DHDF5_INSTALL_DATA_DIR=share/hdf5/data
-DHDF5_INSTALL_CMAKE_DIR=share
"-DSZIP_LIBRARY_DEBUG:PATH=${SZIP_DEBUG}"
@ -48,18 +60,43 @@ vcpkg_configure_cmake(
)
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(READ "${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-config.cmake" contents)
string(REPLACE [[${HDF5_PACKAGE_NAME}_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/bin"]] [[${HDF5_PACKAGE_NAME}_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/tools/hdf5"]] contents ${contents})
file(WRITE "${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-config.cmake" ${contents})
if(FEATURES MATCHES "tools")
set(TOOLS h5cc h5hlcc h5c++ h5hlc++ h5copy h5diff h5dump h5ls h5stat gif2h5 h52gif h5clear h5debug h5format_convert h5jam h5unjam h5ls h5mkgrp h5repack h5repart h5watch ph5diff h5import)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(TOOL_SUFFIXES "-shared${VCPKG_TARGET_EXECUTABLE_SUFFIX};${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
else()
set(TOOL_SUFFIXES "-static${VCPKG_TARGET_EXECUTABLE_SUFFIX};${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
endif()
foreach(tool IN LISTS TOOLS)
foreach(suffix IN LISTS TOOL_SUFFIXES)
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${suffix}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${suffix}")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}")
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}")
endif()
endforeach()
endforeach()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/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)

View File

@ -0,0 +1,37 @@
diff --git a/hdf5-1.10.5/CMakeLists.txt b/hdf5-1.10.5/CMakeLists.txt
index 6ca2f5c54..f7a4db9e5 100644
--- a/hdf5-1.10.5/CMakeLists.txt
+++ b/hdf5-1.10.5/CMakeLists.txt
@@ -150,6 +150,7 @@ set (HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB
#-----------------------------------------------------------------------------
# Set the target names of all the libraries
#-----------------------------------------------------------------------------
+if(NOT BUILD_SHARED_LIBS)
set (HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-static")
set (HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-static")
set (HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-static")
@@ -162,9 +163,24 @@ set (HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-static")
set (HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-static")
set (HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-static")
set (HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-static")
+else()
+set (HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-shared")
+set (HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-shared")
+set (HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-shared")
+set (HDF5_HL_LIB_TARGET "${HDF5_HL_LIB_CORENAME}-shared")
+set (HDF5_HL_CPP_LIB_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-shared")
+set (HDF5_TOOLS_LIB_TARGET "${HDF5_TOOLS_LIB_CORENAME}-shared")
+set (HDF5_F90_LIB_TARGET "${HDF5_F90_LIB_CORENAME}-shared")
+set (HDF5_F90_C_LIB_TARGET "${HDF5_F90_C_LIB_CORENAME}-shared")
+set (HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-shared")
+set (HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-shared")
+set (HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-shared")
+set (HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-shared")
+endif()
set (HDF5_JAVA_JNI_LIB_TARGET "${HDF5_JAVA_JNI_LIB_CORENAME}")
set (HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}")
set (HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}")
+
set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared")
set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared")
set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared")