diff options
| author | Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> | 2020-01-11 00:34:09 +0100 |
|---|---|---|
| committer | dan-shaw <51385773+dan-shaw@users.noreply.github.com> | 2020-01-10 15:34:09 -0800 |
| commit | d400f3d50bd0c79b192134aa50875f7579ad8efc (patch) | |
| tree | 8e78a8571a52d190113f2b683a7d738ddc1454b1 | |
| parent | 7dc8ecbc08eed912fe1952c3d462cfc683931060 (diff) | |
| download | vcpkg-d400f3d50bd0c79b192134aa50875f7579ad8efc.tar.gz vcpkg-d400f3d50bd0c79b192134aa50875f7579ad8efc.zip | |
[netcdf-c] Update to 4.7.3 and switched to use targets to generate valid targets (#9361)
* fix netcdf configure errors and generated targets
* remove target_path
since cmake searches in name*
* bump control
* netcdf update to 4.7.3 and use targets instead of libraries in cmake
* remove config from the zlib find_dependency call
because there is no config. The target is supplied by a cmake module itself
* move usage of hdf5 target to an further up in the cmakelists.txt and use config also on linux
* fix dynamic builds
* remove code from portfile
* remove commenting from patch and simply delete the lines
| -rw-r--r-- | ports/netcdf-c/CONTROL | 2 | ||||
| -rw-r--r-- | ports/netcdf-c/fix-build-error-on-linux.patch | 28 | ||||
| -rw-r--r-- | ports/netcdf-c/hdf5.patch | 27 | ||||
| -rw-r--r-- | ports/netcdf-c/hdf5_2.patch | 13 | ||||
| -rw-r--r-- | ports/netcdf-c/hdf5_3.patch | 14 | ||||
| -rw-r--r-- | ports/netcdf-c/portfile.cmake | 15 | ||||
| -rw-r--r-- | ports/netcdf-c/transitive-hdf5.patch | 13 | ||||
| -rw-r--r-- | ports/netcdf-c/use_targets.patch | 168 |
8 files changed, 174 insertions, 106 deletions
diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL index a918e9020..1d5b7cb90 100644 --- a/ports/netcdf-c/CONTROL +++ b/ports/netcdf-c/CONTROL @@ -1,5 +1,5 @@ Source: netcdf-c -Version: 4.7.0-5 +Version: 4.7.3 Build-Depends: hdf5, curl Homepage: https://github.com/Unidata/netcdf-c Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/fix-build-error-on-linux.patch b/ports/netcdf-c/fix-build-error-on-linux.patch deleted file mode 100644 index bdcd7c97a..000000000 --- a/ports/netcdf-c/fix-build-error-on-linux.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/include/ncconfigure.h b/include/ncconfigure.h -index 2c5b2c8..d397790 100644 ---- a/include/ncconfigure.h -+++ b/include/ncconfigure.h -@@ -25,20 +25,20 @@ missing functions should be - defined and missing types defined. - */ - --#ifndef HAVE_STRDUP -+#ifndef strdup - extern char* strdup(const char*); - #endif - - /* handle null arguments */ - #ifndef nulldup --#ifdef HAVE_STRDUP -+#ifdef strdup - #define nulldup(s) ((s)==NULL?NULL:strdup(s)) - #else - char *nulldup(const char* s); - #endif - #endif - --#ifdef _MSC_VER -+#ifdef _WIN32 - #ifndef HAVE_SSIZE_T - #include <basetsd.h> - typedef SSIZE_T ssize_t; diff --git a/ports/netcdf-c/hdf5.patch b/ports/netcdf-c/hdf5.patch deleted file mode 100644 index 71f4921ed..000000000 --- a/ports/netcdf-c/hdf5.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a3874c13..36f15beb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -599,11 +599,10 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) - IF(NC_FIND_SHARED_LIBS) - SET(NC_HDF5_LINK_TYPE "shared") - SET(NC_HDF5_LINK_TYPE_UPPER "SHARED") -- ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB) - ELSE(NC_FIND_SHARED_LIBS) - SET(NC_HDF5_LINK_TYPE "static") - SET(NC_HDF5_LINK_TYPE_UPPER "STATIC") -- ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB) -+ SET(HDF5_USE_STATIC_LIBRARIES ON) - ENDIF(NC_FIND_SHARED_LIBS) - - #####
-@@ -614,8 +615,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) - # had worked.
- #####
- IF(MSVC)
-- SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
-- FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL NO_MODULES REQUIRED ${NC_HDF5_LINK_TYPE}) -+ FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED) - ELSE(MSVC)
- FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
- ENDIF(MSVC)
diff --git a/ports/netcdf-c/hdf5_2.patch b/ports/netcdf-c/hdf5_2.patch deleted file mode 100644 index a3a3fb751..000000000 --- a/ports/netcdf-c/hdf5_2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt -index ea9b0294..3c7f427d 100644 ---- a/liblib/CMakeLists.txt -+++ b/liblib/CMakeLists.txt -@@ -83,7 +83,7 @@ IF(USE_HDF5 OR USE_NETCDF4) - # HDF5_HL_LIBRARY. - SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ELSE() # Windows CMake defines HDF5_LIBRARIES. -- SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) -+ SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ENDIF() - ENDIF() - diff --git a/ports/netcdf-c/hdf5_3.patch b/ports/netcdf-c/hdf5_3.patch deleted file mode 100644 index 502a8ea99..000000000 --- a/ports/netcdf-c/hdf5_3.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt
-index f3c7bbc..34fc2ab 100644
---- a/libhdf5/CMakeLists.txt
-+++ b/libhdf5/CMakeLists.txt
-@@ -20,3 +20,9 @@ add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES})
-
- # Remember to package this file for CMake builds.
- ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt)
-+
-+if(HDF5_BUILD_SHARED_LIBS)
-+ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-shared hdf5::hdf5_hl-shared)
-+else()
-+ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static)
-+endif()
diff --git a/ports/netcdf-c/portfile.cmake b/ports/netcdf-c/portfile.cmake index f3a80ee48..61dd1d885 100644 --- a/ports/netcdf-c/portfile.cmake +++ b/ports/netcdf-c/portfile.cmake @@ -1,24 +1,19 @@ -include(vcpkg_common_functions) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Unidata/netcdf-c - REF v4.7.0 - SHA512 6602799780105c60ac8c873ed4055c1512dc8bebf98de01e1cce572d113ffb3bf3ca522475b93255c415340f672c55dc6785e0bdbcc39055314683da1d02141a + REF b7cd387bee8c661141fabb490f4969587c008c55 # v4.7.3 + SHA512 a55391620fac61e4975fe62907ca21049911afce6190fc12d183d24133a32aae8cd223b97a3fe57fc82d8bdca1a7db451046e3be3c379051624d48b1f56c0332 HEAD_REF master PATCHES no-install-deps.patch config-pkg-location.patch - transitive-hdf5.patch - hdf5.patch - hdf5_2.patch - fix-build-error-on-linux.patch - hdf5_3.patch + use_targets.patch ) #Remove outdated find modules file(REMOVE "${SOURCE_PATH}/cmake/modules/FindSZIP.cmake") file(REMOVE "${SOURCE_PATH}/cmake/modules/FindZLIB.cmake") +file(REMOVE "${SOURCE_PATH}/cmake/modules/windows/FindHDF5.cmake") if(VCPKG_CRT_LINKAGE STREQUAL "static") set(NC_USE_STATIC_CRT ON) @@ -28,7 +23,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - DISABLE_PARALLEL_CONFIGURE + DISABLE_PARALLEL_CONFIGURE # netcdf-c configures in the source! PREFER_NINJA OPTIONS -DBUILD_UTILITIES=OFF diff --git a/ports/netcdf-c/transitive-hdf5.patch b/ports/netcdf-c/transitive-hdf5.patch deleted file mode 100644 index 89773e6d4..000000000 --- a/ports/netcdf-c/transitive-hdf5.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in -index 6f4ccf8..14a3743 100644 ---- a/netCDFConfig.cmake.in -+++ b/netCDFConfig.cmake.in -@@ -11,6 +11,8 @@ set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@") - - set(netCDF_LIBRARIES netcdf) - -+find_package(HDF5 COMPONENTS C HL CONFIG REQUIRED) -+ - # include target information - include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake") - diff --git a/ports/netcdf-c/use_targets.patch b/ports/netcdf-c/use_targets.patch new file mode 100644 index 000000000..99e50dc9d --- /dev/null +++ b/ports/netcdf-c/use_targets.patch @@ -0,0 +1,168 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ce05e0fe..7671d7b1e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -431,7 +431,6 @@ IF(NC_EXTRA_DEPS) + SET(EXTRA_DEPS ${EXTRA_DEPS} "${${_LIB}_DEP}")
+ ENDFOREACH()
+ MESSAGE("Extra deps: ${EXTRA_DEPS}")
+- LIST(REMOVE_DUPLICATES EXTRA_DEPS)
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${EXTRA_DEPS})
+ ENDIF()
+ ###
+@@ -599,15 +599,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) + # we will use a static library. This can be toggled
+ # by explicitly modifying NC_FIND_SHARED_LIBS.
+ ##
+- IF(NC_FIND_SHARED_LIBS)
+- SET(NC_HDF5_LINK_TYPE "shared")
+- SET(NC_HDF5_LINK_TYPE_UPPER "SHARED")
+- ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
+- ELSE(NC_FIND_SHARED_LIBS)
+- SET(NC_HDF5_LINK_TYPE "static")
+- SET(NC_HDF5_LINK_TYPE_UPPER "STATIC")
+- ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB)
+- ENDIF(NC_FIND_SHARED_LIBS)
+
+ #####
+ # First, find the C and HL libraries.
+@@ -620,9 +620,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) + SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
+ FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE})
+ ELSE(MSVC)
+- FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
++ FIND_PACKAGE(HDF5 COMPONENTS C HL CONFIG REQUIRED)
+ ENDIF(MSVC)
+-
++
+ ##
+ # Next, check the HDF5 version. This will inform which
+ # HDF5 variables we need to munge.
+@@ -695,6 +695,19 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) + ENDIF()
+ ENDIF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
+
++ if(TARGET hdf5::hdf5-shared)
++ set(HDF5_C_LIBRARY hdf5::hdf5-shared)
++ set(HDF5_C_LIBRARY_hdf5 hdf5::hdf5-shared)
++ set(HDF5_HL_LIBRARIES hdf5::hdf5_hl-shared) ++ ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
++ else()
++ set(HDF5_C_LIBRARY hdf5::hdf5-static)
++ set(HDF5_C_LIBRARY_hdf5 hdf5::hdf5-static)
++ set(HDF5_HL_LIBRARIES hdf5::hdf5_hl-static) ++ ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB)
++ endif()
++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${HDF5_C_LIBRARY})
++
+ FIND_PACKAGE(Threads)
+
+ # There is a missing case in the above code so default it
+@@ -721,16 +733,11 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
+
+ #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
+- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Z_SZIP "" USE_SZIP)
++ set(USE_SZIP ${HDF5_ENABLE_SZIP_SUPPORT})
+ IF(USE_SZIP)
+- FIND_LIBRARY(SZIP NAMES szip sz)
+- IF(SZIP)
++ #FIND_LIBRARY(SZIP NAMES szip sz)
++ #IF(SZIP)
+ SET(HAVE_H5Z_SZIP 1)
+- SET(SZIP_LIBRARY ${SZIP})
+- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SZIP})
+- ELSE()
+- MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
+- ENDIF()
+ ENDIF()
+
+ CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HAVE_H5PSET_LIBVER_BOUNDS)
+@@ -764,8 +776,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) + ENDIF(USE_HDF5 OR ENABLE_NETCDF_4)
+
+ # See if we have libcurl
+-FIND_PACKAGE(CURL)
+-ADD_DEFINITIONS(-DCURL_STATICLIB=1)
++FIND_PACKAGE(CURL CONFIG)
+ INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
+
+ # Check to see if CURLOPT_USERNAME is defined.
+@@ -1890,7 +1902,6 @@ ENDIF() +
+ STRING(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")
+
+-LIST(REMOVE_DUPLICATES NC_LIBS)
+ LIST(REMOVE_DUPLICATES LINKFLAGS)
+
+ SET(LIBS ${NC_LIBS})
+diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt +index ea9b02949..ec7851f37 100644 +--- a/liblib/CMakeLists.txt ++++ b/liblib/CMakeLists.txt +@@ -58,7 +58,7 @@ ENDIF() + + SET(TLL_LIBS "") + +-SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY}) ++SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ZLIB::ZLIB) + + # Add extra dependencies specified via NC_EXTRA_DEPS + SET(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS}) +@@ -68,27 +68,15 @@ IF(HAVE_LIBDL) + ENDIF() + + IF(USE_HDF5 OR USE_NETCDF4) +- IF(NOT MSVC) +- # Some version of cmake define HDF5_hdf5_LIBRARY instead of +- # HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES +- IF(HDF5_hdf5_LIBRARY AND NOT HDF5_C_LIBRARIES) +- SET(HDF5_C_LIBRARIES ${HDF5_hdf5_LIBRARY}) +- ENDIF() +- IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARIES) +- SET(HDF5_HL_LIBRARIES ${HDF5_hdf5_hl_LIBRARY}) +- ENDIF() +- # The order of the libraries is important here for static +- # builds: +- # Make sure that HDF5_C_LIBRARY appears *after* +- # HDF5_HL_LIBRARY. +- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) +- ELSE() # Windows CMake defines HDF5_LIBRARIES. +- SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) +- ENDIF() ++ if(TARGET hdf5::hdf5-shared) ++ SET(TLL_LIBS ${TLL_LIBS} hdf5::hdf5-shared hdf5::hdf5_hl-shared) ++ else() ++ SET(TLL_LIBS ${TLL_LIBS} hdf5::hdf5-static hdf5::hdf5_hl-static) ++ endif() + ENDIF() + + IF(USE_DAP) +- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) ++ SET(TLL_LIBS ${TLL_LIBS} CURL::libcurl) + ENDIF() + + IF(USE_HDF4) +@@ -100,7 +88,6 @@ IF(ENABLE_PNETCDF AND PNETCDF) + ENDIF() + + IF(TLL_LIBS) +- LIST(REMOVE_DUPLICATES TLL_LIBS) + ENDIF() + + TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS}) +diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in +index c89cf3e67..b81f35a1b 100644 +--- a/netCDFConfig.cmake.in ++++ b/netCDFConfig.cmake.in +@@ -12,6 +12,10 @@ set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@") + set(netCDF_LIBRARIES netcdf) + + # include target information ++include(CMakeFindDependencyMacro) ++find_dependency(ZLIB) ++find_dependency(HDF5 CONFIG) ++find_dependency(CURL CONFIG) + include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake") + + # Compiling Options |
