Skip to content

Commit 3ffe7be

Browse files
Enhance/Fix filter support
re: Discussion #2214 The primary change is to support so-called "standard filters". A standard filter is one that is defined by the following netcdf-c API: ```` int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params); int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params); ```` So for example, zstandard would be a standard filter by defining the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*. In order to define these functions, we need a new dispatch function: ```` int nc_inq_filter_avail(int ncid, unsigned filterid); ```` This function, combined with the existing filter API can be used to implement arbitrary standard filters using a simple code pattern. Note that I would have preferred that this function return a list of all available filters, but HDF5 does not support that functionality. So this PR implements the dispatch function and implements the following standard functions: + bzip2 + zstandard + blosc Specific test cases are also provided for HDF5 and NCZarr. Over time, other specific standard filters will be defined. ## Primary Changes * Add nc_inq_filter_avail() to netcdf-c API. * Add standard filter implementations to test use of *nc_inq_filter_avail*. * Bump the dispatch table version number and add to all the relevant dispatch tables (libsrc, libsrcp, etc). * Create a program to invoke nc_inq_filter_avail so that it is accessible to shell scripts. * Cleanup szip support to properly support szip when HDF5 is disabled. This involves detecting libsz separately from testing if HDF5 supports szip. * Integrate shuffle and fletcher32 into the existing filter API. This means that, for example, nc_def_var_fletcher32 is now a wrapper around nc_def_var_filter. * Extend the Codec defaulting to allow multiple default shared libraries. ## Misc. Changes * Modify configure.ac/CMakeLists.txt to look for the relevant libraries implementing standard filters. * Modify libnetcdf.settings to list available standard filters (including deflate and szip). * Add CMake test modules to locate libbz2 and libzstd. * Cleanup the HDF5 memory manager function use in the plugins. * remove unused file include//ncfilter.h * remove tests for the HDF5 memory operations e.g. H5allocate_memory. * Add flag to ncdump to force use of _Filter instead of _Deflate or _Shuffle or _Fletcher32. Used for testing.
1 parent f121e0b commit 3ffe7be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2419
-1324
lines changed

.github/workflows/mingw.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/run_tests_win_mingw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: Run MSYS2, MinGW64-based Tests
88

99

10-
on: [ pull_request ]
10+
on: [pull_request]
1111

1212
jobs:
1313

CMakeLists.txt

Lines changed: 85 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SET(PACKAGE_VERSION ${VERSION})
4242

4343
# Version of the dispatch table. This must match the value in
4444
# configure.ac.
45-
SET(NC_DISPATCH_VERSION 4)
45+
SET(NC_DISPATCH_VERSION 5)
4646

4747
# Get system configuration, Use it to determine osname, os release, cpu. These
4848
# will be used when committing to CDash.
@@ -588,6 +588,33 @@ ENDIF(ENABLE_STRICT_NULL_BYTE_HEADER_PADDING)
588588
# SET(BUILD_RPC ON CACHE BOOL "")
589589
#ENDIF()
590590

