From https://github.com/winterheart/aseprite/tree/v1.3.16.1-unbundle From: "Azamat H. Hackimov" Date: Sun, 10 Jul 2022 20:14:00 +0300 Subject: [PATCH 3/7] Use shared webp library Added option -DUSE_SHARED_WEBP --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,7 @@ option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off) option(USE_SHARED_TINYEXIF "Use your installed copy of TinyEXIF" off) option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off) option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off) +option(USE_SHARED_WEBP "Use your installed copy of webp" off) option(USE_SHARED_FREETYPE "Use shared FreeType library" off) option(USE_SHARED_HARFBUZZ "Use shared HarfBuzz library" off) option(ENABLE_ASEPRITE_EXE "Compile main Aseprite executable" on) @@ -383,21 +384,27 @@ add_subdirectory(laf) # libwebp if(ENABLE_WEBP) - # Use libwebp from Skia - if(LAF_BACKEND STREQUAL "skia") - find_library(WEBP_LIBRARIES webp - NAMES libwebp # required for Windows - PATHS "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH) - set(WEBP_INCLUDE_DIR "${SKIA_DIR}/third_party/externals/libwebp/src") - if(WEBP_LIBRARIES) - set(WEBP_FOUND ON) + if(USE_SHARED_WEBP) + find_package(PkgConfig QUIET) + pkg_check_modules(WEBP libwebp libwebpdemux libwebpmux) + include_directories(${WEBP_INCLUDE_DIR}) + else() + # Use libwebp from Skia + if(LAF_BACKEND STREQUAL "skia") + find_library(WEBP_LIBRARIES webp + NAMES libwebp # required for Windows + PATHS "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH) + set(WEBP_INCLUDE_DIR "${SKIA_DIR}/third_party/externals/libwebp/src") + if(WEBP_LIBRARIES) + set(WEBP_FOUND ON) + else() + set(WEBP_FOUND OFF) + endif() else() - set(WEBP_FOUND OFF) + set(WEBP_FOUND ON) + set(WEBP_LIBRARIES webp webpdemux libwebpmux) + set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src) endif() - else() - set(WEBP_FOUND ON) - set(WEBP_LIBRARIES webp webpdemux libwebpmux) - set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src) endif() endif() --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -31,7 +31,7 @@ if(NOT USE_SHARED_GIFLIB) add_subdirectory(giflib) endif() -if(ENABLE_WEBP AND NOT LAF_BACKEND STREQUAL "skia") +if(ENABLE_WEBP AND NOT USE_SHARED_WEBP AND NOT LAF_BACKEND STREQUAL "skia") set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.") set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities.") set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool.") -- 2.51.2