add cmake options to perfer system libs to libwebp
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

This commit is contained in:
Green Sky 2025-04-06 20:15:56 +02:00
parent ace5ea9bf0
commit 2b992ade88
No known key found for this signature in database
GPG Key ID: DBE05085D874AB4A
6 changed files with 45 additions and 12 deletions

View File

@ -153,7 +153,7 @@ jobs:
- name: Install Dependencies
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static freetype:x64-windows-static
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static freetype:x64-windows-static
# setup vs env
- uses: ilammy/msvc-dev-cmd@v1
@ -170,7 +170,7 @@ jobs:
# key: ${{github.event.repository.name}}-${{github.job}}
- name: Configure CMake
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato

View File

@ -1,8 +1,36 @@
cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
if (NOT TARGET libwebp)
option(TOMATO_DEP_LIBWEBP_USE_SYSTEM "Prefer system provided libwebp" OFF)
if (TOMATO_DEP_LIBWEBP_USE_SYSTEM)
if (NOT TARGET WebP::libwebpmux)
find_package(WebP CONFIG GLOBAL QUIET COMPONENTS webp webpdemux libwebpmux)
endif()
#if (NOT TARGET libwebp)
# find_package(WebP GLOBAL)
#endif()
if (TARGET WebP::webp)
message(STATUS "found WebP::webp")
endif()
if (TARGET WebP::webpdemux)
message(STATUS "found WebP::webpdemux")
endif()
if (TARGET WebP::libwebpmux)
message(STATUS "found WebP::libwebpmux")
endif()
if (TARGET WebP::libwebpmux)
message(STATUS "found system libwebp")
else()
message(STATUS "system libwebp not found")
endif()
endif()
if (NOT TARGET WebP::libwebpmux)
set(WEBP_LINK_STATIC ON CACHE BOOL "" FORCE)
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "" FORCE)
@ -19,11 +47,13 @@ if (NOT TARGET libwebp)
FetchContent_Declare(libwebp
GIT_REPOSITORY https://github.com/webmproject/libwebp
GIT_TAG v1.4.0
GIT_TAG v1.5.0
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(libwebp)
add_library(WebP::webp ALIAS webp)
add_library(WebP::webpdemux ALIAS webpdemux)
add_library(WebP::libwebpmux ALIAS libwebpmux)
endif()
#add_subdirectory(./libwebp EXCLUDE_FROM_ALL)

View File

@ -7,7 +7,7 @@ option(TOMATO_DEP_SDL_USE_SYSTEM "Prefer system provided SDL" OFF)
if (TOMATO_DEP_SDL_USE_SYSTEM)
if (NOT TARGET SDL3::SDL3)
#find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
find_package(SDL3 REQUIRED CONFIG GLOBAL QUIET)
find_package(SDL3 CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3::SDL3)

View File

@ -6,7 +6,7 @@ option(TOMATO_DEP_SDL_IMAGE_USE_SYSTEM "Prefer system provided SDL_image" OFF)
if (TOMATO_DEP_SDL_IMAGE_USE_SYSTEM)
if (NOT TARGET SDL3_image::SDL3_image)
find_package(SDL3_image REQUIRED CONFIG GLOBAL QUIET)
find_package(SDL3_image CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3_image::SDL3_image)

View File

@ -90,6 +90,8 @@
libopus
libvpx
libwebp
freetype
] ++ self.packages.${system}.default.dlopenBuildInputs;
@ -104,8 +106,9 @@
# TODO: use package instead
"-DFETCHCONTENT_SOURCE_DIR_JSON=${nlohmann-json}" # we care about the version
"-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}" # we dont care about the version (we use 1.4.x features)
"-DFETCHCONTENT_SOURCE_DIR_LIBWEBP=${pkgs.libwebp.src}"
"-DFETCHCONTENT_SOURCE_DIR_SDL3=${sdl3}"
#"-DFETCHCONTENT_SOURCE_DIR_LIBWEBP=${pkgs.libwebp.src}"
"-DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON"
"-DFETCHCONTENT_SOURCE_DIR_SDL3_IMAGE=${sdl3_image}"
"-DSDLIMAGE_JXL=ON"
"-DFETCHCONTENT_SOURCE_DIR_PLUTOSVG=${plutosvg}" # not in pkgs

View File

@ -194,8 +194,8 @@ target_link_libraries(tomato PUBLIC
stb_image
stb_image_write
webpdemux
libwebpmux # the f why (needed for anim encode)
WebP::webpdemux
WebP::libwebpmux # the f why (needed for anim encode)
qoi
SDL3_image::SDL3_image
)