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

Side by Side Diff: cmake/CMakeLists.txt

Issue 1353383003: CMake: Compile in OSMesa on Linux, if found. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-21 (Monday) 12:34:55 EDT Created 5 years, 3 months 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 | no next file » | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 # Make our ports choices. 93 # Make our ports choices.
94 remove_srcs( 94 remove_srcs(
95 ../src/*moz* # We're probably not Mozilla. 95 ../src/*moz* # We're probably not Mozilla.
96 ../src/gpu/GrContextFactory.cpp # For internal testing only . 96 ../src/gpu/GrContextFactory.cpp # For internal testing only .
97 ../src/gpu/gl/GrGLCreateNativeInterface_none.cpp 97 ../src/gpu/gl/GrGLCreateNativeInterface_none.cpp
98 ../src/gpu/gl/GrGLDefaultInterface_none.cpp 98 ../src/gpu/gl/GrGLDefaultInterface_none.cpp
99 ../src/gpu/gl/SkCreatePlatformGLContext*.cpp # For internal testing only . 99 ../src/gpu/gl/SkCreatePlatformGLContext*.cpp # For internal testing only .
100 ../src/gpu/gl/command_buffer/* 100 ../src/gpu/gl/command_buffer/*
101 ../src/gpu/gl/egl/* 101 ../src/gpu/gl/egl/*
102 ../src/gpu/gl/iOS/* 102 ../src/gpu/gl/iOS/*
103 ../src/gpu/gl/mesa/*
104 ../src/opts/SkBitmapProcState_opts_none.cpp 103 ../src/opts/SkBitmapProcState_opts_none.cpp
105 ../src/opts/SkBlitMask_opts_none.cpp 104 ../src/opts/SkBlitMask_opts_none.cpp
106 ../src/opts/SkBlitRow_opts_none.cpp 105 ../src/opts/SkBlitRow_opts_none.cpp
107 ../src/ports/SkFontMgr_empty_factory.cpp 106 ../src/ports/SkFontMgr_empty_factory.cpp
108 ../src/ports/SkGlobalInitialization_chromium.cpp 107 ../src/ports/SkGlobalInitialization_chromium.cpp
109 ../src/ports/SkImageDecoder_empty.cpp 108 ../src/ports/SkImageDecoder_empty.cpp
110 ../src/ports/SkImageGenerator_none.cpp 109 ../src/ports/SkImageGenerator_none.cpp
111 ../src/ports/SkTLS_none.cpp) 110 ../src/ports/SkTLS_none.cpp)
112 111
113 remove_srcs(../src/codec/*) # TODO: Requires Chromium's libjpeg-turbo, and inco mpatible giflib. 112 remove_srcs(../src/codec/*) # TODO: Requires Chromium's libjpeg-turbo, and inco mpatible giflib.
114 113
115 # Certain files must be compiled with support for SSSE3 or SSE4.1 intrinsics. 114 # Certain files must be compiled with support for SSSE3 or SSE4.1 intrinsics.
116 file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp) 115 file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp)
117 file (GLOB_RECURSE sse41_srcs ../src/*sse4*.cpp ../src/*SSE4*.cpp) 116 file (GLOB_RECURSE sse41_srcs ../src/*sse4*.cpp ../src/*SSE4*.cpp)
118 set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3) 117 set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3)
119 set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1) 118 set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1)
120 119
121 # Detect our optional dependencies. 120 # Detect our optional dependencies.
122 # If we can't find them, don't build the parts of Skia that use them. 121 # If we can't find them, don't build the parts of Skia that use them.
123 find_package (Lua) 122 find_package (Lua)
124 find_package (ZLIB) 123 find_package (ZLIB)
125 # No find_package for libwebp as far as I can tell, so simulate it here. 124 # No find_package for libwebp as far as I can tell, so simulate it here.
126 find_path (WEBP_INCLUDE_DIRS "webp/decode.h") 125 find_path (WEBP_INCLUDE_DIRS "webp/decode.h")
127 find_library (WEBP_LIBRARIES webp) 126 find_library (WEBP_LIBRARIES webp)
127 find_path (OSMESA_INCLUDE_DIRS "GL/osmesa.h")
128 find_library(OSMESA_LIBRARIES "OSMesa")
128 129
129 if (UNIX AND NOT APPLE) 130 if (UNIX AND NOT APPLE)
130 find_package (Freetype) 131 find_package (Freetype)
131 # Same deal for fontconfig. 132 # Same deal for fontconfig.
132 find_path (FONTCONFIG_INCLUDE_DIRS "fontconfig/fontconfig.h") 133 find_path (FONTCONFIG_INCLUDE_DIRS "fontconfig/fontconfig.h")
133 find_library (FONTCONFIG_LIBRARIES fontconfig) 134 find_library (FONTCONFIG_LIBRARIES fontconfig)
134 find_package (GIF) 135 find_package (GIF)
135 find_package (JPEG) 136 find_package (JPEG)
136 find_package (PNG) 137 find_package (PNG)
137 endif() 138 endif()
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES) 190 if (FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES)
190 list (APPEND private_includes ${FONTCONFIG_INCLUDE_DIRS}) 191 list (APPEND private_includes ${FONTCONFIG_INCLUDE_DIRS})
191 list (APPEND libs ${FONTCONFIG_LIBRARIES}) 192 list (APPEND libs ${FONTCONFIG_LIBRARIES})
192 endif() 193 endif()
193 194
194 if (APPLE) 195 if (APPLE)
195 find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED) 196 find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED)
196 list (APPEND libs ${APPLICATION_SERVICES_FRAMEWORK}) 197 list (APPEND libs ${APPLICATION_SERVICES_FRAMEWORK})
197 endif() 198 endif()
198 199
200 if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS)
201 list (APPEND libs ${OSMESA_LIBRARIES})
202 list (APPEND private_includes ${OSMESA_INCLUDE_DIRS})
203 list (APPEND public_defines "-DSK_MESA=1")
204 message("-- Found OSMesa: " ${OSMESA_LIBRARIES})
205 else()
206 remove_srcs(../src/gpu/gl/mesa/*)
207 message("-- Could NOT find OSMesa")
208 endif()
209
199 find_package(OpenGL REQUIRED) 210 find_package(OpenGL REQUIRED)
200 list (APPEND libs ${OPENGL_LIBRARIES}) 211 list (APPEND libs ${OPENGL_LIBRARIES})
201 212
202 # This is our main output, libskia.so. 213 # This is our main output, libskia.so.
203 # We mostly build an .so here because it helps test we've linked everything, 214 # We mostly build an .so here because it helps test we've linked everything,
204 # not so much that we think Skia is a good candidate to ship as a shared library . 215 # not so much that we think Skia is a good candidate to ship as a shared library .
205 add_library (skia SHARED ${srcs}) 216 add_library (skia SHARED ${srcs})
206 217
218 list (APPEND private_defines "-DSKIA_DLL")
219
207 target_compile_definitions(skia 220 target_compile_definitions(skia
208 PUBLIC 221 PUBLIC ${public_defines}
209 PRIVATE -DSKIA_DLL) 222 PRIVATE ${private_defines})
210 223
211 target_include_directories(skia 224 target_include_directories(skia
212 PUBLIC ${public_includes} 225 PUBLIC ${public_includes}
213 PRIVATE ${private_includes}) 226 PRIVATE ${private_includes})
214 227
215 target_link_libraries(skia 228 target_link_libraries(skia
216 PUBLIC 229 PUBLIC
217 PRIVATE ${libs}) 230 PRIVATE ${libs})
218 231
219 232
220 set_target_properties(skia PROPERTIES 233 set_target_properties(skia PROPERTIES
221 COMPILE_FLAGS "-fno-exceptions -fno-rtti -Wno-deprecated-declarations" 234 COMPILE_FLAGS "-fno-exceptions -fno-rtti -Wno-deprecated-declarations"
222 CXX_VISIBILITY_PRESET hidden 235 CXX_VISIBILITY_PRESET hidden
223 VISIBILITY_INLINES_HIDDEN true) 236 VISIBILITY_INLINES_HIDDEN true)
224 237
225 # Experimental C API install: 238 # Experimental C API install:
226 file(GLOB cheaders "../include/c/*.h") 239 file(GLOB cheaders "../include/c/*.h")
227 install(FILES ${cheaders} DESTINATION include) 240 install(FILES ${cheaders} DESTINATION include)
228 install(TARGETS skia DESTINATION lib) 241 install(TARGETS skia DESTINATION lib)
229 242
230 # Now build a simple example app that uses Skia via libskia.so. 243 # Now build a simple example app that uses Skia via libskia.so.
231 add_executable(example example.cpp) 244 add_executable(example example.cpp)
232 target_link_libraries(example skia ${OPENGL_LIBRARIES}) 245 target_link_libraries(example skia ${OPENGL_LIBRARIES})
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698