591+
# Note that szip management is tricky.
592+
# This is because we have three things to consider:
593+
# 1. is libsz available?
594+
# 2. is szip enabled in HDF5?
595+
# 3. is nczarr enabled?
596+
# We need separate flags for cases 1 and 2
597+
598+
# We need to determine if libsz is available both for HDF5 and NCZarr
599+
# If user has specified the `SZIP_LIBRARY`, use it; otherwise try to find...
600+
IF(NOT SZIP_LIBRARY)
601+
FIND_LIBRARY(SZIP PATH NAMES szip sz sz2)
602+
IF(SZIP)
603+
SET(SZIP_LIBRARY ${SZIP})
604+
ELSE()
605+
UNSET(SZIP_LIBRARY)
606+
UNSET(SZIP)
607+
ENDIF()
608+
ENDIF()
609+
610+
IF(SZIP_LIBRARY)
611+
SET(SZIP_FOUND yes)
612+
SET(HAVE_SZ yes)
613+
ELSE()
614+
SET(SZIP_FOUND no)
615+
SET(HAVE_SZ no)
616+
ENDIF()
617+
591618
##
592619
# Option to Enable HDF5
593620
#
@@ -847,19 +874,18 @@ IF(USE_HDF5)
847874
#error
848875
#endif
849876
int main() {
850-
int x = 1;}" USE_SZIP)
851-
IF(USE_SZIP)
877+
int x = 1;}" USE_HDF5_SZIP)
878+
IF(USE_HDF5_SZIP)
879+
SET(HAVE_H5Z_SZIP yes)
852880
# If user has specified the `SZIP_LIBRARY`, use it; otherwise try to find...
853-
IF(NOT SZIP_LIBRARY)
854-
FIND_LIBRARY(SZIP PATH NAMES szip sz)
855-
SET(SZIP_LIBRARY ${SZIP})
856-
IF(NOT SZIP)
881+
IF(SZIP_FOUND)
882+
SET(CMAKE_REQUIRED_LIBRARIES ${SZIP_LIBRARY} ${CMAKE_REQUIRED_LIBRARIES})
883+
MESSAGE(STATUS "HDF5 has szip.")
884+
ELSE()
857885
MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
858-
ENDIF()
859886
ENDIF()
860-
SET(HAVE_H5Z_SZIP 1)
861-
SET(CMAKE_REQUIRED_LIBRARIES ${SZIP_LIBRARY} ${CMAKE_REQUIRED_LIBRARIES})
862-
MESSAGE(STATUS "HDF5 has szip.")
887+
ELSE()
888+
SET(HAVE_H5Z_SZIP no)
863889
ENDIF()
864890

865891
####
@@ -891,9 +917,6 @@ IF(USE_HDF5)
891917

892918
#Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
893919
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
894-
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY)
895-
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5allocate_memory "" HAVE_H5ALLOCATE_MEMORY)
896-
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5resize_memory "" HAVE_H5RESIZE_MEMORY)
897920

898921
IF(HDF5_PARALLEL)
899922
SET(HDF5_CC h5pcc)
@@ -1055,30 +1078,33 @@ ELSE()
10551078
SET(ENABLE_ZLIB FALSE)
10561079
ENDIF()
10571080

1058-
# See if we have libblosc
1059-
IF(!MSVC)
1060-
FIND_PACKAGE(Blosc)
1061-
ENDIF()
1062-
# Define a test flag for have blosc library
1063-
IF(Blosc_FOUND)
1064-
INCLUDE_DIRECTORIES(${Blosc_INCLUDE_DIRS})
1065-
SET(ENABLE_BLOSC TRUE)
1081+
macro(set_std_filter filter)
1082+
# Upper case the filter name
1083+
string(TOUPPER "${filter}" upfilter)
1084+
string(TOLOWER "${filter}" downfilter)
1085+
# Define a test flag for filter
1086+
IF(${filter}_FOUND)
1087+
INCLUDE_DIRECTORIES(${filter}_INCLUDE_DIRS})
1088+
SET(ENABLE_${upfilter} TRUE)
1089+
SET(STD_FILTERS "${STD_FILTERS},${downfilter}")
10661090
ELSE()
1067-
SET(ENABLE_BLOSC FALSE)
1091+
SET(ENABLE_${upfilter} FALSE)
10681092
ENDIF()
1093+
endmacro(set_std_filter)
10691094

1070-
# See if we have libszip
1071-
IF(!MSVC)
1072-
#FIND_PACKAGE(SZIP)
1073-
#FIND_LIBRARY(SZIP PATH NAMES szip sz)
1074-
SET(SZIP_LIBRARY ${SZIP})
1075-
ENDIF()
1076-
# Define a test flag for have szip library
1077-
IF(SZIP_FOUND)
1078-
INCLUDE_DIRECTORIES(${SZIP_INCLUDE_DIRS})
1079-
SET(ENABLE_SZIP TRUE)
1080-
ELSE()
1081-
SET(ENABLE_SZIP FALSE)
1095+
# Locate some compressors
1096+
FIND_PACKAGE(Bz2)
1097+
FIND_PACKAGE(Blosc)
1098+
FIND_PACKAGE(Zstd)
1099+
1100+
# Accumulate standard filters
1101+
set(STD_FILTERS "deflate") # Always have deflate */
1102+
set_std_filter(SZIP)
1103+
set_std_filter(Blosc)
1104+
set_std_filter(Zstd)
1105+
set_std_filter(Bz2)
1106+
IF(NOT Bz2_FOUND)
1107+
set(STD_FILTERS "${STD_FILTERS},bzip2") # Always have bzip2 */
10821108
ENDIF()
10831109

