Skip to content

Commit

Permalink
[netcdf-c] fix feature nczarr-zip (#30938)
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Apr 19, 2023
1 parent a0a8288 commit 6b718b8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
61 changes: 60 additions & 1 deletion ports/netcdf-c/fix-dependency-libzip.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ index b93a141..c3763a7 100644
-FIND_PACKAGE(Zip)
+if(ENABLE_NCZARR_ZIP)
+ find_package(libzip CONFIG REQUIRED)
+ set(Zip_LIBRARIES libzip::zip)
+ set(Zip_LIBRARIES zip)
+ set(Zip_FOUND TRUE)
+else()
+ set(Zip_LIBRARIES "")
Expand All @@ -32,3 +32,62 @@ index b3be259..72b4b25 100644
include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake")

# Compiling Options
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index 1363d35..31dbbda 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -134,6 +134,10 @@ ENDIF()

TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})

+if(ENABLE_NCZARR_ZIP)
+ target_link_libraries(netcdf libzip::zip)
+endif()
+
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TLL_LIBS})
IF(MSVC)
SET_TARGET_PROPERTIES(netcdf PROPERTIES
diff --git a/libnczarr/CMakeLists.txt b/libnczarr/CMakeLists.txt
index 86e093b..d7edaf6 100644
--- a/libnczarr/CMakeLists.txt
+++ b/libnczarr/CMakeLists.txt
@@ -58,6 +58,10 @@ ENDIF()

add_library(nczarr OBJECT ${libnczarr_SOURCES})

+IF(ENABLE_NCZARR_ZIP)
+ target_link_libraries(nczarr PRIVATE libzip::zip)
+ENDIF()
+
IF(MPI_C_INCLUDE_PATH)
target_include_directories(nczarr PUBLIC ${MPI_C_INCLUDE_PATH})
ENDIF(MPI_C_INCLUDE_PATH)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6357965..3de76cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2123,6 +2123,10 @@ replace_pkgconfig_module("-lzip" "libzip")
replace_pkgconfig_module("-lCURL[^ ]*" "libcurl")
replace_pkgconfig_module("-lZLIB[^ ]*" "zlib")

+IF(ENABLE_NCZARR_ZIP)
+ string(APPEND NC_REQUIRES_PRIVATE " libzip")
+ENDIF()
+
configure_file(
${netCDF_SOURCE_DIR}/netcdf.pc.in
${netCDF_BINARY_DIR}/netcdf.pc @ONLY)
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index 31dbbda..eb497cc 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -120,9 +120,6 @@ IF(ENABLE_PNETCDF AND PNETCDF)
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
ENDIF()

-IF(ENABLE_NCZARR_ZIP)
- SET(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
-ENDIF()

IF(ENABLE_S3_SDK)
TARGET_LINK_DIRECTORIES(netcdf PUBLIC ${AWSSDK_LIB_DIR})
2 changes: 1 addition & 1 deletion ports/netcdf-c/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "netcdf-c",
"version": "4.8.1",
"port-version": 2,
"port-version": 3,
"description": "A set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.",
"homepage": "https://github.com/Unidata/netcdf-c",
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5482,7 +5482,7 @@
},
"netcdf-c": {
"baseline": "4.8.1",
"port-version": 2
"port-version": 3
},
"netcdf-cxx4": {
"baseline": "4.3.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/n-/netcdf-c.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2d17052df3479de37b4c756f4e90661c9fa85e7d",
"version": "4.8.1",
"port-version": 3
},
{
"git-tree": "f4d487e2f7e093b2406887023bb3a0856735bad5",
"version": "4.8.1",
Expand Down

0 comments on commit 6b718b8

Please sign in to comment.