Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: cmake/CMakeLists.txt

Issue 1544493002: CMake: generate SkUserConfig.h with configure_file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dont need else Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cmake/SkUserConfig.h.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Boilerplate. 1 # Boilerplate.
2 cmake_minimum_required (VERSION 3.1) # First version with CMAKE_CXX_STANDARD. 2 cmake_minimum_required (VERSION 3.1) # First version with CMAKE_CXX_STANDARD.
3 project (skimake) 3 project (skimake)
4 set (CMAKE_CXX_STANDARD 11) 4 set (CMAKE_CXX_STANDARD 11)
5 5
6 # Default to Release mode. We're mainly targeting Skia users, not Skia develope rs. 6 # Default to Release mode. We're mainly targeting Skia users, not Skia develope rs.
7 if (NOT CMAKE_BUILD_TYPE) 7 if (NOT CMAKE_BUILD_TYPE)
8 set (CMAKE_BUILD_TYPE Release) 8 set (CMAKE_BUILD_TYPE Release)
9 endif () 9 endif ()
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 if (APPLE) 210 if (APPLE)
211 find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED) 211 find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED)
212 list (APPEND libs ${APPLICATION_SERVICES_FRAMEWORK}) 212 list (APPEND libs ${APPLICATION_SERVICES_FRAMEWORK})
213 endif() 213 endif()
214 214
215 if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS) 215 if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS)
216 list (APPEND libs ${OSMESA_LIBRARIES}) 216 list (APPEND libs ${OSMESA_LIBRARIES})
217 list (APPEND private_includes ${OSMESA_INCLUDE_DIRS}) 217 list (APPEND private_includes ${OSMESA_INCLUDE_DIRS})
218 list (APPEND public_defines "-DSK_MESA=1") 218 list (APPEND public_defines "-DSK_MESA=1")
219 set (SK_MESA 1)
219 else() 220 else()
220 remove_srcs(../src/gpu/gl/mesa/*) 221 remove_srcs(../src/gpu/gl/mesa/*)
221 endif() 222 endif()
222 223
223 if (WIN32) 224 if (WIN32)
224 list (APPEND libs FontSub.lib Usp10.lib) 225 list (APPEND libs FontSub.lib Usp10.lib)
225 endif() 226 endif()
226 227
227 find_package(OpenGL REQUIRED) 228 find_package(OpenGL REQUIRED)
228 list (APPEND libs ${OPENGL_LIBRARIES}) 229 list (APPEND libs ${OPENGL_LIBRARIES})
(...skipping 25 matching lines...) Expand all
254 COMPILE_FLAGS ${cc_flags} 255 COMPILE_FLAGS ${cc_flags}
255 CXX_VISIBILITY_PRESET hidden 256 CXX_VISIBILITY_PRESET hidden
256 VISIBILITY_INLINES_HIDDEN true) 257 VISIBILITY_INLINES_HIDDEN true)
257 258
258 # Experimental C API install: 259 # Experimental C API install:
259 file(GLOB c_headers "../include/c/*.h") 260 file(GLOB c_headers "../include/c/*.h")
260 install(FILES ${c_headers} DESTINATION include) 261 install(FILES ${c_headers} DESTINATION include)
261 install(TARGETS skia DESTINATION lib) 262 install(TARGETS skia DESTINATION lib)
262 263
263 # SkUserConfig.h 264 # SkUserConfig.h
264 set (userconfig_path ${userconfig_directory}/SkUserConfig.h)
265 file(WRITE ${userconfig_path} "// SkUserConfig generated by CMake.\n")
266 file(APPEND ${userconfig_path} "#ifndef SkUserConfig_DEFINED\n")
267 file(APPEND ${userconfig_path} "#define SkUserConfig_DEFINED\n")
268 if (CMAKE_BUILD_TYPE STREQUAL Release) 265 if (CMAKE_BUILD_TYPE STREQUAL Release)
269 file(APPEND ${userconfig_path} "#define SK_RELEASE\n") 266 set (SK_RELEASE 1)
270 file(APPEND ${userconfig_path} "#undef SK_DEBUG\n")
271 else ()
272 file(APPEND ${userconfig_path} "#define SK_DEBUG\n")
273 file(APPEND ${userconfig_path} "#undef SK_RELEASE\n")
274 endif ()
275 if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS)
276 file (APPEND ${userconfig_path} "#define SK_MESA 1\n")
277 endif() 267 endif()
278 file(APPEND ${userconfig_path} "#endif // SkUserConfig_DEFINED\n") 268 configure_file ("SkUserConfig.h.in" "${userconfig_directory}/SkUserConfig.h")
279 269
280 # skia_link_arguments.txt 270 # skia_link_arguments.txt
281 set (link_arguments ${CMAKE_BINARY_DIR}/skia_link_arguments.txt) 271 set (link_arguments ${CMAKE_BINARY_DIR}/skia_link_arguments.txt)
282 file (WRITE ${link_arguments} "-L${CMAKE_BINARY_DIR}\n") 272 file (WRITE ${link_arguments} "-L${CMAKE_BINARY_DIR}\n")
283 file (APPEND ${link_arguments} "-lskia\n") 273 file (APPEND ${link_arguments} "-lskia\n")
284 file (APPEND ${link_arguments} "-Wl,-rpath,${CMAKE_BINARY_DIR}\n") 274 file (APPEND ${link_arguments} "-Wl,-rpath,${CMAKE_BINARY_DIR}\n")
285 275
286 # skia_compile_arguments.txt 276 # skia_compile_arguments.txt
287 set (compile_arguments ${CMAKE_BINARY_DIR}/skia_compile_arguments.txt) 277 set (compile_arguments ${CMAKE_BINARY_DIR}/skia_compile_arguments.txt)
288 file (WRITE ${compile_arguments} "--std=c++11\n") 278 file (WRITE ${compile_arguments} "--std=c++11\n")
(...skipping 24 matching lines...) Expand all
313 file (APPEND ${skia_h_path} "#include \"${filename_component}\"\n") 303 file (APPEND ${skia_h_path} "#include \"${filename_component}\"\n")
314 endif () 304 endif ()
315 endforeach() 305 endforeach()
316 endif() 306 endif()
317 endforeach() 307 endforeach()
318 file(APPEND ${skia_h_path} "\n#endif // skia_DEFINED\n") 308 file(APPEND ${skia_h_path} "\n#endif // skia_DEFINED\n")
319 309
320 # Now build a simple example app that uses Skia via libskia.so. 310 # Now build a simple example app that uses Skia via libskia.so.
321 add_executable(example example.cpp) 311 add_executable(example example.cpp)
322 target_link_libraries(example skia ${OPENGL_LIBRARIES}) 312 target_link_libraries(example skia ${OPENGL_LIBRARIES})
OLDNEW
« no previous file with comments | « no previous file | cmake/SkUserConfig.h.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698