[sail] Fix installing webp and avif features (#30423)

* Fix compiling AVIF and WEBP in static mode

* Bump port version to 2

* vcpkg x-add-version --all

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
Dmitry Baryshev 2023-04-07 02:36:22 +03:00 committed by GitHub
parent b0f2daa91d
commit effb026d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 2 deletions

21
ports/sail/avif.patch Normal file
View File

@ -0,0 +1,21 @@
diff --git a/src/sail-codecs/avif/CMakeLists.txt b/src/sail-codecs/avif/CMakeLists.txt
index 3f36e0c8..7a24ad25 100644
--- a/src/sail-codecs/avif/CMakeLists.txt
+++ b/src/sail-codecs/avif/CMakeLists.txt
@@ -1,7 +1,6 @@
-find_library(AVIF_LIBRARY avif ${SAIL_CODEC_AVIF_REQUIRED_OPTION})
-find_path(AVIF_INCLUDE_DIRS avif/avif.h ${SAIL_CODEC_AVIF_REQUIRED_OPTION})
+find_package(libavif CONFIG ${SAIL_CODEC_AVIF_REQUIRED_OPTION})
-if (NOT AVIF_LIBRARY OR NOT AVIF_INCLUDE_DIRS)
+if (NOT libavif_FOUND)
return()
endif()
@@ -18,5 +17,4 @@ set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_depende
sail_codec(NAME avif
SOURCES helpers.h helpers.c io.h io.c avif.c
ICON avif.png
- DEPENDENCY_INCLUDE_DIRS ${AVIF_INCLUDE_DIRS}
- DEPENDENCY_LIBS ${AVIF_LIBRARY})
+ DEPENDENCY_LIBS avif)

View File

@ -4,6 +4,9 @@ vcpkg_from_github(
REF v0.9.0-rc3
SHA512 5de94277d57b862d4ab99266c2608cd37d7ca9eb89ef753ddddf47e4cebffab54b2cfb9c28d0c3bb7721f0d24c1310377c4b42adab477568e6965bd7ebc55b17
HEAD_REF master
PATCHES
avif.patch
webp.patch
)
# Enable selected codecs

View File

@ -1,7 +1,7 @@
{
"name": "sail",
"version-semver": "0.9.0-rc3",
"port-version": 1,
"port-version": 2,
"description": "The missing small and fast image decoding library for humans (not for machines)",
"homepage": "https://github.com/HappySeaFox/sail",
"license": "MIT",

39
ports/sail/webp.patch Normal file
View File

@ -0,0 +1,39 @@
diff --git a/src/sail-codecs/webp/CMakeLists.txt b/src/sail-codecs/webp/CMakeLists.txt
index 64d31e5a..40c33084 100644
--- a/src/sail-codecs/webp/CMakeLists.txt
+++ b/src/sail-codecs/webp/CMakeLists.txt
@@ -1,28 +1,20 @@
-find_library(WEBP_RELEASE_LIBRARY NAMES webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
-find_library(WEBP_DEBUG_LIBRARY NAMES webpd webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
-find_library(WEBP_DEMUX_RELEASE_LIBRARY NAMES webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
-find_library(WEBP_DEMUX_DEBUG_LIBRARY NAMES webpdemuxd webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
-find_path(WEBP_INCLUDE_DIRS webp/decode.h ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
+find_package(WebP CONFIG ${SAIL_CODEC_WEBP_REQUIRED_OPTION})
-if ((NOT WEBP_RELEASE_LIBRARY AND NOT WEBP_DEBUG_LIBRARY) OR (NOT WEBP_DEMUX_RELEASE_LIBRARY AND NOT WEBP_DEMUX_DEBUG_LIBRARY) OR NOT WEBP_INCLUDE_DIRS)
+if (NOT WebP_FOUND)
return()
endif()
# This will add the following CMake rules to the CMake config for static builds so a client
# application links against the required dependencies:
#
-# find_library(webp_RELEASE_LIBRARY NAMES webp)
-# find_library(webp_DEBUG_LIBRARY NAMES webpd webp)
-# set_property(TARGET SAIL::sail-codecs APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<$<CONFIG:Release>:${webp_RELEASE_LIBRARY}> $<$<CONFIG:Debug>:${webp_DEBUG_LIBRARY}>)
+# find_dependency(LIBWEBP REQUIRED)
+# set_property(TARGET SAIL::sail-codecs APPEND PROPERTY INTERFACE_LINK_LIBRARIES WebP::webp WebP::webpdecoder WebP::webpdemux)
#
-# Same to webpdemux.
-#
-set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_library,webp,webpd" "find_library,webpdemux,webpdemuxd" PARENT_SCOPE)
+set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_dependency,WEBP,WebP::webp WebP::webpdecoder WebP::webpdemux" PARENT_SCOPE)
# Common codec configuration
#
sail_codec(NAME webp
SOURCES helpers.h helpers.c webp.c
ICON webp.png
- DEPENDENCY_INCLUDE_DIRS ${WEBP_INCLUDE_DIRS}
- DEPENDENCY_LIBS optimized ${WEBP_RELEASE_LIBRARY} debug ${WEBP_DEBUG_LIBRARY} optimized ${WEBP_DEMUX_RELEASE_LIBRARY} debug ${WEBP_DEMUX_DEBUG_LIBRARY})
+ DEPENDENCY_LIBS WebP::webp WebP::webpdecoder WebP::webpdemux)

View File

@ -7094,7 +7094,7 @@
},
"sail": {
"baseline": "0.9.0-rc3",
"port-version": 1
"port-version": 2
},
"sais": {
"baseline": "2.4.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0c604af0721281506a77f887d07abca30fe350c3",
"version-semver": "0.9.0-rc3",
"port-version": 2
},
{
"git-tree": "66576c788934d4684f862ba663b49f1bb80c4d4d",
"version-semver": "0.9.0-rc3",