From fb9cd249f442dcc6d023e41ec7cb7f85622dd8b6 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 4 Jan 2024 02:39:26 +0100 Subject: [PATCH] [tiff] Add libdeflate support, add usage (#35925) --- ports/tiff/portfile.cmake | 6 ++++- ports/tiff/usage | 9 ++++++++ ports/tiff/vcpkg-cmake-wrapper.cmake.in | 29 +++++++++++++++++++++--- ports/tiff/vcpkg.json | 15 +++++++++++- scripts/test_ports/cmake-user/vcpkg.json | 3 ++- versions/baseline.json | 2 +- versions/t-/tiff.json | 5 ++++ 7 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 ports/tiff/usage diff --git a/ports/tiff/portfile.cmake b/ports/tiff/portfile.cmake index 6307aae0e1..426d8af72a 100644 --- a/ports/tiff/portfile.cmake +++ b/ports/tiff/portfile.cmake @@ -14,6 +14,8 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS cxx cxx jpeg jpeg jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG + libdeflate libdeflate + libdeflate CMAKE_REQUIRE_FIND_PACKAGE_Deflate lzma lzma lzma CMAKE_REQUIRE_FIND_PACKAGE_liblzma tools tiff-tools @@ -33,7 +35,6 @@ vcpkg_cmake_configure( -Dtiff-docs=OFF -Dtiff-contrib=OFF -Dtiff-tests=OFF - -Dlibdeflate=OFF -Djbig=OFF # This is disabled by default due to GPL/Proprietary licensing. -Djpeg12=OFF -Dlerc=OFF @@ -44,6 +45,8 @@ vcpkg_cmake_configure( OPTIONS_DEBUG -DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only. MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_GLUT + CMAKE_DISABLE_FIND_PACKAGE_OpenGL ZSTD_HAVE_DECOMPRESS_STREAM ) @@ -79,4 +82,5 @@ if ("tools" IN_LIST FEATURES) endif() vcpkg_copy_pdbs() +file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/ports/tiff/usage b/ports/tiff/usage new file mode 100644 index 0000000000..d47265b18f --- /dev/null +++ b/ports/tiff/usage @@ -0,0 +1,9 @@ +tiff is compatible with built-in CMake targets: + + find_package(TIFF REQUIRED) + target_link_libraries(main PRIVATE TIFF::TIFF) + +tiff provides pkg-config modules: + + # Tag Image File Format (TIFF) library. + libtiff-4 diff --git a/ports/tiff/vcpkg-cmake-wrapper.cmake.in b/ports/tiff/vcpkg-cmake-wrapper.cmake.in index 31fef16af8..1d04ec7a0a 100644 --- a/ports/tiff/vcpkg-cmake-wrapper.cmake.in +++ b/ports/tiff/vcpkg-cmake-wrapper.cmake.in @@ -11,9 +11,8 @@ endif() _find_package(${ARGS}) -include(SelectLibraryConfigurations) - if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + include(SelectLibraryConfigurations) set(z_vcpkg_tiff_link_libraries "") set(z_vcpkg_tiff_libraries "") if("@webp@") @@ -53,13 +52,37 @@ if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") add_library(ZSTD::ZSTD INTERFACE IMPORTED) set_property(TARGET ZSTD::ZSTD APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_zstd}) endif() - list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES}) list(APPEND z_vcpkg_tiff_link_libraries ${z_vcpkg_tiff_zstd}) + list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES}) unset(z_vcpkg_tiff_zstd) unset(z_vcpkg_tiff_zstd_configs) unset(z_vcpkg_config) unset(z_vcpkg_tiff_zstd_target) endif() + if("@libdeflate@") + find_package(libdeflate ${z_vcpkg_tiff_find_options}) + set(z_vcpkg_property "IMPORTED_LOCATION_") + if(TARGET libdeflate::libdeflate_shared) + set(z_vcpkg_libdeflate_target libdeflate::libdeflate_shared) + if(WIN32) + set(z_vcpkg_property "IMPORTED_IMPLIB_") + endif() + else() + set(z_vcpkg_libdeflate_target libdeflate::libdeflate_static) + endif() + get_target_property(z_vcpkg_libdeflate_configs "${z_vcpkg_libdeflate_target}" IMPORTED_CONFIGURATIONS) + foreach(z_vcpkg_config IN LISTS z_vcpkg_libdeflate_configs) + get_target_property(Z_VCPKG_DEFLATE_LIBRARY_${z_vcpkg_config} "${z_vcpkg_libdeflate_target}" "${z_vcpkg_property}${z_vcpkg_config}") + endforeach() + select_library_configurations(Z_VCPKG_DEFLATE) + list(APPEND z_vcpkg_tiff_link_libraries "\$") + list(APPEND z_vcpkg_tiff_libraries ${Z_VCPKG_DEFLATE_LIBRARIES}) + unset(z_vcpkg_config) + unset(z_vcpkg_libdeflate_configs) + unset(z_vcpkg_libdeflate_target) + unset(z_vcpkg_property) + unset(Z_VCPKG_DEFLATE_FOUND) + endif() if("@zlib@") find_package(ZLIB ${z_vcpkg_tiff_find_options}) list(APPEND z_vcpkg_tiff_link_libraries "\$") diff --git a/ports/tiff/vcpkg.json b/ports/tiff/vcpkg.json index 18a1950d5b..eea6684aa7 100644 --- a/ports/tiff/vcpkg.json +++ b/ports/tiff/vcpkg.json @@ -1,7 +1,7 @@ { "name": "tiff", "version": "4.6.0", - "port-version": 1, + "port-version": 2, "description": "A library that supports the manipulation of TIFF image files", "homepage": "https://libtiff.gitlab.io/libtiff/", "license": "libtiff", @@ -30,6 +30,19 @@ "libjpeg-turbo" ] }, + "libdeflate": { + "description": "Use libdeflate for faster ZIP support", + "dependencies": [ + "libdeflate", + { + "name": "tiff", + "default-features": false, + "features": [ + "zip" + ] + } + ] + }, "lzma": { "description": "Support LZMA compression in TIFF image files", "dependencies": [ diff --git a/scripts/test_ports/cmake-user/vcpkg.json b/scripts/test_ports/cmake-user/vcpkg.json index ed1718e093..1e727be0e5 100644 --- a/scripts/test_ports/cmake-user/vcpkg.json +++ b/scripts/test_ports/cmake-user/vcpkg.json @@ -40,7 +40,7 @@ "dependencies": [ { "$package": "Boost", - "name":"boost", + "name": "boost", "platform": "!uwp" }, { @@ -158,6 +158,7 @@ "name": "tiff", "default-features": false, "features": [ + "libdeflate", "zstd" ] }, diff --git a/versions/baseline.json b/versions/baseline.json index f9196b835d..d0272f0a76 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8426,7 +8426,7 @@ }, "tiff": { "baseline": "4.6.0", - "port-version": 1 + "port-version": 2 }, "tinkerforge": { "baseline": "2.1.25", diff --git a/versions/t-/tiff.json b/versions/t-/tiff.json index 954fad6365..7596064aa9 100644 --- a/versions/t-/tiff.json +++ b/versions/t-/tiff.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "eee46c160d2fcf26a0013e7159adc2e6c03039d5", + "version": "4.6.0", + "port-version": 2 + }, { "git-tree": "1c0fc716f916833234f0fb5e7061d52e9063e7c6", "version": "4.6.0",