OLD | NEW |
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (UNIX AND NOT APPLE) | 138 if (UNIX AND NOT APPLE) |
139 find_package (Freetype) | 139 find_package (Freetype) |
140 # Same deal for fontconfig. | 140 # Same deal for fontconfig. |
141 find_path (FONTCONFIG_INCLUDE_DIRS "fontconfig/fontconfig.h") | 141 find_path (FONTCONFIG_INCLUDE_DIRS "fontconfig/fontconfig.h") |
142 find_library (FONTCONFIG_LIBRARIES fontconfig) | 142 find_library (FONTCONFIG_LIBRARIES fontconfig) |
143 find_package (GIF) | 143 find_package (GIF) |
144 find_package (JPEG) | 144 find_package (JPEG) |
145 find_package (PNG) | 145 find_package (PNG) |
146 endif() | 146 endif() |
147 | 147 |
148 # Decide whether to turn on SkCodec. | |
149 # TODO (skbug.com/4956): We should be able to turn specific codecs on and off ra
ther than | |
150 # disabling all of them if one library is missing. | |
151 if (NOT (GIF_FOUND AND JPEG_FOUND AND PNG_FOUND AND WEBP_INCLUDE_DIRS AND WEBP_L
IBRARIES)) | |
152 remove_srcs(../src/codec/* ../src/android/*) | |
153 endif() | |
154 | |
155 # Do not compile SkRawCodec. | 148 # Do not compile SkRawCodec. |
156 remove_srcs(../src/codec/*Raw*.cpp) | 149 remove_srcs(../src/codec/*Raw*.cpp) |
157 | 150 |
158 # TODO: macro away this if (found) ... else() ... endif() stuff. | 151 # TODO: macro away this if (found) ... else() ... endif() stuff. |
159 | 152 |
160 if (EXPAT_FOUND) | 153 if (EXPAT_FOUND) |
161 list (APPEND private_includes ${EXPAT_INCLUDE_DIRS}) | 154 list (APPEND private_includes ${EXPAT_INCLUDE_DIRS}) |
162 list (APPEND libs ${EXPAT_LIBRARIES}) | 155 list (APPEND libs ${EXPAT_LIBRARIES}) |
163 else() | 156 else() |
164 remove_srcs (../src/ports/SkFontMgr_android_parser.cpp) | 157 remove_srcs (../src/ports/SkFontMgr_android_parser.cpp) |
165 endif() | 158 endif() |
166 | 159 |
167 if (GIF_FOUND) | 160 if (GIF_FOUND) |
168 list (APPEND private_includes ${GIF_INCLUDE_DIRS}) | 161 list (APPEND private_includes ${GIF_INCLUDE_DIRS}) |
169 list (APPEND libs ${GIF_LIBRARIES}) | 162 list (APPEND libs ${GIF_LIBRARIES}) |
| 163 add_definitions(-DSK_CODEC_DECODES_GIF) |
170 else() | 164 else() |
171 remove_srcs(../src/images/*gif*) | 165 remove_srcs(../src/images/*gif*) |
| 166 remove_srcs(../src/codec/*Gif*) |
172 endif() | 167 endif() |
173 | 168 |
174 if (JPEG_FOUND) | 169 if (JPEG_FOUND) |
175 list (APPEND private_includes ${JPEG_INCLUDE_DIRS}) | 170 list (APPEND private_includes ${JPEG_INCLUDE_DIRS}) |
176 list (APPEND libs ${JPEG_LIBRARIES}) | 171 list (APPEND libs ${JPEG_LIBRARIES}) |
| 172 add_definitions(-DSK_CODEC_DECODES_JPEG) |
177 else() | 173 else() |
178 remove_srcs(../src/images/*jpeg*) | 174 remove_srcs(../src/images/*jpeg*) |
| 175 remove_srcs(../src/images/*Jpeg*) |
| 176 remove_srcs(../src/codec/*Jpeg*) |
179 endif() | 177 endif() |
180 | 178 |
181 if (LUA_FOUND) | 179 if (LUA_FOUND) |
182 list (APPEND private_includes ${LUA_INCLUDE_DIR}) | 180 list (APPEND private_includes ${LUA_INCLUDE_DIR}) |
183 list (APPEND libs ${LUA_LIBRARIES}) | 181 list (APPEND libs ${LUA_LIBRARIES}) |
184 else() | 182 else() |
185 remove_srcs(../src/utils/*Lua*) | 183 remove_srcs(../src/utils/*Lua*) |
186 endif() | 184 endif() |
187 | 185 |
188 if (PNG_FOUND) | 186 if (PNG_FOUND) |
189 list (APPEND private_includes ${PNG_INCLUDE_DIRS}) | 187 list (APPEND private_includes ${PNG_INCLUDE_DIRS}) |
190 list (APPEND libs ${PNG_LIBRARIES}) | 188 list (APPEND libs ${PNG_LIBRARIES}) |
191 add_definitions(-DPNG_SKIP_SETJMP_CHECK) | 189 add_definitions(-DPNG_SKIP_SETJMP_CHECK) |
192 add_definitions(-DPNG_SKIP_SKIA_OPTS) | 190 add_definitions(-DPNG_SKIP_SKIA_OPTS) |
| 191 add_definitions(-DSK_CODEC_DECODES_PNG) |
193 else() | 192 else() |
194 remove_srcs(../src/images/*png*) | 193 remove_srcs(../src/images/*png*) |
| 194 remove_srcs(../src/images/*ico*) |
| 195 remove_srcs(../src/codec/*Png*) |
| 196 remove_srcs(../src/codec/*Ico*) |
195 endif() | 197 endif() |
196 | 198 |
197 if (ZLIB_FOUND) | 199 if (ZLIB_FOUND) |
198 list (APPEND private_includes ${ZLIB_INCLUDE_DIRS}) | 200 list (APPEND private_includes ${ZLIB_INCLUDE_DIRS}) |
199 list (APPEND libs ${ZLIB_LIBRARIES}) | 201 list (APPEND libs ${ZLIB_LIBRARIES}) |
200 remove_srcs(../src/doc/SkDocument_PDF_None.cpp) | 202 remove_srcs(../src/doc/SkDocument_PDF_None.cpp) |
201 else() | 203 else() |
202 remove_srcs(../src/pdf/*.cpp ../src/doc/SkDocument_PDF.cpp) | 204 remove_srcs(../src/pdf/*.cpp ../src/doc/SkDocument_PDF.cpp) |
203 endif() | 205 endif() |
204 | 206 |
205 if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES) | 207 if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES) |
206 list (APPEND private_includes ${WEBP_INCLUDE_DIRS}) | 208 list (APPEND private_includes ${WEBP_INCLUDE_DIRS}) |
207 list (APPEND libs ${WEBP_LIBRARIES}) | 209 list (APPEND libs ${WEBP_LIBRARIES}) |
| 210 add_definitions(-DSK_CODEC_DECODES_WEBP) |
208 else() | 211 else() |
209 remove_srcs(../src/images/*webp*) | 212 remove_srcs(../src/images/*webp*) |
| 213 remove_srcs(../src/codec/*Webp*) |
210 endif() | 214 endif() |
211 | 215 |
212 if (FREETYPE_FOUND) | 216 if (FREETYPE_FOUND) |
213 list (APPEND private_includes ${FREETYPE_INCLUDE_DIRS}) | 217 list (APPEND private_includes ${FREETYPE_INCLUDE_DIRS}) |
214 list (APPEND libs ${FREETYPE_LIBRARIES}) | 218 list (APPEND libs ${FREETYPE_LIBRARIES}) |
215 endif() | 219 endif() |
216 | 220 |
217 if (FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES) | 221 if (FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES) |
218 list (APPEND private_includes ${FONTCONFIG_INCLUDE_DIRS}) | 222 list (APPEND private_includes ${FONTCONFIG_INCLUDE_DIRS}) |
219 list (APPEND libs ${FONTCONFIG_LIBRARIES}) | 223 list (APPEND libs ${FONTCONFIG_LIBRARIES}) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 file (APPEND ${skia_h_path} "#include \"${filename_component}\"\n") | 321 file (APPEND ${skia_h_path} "#include \"${filename_component}\"\n") |
318 endif () | 322 endif () |
319 endforeach() | 323 endforeach() |
320 endif() | 324 endif() |
321 endforeach() | 325 endforeach() |
322 file(APPEND ${skia_h_path} "\n#endif // skia_DEFINED\n") | 326 file(APPEND ${skia_h_path} "\n#endif // skia_DEFINED\n") |
323 | 327 |
324 # Now build a simple example app that uses Skia via libskia.so. | 328 # Now build a simple example app that uses Skia via libskia.so. |
325 add_executable(example example.cpp) | 329 add_executable(example example.cpp) |
326 target_link_libraries(example skia ${OPENGL_LIBRARIES}) | 330 target_link_libraries(example skia ${OPENGL_LIBRARIES}) |
OLD | NEW |