10841110
# See if we have libzip
@@ -1160,21 +1186,22 @@ IF(ENABLE_NCZARR_S3_TESTS AND NOT ENABLE_NCZARR_S3)
11601186
SET(ENABLE_NCZARR_S3_TESTS OFF CACHE BOOL "NCARR S3 TESTS" FORCE)
11611187
ENDIF()
11621188

1163-
# See if aws-s3-sdk is available
1164-
# But only if enabled
1189+
# Note we check for the library after checking for enable_nczarr_s3
1190+
# because for some reason this screws up if we unconditionally test for sdk
1191+
# and it is not available. Fix someday
11651192
IF(ENABLE_NCZARR_S3)
1166-
find_package(AWSSDK REQUIRED COMPONENTS s3;core)
1167-
IF(AWSSDK_FOUND)
1168-
SET(service s3;core)
1169-
AWSSDK_DETERMINE_LIBS_TO_LINK(service AWS_LINK_LIBRARIES)
1170-
SET(ENABLE_S3_SDK ON CACHE BOOL "S3 SDK" FORCE)
1193+
# See if aws-s3-sdk is available
1194+
find_package(AWSSDK REQUIRED COMPONENTS s3;core)
1195+
IF(AWSSDK_FOUND)
1196+
SET(service s3;core)
1197+
AWSSDK_DETERMINE_LIBS_TO_LINK(service AWS_LINK_LIBRARIES)
1198+
SET(ENABLE_S3_SDK ON CACHE BOOL "S3 SDK" FORCE)
1199+
ELSE()
1200+
SET(ENABLE_S3_SDK OFF CACHE BOOL "S3 SDK" FORCE)
1201+
ENDIF()
11711202
ELSE()
11721203
SET(ENABLE_S3_SDK OFF CACHE BOOL "S3 SDK" FORCE)
11731204
ENDIF()
1174-
ELSE(ENABLE_NCZARR_S3)
1175-
# Unconditionally disable
1176-
SET(ENABLE_S3_SDK OFF CACHE BOOL "S3 SDK" FORCE)
1177-
ENDIF(ENABLE_NCZARR_S3)
11781205

11791206
IF(NOT ENABLE_S3_SDK)
11801207
IF(ENABLE_NCZARR_S3 OR ENABLE_NCZARR_S3_TESTS)
@@ -1493,11 +1520,19 @@ IF(NOT BUILD_SHARED_LIBS)
14931520
ENDIF()
14941521

