aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-01-05 08:32:32 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-05 08:32:32 -0800
commit014f06b726267dff5ca1ce094affd605e041fac3 (patch)
treee87e00dad931521b125f5f237ca7a0cde6fdb533 /cmake
parent3323b05be5aacb6008e8e09fd922d0c9269e4c07 (diff)
CMake: generate SkUserConfig.h with configure_file
1) It's simpler. 2) It should cache correctly (and not trigger total rebuilds everytime we re-run CMake.) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1544493002 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1544493002
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt16
-rw-r--r--cmake/SkUserConfig.h.in15
2 files changed, 18 insertions, 13 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index fcbce4ff5c..adc41501bd 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -216,6 +216,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")
+ set (SK_MESA 1)
else()
remove_srcs(../src/gpu/gl/mesa/*)
endif()
@@ -261,21 +262,10 @@ install(FILES ${c_headers} DESTINATION include)
install(TARGETS skia DESTINATION lib)
# SkUserConfig.h
-set (userconfig_path ${userconfig_directory}/SkUserConfig.h)
-file(WRITE ${userconfig_path} "// SkUserConfig generated by CMake.\n")
-file(APPEND ${userconfig_path} "#ifndef SkUserConfig_DEFINED\n")
-file(APPEND ${userconfig_path} "#define SkUserConfig_DEFINED\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 ()
-if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS)
- file (APPEND ${userconfig_path} "#define SK_MESA 1\n")
+ set (SK_RELEASE 1)
endif()
-file(APPEND ${userconfig_path} "#endif // SkUserConfig_DEFINED\n")
+configure_file ("SkUserConfig.h.in" "${userconfig_directory}/SkUserConfig.h")
# skia_link_arguments.txt
set (link_arguments ${CMAKE_BINARY_DIR}/skia_link_arguments.txt)
diff --git a/cmake/SkUserConfig.h.in b/cmake/SkUserConfig.h.in
new file mode 100644
index 0000000000..0649656e7f
--- /dev/null
+++ b/cmake/SkUserConfig.h.in
@@ -0,0 +1,15 @@
+// SkUserConfig generated by CMake.
+#ifndef SkUserConfig_DEFINED
+#define SkUserConfig_DEFINED
+
+#if ${SK_RELEASE}
+ #define SK_RELEASE
+ #undef SK_DEBUG
+#else
+ #define SK_DEBUG
+ #undef SK_RELEASE
+#endif
+
+#cmakedefine01 SK_MESA
+
+#endif