summaryrefslogtreecommitdiff
blob: 161e4f8e116be301e377612a2fb02a7b4d7b1d8b (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
diff -uNr a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt	2022-01-12 15:10:33.000000000 +0100
+++ b/CMakeLists.txt	2022-02-15 18:39:49.384093189 +0100
@@ -62,6 +62,7 @@
 option(USE_SHARED_PIXMAN  "Use your installed copy of pixman" off)
 option(USE_SHARED_FREETYPE "Use shared FreeType library" off)
 option(USE_SHARED_HARFBUZZ "Use shared HarfBuzz library" off)
+option(USE_SHARED_WEBP    "Use your installed copy of webp" off)
 option(ENABLE_ASEPRITE_EXE "Compile main Aseprite executable" on)
 option(ENABLE_MEMLEAK      "Enable memory-leaks detector (only for developers)" off)
 option(ENABLE_NEWS         "Enable the news in Home tab" on)
@@ -235,9 +236,17 @@
 
 # libwebp
 if(ENABLE_WEBP)
-  set(WEBP_LIBRARIES webp webpdemux libwebpmux)
-  set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
-  include_directories(${WEBP_INCLUDE_DIR})
+  if(USE_SHARED_WEBP)
+    find_library(WEBP_LIBRARY NAMES webp)
+    find_library(WEBPDEMUX_LIBRARY NAMES webpdemux)
+    find_library(WEBPMUX_LIBRARY NAMES webpmux)
+    set(WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY} ${WEBPMUX_LIBRARY})
+    find_path(WEBP_INCLUDE_DIRS NAMES decode.h PATH_SUFFIXES webp)
+  else()
+    set(WEBP_LIBRARIES webp webpdemux libwebpmux)
+    set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
+    include_directories(${WEBP_INCLUDE_DIR})
+  endif()
 endif()
 
 # tinyxml
diff -uNr a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
--- a/third_party/CMakeLists.txt	2022-01-12 15:10:34.000000000 +0100
+++ b/third_party/CMakeLists.txt	2022-02-15 18:39:26.632093684 +0100
@@ -33,7 +33,7 @@
   add_subdirectory(giflib)
 endif()
 
-if(ENABLE_WEBP)
+if(ENABLE_WEBP AND NOT USE_SHARED_WEBP)
   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.")