From 3712738877a14c3257155acd1f558cfe039f3625 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 8 Mar 2018 15:54:40 -0600 Subject: HDFFV-4359 Add C,HL,CXX files --- CMakeInstallation.cmake | 18 ----------------- MANIFEST | 2 ++ c++/src/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++ config/cmake/libh5cc.in | 32 +++++++++++++++++++++++++++++++ config/cmake/libhdf5.pc.in | 14 ++++++++++++++ hl/src/CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 189 insertions(+), 18 deletions(-) create mode 100755 config/cmake/libh5cc.in create mode 100755 config/cmake/libhdf5.pc.in diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 0bfb2cc..4a09d2d 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -144,24 +144,6 @@ install ( ) #----------------------------------------------------------------------------- -# Create pkgconfig files -#----------------------------------------------------------------------------- -#foreach (libs ${LINK_LIBS}) -# set (LIBS "${LIBS} -l${libs}") -#endforeach () -#foreach (libs ${HDF5_LIBRARIES_TO_EXPORT}) -# set (HDF5LIBS "${HDF5LIBS} -l${libs}") -#endforeach () -#configure_file ( -# ${HDF_RESOURCES_DIR}/libhdf5.pc.in -# ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc @ONLY -#) -#install ( -# FILES ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc -# DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig -#) - -#----------------------------------------------------------------------------- # Configure the HDF518_Examples.cmake file and the examples #----------------------------------------------------------------------------- option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) diff --git a/MANIFEST b/MANIFEST index 229a5ec..4e35691 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3084,6 +3084,8 @@ ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5UseFortran.cmake ./config/cmake/jrunTest.cmake +./config/cmake/libh5cc.in +./config/cmake/libhdf5.pc.in ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/mccacheinit.cmake ./config/cmake/patch.xml diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 921497f..e685491 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -139,3 +139,50 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_CPP_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT libraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) +endif () + diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in new file mode 100755 index 0000000..f462d56 --- /dev/null +++ b/config/cmake/libh5cc.in @@ -0,0 +1,32 @@ +#! /bin/sh +## +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +## + +prg=$0 +if [ ! -e "$prg" ]; then + case $prg in + (*/*) exit 1;; + (*) prg=$(command -v -- "$prg") || exit;; + esac +fi +dir=$( + cd -P -- "$(dirname -- "$prg")/.." && pwd -P +) || exit +prg=$dir/$(basename -- "$prg") || exit + +printf '%s\n' "$prg" +printf 'dir is %s\n' "$dir" + +export PKG_CONFIG_PATH=$dir/lib/pkgconfig + +@_PKG_CONFIG_COMPILER@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@-@_PKG_CONFIG_VERSION@` $@ diff --git a/config/cmake/libhdf5.pc.in b/config/cmake/libhdf5.pc.in new file mode 100755 index 0000000..4a2ebaa --- /dev/null +++ b/config/cmake/libhdf5.pc.in @@ -0,0 +1,14 @@ +prefix=@_PKG_CONFIG_PREFIX@ +exec_prefix=@_PKG_CONFIG_EXEC_PREFIX@ +libdir=@_PKG_CONFIG_LIBDIR@ +includedir=@_PKG_CONFIG_INCLUDEDIR@ + +Name: @_PKG_CONFIG_LIBNAME@ +Description: HDF5 (Hierarchical Data Format 5) Software Library +Version: @_PKG_CONFIG_VERSION@ + +Cflags: -I${includedir} +Libs: -L${libdir} @_PKG_CONFIG_SH_LIBS@ +Requires: @_PKG_CONFIG_REQUIRES@ +Libs.private: @_PKG_CONFIG_LIBS_PRIVATE@ @_PKG_CONFIG_LIBS@ +Requires.private: @_PKG_CONFIG_REQUIRES_PRIVATE@ diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index d21a3ea..e9216bd 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -88,3 +88,49 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_HL_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT libraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5chl + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5chl + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) +endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf7fb07..d10870d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -991,3 +991,51 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS}) + set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") +endforeach () + +set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES) +set (_PKG_CONFIG_REQUIRES_PRIVATE) + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT libraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5cc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5cc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) +endif () -- cgit v0.12 From 13f5388149a0dd39a6f67d30d63c6d622e249fd9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 8 Mar 2018 16:39:35 -0600 Subject: HDFFV-4359 Add HL C++ and fix install parameters --- c++/src/CMakeLists.txt | 4 ++-- hl/c++/src/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ hl/src/CMakeLists.txt | 4 ++-- release_docs/RELEASE.txt | 10 ++++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index e685491..350bdf7 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -168,7 +168,7 @@ configure_file ( install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig - COMPONENT libraries + COMPONENT cpplibraries ) if (NOT WIN32) @@ -182,7 +182,7 @@ if (NOT WIN32) FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ DESTINATION ${HDF5_INSTALL_BIN_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries + COMPONENT cpplibraries ) endif () diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 0f187c5..28f860f 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -69,3 +69,50 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_HL_CPP_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT hlcpplibraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT hlcpplibraries + ) +endif () + diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index e9216bd..62e8c21 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -117,7 +117,7 @@ configure_file ( install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig - COMPONENT libraries + COMPONENT hllibraries ) if (NOT WIN32) @@ -131,6 +131,6 @@ if (NOT WIN32) FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5chl DESTINATION ${HDF5_INSTALL_BIN_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries + COMPONENT hllibraries ) endif () diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6f16aa2..0061910 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -56,6 +56,16 @@ New Features ------------- - CMake + Add pkg-config file generation + + Added pkg-config file generation for the C, C++, HL, and HL C++ libraries. + In addition, builds on linux will create h5cXXX scripts that use the pkg-config + files. This is a limited implementation of a script like autotools h5cc. + + (ADB - 2018/03/08, HDFFV-4359) + + - CMake + Refactor use of CMAKE_BUILD_TYPE for new variable, which understands the type of generator in use. -- cgit v0.12