blob: d5a6ad0310cdd3e11dbc91217d57ba8e9b19d1d1 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Mike Kleincfc4f442016-10-26 17:19:03 -04006import("gn/android_framework_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
mtklein3e8012e2016-09-21 09:14:19 -07009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12
mtkleinc04ff472016-06-23 10:29:30 -070013declare_args() {
mtkleind68f9b02016-09-23 13:18:41 -070014 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070015 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070016 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070017 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040018 skia_use_gdi = false
mtklein63213812016-08-24 09:55:56 -070019 skia_use_libjpeg_turbo = true
20 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070021 skia_use_libwebp = !is_fuchsia
mtkleina627b5c2016-09-20 13:36:47 -070022 skia_use_mesa = false
scroggof84ad642016-10-31 09:02:57 -070023 skia_use_raw = !is_win
Mike Kleinae7e6712016-10-11 17:49:33 -040024 skia_use_sfntly = !is_fuchsia && !is_win # TODO: icu on Windows, re-enable this.
mtklein63213812016-08-24 09:55:56 -070025 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070026
27 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070028 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070029 skia_enable_tools = is_skia_standalone
30 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040031 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070032}
33
Brian Salomon23d73ea2016-10-27 13:31:37 -040034declare_args() {
35 skia_use_vulkan =
36 skia_vulkan_sdk != "" || (is_android && defined(ndk_api) && ndk_api >= 24)
37}
Brian Salomon789e25e2016-09-30 13:41:03 -040038
mtklein38925aa2016-09-21 10:11:25 -070039# Our tools require static linking (they use non-exported symbols).
40skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070041
mtkleina45be612016-08-29 15:22:10 -070042fontmgr_android_enabled = skia_use_expat && skia_use_freetype
43
mtklein1211e0c2016-07-26 13:55:45 -070044skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070045 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070046 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070047 "include/codec",
48 "include/config",
49 "include/core",
50 "include/effects",
51 "include/gpu",
52 "include/gpu/gl",
53 "include/images",
54 "include/pathops",
55 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070056 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070057 "include/utils",
58 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070059 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070060]
61
mtkleinc04ff472016-06-23 10:29:30 -070062# Skia public API, generally provided by :skia.
63config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070064 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040065 defines = []
66 if (is_component_build) {
67 defines += [ "SKIA_DLL" ]
68 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040069 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070070 defines += [ "SK_SAMPLES_FOR_X" ]
71 }
mtkleincae1be52016-09-20 08:24:34 -070072 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040073 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070074 }
mtklein06c35c02016-09-20 12:28:12 -070075 if (!skia_enable_gpu) {
76 defines += [ "SK_SUPPORT_GPU=0" ]
77 }
mtkleinc04ff472016-06-23 10:29:30 -070078}
79
80# Skia internal APIs, used by Skia itself and a few test tools.
81config("skia_private") {
82 visibility = [ ":*" ]
83
84 include_dirs = [
85 "include/private",
86 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070087 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070088 "src/config",
89 "src/core",
90 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070091 "src/effects/gradients",
92 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070093 "src/gpu",
94 "src/image",
95 "src/images",
96 "src/lazy",
97 "src/opts",
98 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070099 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/ports",
101 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700102 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700103 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700104 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700105 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700106 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700107 "third_party/ktx",
108 ]
mtklein150d1132016-08-01 06:56:40 -0700109
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400110 defines = [
111 "SK_GAMMA_APPLY_TO_A8",
112 "SK_INTERNAL",
113 ]
mtkleinb37c0342016-09-09 11:07:45 -0700114 if (is_android) {
115 defines += [
116 "SK_GAMMA_EXPONENT=1.4",
117 "SK_GAMMA_CONTRAST=0.0",
118 ]
119 }
mtklein88a7ac02016-09-14 11:16:49 -0700120 if (is_official_build || is_android) {
121 # TODO(bsalomon): it'd be nice to make Android normal.
122 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
123 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400124 libs = []
125 lib_dirs = []
126 if (skia_use_vulkan) {
127 if (skia_vulkan_sdk != "") {
Mike Klein487bfc22016-10-14 14:04:56 -0400128 if (is_win) {
129 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
130 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
131 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400132 include_dirs += [ "$skia_vulkan_sdk/include/" ]
133 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400134 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400135 }
Mike Klein487bfc22016-10-14 14:04:56 -0400136 if (is_win) {
137 libs += [ "vulkan-1.lib" ]
138 } else {
139 libs += [ "vulkan" ]
140 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400141 }
mtkleinc04ff472016-06-23 10:29:30 -0700142}
143
144# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
145config("skia_library") {
146 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700147 defines = [ "SKIA_IMPLEMENTATION=1" ]
148}
149
150skia_library_configs = [
151 ":skia_public",
152 ":skia_private",
153 ":skia_library",
154]
155
mtklein9b8583d2016-08-24 17:32:30 -0700156# Use for CPU-specific Skia code that needs particular compiler flags.
157template("opts") {
158 if (invoker.enabled) {
159 source_set(target_name) {
160 forward_variables_from(invoker, "*")
161 configs += skia_library_configs
162 }
163 } else {
164 # If not enabled, a phony empty target that swallows all otherwise unused variables.
165 source_set(target_name) {
166 forward_variables_from(invoker,
167 "*",
168 [
169 "sources",
170 "cflags",
171 ])
172 }
173 }
anmittala7eaf2e2016-08-17 13:57:26 -0700174}
175
mtklein422310d2016-08-16 18:28:43 -0700176is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700177
mtklein7d6fb2c2016-08-25 14:50:44 -0700178opts("none") {
179 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700181 cflags = []
182}
183
mtklein7d6fb2c2016-08-25 14:50:44 -0700184opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700185 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700186 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700187 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700188}
189
190opts("arm64") {
191 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700192 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700193 cflags = []
194}
195
196opts("crc32") {
197 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700198 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700199 cflags = [ "-march=armv8-a+crc" ]
200}
201
mtklein9b8583d2016-08-24 17:32:30 -0700202opts("sse2") {
203 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700204 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400205 if (is_win) {
206 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
207 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400208 cflags = [ "-msse2" ]
209 }
mtklein9b8583d2016-08-24 17:32:30 -0700210}
mtkleinc04ff472016-06-23 10:29:30 -0700211
mtklein9b8583d2016-08-24 17:32:30 -0700212opts("ssse3") {
213 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400215 if (is_win) {
216 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
217 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400218 cflags = [ "-mssse3" ]
219 }
mtklein9b8583d2016-08-24 17:32:30 -0700220}
mtkleinc04ff472016-06-23 10:29:30 -0700221
mtklein9b8583d2016-08-24 17:32:30 -0700222opts("sse41") {
223 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700224 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400225 if (is_win) {
226 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
227 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400228 cflags = [ "-msse4.1" ]
229 }
mtklein9b8583d2016-08-24 17:32:30 -0700230}
mtklein4e976072016-08-08 09:06:27 -0700231
mtklein9b8583d2016-08-24 17:32:30 -0700232opts("sse42") {
233 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700234 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400235 if (is_win) {
236 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
237 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400238 cflags = [ "-msse4.2" ]
239 }
mtklein9b8583d2016-08-24 17:32:30 -0700240}
241
242opts("avx") {
243 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400245 if (is_win) {
246 cflags = [ "/arch:AVX" ]
247 } else {
248 cflags = [ "-mavx" ]
249 }
mtkleinc04ff472016-06-23 10:29:30 -0700250}
251
Mike Klein78d5a3b2016-09-30 10:48:01 -0400252opts("hsw") {
253 enabled = is_x86
254 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400255 if (is_win) {
256 cflags = [ "/arch:AVX2" ]
257 } else {
258 cflags = [
259 "-mavx2",
260 "-mbmi",
261 "-mbmi2",
262 "-mf16c",
263 "-mfma",
264 ]
265 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400266}
267
mtklein349cece2016-08-26 08:13:04 -0700268opts("dsp") {
269 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700270 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700271 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700272}
273
mtkleinc095df52016-08-24 12:23:52 -0700274# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700275template("optional") {
276 if (invoker.enabled) {
277 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700278 if (defined(invoker.public_defines)) {
279 defines = invoker.public_defines
280 }
mtklein457b42a2016-08-23 13:56:37 -0700281 }
282 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700283 forward_variables_from(invoker,
284 "*",
285 [
286 "public_defines",
287 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700288 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700289 ])
mtklein457b42a2016-08-23 13:56:37 -0700290 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700291 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700292 if (defined(invoker.configs_to_remove)) {
293 configs -= invoker.configs_to_remove
294 }
mtklein457b42a2016-08-23 13:56:37 -0700295 }
296 } else {
mtklein457b42a2016-08-23 13:56:37 -0700297 source_set(target_name) {
298 forward_variables_from(invoker,
299 "*",
300 [
301 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700302 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700303 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700304 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700305 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700306 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700307 ])
mtkleincd01b032016-08-31 04:58:19 -0700308 if (defined(invoker.sources_when_disabled)) {
309 sources = invoker.sources_when_disabled
310 }
311 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700312 }
mtkleineb3c4252016-08-23 07:38:09 -0700313 }
mtklein457b42a2016-08-23 13:56:37 -0700314}
mtklein457b42a2016-08-23 13:56:37 -0700315
mtkleina45be612016-08-29 15:22:10 -0700316optional("fontmgr_android") {
317 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700318
319 deps = [
320 "//third_party/expat",
321 "//third_party/freetype2",
322 ]
323 sources = [
324 "src/ports/SkFontMgr_android.cpp",
325 "src/ports/SkFontMgr_android_factory.cpp",
326 "src/ports/SkFontMgr_android_parser.cpp",
327 ]
328}
329
mtkleind2e39db2016-09-07 07:52:55 -0700330optional("fontmgr_custom") {
331 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
332
333 deps = [
334 "//third_party/freetype2",
335 ]
336 sources = [
337 "src/ports/SkFontMgr_custom.cpp",
338 "src/ports/SkFontMgr_custom_directory_factory.cpp",
339 ]
340}
341
mtklein3cc22182016-08-29 13:26:14 -0700342optional("fontmgr_fontconfig") {
343 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700344
345 deps = [
346 "//third_party:fontconfig",
347 "//third_party/freetype2",
348 ]
349 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700350 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700351 "src/ports/SkFontConfigInterface_direct.cpp",
352 "src/ports/SkFontConfigInterface_direct_factory.cpp",
353 "src/ports/SkFontMgr_FontConfigInterface.cpp",
354 "src/ports/SkFontMgr_fontconfig.cpp",
355 "src/ports/SkFontMgr_fontconfig_factory.cpp",
356 ]
357}
358
mtkleincdedd0e2016-09-12 15:15:44 -0700359optional("fontmgr_fuchsia") {
360 enabled = is_fuchsia && skia_use_freetype
361
362 deps = [
363 "//third_party/freetype2",
364 ]
365 sources = [
366 "src/ports/SkFontMgr_custom.cpp",
367 "src/ports/SkFontMgr_custom_empty_factory.cpp",
368 ]
369}
370
mtklein06c35c02016-09-20 12:28:12 -0700371optional("gpu") {
372 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700373 public_defines = []
374
mtklein06c35c02016-09-20 12:28:12 -0700375 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
376
377 # These paths need to be absolute to match the ones produced by shared_sources.gni.
378 sources -= get_path_info([
379 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
380 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
381 ],
382 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400383 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700384 if (is_android) {
385 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
386 } else if (is_linux) {
387 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
388 } else if (is_mac) {
389 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400390 } else if (is_win) {
391 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
392 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700393 } else {
394 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
395 }
mtkleine9fb3d52016-09-20 15:11:46 -0700396
397 if (skia_use_vulkan) {
398 public_defines += [ "SK_VULKAN" ]
399 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700400 if (skia_enable_vulkan_debug_layers) {
401 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
402 }
mtkleine9fb3d52016-09-20 15:11:46 -0700403 }
mtklein06c35c02016-09-20 12:28:12 -0700404}
405
mtklein63213812016-08-24 09:55:56 -0700406optional("jpeg") {
407 enabled = skia_use_libjpeg_turbo
408 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
409
mtklein63213812016-08-24 09:55:56 -0700410 deps = [
411 "//third_party/libjpeg-turbo:libjpeg",
412 ]
413 sources = [
414 "src/codec/SkJpegCodec.cpp",
415 "src/codec/SkJpegDecoderMgr.cpp",
416 "src/codec/SkJpegUtility.cpp",
417 "src/images/SkJPEGImageEncoder.cpp",
418 "src/images/SkJPEGWriteUtility.cpp",
419 ]
420}
421
422optional("pdf") {
423 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700424
mtklein63213812016-08-24 09:55:56 -0700425 deps = [
426 "//third_party/zlib",
427 ]
brettwb9447282016-09-01 14:24:39 -0700428 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700429 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700430
431 if (skia_use_sfntly) {
432 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700433 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700434 }
435}
436
437optional("png") {
438 enabled = skia_use_libpng
439 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
440
mtklein63213812016-08-24 09:55:56 -0700441 deps = [
442 "//third_party/libpng",
443 ]
444 sources = [
445 "src/codec/SkIcoCodec.cpp",
446 "src/codec/SkPngCodec.cpp",
447 "src/images/SkPNGImageEncoder.cpp",
448 ]
449}
450
scroggof84ad642016-10-31 09:02:57 -0700451optional("raw") {
452 enabled = skia_use_raw && skia_use_libjpeg_turbo && skia_use_zlib
453 public_defines = [ "SK_CODEC_DECODES_RAW" ]
454
455 deps = [
456 "//third_party/dng_sdk",
457 "//third_party/libjpeg-turbo:libjpeg",
458 "//third_party/piex",
459 ]
460
461 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
462 # Skia.
463 configs_to_remove = [ "//gn:no_exceptions" ]
464
465 sources = [
466 "src/codec/SkRawAdapterCodec.cpp",
467 "src/codec/SkRawCodec.cpp",
468 ]
469}
470
mtklein3cc22182016-08-29 13:26:14 -0700471optional("typeface_freetype") {
472 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700473
474 deps = [
475 "//third_party/freetype2",
476 ]
477 sources = [
478 "src/ports/SkFontHost_FreeType.cpp",
479 "src/ports/SkFontHost_FreeType_common.cpp",
480 ]
481}
482
mtklein457b42a2016-08-23 13:56:37 -0700483optional("webp") {
484 enabled = skia_use_libwebp
485 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
486
mtklein457b42a2016-08-23 13:56:37 -0700487 deps = [
488 "//third_party/libwebp",
489 ]
490 sources = [
491 "src/codec/SkWebpAdapterCodec.cpp",
492 "src/codec/SkWebpCodec.cpp",
493 "src/images/SkWEBPImageEncoder.cpp",
494 ]
mtkleineb3c4252016-08-23 07:38:09 -0700495}
496
mtklein63213812016-08-24 09:55:56 -0700497optional("xml") {
498 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700499
mtklein63213812016-08-24 09:55:56 -0700500 deps = [
501 "//third_party/expat",
502 ]
503 sources = [
504 "src/xml/SkDOM.cpp",
505 "src/xml/SkXMLParser.cpp",
506 "src/xml/SkXMLWriter.cpp",
507 ]
508}
509
mtkleinc04ff472016-06-23 10:29:30 -0700510component("skia") {
511 public_configs = [ ":skia_public" ]
512 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700513
514 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700515 ":arm64",
516 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700517 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700518 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700519 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700520 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700521 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700522 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700523 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700524 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400525 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700526 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700527 ":none",
mtklein63213812016-08-24 09:55:56 -0700528 ":pdf",
529 ":png",
scroggof84ad642016-10-31 09:02:57 -0700530 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700531 ":sse2",
532 ":sse41",
533 ":sse42",
534 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700535 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700536 ":webp",
mtklein63213812016-08-24 09:55:56 -0700537 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700538 ]
539
mtkleinc04ff472016-06-23 10:29:30 -0700540 sources = []
brettwb9447282016-09-01 14:24:39 -0700541 sources += skia_core_sources
542 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700543 sources += skia_sksl_sources
544 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700545 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700546 "src/android/SkBitmapRegionCodec.cpp",
547 "src/android/SkBitmapRegionDecoder.cpp",
548 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700549 "src/codec/SkBmpCodec.cpp",
550 "src/codec/SkBmpMaskCodec.cpp",
551 "src/codec/SkBmpRLECodec.cpp",
552 "src/codec/SkBmpStandardCodec.cpp",
553 "src/codec/SkCodec.cpp",
554 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700555 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700556 "src/codec/SkMaskSwizzler.cpp",
557 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700558 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700559 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700560 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700561 "src/codec/SkSwizzler.cpp",
562 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700563 "src/images/SkImageEncoder.cpp",
564 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700565 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700566 "src/ports/SkDiscardableMemory_none.cpp",
567 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700568 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700569 "src/ports/SkMemory_malloc.cpp",
570 "src/ports/SkOSFile_stdio.cpp",
571 "src/sfnt/SkOTTable_name.cpp",
572 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700573 "src/svg/SkSVGCanvas.cpp",
574 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700575 "src/utils/mac/SkStream_mac.cpp",
576 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700577 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700578 "third_party/ktx/ktx.cpp",
579 ]
brettwb9447282016-09-01 14:24:39 -0700580
mtklein7d6fb2c2016-08-25 14:50:44 -0700581 libs = []
582
mtkleinc04ff472016-06-23 10:29:30 -0700583 if (is_win) {
584 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400585 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700586 "src/ports/SkDebug_win.cpp",
587 "src/ports/SkFontHost_win.cpp",
588 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700589 "src/ports/SkImageEncoder_WIC.cpp",
590 "src/ports/SkImageGeneratorWIC.cpp",
591 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700592 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700593 "src/ports/SkScalerContext_win_dw.cpp",
594 "src/ports/SkTLS_win.cpp",
595 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700596 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400597 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700598 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400599 if (skia_use_gdi) {
600 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
601 libs += [
602 "Gdi32.lib",
603 "Usp10.lib",
604 ]
605 } else {
606 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
607 }
mtkleinb9be9792016-09-16 14:44:18 -0700608 sources -=
609 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400610 libs += [
611 "FontSub.lib",
612 "Ole32.lib",
613 "OleAut32.lib",
614 "User32.lib",
615 ]
mtkleinc04ff472016-06-23 10:29:30 -0700616 } else {
617 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700618 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700619 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700620 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700621 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700622 ]
623 }
624
mtklein7d6fb2c2016-08-25 14:50:44 -0700625 if (is_android) {
626 deps += [
627 "//third_party/cpu-features",
628 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700629 ]
mtklein06c35c02016-09-20 12:28:12 -0700630 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700631 libs += [
632 "EGL",
633 "GLESv2",
634 "log",
635 ]
636 }
637
mtkleinc04ff472016-06-23 10:29:30 -0700638 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700639 libs += [
640 "GL",
641 "GLU",
642 "X11",
643 ]
mtklein06c35c02016-09-20 12:28:12 -0700644 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700645 }
646
647 if (is_mac) {
648 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700649 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700650 "src/ports/SkFontHost_mac.cpp",
651 "src/ports/SkImageEncoder_CG.cpp",
652 "src/ports/SkImageGeneratorCG.cpp",
653 ]
mtklein09e61f72016-08-23 13:35:28 -0700654 libs += [
655 "ApplicationServices.framework",
656 "OpenGL.framework",
657 ]
mtkleinc04ff472016-06-23 10:29:30 -0700658 }
abarth6fc8ff02016-07-15 15:15:15 -0700659
660 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700661 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700662 }
mtkleinc04ff472016-06-23 10:29:30 -0700663}
664
mtkleinada5a442016-08-02 14:28:26 -0700665skia_h_headers = exec_script("gyp/find.py",
666 [ "*.h" ] + rebase_path(skia_public_includes),
667 "list lines",
668 []) -
669 [
670 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
671 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
672 rebase_path("include/gpu/vk/GrVkDefines.h"),
673 rebase_path("include/gpu/vk/GrVkInterface.h"),
674 rebase_path("include/gpu/vk/GrVkTypes.h"),
675 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
676 ]
677
mtklein1211e0c2016-07-26 13:55:45 -0700678action("skia.h") {
679 script = "gn/echo_headers.py"
680 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700681 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400682 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700683 outputs = [
684 "$target_gen_dir/skia.h",
685 ]
686}
687
mtklein06c35c02016-09-20 12:28:12 -0700688if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700689 # Our bots only have 64-bit libOSMesa installed.
690 # TODO: worth fixing?
691 executable("fiddle") {
692 include_dirs = [ "$target_gen_dir" ]
693 libs = []
694 if (is_linux) {
695 libs += [ "OSMesa" ]
696 }
mtklein56d56692016-09-15 11:18:55 -0700697
mtklein1fbdf982016-09-15 12:07:48 -0700698 sources = [
699 "src/images/SkForceLinking.cpp",
700 "tools/fiddle/draw.cpp",
701 "tools/fiddle/fiddle_main.cpp",
702 ]
703 deps = [
704 ":skia",
705 ":skia.h",
706 ]
707 }
mtkleinc04ff472016-06-23 10:29:30 -0700708}
mtklein25c81d42016-07-27 13:55:26 -0700709
mtkleinc095df52016-08-24 12:23:52 -0700710# Targets guarded by skia_enable_tools may use //third_party freely.
711if (skia_enable_tools) {
712 template("test_lib") {
713 config(target_name + "_config") {
714 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700715 if (defined(invoker.public_defines)) {
716 defines = invoker.public_defines
717 }
mtklein25c81d42016-07-27 13:55:26 -0700718 }
mtkleinc095df52016-08-24 12:23:52 -0700719 source_set(target_name) {
720 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
721 public_configs = [
722 ":" + target_name + "_config",
723 ":skia_private",
724 ]
725
726 if (!defined(deps)) {
727 deps = []
728 }
729 deps += [ ":skia" ]
730 testonly = true
731 }
mtklein25c81d42016-07-27 13:55:26 -0700732 }
mtklein25c81d42016-07-27 13:55:26 -0700733
mtkleinc095df52016-08-24 12:23:52 -0700734 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700735 public_include_dirs = []
736 if (skia_enable_gpu) {
737 public_defines = []
738 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700739
740 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700741 sources = [
742 "tools/gpu/GrContextFactory.cpp",
743 "tools/gpu/GrTest.cpp",
744 "tools/gpu/TestContext.cpp",
745 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700746 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700747 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
748 "tools/gpu/gl/debug/GrBufferObj.cpp",
749 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
750 "tools/gpu/gl/debug/GrProgramObj.cpp",
751 "tools/gpu/gl/debug/GrShaderObj.cpp",
752 "tools/gpu/gl/debug/GrTextureObj.cpp",
753 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
754 "tools/gpu/gl/null/NullGLTestContext.cpp",
755 ]
756 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700757
mtklein38925aa2016-09-21 10:11:25 -0700758 if (is_android) {
759 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
760 } else if (is_linux) {
761 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
762 } else if (is_mac) {
763 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400764 } else if (is_win) {
765 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
766 libs += [
767 "Gdi32.lib",
768 "OpenGL32.lib",
769 ]
mtklein38925aa2016-09-21 10:11:25 -0700770 }
mtklein6ef69992016-09-14 06:12:09 -0700771
mtkleind68f9b02016-09-23 13:18:41 -0700772 if (skia_use_angle) {
773 public_defines += [ "SK_ANGLE" ]
774 deps += [ "//third_party/angle2" ]
775 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700776 }
777 if (skia_use_mesa) {
778 public_defines += [ "SK_MESA" ]
779 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
780 libs += [ "OSMesa" ]
781 }
mtkleind68f9b02016-09-23 13:18:41 -0700782 if (skia_use_vulkan) {
783 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
784 }
mtkleina627b5c2016-09-20 13:36:47 -0700785 }
mtklein25c81d42016-07-27 13:55:26 -0700786 }
mtklein25c81d42016-07-27 13:55:26 -0700787
mtkleinc095df52016-08-24 12:23:52 -0700788 test_lib("flags") {
789 public_include_dirs = [ "tools/flags" ]
790 sources = [
791 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700792 ]
793 }
794 test_lib("common_flags") {
795 public_include_dirs = [ "tools/flags" ]
796 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700797 "tools/flags/SkCommonFlags.cpp",
798 "tools/flags/SkCommonFlagsConfig.cpp",
799 ]
800 deps = [
mtklein046cb562016-09-16 10:23:12 -0700801 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700802 ":gpu_tool_utils",
803 ]
804 }
mtklein25c81d42016-07-27 13:55:26 -0700805
mtkleinc095df52016-08-24 12:23:52 -0700806 test_lib("tool_utils") {
807 public_include_dirs = [
808 "tools",
809 "tools/debugger",
810 "tools/timer",
811 ]
812 sources = [
813 "src/images/SkForceLinking.cpp",
814 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700815 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700816 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700817 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700818 "tools/ProcStats.cpp",
819 "tools/Resources.cpp",
820 "tools/ThermalManager.cpp",
821 "tools/UrlDataManager.cpp",
822 "tools/debugger/SkDebugCanvas.cpp",
823 "tools/debugger/SkDrawCommand.cpp",
824 "tools/debugger/SkJsonWriteBuffer.cpp",
825 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700826 "tools/picture_utils.cpp",
827 "tools/random_parse_path.cpp",
828 "tools/sk_tool_utils.cpp",
829 "tools/sk_tool_utils_font.cpp",
830 "tools/timer/Timer.cpp",
831 ]
832 deps = [
mtklein046cb562016-09-16 10:23:12 -0700833 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700834 ":flags",
835 "//third_party/libpng",
836 ]
837 public_deps = [
838 "//third_party/jsoncpp",
839 ]
840 }
mtklein25c81d42016-07-27 13:55:26 -0700841
Mike Klein6e744122016-10-27 12:21:40 -0400842 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700843 test_lib("gm") {
844 public_include_dirs = [ "gm" ]
845 sources = gm_sources
846 deps = [
scroggo19b91532016-10-24 09:03:26 -0700847 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700848 ":gpu_tool_utils",
849 ":skia",
850 ":tool_utils",
851 ]
852 }
mtklein25c81d42016-07-27 13:55:26 -0700853
Mike Klein6e744122016-10-27 12:21:40 -0400854 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700855 test_lib("tests") {
856 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400857 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700858 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400859 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700860 }
mtkleinc095df52016-08-24 12:23:52 -0700861 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700862 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700863 ":flags",
864 ":gpu_tool_utils",
865 ":skia",
866 ":tool_utils",
867 "//third_party/libpng",
868 "//third_party/zlib",
869 ]
870 }
mtklein2f3416d2016-08-02 16:02:05 -0700871
Mike Klein6e744122016-10-27 12:21:40 -0400872 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700873 test_lib("bench") {
874 public_include_dirs = [ "bench" ]
875 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700876 deps = [
877 ":flags",
878 ":gm",
879 ":gpu_tool_utils",
880 ":skia",
881 ":tool_utils",
882 ]
883 }
mtklein2b6870c2016-07-28 14:17:33 -0700884
mtkleinc095df52016-08-24 12:23:52 -0700885 test_lib("experimental_svg_model") {
886 public_include_dirs = [ "experimental/svg/model" ]
887 sources = [
888 "experimental/svg/model/SkSVGAttribute.cpp",
889 "experimental/svg/model/SkSVGAttributeParser.cpp",
890 "experimental/svg/model/SkSVGCircle.cpp",
891 "experimental/svg/model/SkSVGContainer.cpp",
892 "experimental/svg/model/SkSVGDOM.cpp",
893 "experimental/svg/model/SkSVGEllipse.cpp",
894 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700895 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700896 "experimental/svg/model/SkSVGNode.cpp",
897 "experimental/svg/model/SkSVGPath.cpp",
898 "experimental/svg/model/SkSVGPoly.cpp",
899 "experimental/svg/model/SkSVGRect.cpp",
900 "experimental/svg/model/SkSVGRenderContext.cpp",
901 "experimental/svg/model/SkSVGSVG.cpp",
902 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700903 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700904 "experimental/svg/model/SkSVGTransformableNode.cpp",
905 "experimental/svg/model/SkSVGValue.cpp",
906 ]
907 deps = [
908 ":skia",
909 ]
910 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700911
Brian Osman16adfa32016-10-18 14:42:44 -0400912 test_lib("views") {
913 public_include_dirs = [ "include/views" ]
914 sources = [
915 "src/views/SkEvent.cpp",
916 "src/views/SkEventSink.cpp",
917 "src/views/SkOSMenu.cpp",
918 "src/views/SkTagList.cpp",
919 "src/views/SkTouchGesture.cpp",
920 "src/views/SkView.cpp",
921 "src/views/SkViewPriv.cpp",
922 ]
923 libs = []
924 if (!is_android) {
925 sources += [ "src/views/SkWindow.cpp" ]
926 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400927 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400928 public_include_dirs += [ "src/views/unix" ]
929 sources += [
930 "src/views/unix/SkOSWindow_Unix.cpp",
931 "src/views/unix/keysym2ucs.c",
932 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400933 } else if (is_mac) {
934 sources += [
935 "src/views/mac/SkEventNotifier.mm",
936 "src/views/mac/SkNSView.mm",
937 "src/views/mac/SkOSWindow_Mac.mm",
938 "src/views/mac/SkTextFieldCell.m",
939 ]
940 libs += [
941 "QuartzCore.framework",
942 "Cocoa.framework",
943 "Foundation.framework",
944 ]
945 } else if (is_win) {
946 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
947 }
948 }
949
Mike Klein6e744122016-10-27 12:21:40 -0400950 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -0400951 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -0400952 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -0400953 include_dirs = [ "experimental" ]
954 sources = samples_sources + [
955 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
956 "experimental/SkSetPoly3To3.cpp",
957 "experimental/SkSetPoly3To3_A.cpp",
958 "experimental/SkSetPoly3To3_D.cpp",
959 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400960 deps = [
961 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -0400962 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -0400963 ":tool_utils",
964 ":views",
965 ":xml",
966 ]
967 }
968
mtklein2b6870c2016-07-28 14:17:33 -0700969 executable("dm") {
970 sources = [
971 "dm/DM.cpp",
972 "dm/DMJsonWriter.cpp",
973 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700974 ]
975 include_dirs = [ "tests" ]
976 deps = [
mtklein046cb562016-09-16 10:23:12 -0700977 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700978 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700979 ":flags",
980 ":gm",
981 ":gpu_tool_utils",
982 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700983 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700984 ":tool_utils",
985 "//third_party/jsoncpp",
986 "//third_party/libpng",
987 ]
988 testonly = true
989 }
990
Mike Kleina3430172016-09-27 16:46:29 -0400991 if (!is_debug) { # I've benchmarked debug code once too many times...
992 executable("monobench") {
993 sources = [
994 "tools/monobench.cpp",
995 ]
996 deps = [
997 ":bench",
998 ":skia",
999 ]
1000 testonly = true
1001 }
mtklein2b6870c2016-07-28 14:17:33 -07001002 }
1003
1004 executable("nanobench") {
1005 sources = [
1006 "bench/nanobench.cpp",
1007 ]
1008 deps = [
1009 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001010 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001011 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001012 ":flags",
1013 ":gm",
1014 ":gpu_tool_utils",
1015 ":skia",
1016 ":tool_utils",
1017 "//third_party/jsoncpp",
1018 ]
1019 testonly = true
1020 }
halcanary19a97202016-08-03 15:08:04 -07001021
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001022 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001023 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001024 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001025 "samplecode/SampleApp.cpp",
1026 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001027 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001028 if (is_mac) {
1029 sources += [ "src/views/mac/skia_mac.mm" ]
1030 } else if (is_win) {
1031 sources += [ "src/views/win/skia_win.cpp" ]
1032 } else if (is_linux) {
1033 sources += [ "src/views/unix/skia_unix.cpp" ]
1034 }
mtklein38925aa2016-09-21 10:11:25 -07001035 deps = [
1036 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001037 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001038 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001039 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001040 ":skia",
1041 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001042 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001043 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001044 if (skia_use_angle) {
1045 deps += [ "//third_party/angle2" ]
1046 }
mtklein38925aa2016-09-21 10:11:25 -07001047 testonly = true
1048 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001049 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001050
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001051 if (skia_enable_gpu) {
1052 executable("skpbench") {
1053 sources = [
1054 "tools/skpbench/skpbench.cpp",
1055 ]
1056 deps = [
1057 ":flags",
1058 ":gpu_tool_utils",
1059 ":skia",
1060 ":tool_utils",
1061 ]
1062 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001063 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001064 }
1065
Mike Klein4b167fc2016-10-11 18:13:53 -04001066 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001067 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001068 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001069 sources = [
1070 "tools/SkShaper_harfbuzz.cpp",
1071 "tools/using_skia_and_harfbuzz.cpp",
1072 ]
1073 deps = [
1074 ":skia",
1075 "//third_party/harfbuzz",
1076 ]
1077 testonly = true
1078 }
halcanary19a97202016-08-03 15:08:04 -07001079 }
halcanary3eee9d92016-09-10 07:01:53 -07001080 executable("sktexttopdf") {
1081 sources = [
1082 "tools/SkShaper_primitive.cpp",
1083 "tools/using_skia_and_harfbuzz.cpp",
1084 ]
1085 deps = [
1086 ":skia",
1087 ]
1088 testonly = true
1089 }
mtklein046cb562016-09-16 10:23:12 -07001090
1091 executable("get_images_from_skps") {
1092 sources = [
1093 "tools/get_images_from_skps.cpp",
1094 ]
1095 deps = [
1096 ":flags",
1097 ":skia",
1098 "//third_party/jsoncpp",
1099 ]
1100 testonly = true
1101 }
mtkleinecbc5262016-09-22 11:51:24 -07001102
1103 executable("skiaserve") {
1104 sources = [
1105 "tools/skiaserve/Request.cpp",
1106 "tools/skiaserve/Response.cpp",
1107 "tools/skiaserve/skiaserve.cpp",
1108 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1109 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1110 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1111 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1112 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1113 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1114 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1115 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1116 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1117 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1118 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001119 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001120 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1121 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1122 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1123 ]
1124 deps = [
1125 ":flags",
1126 ":gpu_tool_utils",
1127 ":skia",
1128 ":tool_utils",
1129 "//third_party/jsoncpp",
1130 "//third_party/libmicrohttpd",
1131 "//third_party/libpng",
1132 ]
1133 testonly = true
1134 }
kjlubick14f984b2016-10-03 11:49:45 -07001135
1136 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001137 if (is_skia_standalone) {
1138 configs -= [ "//gn:no_exceptions" ]
1139 }
kjlubick14f984b2016-10-03 11:49:45 -07001140 sources = [
1141 "fuzz/FilterFuzz.cpp",
1142 "fuzz/FuzzGradients.cpp",
1143 "fuzz/FuzzParsePath.cpp",
1144 "fuzz/FuzzPathop.cpp",
1145 "fuzz/FuzzScaleToSides.cpp",
1146 "fuzz/fuzz.cpp",
1147 ]
1148 deps = [
1149 ":flags",
1150 ":skia",
1151 ]
1152 testonly = true
1153 }
Mike Klein38312422016-10-05 15:41:01 -04001154
caryclark9feb6322016-10-25 08:58:26 -07001155 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001156 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001157 rebase_path("tests/skia_test.cpp"),
1158 rebase_path("tests/Test.cpp"),
1159 ]
caryclark9feb6322016-10-25 08:58:26 -07001160 deps = [
1161 ":flags",
1162 ":gpu_tool_utils",
1163 ":skia",
1164 ":tool_utils",
1165 ]
1166 testonly = true
1167 }
1168
Mike Klein38312422016-10-05 15:41:01 -04001169 executable("dump_record") {
1170 sources = [
1171 "tools/DumpRecord.cpp",
1172 "tools/dump_record.cpp",
1173 ]
1174 deps = [
1175 ":flags",
1176 ":skia",
1177 ]
1178 testonly = true
1179 }
bungemanfe917272016-10-13 17:36:40 -04001180
1181 executable("skdiff") {
1182 sources = [
1183 "tools/skdiff/skdiff.cpp",
1184 "tools/skdiff/skdiff_html.cpp",
1185 "tools/skdiff/skdiff_main.cpp",
1186 "tools/skdiff/skdiff_utils.cpp",
1187 ]
1188 deps = [
1189 ":skia",
1190 ":tool_utils",
1191 ]
1192 testonly = true
1193 }
halcanarya73d76a2016-10-17 13:19:02 -07001194
1195 executable("skp_parser") {
1196 sources = [
1197 "tools/skp_parser.cpp",
1198 ]
1199 deps = [
1200 ":skia",
1201 ":tool_utils",
1202 "//third_party/jsoncpp",
1203 ]
1204 testonly = true
1205 }
Brian Osman16adfa32016-10-18 14:42:44 -04001206
Mike Klein43c25262016-10-20 10:17:47 -04001207 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001208 executable("viewer") {
1209 sources = [
1210 "tools/viewer/GMSlide.cpp",
1211 "tools/viewer/ImageSlide.cpp",
1212 "tools/viewer/SKPSlide.cpp",
1213 "tools/viewer/SampleSlide.cpp",
1214 "tools/viewer/Viewer.cpp",
1215 "tools/viewer/sk_app/CommandSet.cpp",
1216 "tools/viewer/sk_app/GLWindowContext.cpp",
1217 "tools/viewer/sk_app/Window.cpp",
1218 "tools/viewer/sk_app/WindowContext.cpp",
1219 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001220 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001221
Jim Van Verth4e56a912016-10-21 10:58:52 -04001222 if (is_android) {
1223 sources += [
1224 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1225 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1226 "tools/viewer/sk_app/android/Window_android.cpp",
1227 "tools/viewer/sk_app/android/main_android.cpp",
1228 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1229 ]
1230 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001231 sources += [
1232 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1233 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1234 "tools/viewer/sk_app/unix/Window_unix.cpp",
1235 "tools/viewer/sk_app/unix/main_unix.cpp",
1236 ]
1237 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001238 sources += [
1239 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1240 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1241 "tools/viewer/sk_app/win/Window_win.cpp",
1242 "tools/viewer/sk_app/win/main_win.cpp",
1243 ]
Mike Klein43c25262016-10-20 10:17:47 -04001244 } else if (is_mac) {
1245 sources += [
1246 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1247 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1248 "tools/viewer/sk_app/mac/Window_mac.cpp",
1249 "tools/viewer/sk_app/mac/main_mac.cpp",
1250 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001251 }
1252
1253 if (skia_use_vulkan) {
1254 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001255 if (is_android) {
1256 sources +=
1257 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1258 libs += [ "android" ]
1259 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001260 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1261 libs += [ "X11-xcb" ]
1262 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001263 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1264 }
1265 }
1266
1267 include_dirs = []
1268 deps = [
1269 ":flags",
1270 ":gm",
1271 ":gpu_tool_utils",
1272 ":samples",
1273 ":skia",
1274 ":tool_utils",
1275 ":views",
1276 "//third_party/jsoncpp",
1277 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001278 if (is_android) {
1279 deps += [ "//third_party/native_app_glue" ]
1280 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001281 deps += [ "//third_party/libsdl" ]
1282 }
Brian Osman16adfa32016-10-18 14:42:44 -04001283 testonly = true
1284 }
1285 }
mtklein25c81d42016-07-27 13:55:26 -07001286}