14951522
OPTION(ENABLE_NCZARR_FILTERS "Enable NCZarr filters" yes)
1523+
OPTION(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." yes)
1524+
1525+
# Constraints
14961526
IF (NOT ENABLE_PLUGINS)
1497-
SET(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Enable NCZarr Filters." FORCE)
1527+
MESSAGE(WARNING "ENABLE_FILTER_TESTING requires shared libraries. Disabling.")
1528+
SET(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Enable NCZarr Filters." FORCE)
1529+
ENDIF()
1530+
1531+
IF (NOT ENABLE_NCZARR)
1532+
MESSAGE(WARNING "ENABLE_NCZARR==NO => ENABLE_NCZARR_FILTERS==NO AND ENABLE_NCZARR_FILTER_TESTING==NO")
1533+
SET(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Disable NCZARR_FILTERS" FORCE)
14981534
ENDIF()
14991535

1500-
OPTION(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." yes)
15011536
IF (NOT ENABLE_NCZARR_FILTERS)
15021537
SET(ENABLE_NCZARR_FILTER_TESTING OFF CACHE BOOL "Enable NCZarr Filter Testing" FORCE)
15031538
ENDIF()
@@ -2357,9 +2392,6 @@ is_enabled(ENABLE_V2_API HAS_NC2)
23572392
is_enabled(ENABLE_NETCDF_4 HAS_NC4)
23582393
is_enabled(ENABLE_HDF4 HAS_HDF4)
23592394
is_enabled(USE_HDF5 HAS_HDF5)
2360-
is_enabled(USE_SZIP HAS_SZIP)
2361-
is_enabled(USE_SZIP HAS_SZIP_WRITE)
2362-
is_enabled(USE_SZIP HAS_SZLIB_WRITE)
23632395
is_enabled(STATUS_PNETCDF HAS_PNETCDF)
23642396
is_enabled(STATUS_PARALLEL HAS_PARALLEL)
23652397
is_enabled(ENABLE_PARALLEL4 HAS_PARALLEL4)
@@ -2373,7 +2405,6 @@ is_enabled(JNA HAS_JNA)
23732405
is_enabled(ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND)
23742406
is_enabled(USE_CDF5 HAS_CDF5)
23752407
is_enabled(ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
2376-
is_enabled(HAVE_H5Z_SZIP HAS_SZLIB)
23772408
is_enabled(HDF5_HAS_PAR_FILTERS HAS_PAR_FILTERS)
23782409
is_enabled(ENABLE_NCZARR HAS_NCZARR)
23792410
is_enabled(ENABLE_NCZARR_S3_TESTS DO_NCZARR_S3_TESTS)
@@ -2382,7 +2413,8 @@ is_enabled(ENABLE_NCZARR_ZIP DO_NCZARR_ZIP_TESTS)
23822413
is_enabled(ENABLE_QUANTIZE HAS_QUANTIZE)
23832414
is_enabled(ENABLE_LOGGING HAS_LOGGING)
23842415
is_enabled(ENABLE_FILTER_TESTING DO_FILTER_TESTS)
2385-
is_enabled(ENABLE_BLOSC HAS_BLOSC)
2416+
is_enabled(HAVE_SZ HAS_SZIP)
2417+
is_enabled(HAVE_SZ HAS_SZLIB_WRITE)
23862418

23872419
# Generate file from template.
23882420
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf.settings.in"

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
77

88
## 4.8.2 - TBD
99

10+
* [Enhancement] Improve filter support. More specifically (1) add nc_inq_filter_avail to check if a filter is available, (2) add the notion of standard filters, (3) cleanup szip support to fix interaction with NCZarr. See [Github #????](https://github.com/Unidata/netcdf-c/pull/????).
1011
* [Bug Fix] Require that the type of the variable in nc_def_var_filter is not variable length. See [Github #/2231](https://github.com/Unidata/netcdf-c/pull/2231).
1112
* [File Change] Apply HDF5 v1.8 format compatibility when writing to previous files, as well as when creating new files. The superblock version remains at 2 for newly created files. Full backward read/write compatibility for netCDF-4 is maintained in all cases. See [Github #2176](https://github.com/Unidata/netcdf-c/issues/2176).
1213
* [Enhancement] Add ability to set dataset alignment for netcdf-4/HDF5 files. See [Github #2206](https://github.com/Unidata/netcdf-c/pull/2206).

cmake/modules/FindBz2.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Searches for an installation of the bz2 library. On success, it sets the following variables:
2+
#
3+
# Bz2_FOUND Set to true to indicate the bz2 library was found
4+
# Bz2_INCLUDE_DIRS The directory containing the header file bz2/bz2.h
5+
# Bz2_LIBRARIES The libraries needed to use the bz2 library
6+
#
7+
# To specify an additional directory to search, set Bz2_ROOT.
8+
#
9+
# Author: Siddhartha Chaudhuri, 2009
10+
#
11+
12+
# Look for the header, first in the user-specified location and then in the system locations
13+
SET(Bz2_INCLUDE_DOC "The directory containing the header file bz2.h")
14+
FIND_PATH(Bz2_INCLUDE_DIRS NAMES bz2.h bz2/bz2.h PATHS ${Bz2_ROOT} ${Bz2_ROOT}/include DOC ${Bz2_INCLUDE_DOC} NO_DEFAULT_PATH)
15+
IF(NOT Bz2_INCLUDE_DIRS) # now look in system locations
16+
FIND_PATH(Bz2_INCLUDE_DIRS NAMES bzlib.h DOC ${Bz2_INCLUDE_DOC})
17+
ENDIF(NOT Bz2_INCLUDE_DIRS)
18+
19+
SET(Bz2_FOUND FALSE)
20+
21+
IF(Bz2_INCLUDE_DIRS)
22+
SET(Bz2_LIBRARY_DIRS ${Bz2_INCLUDE_DIRS})
23+
24+
IF("${Bz2_LIBRARY_DIRS}" MATCHES "/include$")
25+
# Strip off the trailing "/include" in the path.
26+
GET_FILENAME_COMPONENT(Bz2_LIBRARY_DIRS ${Bz2_LIBRARY_DIRS} PATH)
27+
ENDIF("${Bz2_LIBRARY_DIRS}" MATCHES "/include$")
28+
29+
IF(EXISTS "${Bz2_LIBRARY_DIRS}/lib")
30+
SET(Bz2_LIBRARY_DIRS ${Bz2_LIBRARY_DIRS}/lib)
31+
ENDIF(EXISTS "${Bz2_LIBRARY_DIRS}/lib")
32+
33+
# Find Bz2 libraries
34+
FIND_LIBRARY(Bz2_DEBUG_LIBRARY NAMES bz2d bz2_d libbz2d libbz2_d libbz2
35+
PATH_SUFFIXES Debug ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Debug
36+
PATHS ${Bz2_LIBRARY_DIRS} NO_DEFAULT_PATH)
37+
FIND_LIBRARY(Bz2_RELEASE_LIBRARY NAMES bz2 libbz2
38+
PATH_SUFFIXES Release ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Release
39+
PATHS ${Bz2_LIBRARY_DIRS} NO_DEFAULT_PATH)
40+
41+
SET(Bz2_LIBRARIES )
42+
IF(Bz2_DEBUG_LIBRARY AND Bz2_RELEASE_LIBRARY)
43+
SET(Bz2_LIBRARIES debug ${Bz2_DEBUG_LIBRARY} optimized ${Bz2_RELEASE_LIBRARY})
44+
ELSEIF(Bz2_DEBUG_LIBRARY)
45+
SET(Bz2_LIBRARIES ${Bz2_DEBUG_LIBRARY})
46+
ELSEIF(Bz2_RELEASE_LIBRARY)
47+
SET(Bz2_LIBRARIES ${Bz2_RELEASE_LIBRARY})
48+
ENDIF(Bz2_DEBUG_LIBRARY AND Bz2_RELEASE_LIBRARY)
49+
50+
IF(Bz2_LIBRARIES)
51+
SET(Bz2_FOUND TRUE)
52+
ENDIF(Bz2_LIBRARIES)
53+
ENDIF(Bz2_INCLUDE_DIRS)
54+
55+
IF(Bz2_FOUND)
56+
# IF(NOT Bz2_FIND_QUIETLY)
57+
MESSAGE(STATUS "Found Bz2: headers at ${Bz2_INCLUDE_DIRS}, libraries at ${Bz2_LIBRARY_DIRS}")
58+
MESSAGE(STATUS " library is ${Bz2_LIBRARIES}")
59+
# ENDIF(NOT Bz2_FIND_QUIETLY)
60+
ELSE(Bz2_FOUND)
61+
IF(Bz2_FIND_REQUIRED)
62+
MESSAGE(FATAL_ERROR "Bz2 library not found")
63+
ENDIF(Bz2_FIND_REQUIRED)
64+
ENDIF(Bz2_FOUND)

cmake/modules/FindZstd.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Searches for an installation of the zstd library. On success, it sets the following variables:
2+
#
3+
# Zstd_FOUND Set to true to indicate the zstd library was found
4+
# Zstd_INCLUDE_DIRS The directory containing the header file zstd/zstd.h
5+
# Zstd_LIBRARIES The libraries needed to use the zstd library
6+
#
7+
# To specify an additional directory to search, set Zstd_ROOT.
8+
#
9+
# Author: Siddhartha Chaudhuri, 2009
10+
#
11+
12+
# Look for the header, first in the user-specified location and then in the system locations
13+
SET(Zstd_INCLUDE_DOC "The directory containing the header file zstd.h")
14+
FIND_PATH(Zstd_INCLUDE_DIRS NAMES zstd.h zstd/zstd.h PATHS ${Zstd_ROOT} ${Zstd_ROOT}/include DOC ${Zstd_INCLUDE_DOC} NO_DEFAULT_PATH)
15+
IF(NOT Zstd_INCLUDE_DIRS) # now look in system locations
16+
FIND_PATH(Zstd_INCLUDE_DIRS NAMES zstd.h zstd/zstd.h DOC ${Zstd_INCLUDE_DOC})
17+
ENDIF(NOT Zstd_INCLUDE_DIRS)
18+
19+
SET(Zstd_FOUND FALSE)
20+
21+
IF(Zstd_INCLUDE_DIRS)
22+
SET(Zstd_LIBRARY_DIRS ${Zstd_INCLUDE_DIRS})
23+
24+
IF("${Zstd_LIBRARY_DIRS}" MATCHES "/include$")
25+
# Strip off the trailing "/include" in the path.
26+
GET_FILENAME_COMPONENT(Zstd_LIBRARY_DIRS ${Zstd_LIBRARY_DIRS} PATH)
27+
ENDIF("${Zstd_LIBRARY_DIRS}" MATCHES "/include$")
28+
29+
IF(EXISTS "${Zstd_LIBRARY_DIRS}/lib")
30+
SET(Zstd_LIBRARY_DIRS ${Zstd_LIBRARY_DIRS}/lib)
31+
ENDIF(EXISTS "${Zstd_LIBRARY_DIRS}/lib")
32+
33+
# Find Zstd libraries
34+
FIND_LIBRARY(Zstd_DEBUG_LIBRARY NAMES zstdd zstd_d libzstdd libzstd_d libzstd
35+
PATH_SUFFIXES Debug ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Debug
36+
PATHS ${Zstd_LIBRARY_DIRS} NO_DEFAULT_PATH)
37+
FIND_LIBRARY(Zstd_RELEASE_LIBRARY NAMES zstd libzstd
38+
PATH_SUFFIXES Release ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Release
39+
PATHS ${Zstd_LIBRARY_DIRS} NO_DEFAULT_PATH)
40+
41+
SET(Zstd_LIBRARIES )
42+
IF(Zstd_DEBUG_LIBRARY AND Zstd_RELEASE_LIBRARY)
43+
SET(Zstd_LIBRARIES debug ${Zstd_DEBUG_LIBRARY} optimized ${Zstd_RELEASE_LIBRARY})
44+
ELSEIF(Zstd_DEBUG_LIBRARY)
45+
SET(Zstd_LIBRARIES ${Zstd_DEBUG_LIBRARY})
46+
ELSEIF(Zstd_RELEASE_LIBRARY)
47+
SET(Zstd_LIBRARIES ${Zstd_RELEASE_LIBRARY})
48+
ENDIF(Zstd_DEBUG_LIBRARY AND Zstd_RELEASE_LIBRARY)
49+
50+
IF(Zstd_LIBRARIES)
51+
SET(Zstd_FOUND TRUE)
52+
ENDIF(Zstd_LIBRARIES)
53+
ENDIF(Zstd_INCLUDE_DIRS)
54+
55+
IF(Zstd_FOUND)
56+
# IF(NOT Zstd_FIND_QUIETLY)
57+
MESSAGE(STATUS "Found Zstd: headers at ${Zstd_INCLUDE_DIRS}, libraries at ${Zstd_LIBRARY_DIRS}")
58+
MESSAGE(STATUS " library is ${Zstd_LIBRARIES}")
59+
# ENDIF(NOT Zstd_FIND_QUIETLY)
60+
ELSE(Zstd_FOUND)
61+
IF(Zstd_FIND_REQUIRED)
62+
MESSAGE(FATAL_ERROR "Zstd library not found")
63+
ENDIF(Zstd_FIND_REQUIRED)
64+
ENDIF(Zstd_FOUND)

0 commit comments

Comments
 (0)