Index: cmake/CMakeLists.txt |
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt |
index cd71de74b7b9843d81a66ccc8aabe5b7002274eb..f87b5f836b276868974cf1060ee525f9ebe8ccc6 100644 |
--- a/cmake/CMakeLists.txt |
+++ b/cmake/CMakeLists.txt |
@@ -8,6 +8,17 @@ if (NOT CMAKE_BUILD_TYPE) |
set (CMAKE_BUILD_TYPE Release) |
endif () |
+set (userconfig_directory ${CMAKE_BINARY_DIR}/include) |
+set (userconfig_path ${userconfig_directory}/SkUserConfig.h) |
+file(WRITE ${userconfig_path} "// SkUserConfig generated by CMake.\n") |
+if (CMAKE_BUILD_TYPE STREQUAL Release) |
+ file(APPEND ${userconfig_path} "#define SK_RELEASE\n") |
+ file(APPEND ${userconfig_path} "#undef SK_DEBUG\n") |
+else () |
+ file(APPEND ${userconfig_path} "#define SK_DEBUG\n") |
+ file(APPEND ${userconfig_path} "#undef SK_RELEASE\n") |
+endif () |
+ |
# To first approximation, the Skia library comprises all .cpp files under src/. |
file (GLOB_RECURSE srcs ../src/*.cpp) |
@@ -26,6 +37,9 @@ endfunction() |
find_include_dirs(private_includes ../src/*.h ../include/private/*.h) |
find_include_dirs(public_includes ../include/*.h) |
list (REMOVE_ITEM public_includes ${private_includes}) # Easiest way to exclude private. |
+file (GLOB default_include_config "../include/config") |
+list (REMOVE_ITEM public_includes ${default_include_config}) |
+list (APPEND public_includes ${userconfig_directory}) |
# These guys are third_party but provided by a Skia checkout. |
list (APPEND srcs ../third_party/etc1/etc1.cpp ../third_party/ktx/ktx.cpp) |
@@ -201,6 +215,7 @@ if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS) |
list (APPEND libs ${OSMESA_LIBRARIES}) |
list (APPEND private_includes ${OSMESA_INCLUDE_DIRS}) |
list (APPEND public_defines "-DSK_MESA=1") |
+ file (APPEND ${userconfig_path} "#define SK_MESA 1\n") |
else() |
remove_srcs(../src/gpu/gl/mesa/*) |
endif() |