From 8fe30fe1ea70d5bfac400fdccf30276e4d987be5 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Fri, 2 Mar 2018 03:39:20 +0900 Subject: Add kealib ports and modify hdf5 recipe (#2708) * [kealib] add kealib ports KEALib is a GDAL model library using HDF5 standard. - Patch library cmake scripts. - Provide MIT license file. - Depend on hdf5 library with [cpp] feature. - No generation of GDAL driver. Signed-off-by: Hiroshi Miura * [kealib] fix option key to specify building shared library Signed-off-by: Hiroshi Miura * [kealib] call copy_pdbs() after install Signed-off-by: Hiroshi Miura * [kealib] update cmake patch - fix library name in MSVC - fix to find hdf5 libraries Signed-off-by: Hiroshi Miura * [kealib] add parallel feature Signed-off-by: Hiroshi Miura * Revert "[hdf5] add cpp feature" This reverts commit fbe876646601ea1426679793d44dec7cd3852ddf. * [hdf5] always build cpp library Signed-off-by: Hiroshi Miura * [kealib] drop dependency for feature hdf5[cpp] Signed-off-by: Hiroshi Miura * [kealib] update static link handling Signed-off-by: Hiroshi Miura * [kealib] revert a previous hack for static link to szip/zlib Signed-off-by: Hiroshi Miura * [hdf5] work around szip-config.cmake behavior Signed-off-by: Hiroshi Miura * link dependencies of static libs --- ports/hdf5/.gitattributes | 1 + ports/kealib/CONTROL | 8 +++ ports/kealib/fix-cmake.patch | 122 +++++++++++++++++++++++++++++++++++++++++++ ports/kealib/portfile.cmake | 39 ++++++++++++++ 4 files changed, 170 insertions(+) create mode 100644 ports/hdf5/.gitattributes create mode 100644 ports/kealib/CONTROL create mode 100644 ports/kealib/fix-cmake.patch create mode 100644 ports/kealib/portfile.cmake diff --git a/ports/hdf5/.gitattributes b/ports/hdf5/.gitattributes new file mode 100644 index 000000000..7cb1b64e1 --- /dev/null +++ b/ports/hdf5/.gitattributes @@ -0,0 +1 @@ +use-szip-config.patch text eol=crlf diff --git a/ports/kealib/CONTROL b/ports/kealib/CONTROL new file mode 100644 index 000000000..7e8a712a2 --- /dev/null +++ b/ports/kealib/CONTROL @@ -0,0 +1,8 @@ +Source: kealib +Version: 1.4.7-1 +Build-Depends: hdf5[cpp], zlib, szip +Description: kealib is gdal model using HDF5 standard. + +Feature: parallel +Description: Use parallel support for HDF5 +Build-Depends: hdf5[parallel], msmpi diff --git a/ports/kealib/fix-cmake.patch b/ports/kealib/fix-cmake.patch new file mode 100644 index 000000000..191517990 --- /dev/null +++ b/ports/kealib/fix-cmake.patch @@ -0,0 +1,122 @@ +diff --git a/trunk/CMakeLists.txt b/trunk/CMakeLists.txt +index 464fb13..dc8e26f 100644 +--- a/trunk/CMakeLists.txt ++++ b/trunk/CMakeLists.txt +@@ -8,6 +8,7 @@ + # which were derived from those used by libLAS (http://liblas.org/) + # + # History ++# 2018/01/25 - updated by Hiroshi Miura + # 2012/07/02 - Created by Peter Bunting + # + ############################################################################### +@@ -50,13 +51,10 @@ endif() + + option (BUILD_SHARED_LIBS "Build with shared library" ON) + +-set(HDF5_INCLUDE_DIR /usr/local/include CACHE PATH "Include PATH for HDF5") +-set(HDF5_LIB_PATH /usr/local/lib CACHE PATH "Library PATH for HDF5") + + set(GDAL_INCLUDE_DIR "NOTFOUND" CACHE PATH "Include PATH for GDAL") + set(GDAL_LIB_PATH "NOTFOUND" CACHE PATH "Library PATH for GDAL") + +-set(HDF5_STATIC_LIBS FALSE CACHE BOOL "On Windows, link against static HDF5 libs") + + IF(GDAL_INCLUDE_DIR AND GDAL_LIB_PATH) + # by default, only build if paths are set +@@ -65,6 +63,8 @@ ELSE() + set(LIBKEA_WITH_GDAL FALSE CACHE BOOL "Choose if .kea GDAL driver should be built") + ENDIF() + ++find_package(hdf5 COMPONENTS CXX HL REQUIRED) ++link_libraries(hdf5::hdf5_cpp-shared) + ############################################################################### + + ############################################################################### +@@ -141,14 +141,7 @@ endif(APPLE) + # Check the required libraries are present + + if (MSVC) +- if(HDF5_STATIC_LIBS) +- set(HDF5_LIBRARIES -LIBPATH:"${HDF5_LIB_PATH}" hdf5_cpp.lib hdf5.lib zlibstatic.lib) +- else() +- set(HDF5_LIBRARIES -LIBPATH:"${HDF5_LIB_PATH}" hdf5_cpp.lib hdf5.lib) +- set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB) +- endif() + else() +- set(HDF5_LIBRARIES "-L${HDF5_LIB_PATH} -lhdf5 -lhdf5_hl -lhdf5_cpp") + endif(MSVC) + + if (MSVC) +@@ -160,21 +153,19 @@ endif(MSVC) + + ############################################################################### + # Setup configure file +-configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${PROJECT_HEADER_DIR}/libkea/kea-config.h" ) +-configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${PROJECT_BINARY_DIR}/kea-config" ) ++configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" ) ++configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" ) + ############################################################################### + + ############################################################################### + # Documentation +-file(READ "doc/index.txt" README ) +-file(WRITE "README.txt" "${README}") + ############################################################################### + + ############################################################################### + # Build library + + include_directories ("${PROJECT_HEADER_DIR}") +-include_directories(${HDF5_INCLUDE_DIR}) ++include_directories ("${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}") + add_subdirectory ("${PROJECT_SOURCE_DIR}") + if (LIBKEA_WITH_GDAL) + add_subdirectory ("${PROJECT_GDAL_DIR}") +@@ -185,13 +176,11 @@ endif(LIBKEA_WITH_GDAL) + # Tests + enable_testing() + add_test(NAME test1 COMMAND src/test1) +- + ############################################################################### + + ############################################################################### + # Installation +- +-install (FILES "${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ++install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + ############################################################################### + + ############################################################################### +diff --git a/trunk/src/CMakeLists.txt b/trunk/src/CMakeLists.txt +index 84456c4..b804e74 100644 +--- a/trunk/src/CMakeLists.txt ++++ b/trunk/src/CMakeLists.txt +@@ -37,6 +37,7 @@ target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} ) + + ############################################################################### + # Testing ++if(NOT DISABLE_TESTS) + # exe needs to be in 'src' otherwise it doesn't work + add_executable (test1 ${PROJECT_TEST_DIR}/test1.cpp) + target_link_libraries (test1 ${LIBKEA_LIB_NAME}) +@@ -53,6 +54,7 @@ if(NOT WIN32) + # probably should match other compilers, but since this is a Conda + # specific hack I'm not going to bother + endif() ++endif() + + ############################################################################### + # Set target properties +@@ -67,6 +69,9 @@ PROPERTIES + + ############################################################################### + # Installation +-install (TARGETS ${LIBKEA_LIB_NAME} DESTINATION lib) ++install (TARGETS ${LIBKEA_LIB_NAME} ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + install (FILES ${LIBKEA_H} DESTINATION include/libkea) + ############################################################################### +\ No newline at end of file diff --git a/ports/kealib/portfile.cmake b/ports/kealib/portfile.cmake new file mode 100644 index 000000000..4cd8b59d5 --- /dev/null +++ b/ports/kealib/portfile.cmake @@ -0,0 +1,39 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/kealib-1.4.7) +vcpkg_download_distfile(ARCHIVE + URLS "https://bitbucket.org/chchrsc/kealib/downloads/kealib-1.4.7.tar.gz" + FILENAME "kealib-1.4.7.tar.gz" + SHA512 2d58d7d08943d028e19a24f3ad3316a13b4db59be8697cebf30ee621e6bf0a6a47bf61abadd972d6ea7af1c8eed28bba7edf40fb8709fcccc1effbc90ae6e244 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/fix-cmake.patch +) + +if ("parallel" IN_LIST FEATURES) + set(ENABLE_PARALLEL ON) +else() + set(ENABLE_PARALLEL OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/trunk + PREFER_NINJA + OPTIONS + -DHDF5_PREFER_PARALLEL=${ENABLE_PARALLEL} + -DLIBKEA_WITH_GDAL=OFF + -DDISABLE_TESTS=ON +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL ${SOURCE_PATH}/trunk/python/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/kealib RENAME copyright) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin) +endif() \ No newline at end of file -- cgit v1.2.3