summaryrefslogtreecommitdiff
path: root/dev-games/aseprite/files/aseprite-1.3.2_shared_webp.patch
blob: 3026b7641e6d166cdff30c88a89e8f0157747583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From 06d5d4cd307e9ee0b83bdbff71729dab1305ea9a Mon Sep 17 00:00:00 2001
From: "Azamat H. Hackimov" <azamat.hackimov@gmail.com>
Date: Sun, 10 Jul 2022 20:14:00 +0300
Subject: [PATCH 2/4] Use shared webp library

Added option -DUSE_SHARED_WEBP
---
 CMakeLists.txt             | 28 ++++++++++++++++++----------
 third_party/CMakeLists.txt |  2 +-
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4f364185..ba05f8d84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ option(USE_SHARED_LIBARCHIVE "Use your installed copy of libarchive" off)
 option(USE_SHARED_LIBPNG  "Use your installed copy of libpng" 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)
@@ -342,24 +343,31 @@ set(UNDO_TESTS     ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
 if(ENABLE_DRM)
   add_subdirectory(drm)
 endif()
-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(USE_SHARED_WEBP)
+    find_package(PkgConfig QUIET)
+    pkg_check_modules(WEBP libwebp libwebpdemux libwebpmux)
+    include_directories(${WEBP_INCLUDE_DIR})
   else()
-    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
+        NAMES libwebp # required for Windows
+        PATHS "${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()
-  include_directories(${WEBP_INCLUDE_DIR})
 endif()
 message(STATUS "aseprite libwebp: ${WEBP_LIBRARIES}")
 
+add_subdirectory(laf)
+
 # LAF libraries + Aseprite are compiled with config.h
 target_include_directories(laf-base PUBLIC src)
 target_compile_definitions(laf-base PUBLIC HAVE_CONFIG_H)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 88eea9b5e..31aa3e52f 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -33,7 +33,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.41.0