Index: cmake/CMakeLists.txt |
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt |
index 751361a92796e246508ee6f275735f3b71c65db1..d32c8e338647edc0d0dc6422463652413f9641f9 100644 |
--- a/cmake/CMakeLists.txt |
+++ b/cmake/CMakeLists.txt |
@@ -145,12 +145,9 @@ if (UNIX AND NOT APPLE) |
find_package (PNG) |
endif() |
-# Decide whether to turn on SkCodec. |
-# TODO (skbug.com/4956): We should be able to turn specific codecs on and off rather than |
-# disabling all of them if one library is missing. |
-if (NOT (GIF_FOUND AND JPEG_FOUND AND PNG_FOUND AND WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES)) |
- remove_srcs(../src/codec/* ../src/android/*) |
-endif() |
+# We can always turn on BMP and WBMP codecs. They don't requires any dependencies. |
mtklein
2016/02/16 23:08:59
Probably no need to guard these with defines then?
msarett
2016/02/17 14:34:54
You're right. Removing these defines.
|
+add_definitions(-DSK_CODEC_DECODES_BMP) |
+add_definitions(-DSK_CODEC_DECODES_WBMP) |
# Do not compile SkRawCodec. |
remove_srcs(../src/codec/*Raw*.cpp) |
@@ -167,15 +164,20 @@ endif() |
if (GIF_FOUND) |
list (APPEND private_includes ${GIF_INCLUDE_DIRS}) |
list (APPEND libs ${GIF_LIBRARIES}) |
+ add_definitions(-DSK_CODEC_DECODES_GIF) |
else() |
remove_srcs(../src/images/*gif*) |
+ remove_srcs(../src/codec/*Gif*) |
endif() |
if (JPEG_FOUND) |
list (APPEND private_includes ${JPEG_INCLUDE_DIRS}) |
list (APPEND libs ${JPEG_LIBRARIES}) |
+ add_definitions(-DSK_CODEC_DECODES_JPEG) |
else() |
remove_srcs(../src/images/*jpeg*) |
+ remove_srcs(../src/images/*Jpeg*) |
+ remove_srcs(../src/codec/*Jpeg*) |
endif() |
if (LUA_FOUND) |
@@ -190,8 +192,13 @@ if (PNG_FOUND) |
list (APPEND libs ${PNG_LIBRARIES}) |
add_definitions(-DPNG_SKIP_SETJMP_CHECK) |
add_definitions(-DPNG_SKIP_SKIA_OPTS) |
+ add_definitions(-DSK_CODEC_DECODES_PNG) |
+ add_definitions(-DSK_CODEC_DECODES_ICO) |
else() |
remove_srcs(../src/images/*png*) |
+ remove_srcs(../src/images/*ico*) |
+ remove_srcs(../src/codec/*Png*) |
+ remove_srcs(../src/codec/*Ico*) |
endif() |
if (ZLIB_FOUND) |
@@ -205,8 +212,10 @@ endif() |
if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES) |
list (APPEND private_includes ${WEBP_INCLUDE_DIRS}) |
list (APPEND libs ${WEBP_LIBRARIES}) |
+ add_definitions(-DSK_CODEC_DECODES_WEBP) |
else() |
remove_srcs(../src/images/*webp*) |
+ remove_srcs(../src/codec/*Webp*) |
endif() |
if (FREETYPE_FOUND) |