Skip to content

Commit

Permalink
[tiff] Fix zstd plus minor changes (microsoft#28530)
Browse files Browse the repository at this point in the history
* Use official zstd config

* Require packages for features

* Test zstd in CI

* Enable libtiffxx on arm

* Update versions

* Assume ZSTD_decompressStream

* Don't put targets into TIFF_LIBRARIES

* [qt5-imageformats] Use libtiff-4.pc

* [zstd] Revise thread lib export

* Mark link libs with LINK_ONLY

* Revert "[zstd] Revise thread lib export"

This reverts commit a99e637.

* [qt5-imageformats] Get all tiff lflags

* [gdk-pixbuf] Use libtiff-4 pc file for msvc

* [qtimageformat] Workaround for QTBUG-95052
  • Loading branch information
dg0yt authored Dec 31, 2022
1 parent 4089030 commit b93bc1b
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 26 deletions.
1 change: 1 addition & 0 deletions ports/gdk-pixbuf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vcpkg_from_gitlab(
PATCHES
fix_build_error_windows.patch
loaders-cache.patch
use-libtiff-4-pkgconfig.patch
)

if(VCPKG_TARGET_IS_WINDOWS)
Expand Down
13 changes: 13 additions & 0 deletions ports/gdk-pixbuf/use-libtiff-4-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index b5280f3..4927ed5 100644
--- a/meson.build
+++ b/meson.build
@@ -333,7 +333,7 @@ tiff_opt = get_option('tiff')
if not tiff_opt.disabled() and not native_windows_loaders
# We currently don't have a fallback subproject, but this handles error
# reporting if tiff_opt is enabled.
- tiff_dep = dependency(is_msvc_like ? 'tiff' : 'libtiff-4', required: tiff_opt)
+ tiff_dep = dependency(false ? 'tiff' : 'libtiff-4', required: tiff_opt)

if tiff_dep.found()
enabled_loaders += 'tiff'
2 changes: 1 addition & 1 deletion ports/gdk-pixbuf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gdk-pixbuf",
"version": "2.42.9",
"port-version": 3,
"port-version": 4,
"description": "Image loading library.",
"homepage": "https://gitlab.gnome.org/GNOME/gdk-pixbuf",
"license": "LGPL-2.1-or-later",
Expand Down
12 changes: 4 additions & 8 deletions ports/qt5-imageformats/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ list(APPEND CORE_OPTIONS
-no-mng # must be explicitly disabled to not automatically pick up mng
-verbose)

find_library(TIFF_RELEASE NAMES tiff PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on lzma
find_library(TIFF_DEBUG NAMES tiffd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
x_vcpkg_pkgconfig_get_modules(PREFIX tiff MODULES libtiff-4 LIBS)

find_library(JPEG_RELEASE NAMES jpeg jpeg-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(JPEG_DEBUG NAMES jpeg jpeg-static jpegd jpeg-staticd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(ZLIB_RELEASE NAMES z zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
Expand Down Expand Up @@ -39,19 +39,15 @@ find_library(WEBPDECODER_DEBUG NAMES webpdecoder PATHS "${CURRENT_INSTALLED_DIR}
# Depends on opengl in default build but might depend on giflib, libjpeg-turbo, zlib, libpng, tiff, freeglut (!osx), sdl1 (windows)
# which would require extra libraries to be linked e.g. giflib freeglut sdl1 other ones are already linked

#Dependent libraries
find_library(LZMA_RELEASE lzma PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(LZMA_DEBUG lzma PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)

if(NOT VCPKG_TARGET_IS_WINDOWS)
string(APPEND WEBP_RELEASE " -pthread")
string(APPEND WEBP_DEBUG " -pthread")
endif()

set(OPT_REL "TIFF_LIBS=${TIFF_RELEASE} ${LZMA_RELEASE} ${JPEG_RELEASE} ${ZLIB_RELEASE}"
set(OPT_REL "TIFF_LIBS=${tiff_LIBS_RELEASE}"
"WEBP_LIBS=${WEBPDECODER_RELEASE} ${WEBPDEMUX_RELEASE} ${WEBPMUX_RELEASE} ${WEBP_RELEASE}"
"JASPER_LIBS=${JASPER_RELEASE} ${JPEG_RELEASE} ${ZLIB_RELEASE}") # This will still fail if LIBWEBP is installed with all available features due to the missing additional dependencies
set(OPT_DBG "TIFF_LIBS=${TIFF_DEBUG} ${LZMA_DEBUG} ${JPEG_DEBUG} ${ZLIB_DEBUG}"
set(OPT_DBG "TIFF_LIBS=${tiff_LIBS_DEBUG}"
"WEBP_LIBS=${WEBPDECODER_DEBUG} ${WEBPDEMUX_DEBUG} ${WEBPMUX_DEBUG} ${WEBP_DEBUG}"
"JASPER_LIBS=${JASPER_DEBUG} ${JPEG_DEBUG} ${ZLIB_DEBUG}")

Expand Down
7 changes: 6 additions & 1 deletion ports/qt5-imageformats/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qt5-imageformats",
"version": "5.15.7",
"port-version": 1,
"description": "Qt5 Image Formats Module - Plugins for additional image formats: TIFF, MNG, TGA, WBMP",
"license": null,
"dependencies": [
Expand All @@ -10,6 +11,10 @@
"name": "qt5-base",
"default-features": false
},
"tiff"
"tiff",
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
}
]
}
1 change: 1 addition & 0 deletions ports/qtimageformats/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ list(APPEND FEATURE_OPTIONS -DINPUT_mng=no) # marked as FIXME
qt_install_submodule(PATCHES ${${PORT}_PATCHES}
CONFIGURE_OPTIONS
${FEATURE_OPTIONS}
-DCMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON # Cf. QTBUG-95052
CONFIGURE_OPTIONS_RELEASE
CONFIGURE_OPTIONS_DEBUG
)
1 change: 1 addition & 0 deletions ports/qtimageformats/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qtimageformats",
"version": "6.4.1",
"port-version": 1,
"description": "Additional Image Format plugins for Qt",
"homepage": "https://www.qt.io/",
"license": null,
Expand Down
9 changes: 9 additions & 0 deletions ports/tiff/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cxx cxx
jpeg jpeg
jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG
lzma lzma
lzma CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA
tools tiff-tools
webp webp
webp CMAKE_REQUIRE_FIND_PACKAGE_WebP
zip zlib
zip CMAKE_REQUIRE_FIND_PACKAGE_ZLIB
zstd zstd
zstd CMAKE_REQUIRE_FIND_PACKAGE_ZSTD
)

vcpkg_cmake_configure(
Expand All @@ -35,8 +40,11 @@ vcpkg_cmake_configure(
-Dlerc=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON
-DZSTD_HAVE_DECOMPRESS_STREAM=ON
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only.
MAYBE_UNUSED_VARIABLES
ZSTD_HAVE_DECOMPRESS_STREAM
)

vcpkg_cmake_install()
Expand All @@ -56,6 +64,7 @@ file(REMOVE_RECURSE
)

configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(COPY "${SOURCE_PATH}/cmake/FindZSTD.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

if ("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES
Expand Down
19 changes: 11 additions & 8 deletions ports/tiff/vcpkg-cmake-wrapper.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,35 @@ if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
set(z_vcpkg_tiff_libraries "")
if("@webp@")
find_package(WebP CONFIG ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries WebP::WebP)
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:WebP::WebP>")
list(APPEND z_vcpkg_tiff_libraries ${WebP_LIBRARIES})
endif()
if("@lzma@")
find_package(LibLZMA ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries LibLZMA::LibLZMA)
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:LibLZMA::LibLZMA>")
list(APPEND z_vcpkg_tiff_libraries ${LIBLZMA_LIBRARIES})
endif()
if("@jpeg@")
find_package(JPEG ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries JPEG::JPEG)
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:JPEG::JPEG>")
list(APPEND z_vcpkg_tiff_libraries ${JPEG_LIBRARIES})
endif()
if("@zstd@")
find_package(ZSTD CONFIG ${z_vcpkg_tiff_find_options})
find_package(zstd CONFIG ${z_vcpkg_tiff_find_options})
if(TARGET zstd::libzstd_shared)
set(z_vcpkg_tiff_zstd zstd::libzstd_shared)
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_shared>")
else()
set(z_vcpkg_tiff_zstd zstd::libzstd_static)
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_static>")
endif()
list(APPEND z_vcpkg_tiff_link_libraries ${z_vcpkg_tiff_zstd})
list(APPEND z_vcpkg_tiff_libraries ${z_vcpkg_tiff_zstd})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_package(ZSTD MODULE ${z_vcpkg_tiff_find_options})
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES})
endif()
if("@zlib@")
find_package(ZLIB ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries ZLIB::ZLIB)
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:ZLIB::ZLIB>")
list(APPEND z_vcpkg_tiff_libraries ${ZLIB_LIBRARIES})
endif()
if(UNIX)
Expand Down
4 changes: 2 additions & 2 deletions ports/tiff/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "tiff",
"version": "4.5.0",
"port-version": 1,
"description": "A library that supports the manipulation of TIFF image files",
"homepage": "https://libtiff.gitlab.io/libtiff/",
"license": null,
Expand All @@ -21,8 +22,7 @@
],
"features": {
"cxx": {
"description": "Build C++ libtiffxx library",
"supports": "!arm"
"description": "Build C++ libtiffxx library"
},
"jpeg": {
"description": "Support JPEG compression in TIFF image files",
Expand Down
7 changes: 5 additions & 2 deletions scripts/test_ports/cmake-user/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,17 @@
},
{
"$package": "SQLite3",
"name": "sqlite3",
"$since": "3.14",
"name": "sqlite3",
"default-features": false
},
{
"$package": "TIFF",
"name": "tiff",
"default-features": false
"default-features": false,
"features": [
"zstd"
]
},
{
"$package": "wxWidgets",
Expand Down
8 changes: 4 additions & 4 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@
},
"gdk-pixbuf": {
"baseline": "2.42.9",
"port-version": 3
"port-version": 4
},
"gemmlowp": {
"baseline": "2021-09-28",
Expand Down Expand Up @@ -6174,7 +6174,7 @@
},
"qt5-imageformats": {
"baseline": "5.15.7",
"port-version": 0
"port-version": 1
},
"qt5-location": {
"baseline": "5.15.7",
Expand Down Expand Up @@ -6346,7 +6346,7 @@
},
"qtimageformats": {
"baseline": "6.4.1",
"port-version": 0
"port-version": 1
},
"qtinterfaceframework": {
"baseline": "6.4.1",
Expand Down Expand Up @@ -7482,7 +7482,7 @@
},
"tiff": {
"baseline": "4.5.0",
"port-version": 0
"port-version": 1
},
"tinkerforge": {
"baseline": "2.1.25",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/gdk-pixbuf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "830adc727c34a71a305d01d1cb77ae16d41e289a",
"version": "2.42.9",
"port-version": 4
},
{
"git-tree": "b1a623b67b4de018a0550b7d8cd60a21569972b0",
"version": "2.42.9",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qt5-imageformats.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d1d145a3a466d0ace1fc3d79c9c255b239d0ca6e",
"version": "5.15.7",
"port-version": 1
},
{
"git-tree": "019d2b693d40b53785d13277801a8e71322509e4",
"version": "5.15.7",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtimageformats.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a1c2ace68dcaa899f934673aab72d54fe3924f12",
"version": "6.4.1",
"port-version": 1
},
{
"git-tree": "a2c32b799e5b3ef2d6f7d43c0d8101aec38d1784",
"version": "6.4.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/tiff.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b4c6d03a0a9be7b7c7b64a41d1a9f4e751e9746f",
"version": "4.5.0",
"port-version": 1
},
{
"git-tree": "e1bb817eb3c58fcbe28f9d5217cb1b594493003f",
"version": "4.5.0",
Expand Down

0 comments on commit b93bc1b

Please sign in to comment.