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 <miurahr@linux.com>

* [kealib] fix option key to specify building shared library

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] call copy_pdbs() after install

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] update cmake patch

- fix library name in MSVC
- fix to find hdf5 libraries

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] add parallel feature

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Revert "[hdf5] add cpp feature"

This reverts commit fbe876646601ea1426679793d44dec7cd3852ddf.

* [hdf5] always build cpp library

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] drop dependency for feature hdf5[cpp]

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] update static link handling

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [kealib] revert a previous hack for static link to szip/zlib

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* [hdf5] work around szip-config.cmake behavior

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* link dependencies of static libs
This commit is contained in:
Hiroshi Miura 2018-03-02 03:39:20 +09:00 committed by Robert Schumacher
parent e70250ca19
commit 8fe30fe1ea
4 changed files with 170 additions and 0 deletions

1
ports/hdf5/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
use-szip-config.patch text eol=crlf

8
ports/kealib/CONTROL Normal file
View File

@ -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

View File

@ -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

View File

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