blob: f5d1dd6b54f6e31f18aa2dbb3b5600c819b99de7 [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
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040024 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040025 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070026 skia_use_libjpeg_turbo = true
27 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070028 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050029 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070030 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040031 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070032 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040033 skia_use_metal = false
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070036 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050037 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050038 skia_enable_effects = true
mtklein06c35c02016-09-20 12:28:12 -070039 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050040 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040041 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050042 skia_enable_tools = is_skia_dev_build
43 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040044 skia_vulkan_sdk = getenv("VULKAN_SDK")
Ethan Nicholas762466e2017-06-29 10:03:38 -040045 skia_compile_processors = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040046
47 skia_jumper_clang = ""
48 skia_jumper_objdump = ""
49 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070050}
Brian Salomon23d73ea2016-10-27 13:31:37 -040051declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040052 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040053 skia_use_sfntly = skia_use_icu
54
Mike Klein4d598a32016-10-31 13:44:49 -040055 if (is_android) {
56 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070057 } else if (is_fuchsia) {
58 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040059 } else {
60 skia_use_vulkan = skia_vulkan_sdk != ""
61 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040062}
Greg Danielec6ae522017-04-25 13:38:26 -040063declare_args() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000064 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040065 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000066 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040067 if (is_fuchsia) {
68 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
69 } else if (is_linux || is_win) {
70 skia_vulkan_headers = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040071 }
Greg Danielec6ae522017-04-25 13:38:26 -040072 }
73}
Brian Salomon789e25e2016-09-30 13:41:03 -040074
mtklein38925aa2016-09-21 10:11:25 -070075# Our tools require static linking (they use non-exported symbols).
76skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070077
mtkleina45be612016-08-29 15:22:10 -070078fontmgr_android_enabled = skia_use_expat && skia_use_freetype
79
mtklein1211e0c2016-07-26 13:55:45 -070080skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070081 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070082 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070083 "include/codec",
84 "include/config",
85 "include/core",
86 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040087 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070088 "include/gpu",
89 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070090 "include/pathops",
91 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070092 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070093 "include/utils",
94 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070095]
96
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000097if (skia_use_vulkan) {
98 skia_public_includes += [ "include/gpu/vk" ]
99}
Greg Daniele5ddff52017-07-05 16:49:36 -0400100if (skia_use_metal) {
101 skia_public_includes += [ "include/gpu/mtl" ]
102}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000103
mtkleinc04ff472016-06-23 10:29:30 -0700104# Skia public API, generally provided by :skia.
105config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700106 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -0400107 if (skia_vulkan_headers != "") {
108 include_dirs += [ skia_vulkan_headers ]
109 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400110 defines = []
111 if (is_component_build) {
112 defines += [ "SKIA_DLL" ]
113 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400114 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700115 defines += [ "SK_SAMPLES_FOR_X" ]
116 }
mtkleincae1be52016-09-20 08:24:34 -0700117 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -0400118 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -0700119 }
mtklein06c35c02016-09-20 12:28:12 -0700120 if (!skia_enable_gpu) {
121 defines += [ "SK_SUPPORT_GPU=0" ]
122 }
mtkleinc04ff472016-06-23 10:29:30 -0700123}
124
125# Skia internal APIs, used by Skia itself and a few test tools.
126config("skia_private") {
127 visibility = [ ":*" ]
128
129 include_dirs = [
130 "include/private",
131 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700132 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700133 "src/core",
134 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700135 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700136 "src/image",
137 "src/images",
138 "src/lazy",
139 "src/opts",
140 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700141 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700142 "src/ports",
143 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400144 "src/shaders",
145 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700146 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700148 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500149 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700150 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700151 ]
mtklein150d1132016-08-01 06:56:40 -0700152
Mike Reeda9e241d2017-05-03 10:52:00 -0400153 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700154 if (is_android) {
155 defines += [
156 "SK_GAMMA_EXPONENT=1.4",
157 "SK_GAMMA_CONTRAST=0.0",
158 ]
159 }
mtklein88a7ac02016-09-14 11:16:49 -0700160 if (is_official_build || is_android) {
161 # TODO(bsalomon): it'd be nice to make Android normal.
162 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
163 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400164 libs = []
165 lib_dirs = []
166 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700167 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400168 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400169 lib_dirs += [
170 "$skia_vulkan_sdk/Bin",
171 "$skia_vulkan_sdk/Lib",
172 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400173 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400174 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400175 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400176 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400177 }
Brian Salomon03e05842017-02-23 12:23:47 -0500178 if (skia_enable_gpu) {
179 include_dirs += [ "src/gpu" ]
180 }
Brian Osman34755e22016-12-05 09:46:02 -0500181 if (skia_use_angle) {
182 defines += [ "SK_ANGLE" ]
183 }
Brian Osman3f375d02016-12-28 11:19:22 -0500184 if (skia_enable_discrete_gpu) {
185 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
186 }
mtkleinc04ff472016-06-23 10:29:30 -0700187}
188
189# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
190config("skia_library") {
191 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700192 defines = [ "SKIA_IMPLEMENTATION=1" ]
193}
194
195skia_library_configs = [
196 ":skia_public",
197 ":skia_private",
198 ":skia_library",
199]
200
mtklein9b8583d2016-08-24 17:32:30 -0700201# Use for CPU-specific Skia code that needs particular compiler flags.
202template("opts") {
203 if (invoker.enabled) {
204 source_set(target_name) {
205 forward_variables_from(invoker, "*")
206 configs += skia_library_configs
207 }
208 } else {
209 # If not enabled, a phony empty target that swallows all otherwise unused variables.
210 source_set(target_name) {
211 forward_variables_from(invoker,
212 "*",
213 [
214 "sources",
215 "cflags",
216 ])
217 }
218 }
anmittala7eaf2e2016-08-17 13:57:26 -0700219}
220
mtklein422310d2016-08-16 18:28:43 -0700221is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700222
mtklein7d6fb2c2016-08-25 14:50:44 -0700223opts("none") {
224 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700225 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700226 cflags = []
227}
228
mtklein7d6fb2c2016-08-25 14:50:44 -0700229opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700230 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700231 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700232 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700233}
234
235opts("arm64") {
236 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700237 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700238 cflags = []
239}
240
241opts("crc32") {
242 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700244 cflags = [ "-march=armv8-a+crc" ]
245}
246
mtklein9b8583d2016-08-24 17:32:30 -0700247opts("sse2") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400250 if (is_win) {
251 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
252 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400253 cflags = [ "-msse2" ]
254 }
mtklein9b8583d2016-08-24 17:32:30 -0700255}
mtkleinc04ff472016-06-23 10:29:30 -0700256
mtklein9b8583d2016-08-24 17:32:30 -0700257opts("ssse3") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400260 if (is_win) {
261 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
262 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400263 cflags = [ "-mssse3" ]
264 }
mtklein9b8583d2016-08-24 17:32:30 -0700265}
mtkleinc04ff472016-06-23 10:29:30 -0700266
mtklein9b8583d2016-08-24 17:32:30 -0700267opts("sse41") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400270 if (is_win) {
271 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
272 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400273 cflags = [ "-msse4.1" ]
274 }
mtklein9b8583d2016-08-24 17:32:30 -0700275}
mtklein4e976072016-08-08 09:06:27 -0700276
mtklein9b8583d2016-08-24 17:32:30 -0700277opts("sse42") {
278 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700279 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400280 if (is_win) {
281 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
282 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400283 cflags = [ "-msse4.2" ]
284 }
mtklein9b8583d2016-08-24 17:32:30 -0700285}
286
287opts("avx") {
288 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700289 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400290 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000291 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400292 } else {
293 cflags = [ "-mavx" ]
294 }
mtkleinc04ff472016-06-23 10:29:30 -0700295}
296
Mike Klein78d5a3b2016-09-30 10:48:01 -0400297opts("hsw") {
298 enabled = is_x86
299 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400300 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000301 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400302 } else {
303 cflags = [
304 "-mavx2",
305 "-mbmi",
306 "-mbmi2",
307 "-mf16c",
308 "-mfma",
309 ]
310 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400311}
312
mtkleinc095df52016-08-24 12:23:52 -0700313# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700314template("optional") {
315 if (invoker.enabled) {
316 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700317 if (defined(invoker.public_defines)) {
318 defines = invoker.public_defines
319 }
mtklein457b42a2016-08-23 13:56:37 -0700320 }
321 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700322 forward_variables_from(invoker,
323 "*",
324 [
325 "public_defines",
326 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700327 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700328 ])
mtklein457b42a2016-08-23 13:56:37 -0700329 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700330 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700331 if (defined(invoker.configs_to_remove)) {
332 configs -= invoker.configs_to_remove
333 }
mtklein457b42a2016-08-23 13:56:37 -0700334 }
335 } else {
mtklein457b42a2016-08-23 13:56:37 -0700336 source_set(target_name) {
337 forward_variables_from(invoker,
338 "*",
339 [
340 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700341 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700342 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700343 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700344 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700345 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700346 ])
mtkleincd01b032016-08-31 04:58:19 -0700347 if (defined(invoker.sources_when_disabled)) {
348 sources = invoker.sources_when_disabled
349 }
350 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700351 }
mtkleineb3c4252016-08-23 07:38:09 -0700352 }
mtklein457b42a2016-08-23 13:56:37 -0700353}
mtklein457b42a2016-08-23 13:56:37 -0700354
Mike Kleina04bb452017-02-09 12:24:07 -0500355optional("effects") {
356 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400357 deps = [
358 ":compile_processors",
359 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500360 sources =
361 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
362 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
363}
364
mtkleina45be612016-08-29 15:22:10 -0700365optional("fontmgr_android") {
366 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700367
368 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500369 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700370 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700371 ]
372 sources = [
373 "src/ports/SkFontMgr_android.cpp",
374 "src/ports/SkFontMgr_android_factory.cpp",
375 "src/ports/SkFontMgr_android_parser.cpp",
376 ]
377}
378
mtkleind2e39db2016-09-07 07:52:55 -0700379optional("fontmgr_custom") {
380 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
381
382 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500383 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700384 ]
385 sources = [
386 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500387 "src/ports/SkFontMgr_custom.h",
388 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700389 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500390 "src/ports/SkFontMgr_custom_embedded.cpp",
391 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700392 ]
393}
394
mtklein3cc22182016-08-29 13:26:14 -0700395optional("fontmgr_fontconfig") {
396 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700397
398 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500399 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700400 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700401 ]
402 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700403 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700404 "src/ports/SkFontConfigInterface_direct.cpp",
405 "src/ports/SkFontConfigInterface_direct_factory.cpp",
406 "src/ports/SkFontMgr_FontConfigInterface.cpp",
407 "src/ports/SkFontMgr_fontconfig.cpp",
408 "src/ports/SkFontMgr_fontconfig_factory.cpp",
409 ]
410}
411
mtkleincdedd0e2016-09-12 15:15:44 -0700412optional("fontmgr_fuchsia") {
413 enabled = is_fuchsia && skia_use_freetype
414
415 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500416 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700417 ]
418 sources = [
419 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500420 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700421 "src/ports/SkFontMgr_custom_empty_factory.cpp",
422 ]
423}
424
Ethan Nicholas762466e2017-06-29 10:03:38 -0400425if (skia_compile_processors) {
426 executable("skslc") {
427 defines = [ "SKSL_STANDALONE" ]
428 sources = [
429 "src/sksl/SkSLMain.cpp",
430 ]
431 sources += skia_sksl_sources
432 include_dirs = [
433 "src/gpu",
434 "src/sksl",
435 ]
436 deps = [
437 "//third_party/spirv-tools",
438 ]
439 }
440
441 skia_gpu_processor_outputs = []
442 foreach(src, skia_gpu_processor_sources) {
443 dir = get_path_info(src, "dir")
444 name = get_path_info(src, "name")
445
446 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
447 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
448 skia_gpu_processor_outputs += [
449 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
450 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
451 # confused due to the same file being named by two different paths
452 ]
453 }
454
455 action("compile_processors") {
456 script = "gn/compile_processors.py"
457 deps = [
458 ":skslc(//gn/toolchain:$host_toolchain)",
459 ]
460 sources = skia_gpu_processor_sources
461 outputs = skia_gpu_processor_outputs
462 skslc_path = "$root_out_dir/"
463 if (host_toolchain != default_toolchain_name) {
464 skslc_path += "$host_toolchain/"
465 }
466 skslc_path += "skslc"
467 if (host_os == "win") {
468 skslc_path += ".exe"
469 }
470 args = [ rebase_path(skslc_path) ]
471 args += rebase_path(skia_gpu_processor_sources)
472 }
473} else {
474 skia_gpu_processor_outputs = []
475 group("compile_processors") {
476 }
477}
478
mtklein06c35c02016-09-20 12:28:12 -0700479optional("gpu") {
480 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400481 deps = [
482 ":compile_processors",
483 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700484 public_defines = []
485
Mike Klein29b3e582017-02-09 11:57:32 -0500486 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400487 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
488 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700489
490 # These paths need to be absolute to match the ones produced by shared_sources.gni.
491 sources -= get_path_info([
492 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
493 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
494 ],
495 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400496 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700497 if (is_android) {
498 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400499
500 # this lib is required to link against AHardwareBuffer
501 if (defined(ndk_api) && ndk_api >= 26) {
502 libs += [ "android" ]
503 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400504 } else if (skia_use_egl) {
505 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
506 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700507 } else if (is_linux) {
508 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500509 libs += [
510 "GL",
511 "GLU",
512 ]
mtklein06c35c02016-09-20 12:28:12 -0700513 } else if (is_mac) {
514 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800515 } else if (is_ios) {
516 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400517 } else if (is_win) {
518 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
519 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700520 } else {
521 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
522 }
mtkleine9fb3d52016-09-20 15:11:46 -0700523
524 if (skia_use_vulkan) {
525 public_defines += [ "SK_VULKAN" ]
526 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700527 if (skia_enable_vulkan_debug_layers) {
528 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
529 }
mtkleine9fb3d52016-09-20 15:11:46 -0700530 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400531 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400532 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400533 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
534 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400535
536 if (skia_use_metal) {
537 public_defines += [ "SK_METAL" ]
538 sources += skia_metal_sources
539 libs += [ "Metal.framework" ]
540 }
mtklein06c35c02016-09-20 12:28:12 -0700541}
542
mtklein63213812016-08-24 09:55:56 -0700543optional("jpeg") {
544 enabled = skia_use_libjpeg_turbo
545 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
546
mtklein63213812016-08-24 09:55:56 -0700547 deps = [
548 "//third_party/libjpeg-turbo:libjpeg",
549 ]
550 sources = [
551 "src/codec/SkJpegCodec.cpp",
552 "src/codec/SkJpegDecoderMgr.cpp",
553 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700554 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400555 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700556 ]
557}
558
559optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500560 enabled = skia_use_zlib && skia_enable_pdf
561 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700562
mtklein63213812016-08-24 09:55:56 -0700563 deps = [
564 "//third_party/zlib",
565 ]
brettwb9447282016-09-01 14:24:39 -0700566 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700567 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700568
569 if (skia_use_sfntly) {
570 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500571 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700572 }
573}
574
575optional("png") {
576 enabled = skia_use_libpng
577 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
578
mtklein63213812016-08-24 09:55:56 -0700579 deps = [
580 "//third_party/libpng",
581 ]
582 sources = [
583 "src/codec/SkIcoCodec.cpp",
584 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400585 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700586 ]
587}
588
scroggof84ad642016-10-31 09:02:57 -0700589optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400590 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700591 public_defines = [ "SK_CODEC_DECODES_RAW" ]
592
593 deps = [
594 "//third_party/dng_sdk",
595 "//third_party/libjpeg-turbo:libjpeg",
596 "//third_party/piex",
597 ]
598
599 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
600 # Skia.
601 configs_to_remove = [ "//gn:no_exceptions" ]
602
603 sources = [
604 "src/codec/SkRawAdapterCodec.cpp",
605 "src/codec/SkRawCodec.cpp",
606 ]
607}
608
mtklein3cc22182016-08-29 13:26:14 -0700609optional("typeface_freetype") {
610 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700611
612 deps = [
613 "//third_party/freetype2",
614 ]
615 sources = [
616 "src/ports/SkFontHost_FreeType.cpp",
617 "src/ports/SkFontHost_FreeType_common.cpp",
618 ]
619}
620
mtklein457b42a2016-08-23 13:56:37 -0700621optional("webp") {
622 enabled = skia_use_libwebp
623 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
624
mtklein457b42a2016-08-23 13:56:37 -0700625 deps = [
626 "//third_party/libwebp",
627 ]
628 sources = [
629 "src/codec/SkWebpAdapterCodec.cpp",
630 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400631 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700632 ]
mtkleineb3c4252016-08-23 07:38:09 -0700633}
634
mtklein63213812016-08-24 09:55:56 -0700635optional("xml") {
636 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000637 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700638
mtklein63213812016-08-24 09:55:56 -0700639 deps = [
640 "//third_party/expat",
641 ]
642 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500643 "src/svg/SkSVGCanvas.cpp",
644 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700645 "src/xml/SkDOM.cpp",
646 "src/xml/SkXMLParser.cpp",
647 "src/xml/SkXMLWriter.cpp",
648 ]
649}
650
mtkleinc04ff472016-06-23 10:29:30 -0700651component("skia") {
652 public_configs = [ ":skia_public" ]
653 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700654
655 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700656 ":arm64",
657 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700658 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700659 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500660 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700661 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700662 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700663 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700664 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700665 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400666 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700667 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700668 ":none",
mtklein63213812016-08-24 09:55:56 -0700669 ":pdf",
670 ":png",
scroggof84ad642016-10-31 09:02:57 -0700671 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700672 ":sse2",
673 ":sse41",
674 ":sse42",
675 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700676 ":webp",
mtklein63213812016-08-24 09:55:56 -0700677 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700678 ]
679
Chinmay Garde43f115c2016-11-16 15:04:12 -0800680 # This file (and all GN files in Skia) are designed to work with an
681 # empty sources assignment filter; we handle all that explicitly.
682 # We clear the filter here for clients who may have set up a global filter.
683 set_sources_assignment_filter([])
684
mtkleinc04ff472016-06-23 10:29:30 -0700685 sources = []
brettwb9447282016-09-01 14:24:39 -0700686 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700687 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500688 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700689 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700690 "src/android/SkBitmapRegionCodec.cpp",
691 "src/android/SkBitmapRegionDecoder.cpp",
692 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400693 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700694 "src/codec/SkBmpCodec.cpp",
695 "src/codec/SkBmpMaskCodec.cpp",
696 "src/codec/SkBmpRLECodec.cpp",
697 "src/codec/SkBmpStandardCodec.cpp",
698 "src/codec/SkCodec.cpp",
699 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700700 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700701 "src/codec/SkMaskSwizzler.cpp",
702 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700703 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700704 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700705 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700706 "src/codec/SkSwizzler.cpp",
707 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700708 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700709 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700710 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700711 "src/ports/SkMemory_malloc.cpp",
712 "src/ports/SkOSFile_stdio.cpp",
713 "src/sfnt/SkOTTable_name.cpp",
714 "src/sfnt/SkOTUtils.cpp",
715 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700716 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700717 ]
brettwb9447282016-09-01 14:24:39 -0700718
mtklein7d6fb2c2016-08-25 14:50:44 -0700719 libs = []
720
mtkleinc04ff472016-06-23 10:29:30 -0700721 if (is_win) {
722 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400723 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700724 "src/ports/SkDebug_win.cpp",
725 "src/ports/SkFontHost_win.cpp",
726 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700727 "src/ports/SkImageEncoder_WIC.cpp",
728 "src/ports/SkImageGeneratorWIC.cpp",
729 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700730 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700731 "src/ports/SkScalerContext_win_dw.cpp",
732 "src/ports/SkTLS_win.cpp",
733 "src/ports/SkTypeface_win_dw.cpp",
734 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400735 if (skia_use_gdi) {
736 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
737 libs += [
738 "Gdi32.lib",
739 "Usp10.lib",
740 ]
741 } else {
742 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
743 }
mtkleinb9be9792016-09-16 14:44:18 -0700744 sources -=
745 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400746 libs += [
747 "FontSub.lib",
748 "Ole32.lib",
749 "OleAut32.lib",
750 "User32.lib",
751 ]
mtkleinc04ff472016-06-23 10:29:30 -0700752 } else {
753 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700754 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700755 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700756 "src/ports/SkTLS_pthread.cpp",
757 ]
758 }
759
mtklein7d6fb2c2016-08-25 14:50:44 -0700760 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500761 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500762 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500763 deps += [ "//third_party/cpu-features" ]
764 }
mtklein06c35c02016-09-20 12:28:12 -0700765 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700766 libs += [
767 "EGL",
768 "GLESv2",
769 "log",
770 ]
771 }
772
mtkleinc04ff472016-06-23 10:29:30 -0700773 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700774 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700775 }
776
777 if (is_mac) {
778 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700779 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700780 "src/ports/SkFontHost_mac.cpp",
781 "src/ports/SkImageEncoder_CG.cpp",
782 "src/ports/SkImageGeneratorCG.cpp",
783 ]
mtklein09e61f72016-08-23 13:35:28 -0700784 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400785 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
786 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700787 "ApplicationServices.framework",
788 "OpenGL.framework",
789 ]
mtkleinc04ff472016-06-23 10:29:30 -0700790 }
abarth6fc8ff02016-07-15 15:15:15 -0700791
Mike Klein7d302882016-11-03 14:06:31 -0400792 if (is_ios) {
793 sources += [
794 "src/ports/SkDebug_stdio.cpp",
795 "src/ports/SkFontHost_mac.cpp",
796 "src/ports/SkImageEncoder_CG.cpp",
797 "src/ports/SkImageGeneratorCG.cpp",
798 ]
799 libs += [
800 "CoreFoundation.framework",
801 "CoreGraphics.framework",
802 "CoreText.framework",
803 "ImageIO.framework",
804 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400805
806 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
807 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400808 ]
809 }
810
abarth6fc8ff02016-07-15 15:15:15 -0700811 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700812 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700813 }
mtkleinc04ff472016-06-23 10:29:30 -0700814}
815
mtkleinc095df52016-08-24 12:23:52 -0700816# Targets guarded by skia_enable_tools may use //third_party freely.
817if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500818 # Used by gn_to_bp.py to list our public include dirs.
819 source_set("public") {
820 configs += [ ":skia_public" ]
821 }
822
Mike Kleinc36dedf2016-11-18 09:35:28 -0500823 config("skia.h_config") {
824 include_dirs = [ "$target_gen_dir" ]
825 }
826 action("skia.h") {
827 public_configs = [ ":skia.h_config" ]
828 skia_h = "$target_gen_dir/skia.h"
829 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400830 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000831 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500832 depfile = "$skia_h.deps"
833 outputs = [
834 skia_h,
835 ]
836 }
837
838 if (skia_enable_gpu && target_cpu == "x64") {
839 # Our bots only have 64-bit libOSMesa installed.
840 # TODO: worth fixing?
841 executable("fiddle") {
842 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500843 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500844 "tools/fiddle/draw.cpp",
845 "tools/fiddle/fiddle_main.cpp",
846 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400847
848 if (skia_use_egl) {
849 sources += [ "tools/fiddle/egl_context.cpp" ]
850 } else if (skia_use_mesa) {
851 sources += [ "tools/fiddle/mesa_context.cpp" ]
852 if (is_linux) {
853 libs += [ "OSMesa" ]
854 }
855 } else {
856 sources += [ "tools/fiddle/null_context.cpp" ]
857 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400858 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500859 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400860 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500861 ":skia",
862 ":skia.h",
863 ]
864 }
865 }
866
867 if (skia_enable_gpu) {
868 source_set("public_headers_warnings_check") {
869 sources = [
870 "tools/public_headers_warnings_check.cpp",
871 ]
872 configs -= [ "//gn:warnings_except_public_headers" ]
873 deps = [
874 ":skia",
875 ":skia.h",
876 ]
877 }
878 }
879
mtkleinc095df52016-08-24 12:23:52 -0700880 template("test_lib") {
881 config(target_name + "_config") {
882 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700883 if (defined(invoker.public_defines)) {
884 defines = invoker.public_defines
885 }
mtklein25c81d42016-07-27 13:55:26 -0700886 }
mtkleinc095df52016-08-24 12:23:52 -0700887 source_set(target_name) {
888 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
889 public_configs = [
890 ":" + target_name + "_config",
891 ":skia_private",
892 ]
893
894 if (!defined(deps)) {
895 deps = []
896 }
897 deps += [ ":skia" ]
898 testonly = true
899 }
mtklein25c81d42016-07-27 13:55:26 -0700900 }
mtklein25c81d42016-07-27 13:55:26 -0700901
Mike Kleine6682eb2017-01-05 10:54:57 -0500902 template("test_app") {
903 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
904 shared_library("lib" + target_name) {
905 forward_variables_from(invoker, "*", [ "is_shared_library" ])
906 testonly = true
907 }
908 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500909 _executable = target_name
910 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500911 forward_variables_from(invoker, "*", [ "is_shared_library" ])
912 testonly = true
913 }
914 }
Mike Klein7d921032017-01-05 12:20:41 -0500915 if (is_android && skia_android_serial != "" && defined(_executable)) {
916 action("push_" + target_name) {
917 script = "gn/push_to_android.py"
918 deps = [
919 ":" + _executable,
920 ]
921 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
922 outputs = [
923 _stamp,
924 ]
925 args = [
926 rebase_path("$root_build_dir/$_executable"),
927 skia_android_serial,
928 rebase_path(_stamp),
929 ]
930 testonly = true
931 }
932 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500933 }
934
mtkleinc095df52016-08-24 12:23:52 -0700935 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700936 public_include_dirs = []
937 if (skia_enable_gpu) {
938 public_defines = []
939 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700940
941 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700942 sources = [
943 "tools/gpu/GrContextFactory.cpp",
944 "tools/gpu/GrTest.cpp",
945 "tools/gpu/TestContext.cpp",
946 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700947 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700948 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
949 "tools/gpu/gl/debug/GrBufferObj.cpp",
950 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
951 "tools/gpu/gl/debug/GrProgramObj.cpp",
952 "tools/gpu/gl/debug/GrShaderObj.cpp",
953 "tools/gpu/gl/debug/GrTextureObj.cpp",
954 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
955 "tools/gpu/gl/null/NullGLTestContext.cpp",
956 ]
957 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700958
Kevin Lubick4a24e102017-03-29 11:19:01 -0400959 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700960 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400961 } else if (is_ios) {
962 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
963 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700964 } else if (is_linux) {
965 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500966 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700967 } else if (is_mac) {
968 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400969 } else if (is_win) {
970 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
971 libs += [
972 "Gdi32.lib",
973 "OpenGL32.lib",
974 ]
mtklein38925aa2016-09-21 10:11:25 -0700975 }
mtklein6ef69992016-09-14 06:12:09 -0700976
Mike Kleinc168a3a2016-11-14 14:53:13 +0000977 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000978 deps += [ "//third_party/angle2" ]
979 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
980 }
mtklein38925aa2016-09-21 10:11:25 -0700981 if (skia_use_mesa) {
982 public_defines += [ "SK_MESA" ]
983 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
984 libs += [ "OSMesa" ]
985 }
mtkleind68f9b02016-09-23 13:18:41 -0700986 if (skia_use_vulkan) {
987 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400988 if (is_win) {
989 libs += [ "vulkan-1.lib" ]
990 } else {
991 libs += [ "vulkan" ]
992 }
mtkleind68f9b02016-09-23 13:18:41 -0700993 }
mtkleina627b5c2016-09-20 13:36:47 -0700994 }
mtklein25c81d42016-07-27 13:55:26 -0700995 }
mtklein25c81d42016-07-27 13:55:26 -0700996
mtkleinc095df52016-08-24 12:23:52 -0700997 test_lib("flags") {
998 public_include_dirs = [ "tools/flags" ]
999 sources = [
1000 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001001 ]
1002 }
1003 test_lib("common_flags") {
1004 public_include_dirs = [ "tools/flags" ]
1005 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001006 "tools/flags/SkCommonFlags.cpp",
1007 "tools/flags/SkCommonFlagsConfig.cpp",
1008 ]
1009 deps = [
mtklein046cb562016-09-16 10:23:12 -07001010 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001011 ":gpu_tool_utils",
1012 ]
1013 }
mtklein25c81d42016-07-27 13:55:26 -07001014
mtkleinc095df52016-08-24 12:23:52 -07001015 test_lib("tool_utils") {
1016 public_include_dirs = [
1017 "tools",
1018 "tools/debugger",
1019 "tools/timer",
1020 ]
1021 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001022 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001023 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001024 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001025 "tools/ProcStats.cpp",
1026 "tools/Resources.cpp",
1027 "tools/ThermalManager.cpp",
1028 "tools/UrlDataManager.cpp",
1029 "tools/debugger/SkDebugCanvas.cpp",
1030 "tools/debugger/SkDrawCommand.cpp",
1031 "tools/debugger/SkJsonWriteBuffer.cpp",
1032 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001033 "tools/picture_utils.cpp",
1034 "tools/random_parse_path.cpp",
1035 "tools/sk_tool_utils.cpp",
1036 "tools/sk_tool_utils_font.cpp",
1037 "tools/timer/Timer.cpp",
1038 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001039 libs = []
1040 if (is_ios) {
1041 sources += [ "tools/ios_utils.m" ]
1042 libs += [ "Foundation.framework" ]
1043 }
mtkleinc095df52016-08-24 12:23:52 -07001044 deps = [
mtklein046cb562016-09-16 10:23:12 -07001045 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001046 ":flags",
1047 "//third_party/libpng",
1048 ]
1049 public_deps = [
1050 "//third_party/jsoncpp",
1051 ]
1052 }
mtklein25c81d42016-07-27 13:55:26 -07001053
Mike Klein6e744122016-10-27 12:21:40 -04001054 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001055 test_lib("gm") {
1056 public_include_dirs = [ "gm" ]
1057 sources = gm_sources
1058 deps = [
scroggo19b91532016-10-24 09:03:26 -07001059 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001060 ":gpu_tool_utils",
1061 ":skia",
1062 ":tool_utils",
1063 ]
1064 }
mtklein25c81d42016-07-27 13:55:26 -07001065
Mike Klein6e744122016-10-27 12:21:40 -04001066 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001067 test_lib("tests") {
1068 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001069 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001070 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001071 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001072 }
mtkleinc095df52016-08-24 12:23:52 -07001073 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001074 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001075 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001076 ":skia",
1077 ":tool_utils",
1078 "//third_party/libpng",
1079 "//third_party/zlib",
1080 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001081 public_deps = [
1082 ":gpu_tool_utils", # Test.h #includes headers from this target.
1083 ]
mtkleinc095df52016-08-24 12:23:52 -07001084 }
mtklein2f3416d2016-08-02 16:02:05 -07001085
Mike Klein6e744122016-10-27 12:21:40 -04001086 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001087 test_lib("bench") {
1088 public_include_dirs = [ "bench" ]
1089 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001090 deps = [
1091 ":flags",
1092 ":gm",
1093 ":gpu_tool_utils",
1094 ":skia",
1095 ":tool_utils",
1096 ]
1097 }
mtklein2b6870c2016-07-28 14:17:33 -07001098
mtkleinc095df52016-08-24 12:23:52 -07001099 test_lib("experimental_svg_model") {
1100 public_include_dirs = [ "experimental/svg/model" ]
1101 sources = [
1102 "experimental/svg/model/SkSVGAttribute.cpp",
1103 "experimental/svg/model/SkSVGAttributeParser.cpp",
1104 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001105 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001106 "experimental/svg/model/SkSVGContainer.cpp",
1107 "experimental/svg/model/SkSVGDOM.cpp",
1108 "experimental/svg/model/SkSVGEllipse.cpp",
1109 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001110 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001111 "experimental/svg/model/SkSVGNode.cpp",
1112 "experimental/svg/model/SkSVGPath.cpp",
1113 "experimental/svg/model/SkSVGPoly.cpp",
1114 "experimental/svg/model/SkSVGRect.cpp",
1115 "experimental/svg/model/SkSVGRenderContext.cpp",
1116 "experimental/svg/model/SkSVGSVG.cpp",
1117 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001118 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001119 "experimental/svg/model/SkSVGTransformableNode.cpp",
1120 "experimental/svg/model/SkSVGValue.cpp",
1121 ]
1122 deps = [
1123 ":skia",
1124 ]
1125 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001126
Brian Osman16adfa32016-10-18 14:42:44 -04001127 test_lib("views") {
1128 public_include_dirs = [ "include/views" ]
1129 sources = [
1130 "src/views/SkEvent.cpp",
1131 "src/views/SkEventSink.cpp",
1132 "src/views/SkOSMenu.cpp",
1133 "src/views/SkTagList.cpp",
1134 "src/views/SkTouchGesture.cpp",
1135 "src/views/SkView.cpp",
1136 "src/views/SkViewPriv.cpp",
1137 ]
1138 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001139 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001140 if (!is_android) {
1141 sources += [ "src/views/SkWindow.cpp" ]
1142 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001143 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001144 public_include_dirs += [ "src/views/unix" ]
1145 sources += [
1146 "src/views/unix/SkOSWindow_Unix.cpp",
1147 "src/views/unix/keysym2ucs.c",
1148 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001149 libs += [
1150 "GL",
1151 "X11",
1152 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001153 } else if (is_mac) {
1154 sources += [
1155 "src/views/mac/SkEventNotifier.mm",
1156 "src/views/mac/SkNSView.mm",
1157 "src/views/mac/SkOSWindow_Mac.mm",
1158 "src/views/mac/SkTextFieldCell.m",
1159 ]
1160 libs += [
1161 "QuartzCore.framework",
1162 "Cocoa.framework",
1163 "Foundation.framework",
1164 ]
1165 } else if (is_win) {
1166 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1167 }
Brian Osman34755e22016-12-05 09:46:02 -05001168 if (skia_use_angle) {
1169 deps += [ "//third_party/angle2" ]
1170 }
Brian Osman16adfa32016-10-18 14:42:44 -04001171 }
1172
Mike Klein38af9432016-11-11 11:39:44 -05001173 if (skia_use_lua) {
1174 test_lib("lua") {
1175 public_include_dirs = []
1176 sources = [
1177 "src/utils/SkLua.cpp",
1178 "src/utils/SkLuaCanvas.cpp",
1179 ]
1180 deps = [
1181 "//third_party/lua",
1182 ]
1183 }
1184
Mike Kleine6682eb2017-01-05 10:54:57 -05001185 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001186 sources = [
1187 "tools/lua/lua_app.cpp",
1188 ]
1189 deps = [
1190 ":lua",
1191 ":skia",
1192 "//third_party/lua",
1193 ]
Mike Klein38af9432016-11-11 11:39:44 -05001194 }
1195
Mike Kleine6682eb2017-01-05 10:54:57 -05001196 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001197 sources = [
1198 "tools/lua/lua_pictures.cpp",
1199 ]
1200 deps = [
1201 ":flags",
1202 ":lua",
1203 ":skia",
1204 ":tool_utils",
1205 "//third_party/lua",
1206 ]
Mike Klein38af9432016-11-11 11:39:44 -05001207 }
1208 }
1209
Mike Klein6e744122016-10-27 12:21:40 -04001210 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001211 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001212 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001213 include_dirs = [ "experimental" ]
1214 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001215 "experimental/SkSetPoly3To3.cpp",
1216 "experimental/SkSetPoly3To3_A.cpp",
1217 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001218
1219 # Relocating these files here, so that clients don't try to build them while they're
1220 # still in active development. Clang's thread safety analysis gets tripped up by
1221 # conditional locks.
1222 "src/core/SkThreadedBMPDevice.cpp",
1223 "src/core/SkThreadedBMPDevice.h",
Mike Klein6e744122016-10-27 12:21:40 -04001224 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001225 deps = [
1226 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001227 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001228 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001229 ":tool_utils",
1230 ":views",
1231 ":xml",
1232 ]
Mike Klein38af9432016-11-11 11:39:44 -05001233
1234 if (skia_use_lua) {
1235 sources += [ "samplecode/SampleLua.cpp" ]
1236 deps += [
1237 ":lua",
1238 "//third_party/lua",
1239 ]
1240 }
Brian Osman16adfa32016-10-18 14:42:44 -04001241 }
1242
Mike Kleine6682eb2017-01-05 10:54:57 -05001243 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001244 sources = [
1245 "dm/DM.cpp",
1246 "dm/DMJsonWriter.cpp",
1247 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001248 ]
1249 include_dirs = [ "tests" ]
1250 deps = [
mtklein046cb562016-09-16 10:23:12 -07001251 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001252 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001253 ":flags",
1254 ":gm",
1255 ":gpu_tool_utils",
1256 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001257 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001258 ":tool_utils",
1259 "//third_party/jsoncpp",
1260 "//third_party/libpng",
1261 ]
mtklein2b6870c2016-07-28 14:17:33 -07001262 }
1263
Mike Klein06432b22017-03-21 13:14:33 -04001264 test_app("ok") {
1265 sources = [
1266 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001267 "tools/ok_dsts.cpp",
1268 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001269 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001270 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001271 ]
1272 deps = [
1273 ":gm",
1274 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001275 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001276 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001277 ]
1278 }
1279
Mike Kleina3430172016-09-27 16:46:29 -04001280 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001281 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001282 sources = [
1283 "tools/monobench.cpp",
1284 ]
1285 deps = [
1286 ":bench",
1287 ":skia",
1288 ]
Mike Kleina3430172016-09-27 16:46:29 -04001289 }
mtklein2b6870c2016-07-28 14:17:33 -07001290 }
1291
Mike Kleine6682eb2017-01-05 10:54:57 -05001292 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001293 sources = [
1294 "bench/nanobench.cpp",
1295 ]
1296 deps = [
1297 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001298 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001299 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001300 ":flags",
1301 ":gm",
1302 ":gpu_tool_utils",
1303 ":skia",
1304 ":tool_utils",
1305 "//third_party/jsoncpp",
1306 ]
mtklein2b6870c2016-07-28 14:17:33 -07001307 }
halcanary19a97202016-08-03 15:08:04 -07001308
Ravi Mistry10d36c52017-01-31 09:49:18 -05001309 test_app("skpinfo") {
1310 sources = [
1311 "tools/skpinfo.cpp",
1312 ]
1313 deps = [
1314 ":flags",
1315 ":skia",
1316 ]
1317 }
1318
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001319 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001320 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001321 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001322 "samplecode/SampleApp.cpp",
1323 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001324 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001325 if (is_mac) {
1326 sources += [ "src/views/mac/skia_mac.mm" ]
1327 } else if (is_win) {
1328 sources += [ "src/views/win/skia_win.cpp" ]
1329 } else if (is_linux) {
1330 sources += [ "src/views/unix/skia_unix.cpp" ]
1331 }
mtklein38925aa2016-09-21 10:11:25 -07001332 deps = [
1333 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001334 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001335 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001336 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001337 ":skia",
1338 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001339 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001340 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001341 if (skia_use_angle) {
1342 deps += [ "//third_party/angle2" ]
1343 }
mtklein38925aa2016-09-21 10:11:25 -07001344 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001345 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001346
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001347 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001348 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001349 sources = [
1350 "tools/skpbench/skpbench.cpp",
1351 ]
1352 deps = [
1353 ":flags",
1354 ":gpu_tool_utils",
1355 ":skia",
1356 ":tool_utils",
1357 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001358 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001359 }
1360
Mike Klein7d302882016-11-03 14:06:31 -04001361 # We can't yet build ICU on iOS or Windows.
1362 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001363 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001364 sources = [
1365 "tools/SkShaper_harfbuzz.cpp",
1366 "tools/using_skia_and_harfbuzz.cpp",
1367 ]
1368 deps = [
1369 ":skia",
1370 "//third_party/harfbuzz",
1371 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001372 }
halcanary19a97202016-08-03 15:08:04 -07001373 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001374 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001375 sources = [
1376 "tools/SkShaper_primitive.cpp",
1377 "tools/using_skia_and_harfbuzz.cpp",
1378 ]
1379 deps = [
1380 ":skia",
1381 ]
halcanary3eee9d92016-09-10 07:01:53 -07001382 }
mtklein046cb562016-09-16 10:23:12 -07001383
Matt Sarett9f1c4032017-05-17 10:06:32 -04001384 test_app("create_flutter_test_images") {
1385 sources = [
1386 "tools/create_flutter_test_images.cpp",
1387 ]
1388 deps = [
1389 ":skia",
1390 ":tool_utils",
1391 ]
1392 }
1393
Mike Kleine6682eb2017-01-05 10:54:57 -05001394 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001395 sources = [
1396 "tools/get_images_from_skps.cpp",
1397 ]
1398 deps = [
1399 ":flags",
1400 ":skia",
1401 "//third_party/jsoncpp",
1402 ]
mtklein046cb562016-09-16 10:23:12 -07001403 }
mtkleinecbc5262016-09-22 11:51:24 -07001404
Mike Kleine6682eb2017-01-05 10:54:57 -05001405 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001406 sources = [
1407 "tools/colorspaceinfo.cpp",
1408 ]
1409 deps = [
1410 ":flags",
1411 ":skia",
1412 ":tool_utils",
1413 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001414 }
1415
Mike Klein7d302882016-11-03 14:06:31 -04001416 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001417 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001418 sources = [
1419 "tools/skiaserve/Request.cpp",
1420 "tools/skiaserve/Response.cpp",
1421 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001422 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1423 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1424 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1425 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1426 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1427 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1428 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1429 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1430 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001431 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1432 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001433 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1434 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1435 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1436 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1437 ]
1438 deps = [
1439 ":flags",
1440 ":gpu_tool_utils",
1441 ":skia",
1442 ":tool_utils",
1443 "//third_party/jsoncpp",
1444 "//third_party/libmicrohttpd",
1445 "//third_party/libpng",
1446 ]
Mike Klein7d302882016-11-03 14:06:31 -04001447 }
mtkleinecbc5262016-09-22 11:51:24 -07001448 }
kjlubick14f984b2016-10-03 11:49:45 -07001449
Mike Kleine6682eb2017-01-05 10:54:57 -05001450 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001451 sources = [
1452 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001453 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001454 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001455 "fuzz/FuzzGradients.cpp",
1456 "fuzz/FuzzParsePath.cpp",
1457 "fuzz/FuzzPathop.cpp",
1458 "fuzz/FuzzScaleToSides.cpp",
1459 "fuzz/fuzz.cpp",
1460 ]
1461 deps = [
1462 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001463 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001464 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001465 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001466 ]
kjlubick14f984b2016-10-03 11:49:45 -07001467 }
Mike Klein38312422016-10-05 15:41:01 -04001468
Mike Kleine6682eb2017-01-05 10:54:57 -05001469 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001470 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001471 rebase_path("tests/skia_test.cpp"),
1472 rebase_path("tests/Test.cpp"),
1473 ]
caryclark9feb6322016-10-25 08:58:26 -07001474 deps = [
1475 ":flags",
1476 ":gpu_tool_utils",
1477 ":skia",
1478 ":tool_utils",
1479 ]
caryclark9feb6322016-10-25 08:58:26 -07001480 }
1481
Mike Kleine6682eb2017-01-05 10:54:57 -05001482 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001483 sources = [
1484 "tools/DumpRecord.cpp",
1485 "tools/dump_record.cpp",
1486 ]
1487 deps = [
1488 ":flags",
1489 ":skia",
1490 ]
Mike Klein38312422016-10-05 15:41:01 -04001491 }
bungemanfe917272016-10-13 17:36:40 -04001492
Mike Kleine6682eb2017-01-05 10:54:57 -05001493 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001494 sources = [
1495 "tools/skdiff/skdiff.cpp",
1496 "tools/skdiff/skdiff_html.cpp",
1497 "tools/skdiff/skdiff_main.cpp",
1498 "tools/skdiff/skdiff_utils.cpp",
1499 ]
1500 deps = [
1501 ":skia",
1502 ":tool_utils",
1503 ]
bungemanfe917272016-10-13 17:36:40 -04001504 }
halcanarya73d76a2016-10-17 13:19:02 -07001505
Mike Kleine6682eb2017-01-05 10:54:57 -05001506 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001507 sources = [
1508 "tools/skp_parser.cpp",
1509 ]
1510 deps = [
1511 ":skia",
1512 ":tool_utils",
1513 "//third_party/jsoncpp",
1514 ]
halcanarya73d76a2016-10-17 13:19:02 -07001515 }
Brian Osman16adfa32016-10-18 14:42:44 -04001516
Mike Kleina92c3832016-12-08 09:49:39 -05001517 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001518 test_app("viewer") {
1519 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001520 sources = [
1521 "tools/viewer/GMSlide.cpp",
1522 "tools/viewer/ImageSlide.cpp",
1523 "tools/viewer/SKPSlide.cpp",
1524 "tools/viewer/SampleSlide.cpp",
1525 "tools/viewer/Viewer.cpp",
1526 "tools/viewer/sk_app/CommandSet.cpp",
1527 "tools/viewer/sk_app/GLWindowContext.cpp",
1528 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001529 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001530 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001531
Jim Van Verth4e56a912016-10-21 10:58:52 -04001532 if (is_android) {
1533 sources += [
1534 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1535 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1536 "tools/viewer/sk_app/android/Window_android.cpp",
1537 "tools/viewer/sk_app/android/main_android.cpp",
1538 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1539 ]
Brian Osman462334e2017-02-09 11:22:57 -05001540 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001541 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001542 sources += [
1543 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1544 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1545 "tools/viewer/sk_app/unix/Window_unix.cpp",
1546 "tools/viewer/sk_app/unix/main_unix.cpp",
1547 ]
1548 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001549 sources += [
1550 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1551 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1552 "tools/viewer/sk_app/win/Window_win.cpp",
1553 "tools/viewer/sk_app/win/main_win.cpp",
1554 ]
Mike Klein43c25262016-10-20 10:17:47 -04001555 } else if (is_mac) {
1556 sources += [
1557 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1558 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1559 "tools/viewer/sk_app/mac/Window_mac.cpp",
1560 "tools/viewer/sk_app/mac/main_mac.cpp",
1561 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001562 }
1563
1564 if (skia_use_vulkan) {
1565 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001566 if (is_android) {
1567 sources +=
1568 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001569 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001570 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1571 libs += [ "X11-xcb" ]
1572 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001573 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1574 }
1575 }
1576
1577 include_dirs = []
1578 deps = [
1579 ":flags",
1580 ":gm",
1581 ":gpu_tool_utils",
1582 ":samples",
1583 ":skia",
1584 ":tool_utils",
1585 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001586 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001587 "//third_party/jsoncpp",
1588 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001589 if (is_android) {
1590 deps += [ "//third_party/native_app_glue" ]
1591 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001592 deps += [ "//third_party/libsdl" ]
1593 }
Mike Kleina92c3832016-12-08 09:49:39 -05001594 }
Brian Osman16adfa32016-10-18 14:42:44 -04001595 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001596
Mike Kleine459afd2017-03-03 09:21:30 -05001597 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001598 copy("gdbserver") {
1599 sources = [
1600 "$ndk/$ndk_gdbserver",
1601 ]
1602 outputs = [
1603 "$root_out_dir/gdbserver",
1604 ]
1605 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001606 }
mtklein25c81d42016-07-27 13:55:26 -07001607}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001608
1609if (skia_jumper_clang != "") {
1610 action("regen_jumper") {
1611 script = "src/jumper/build_stages.py"
1612
1613 inputs = [
1614 "src/jumper/SkJumper_stages.cpp",
1615 "src/jumper/SkJumper_stages_lowp.cpp",
1616 ]
1617
1618 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1619 outputs = [
1620 "$target_out_dir/" +
1621 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1622 "$target_out_dir/" +
1623 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1624 ]
1625
1626 args = [
1627 skia_jumper_clang,
1628 skia_jumper_objdump,
1629 skia_jumper_ccache,
1630 ] + rebase_path(inputs) + rebase_path(outputs)
1631 }
1632}