2021-06-10 06:17:07 +08:00
|
|
|
set(SZIP_VERSION "2.1.1")
|
2017-01-11 19:13:19 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2021-06-10 06:17:07 +08:00
|
|
|
URLS "https://support.hdfgroup.org/ftp/lib-external/szip/${SZIP_VERSION}/src/szip-${SZIP_VERSION}.tar.gz"
|
|
|
|
FILENAME "szip-${SZIP_VERSION}.tar.gz"
|
2018-01-03 19:03:29 +08:00
|
|
|
SHA512 ada6406efb096cd8a2daf8f9217fe9111a96dcae87e29d1c31f58ddd2ad2aa7bac03f23c7205dc9360f3b62d259461759330c7189ef0c2fe559704b1ea9d40dd
|
2017-01-11 19:13:19 +08:00
|
|
|
)
|
|
|
|
|
2019-03-15 05:27:05 +08:00
|
|
|
vcpkg_extract_source_archive_ex(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2021-06-10 06:17:07 +08:00
|
|
|
ARCHIVE "${ARCHIVE}"
|
|
|
|
REF szip-${SZIP_VERSION}
|
2017-01-13 16:49:09 +08:00
|
|
|
PATCHES
|
2021-06-10 06:17:07 +08:00
|
|
|
fix-linkage-config.patch
|
|
|
|
mingw-lib-names.patch
|
2017-01-13 16:49:09 +08:00
|
|
|
)
|
|
|
|
|
2021-06-10 06:17:07 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2019-08-01 04:01:02 +08:00
|
|
|
PREFER_NINJA
|
2017-01-11 19:13:19 +08:00
|
|
|
OPTIONS
|
|
|
|
-DSZIP_INSTALL_DATA_DIR=share/szip/data
|
|
|
|
-DSZIP_INSTALL_CMAKE_DIR=share/szip
|
|
|
|
)
|
|
|
|
|
2021-06-10 06:17:07 +08:00
|
|
|
vcpkg_cmake_install()
|
2017-01-11 19:13:19 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-06-10 06:17:07 +08:00
|
|
|
vcpkg_cmake_config_fixup()
|
2017-01-11 19:13:19 +08:00
|
|
|
|
2021-06-10 06:17:07 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/szip_adpt.h"
|
|
|
|
"\n#ifdef SZ_BUILT_AS_DYNAMIC_LIB"
|
|
|
|
"\n#if 1 // SZ_BUILT_AS_DYNAMIC_LIB")
|
|
|
|
endif()
|
2017-01-11 19:13:19 +08:00
|
|
|
|
2021-06-10 06:17:07 +08:00
|
|
|
if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(SZIP_LIB_RELEASE "-lszip")
|
|
|
|
set(SZIP_LIB_DEBUG "-lszip_debug")
|
|
|
|
set(SZIP_LIBS_PRIVATE "-lm")
|
|
|
|
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
set(SZIP_LIB_RELEASE "-llibszip")
|
|
|
|
set(SZIP_LIB_DEBUG "-llibszip_D")
|
|
|
|
set(SZIP_LIBS_PRIVATE "")
|
|
|
|
else()
|
|
|
|
set(SZIP_LIB_RELEASE "-lszip")
|
|
|
|
set(SZIP_LIB_DEBUG "-lszip_D")
|
|
|
|
set(SZIP_LIBS_PRIVATE "")
|
|
|
|
endif()
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(SZIP_LINKAGE_FLAGS "-DSZ_BUILT_AS_DYNAMIC_LIB=1")
|
|
|
|
else()
|
|
|
|
set(SZIP_LINKAGE_FLAGS "")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib")
|
|
|
|
set(SZIP_LIB "${SZIP_LIB_RELEASE}")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/szip.pc" @ONLY)
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib")
|
|
|
|
set(SZIP_LIB "${SZIP_LIB_DEBUG}")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/szip.pc" @ONLY)
|
|
|
|
endif()
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/szip/data/COPYING" "${CURRENT_PACKAGES_DIR}/share/szip/copyright")
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|