Link with libwebp from Skia if possible

master
David Capello 2022-07-20 14:11:00 -03:00
parent 55885ee266
commit ccb32562ad
2 changed files with 12 additions and 3 deletions

View File

@ -229,8 +229,15 @@ add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
# libwebp
if(ENABLE_WEBP)
set(WEBP_LIBRARIES webp webpdemux libwebpmux)
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
# Use libwebp from Skia
if(LAF_BACKEND STREQUAL "skia")
find_library(WEBP_LIBRARIES webp
PATH "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH)
set(WEBP_INCLUDE_DIR "${SKIA_DIR}/third_party/externals/libwebp/src")
else()
set(WEBP_LIBRARIES webp webpdemux libwebpmux)
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
endif()
include_directories(${WEBP_INCLUDE_DIR})
endif()
@ -332,6 +339,8 @@ set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
add_subdirectory(laf)
message(STATUS "aseprite libwebp: ${WEBP_LIBRARIES}")
# LAF libraries + Aseprite are compiled with config.h
target_include_directories(laf-base PUBLIC src)
target_compile_definitions(laf-base PUBLIC HAVE_CONFIG_H)

View File

@ -33,7 +33,7 @@ if(NOT USE_SHARED_GIFLIB)
add_subdirectory(giflib)
endif()
if(ENABLE_WEBP)
if(ENABLE_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.")