blob: 131bf0b6fce0e1c2430589882faaead45076134f [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
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_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 Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050028 skia_use_lua = false
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050035 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050036 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040037 skia_enable_flutter_defines = false
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050043 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040044 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040045 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040046 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070047 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040048
49 skia_jumper_clang = ""
50 skia_jumper_objdump = ""
51 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070052}
Brian Salomon23d73ea2016-10-27 13:31:37 -040053declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040054 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040055 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050056 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040057
Mike Klein4d598a32016-10-31 13:44:49 -040058 if (is_android) {
59 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070060 } else if (is_fuchsia) {
61 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040062 } else {
63 skia_use_vulkan = skia_vulkan_sdk != ""
64 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040065}
Greg Danielec6ae522017-04-25 13:38:26 -040066declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050067 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040068 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000069 # 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 -040070 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050071 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040072 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050073 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040074 }
Greg Danielec6ae522017-04-25 13:38:26 -040075 }
76}
Brian Salomon789e25e2016-09-30 13:41:03 -040077
Adam Barth54ef74a2017-10-13 10:59:38 -070078if (defined(skia_settings)) {
79 import(skia_settings)
80}
81
mtklein38925aa2016-09-21 10:11:25 -070082# Our tools require static linking (they use non-exported symbols).
83skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070084
mtkleina45be612016-08-29 15:22:10 -070085fontmgr_android_enabled = skia_use_expat && skia_use_freetype
86
mtklein1211e0c2016-07-26 13:55:45 -070087skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070088 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070089 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070090 "include/codec",
91 "include/config",
92 "include/core",
93 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040094 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/gpu",
96 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050097 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/pathops",
99 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/utils",
102 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700103]
104
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000105if (skia_use_vulkan) {
106 skia_public_includes += [ "include/gpu/vk" ]
107}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500108if (skia_enable_atlas_text) {
109 skia_public_includes += [ "include/atlastext" ]
110}
Greg Daniele5ddff52017-07-05 16:49:36 -0400111if (skia_use_metal) {
112 skia_public_includes += [ "include/gpu/mtl" ]
113}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000114
mtkleinc04ff472016-06-23 10:29:30 -0700115# Skia public API, generally provided by :skia.
116config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700117 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500118 if (skia_tools_vulkan_header_dir != "") {
119 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400120 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400121 defines = []
122 if (is_component_build) {
123 defines += [ "SKIA_DLL" ]
124 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400125 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700126 defines += [ "SK_SAMPLES_FOR_X" ]
127 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400128 if (skia_enable_flutter_defines) {
129 defines += flutter_defines
130 }
mtklein06c35c02016-09-20 12:28:12 -0700131 if (!skia_enable_gpu) {
132 defines += [ "SK_SUPPORT_GPU=0" ]
133 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500134 if (skia_enable_atlas_text) {
135 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
136 }
mtkleinc04ff472016-06-23 10:29:30 -0700137}
138
139# Skia internal APIs, used by Skia itself and a few test tools.
140config("skia_private") {
141 visibility = [ ":*" ]
142
143 include_dirs = [
144 "include/private",
145 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700146 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/core",
148 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700149 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700150 "src/image",
151 "src/images",
152 "src/lazy",
153 "src/opts",
154 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700155 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/ports",
157 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400158 "src/shaders",
159 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700160 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700161 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700162 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500163 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700164 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700165 ]
mtklein150d1132016-08-01 06:56:40 -0700166
Mike Reeda9e241d2017-05-03 10:52:00 -0400167 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700168 if (is_android) {
169 defines += [
170 "SK_GAMMA_EXPONENT=1.4",
171 "SK_GAMMA_CONTRAST=0.0",
172 ]
173 }
mtklein88a7ac02016-09-14 11:16:49 -0700174 if (is_official_build || is_android) {
175 # TODO(bsalomon): it'd be nice to make Android normal.
176 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
177 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400178 libs = []
179 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500180 if (skia_enable_gpu) {
181 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500182 if (is_skia_dev_build && skia_use_vulkan) {
183 include_dirs += [ "tools/gpu/vk" ]
184 }
Brian Salomon03e05842017-02-23 12:23:47 -0500185 }
Brian Osman34755e22016-12-05 09:46:02 -0500186 if (skia_use_angle) {
187 defines += [ "SK_ANGLE" ]
188 }
Brian Osman3f375d02016-12-28 11:19:22 -0500189 if (skia_enable_discrete_gpu) {
190 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
191 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400192 if (!is_official_build) {
193 defines += [ "GR_TEST_UTILS=1" ]
194 }
mtkleinc04ff472016-06-23 10:29:30 -0700195}
196
197# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
198config("skia_library") {
199 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700200 defines = [ "SKIA_IMPLEMENTATION=1" ]
201}
202
203skia_library_configs = [
204 ":skia_public",
205 ":skia_private",
206 ":skia_library",
207]
208
mtklein9b8583d2016-08-24 17:32:30 -0700209# Use for CPU-specific Skia code that needs particular compiler flags.
210template("opts") {
211 if (invoker.enabled) {
212 source_set(target_name) {
213 forward_variables_from(invoker, "*")
214 configs += skia_library_configs
215 }
216 } else {
217 # If not enabled, a phony empty target that swallows all otherwise unused variables.
218 source_set(target_name) {
219 forward_variables_from(invoker,
220 "*",
221 [
222 "sources",
223 "cflags",
224 ])
225 }
226 }
anmittala7eaf2e2016-08-17 13:57:26 -0700227}
228
mtklein422310d2016-08-16 18:28:43 -0700229is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700230
mtklein7d6fb2c2016-08-25 14:50:44 -0700231opts("none") {
232 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700234 cflags = []
235}
236
mtklein7d6fb2c2016-08-25 14:50:44 -0700237opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700238 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700240 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700241}
242
243opts("arm64") {
244 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700246 cflags = []
247}
248
249opts("crc32") {
250 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700252 cflags = [ "-march=armv8-a+crc" ]
253}
254
mtklein9b8583d2016-08-24 17:32:30 -0700255opts("sse2") {
256 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400258 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400259 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
260 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400261 cflags = [ "-msse2" ]
262 }
mtklein9b8583d2016-08-24 17:32:30 -0700263}
mtkleinc04ff472016-06-23 10:29:30 -0700264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("ssse3") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-mssse3" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("sse41") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-msse4.1" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtklein4e976072016-08-08 09:06:27 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse42") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.2" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
294
295opts("avx") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400298 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000299 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400300 } else {
301 cflags = [ "-mavx" ]
302 }
mtkleinc04ff472016-06-23 10:29:30 -0700303}
304
mtkleinc095df52016-08-24 12:23:52 -0700305# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700306template("optional") {
307 if (invoker.enabled) {
308 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700309 if (defined(invoker.public_defines)) {
310 defines = invoker.public_defines
311 }
mtklein457b42a2016-08-23 13:56:37 -0700312 }
313 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700314 forward_variables_from(invoker,
315 "*",
316 [
317 "public_defines",
318 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700319 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700320 ])
mtklein457b42a2016-08-23 13:56:37 -0700321 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700322 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700323 if (defined(invoker.configs_to_remove)) {
324 configs -= invoker.configs_to_remove
325 }
mtklein457b42a2016-08-23 13:56:37 -0700326 }
327 } else {
mtklein457b42a2016-08-23 13:56:37 -0700328 source_set(target_name) {
329 forward_variables_from(invoker,
330 "*",
331 [
332 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700333 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700334 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700335 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700336 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700337 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700338 ])
mtkleincd01b032016-08-31 04:58:19 -0700339 if (defined(invoker.sources_when_disabled)) {
340 sources = invoker.sources_when_disabled
341 }
342 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700343 }
mtkleineb3c4252016-08-23 07:38:09 -0700344 }
mtklein457b42a2016-08-23 13:56:37 -0700345}
mtklein457b42a2016-08-23 13:56:37 -0700346
Mike Kleina04bb452017-02-09 12:24:07 -0500347optional("effects") {
348 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400349 deps = [
350 ":compile_processors",
351 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500352 sources =
353 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
354 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
355}
356
mtkleina45be612016-08-29 15:22:10 -0700357optional("fontmgr_android") {
358 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700359
360 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500361 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700362 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700363 ]
364 sources = [
365 "src/ports/SkFontMgr_android.cpp",
366 "src/ports/SkFontMgr_android_factory.cpp",
367 "src/ports/SkFontMgr_android_parser.cpp",
368 ]
369}
370
mtkleind2e39db2016-09-07 07:52:55 -0700371optional("fontmgr_custom") {
372 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
373
374 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500375 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700376 ]
377 sources = [
378 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500379 "src/ports/SkFontMgr_custom.h",
380 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700381 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500382 "src/ports/SkFontMgr_custom_embedded.cpp",
383 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700384 ]
385}
386
mtklein3cc22182016-08-29 13:26:14 -0700387optional("fontmgr_fontconfig") {
388 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700389
390 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500391 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700392 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700393 ]
394 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700395 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700396 "src/ports/SkFontConfigInterface_direct.cpp",
397 "src/ports/SkFontConfigInterface_direct_factory.cpp",
398 "src/ports/SkFontMgr_FontConfigInterface.cpp",
399 "src/ports/SkFontMgr_fontconfig.cpp",
400 "src/ports/SkFontMgr_fontconfig_factory.cpp",
401 ]
402}
403
mtkleincdedd0e2016-09-12 15:15:44 -0700404optional("fontmgr_fuchsia") {
405 enabled = is_fuchsia && skia_use_freetype
406
407 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500408 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 ]
410 sources = [
411 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500412 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700413 "src/ports/SkFontMgr_custom_empty_factory.cpp",
414 ]
415}
416
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700417if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400418 executable("sksllex") {
419 sources = [
420 "src/sksl/lex/Main.cpp",
421 "src/sksl/lex/NFA.cpp",
422 "src/sksl/lex/RegexNode.cpp",
423 "src/sksl/lex/RegexParser.cpp",
424 ]
425 include_dirs = [ "src/sksl/lex" ]
426 }
427
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700428 action("run_sksllex") {
429 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400430 deps = [
431 ":sksllex(//gn/toolchain:$host_toolchain)",
432 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700433 sources = [
434 "src/sksl/lex/layout.lex",
435 "src/sksl/lex/sksl.lex",
436 ]
437
438 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
439 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
440 outputs = [
441 "$target_out_dir/" +
442 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
443 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
444 # confused due to the same file being named by two different paths
445 ]
446 sksllex_path = "$root_out_dir/"
447 sksllex_path += "sksllex"
448 if (host_os == "win") {
449 sksllex_path += ".exe"
450 }
451 args = [
452 rebase_path(sksllex_path),
453 rebase_path("bin/clang-format"),
454 rebase_path("src"),
455 ]
456 }
457} else {
458 group("run_sksllex") {
459 }
460}
461
462if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400463 executable("skslc") {
464 defines = [ "SKSL_STANDALONE" ]
465 sources = [
466 "src/sksl/SkSLMain.cpp",
467 ]
468 sources += skia_sksl_sources
469 include_dirs = [
470 "src/gpu",
471 "src/sksl",
472 ]
473 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500474 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400475 "//third_party/spirv-tools",
476 ]
477 }
478
479 skia_gpu_processor_outputs = []
480 foreach(src, skia_gpu_processor_sources) {
481 dir = get_path_info(src, "dir")
482 name = get_path_info(src, "name")
483
484 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
485 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
486 skia_gpu_processor_outputs += [
487 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
488 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
489 # confused due to the same file being named by two different paths
490 ]
491 }
492
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500493 action("create_sksl_enums") {
494 script = "gn/create_sksl_enums.py"
495 sources = [
496 "include/private/GrSharedEnums.h",
497 ]
498 outputs = [
499 "$target_out_dir/" +
500 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
501 ]
502 args = [
503 rebase_path(sources[0]),
504 rebase_path(outputs[0]),
505 ]
506 }
507
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 action("compile_processors") {
509 script = "gn/compile_processors.py"
510 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500511 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400512 ":skslc(//gn/toolchain:$host_toolchain)",
513 ]
514 sources = skia_gpu_processor_sources
515 outputs = skia_gpu_processor_outputs
516 skslc_path = "$root_out_dir/"
517 if (host_toolchain != default_toolchain_name) {
518 skslc_path += "$host_toolchain/"
519 }
520 skslc_path += "skslc"
521 if (host_os == "win") {
522 skslc_path += ".exe"
523 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400524 args = [
525 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400526 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400527 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400528 args += rebase_path(skia_gpu_processor_sources)
529 }
530} else {
531 skia_gpu_processor_outputs = []
532 group("compile_processors") {
533 }
534}
535
mtklein06c35c02016-09-20 12:28:12 -0700536optional("gpu") {
537 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400538 deps = [
539 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700540 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700542 public_defines = []
543
Mike Klein29b3e582017-02-09 11:57:32 -0500544 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
546 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700547
548 # These paths need to be absolute to match the ones produced by shared_sources.gni.
549 sources -= get_path_info([
550 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
551 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
552 ],
553 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400554 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700555 if (is_android) {
556 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400557
558 # this lib is required to link against AHardwareBuffer
559 if (defined(ndk_api) && ndk_api >= 26) {
560 libs += [ "android" ]
561 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400562 } else if (skia_use_egl) {
563 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
564 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700565 } else if (is_linux) {
566 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500567 libs += [
568 "GL",
569 "GLU",
570 ]
mtklein06c35c02016-09-20 12:28:12 -0700571 } else if (is_mac) {
572 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800573 } else if (is_ios) {
574 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400575 } else if (is_win) {
576 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
577 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700578 } else {
579 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
580 }
mtkleine9fb3d52016-09-20 15:11:46 -0700581
582 if (skia_use_vulkan) {
583 public_defines += [ "SK_VULKAN" ]
584 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700585 if (skia_enable_vulkan_debug_layers) {
586 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
587 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500588 if (skia_vulkan_header != "") {
589 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
590 } else {
591 if (is_skia_dev_build) {
592 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
593 }
594 }
mtkleine9fb3d52016-09-20 15:11:46 -0700595 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400596 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400597 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400598 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
599 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400600
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400601 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400602 if (skia_use_metal) {
603 public_defines += [ "SK_METAL" ]
604 sources += skia_metal_sources
605 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400606 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400607 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500608
609 if (skia_enable_atlas_text) {
610 sources += skia_atlas_text_sources
611 }
mtklein06c35c02016-09-20 12:28:12 -0700612}
613
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400614optional("heif") {
615 enabled = skia_use_libheif
616 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
617
618 deps = []
619
620 sources = [
621 "src/codec/SkHeifCodec.cpp",
622 ]
623}
624
mtklein63213812016-08-24 09:55:56 -0700625optional("jpeg") {
626 enabled = skia_use_libjpeg_turbo
627 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
628
mtklein63213812016-08-24 09:55:56 -0700629 deps = [
630 "//third_party/libjpeg-turbo:libjpeg",
631 ]
632 sources = [
633 "src/codec/SkJpegCodec.cpp",
634 "src/codec/SkJpegDecoderMgr.cpp",
635 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700636 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400637 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700638 ]
639}
640
641optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500642 enabled = skia_use_zlib && skia_enable_pdf
643 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700644
mtklein63213812016-08-24 09:55:56 -0700645 deps = [
646 "//third_party/zlib",
647 ]
brettwb9447282016-09-01 14:24:39 -0700648 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700649 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700650
651 if (skia_use_sfntly) {
652 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500653 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700654 }
655}
656
657optional("png") {
658 enabled = skia_use_libpng
659 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
660
mtklein63213812016-08-24 09:55:56 -0700661 deps = [
662 "//third_party/libpng",
663 ]
664 sources = [
665 "src/codec/SkIcoCodec.cpp",
666 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400667 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700668 ]
669}
670
scroggof84ad642016-10-31 09:02:57 -0700671optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400672 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700673 public_defines = [ "SK_CODEC_DECODES_RAW" ]
674
675 deps = [
676 "//third_party/dng_sdk",
677 "//third_party/libjpeg-turbo:libjpeg",
678 "//third_party/piex",
679 ]
680
681 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
682 # Skia.
683 configs_to_remove = [ "//gn:no_exceptions" ]
684
685 sources = [
686 "src/codec/SkRawAdapterCodec.cpp",
687 "src/codec/SkRawCodec.cpp",
688 ]
689}
690
mtklein3cc22182016-08-29 13:26:14 -0700691optional("typeface_freetype") {
692 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700693
694 deps = [
695 "//third_party/freetype2",
696 ]
697 sources = [
698 "src/ports/SkFontHost_FreeType.cpp",
699 "src/ports/SkFontHost_FreeType_common.cpp",
700 ]
701}
702
mtklein457b42a2016-08-23 13:56:37 -0700703optional("webp") {
704 enabled = skia_use_libwebp
705 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
706
mtklein457b42a2016-08-23 13:56:37 -0700707 deps = [
708 "//third_party/libwebp",
709 ]
710 sources = [
711 "src/codec/SkWebpAdapterCodec.cpp",
712 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400713 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700714 ]
mtkleineb3c4252016-08-23 07:38:09 -0700715}
716
mtklein63213812016-08-24 09:55:56 -0700717optional("xml") {
718 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000719 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700720
mtklein63213812016-08-24 09:55:56 -0700721 deps = [
722 "//third_party/expat",
723 ]
724 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500725 "src/svg/SkSVGCanvas.cpp",
726 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700727 "src/xml/SkDOM.cpp",
728 "src/xml/SkXMLParser.cpp",
729 "src/xml/SkXMLWriter.cpp",
730 ]
731}
732
mtkleinc04ff472016-06-23 10:29:30 -0700733component("skia") {
734 public_configs = [ ":skia_public" ]
735 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700736
737 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700738 ":arm64",
739 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700740 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700741 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500742 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700743 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700744 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700745 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700746 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700747 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400748 ":heif",
mtklein63213812016-08-24 09:55:56 -0700749 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700750 ":none",
mtklein63213812016-08-24 09:55:56 -0700751 ":pdf",
752 ":png",
scroggof84ad642016-10-31 09:02:57 -0700753 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700754 ":sse2",
755 ":sse41",
756 ":sse42",
757 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700758 ":webp",
mtklein63213812016-08-24 09:55:56 -0700759 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700760 ]
761
Chinmay Garde43f115c2016-11-16 15:04:12 -0800762 # This file (and all GN files in Skia) are designed to work with an
763 # empty sources assignment filter; we handle all that explicitly.
764 # We clear the filter here for clients who may have set up a global filter.
765 set_sources_assignment_filter([])
766
mtkleinc04ff472016-06-23 10:29:30 -0700767 sources = []
brettwb9447282016-09-01 14:24:39 -0700768 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700769 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500770 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700771 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400772 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700773 "src/android/SkBitmapRegionCodec.cpp",
774 "src/android/SkBitmapRegionDecoder.cpp",
775 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400776 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700777 "src/codec/SkBmpCodec.cpp",
778 "src/codec/SkBmpMaskCodec.cpp",
779 "src/codec/SkBmpRLECodec.cpp",
780 "src/codec/SkBmpStandardCodec.cpp",
781 "src/codec/SkCodec.cpp",
782 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700783 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700784 "src/codec/SkMaskSwizzler.cpp",
785 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700786 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700787 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700788 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700789 "src/codec/SkSwizzler.cpp",
790 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700791 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700792 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700793 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700794 "src/ports/SkMemory_malloc.cpp",
795 "src/ports/SkOSFile_stdio.cpp",
796 "src/sfnt/SkOTTable_name.cpp",
797 "src/sfnt/SkOTUtils.cpp",
798 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700799 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700800 ]
brettwb9447282016-09-01 14:24:39 -0700801
mtklein7d6fb2c2016-08-25 14:50:44 -0700802 libs = []
803
mtkleinc04ff472016-06-23 10:29:30 -0700804 if (is_win) {
805 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400806 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700807 "src/ports/SkDebug_win.cpp",
808 "src/ports/SkFontHost_win.cpp",
809 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500810 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700811 "src/ports/SkImageEncoder_WIC.cpp",
812 "src/ports/SkImageGeneratorWIC.cpp",
813 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700814 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700815 "src/ports/SkScalerContext_win_dw.cpp",
816 "src/ports/SkTLS_win.cpp",
817 "src/ports/SkTypeface_win_dw.cpp",
818 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400819 libs += [
820 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500821 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400822 "Ole32.lib",
823 "OleAut32.lib",
824 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500825 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400826 ]
mtkleinc04ff472016-06-23 10:29:30 -0700827 } else {
828 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700829 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700830 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700831 "src/ports/SkTLS_pthread.cpp",
832 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400833 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700834 }
835
mtklein7d6fb2c2016-08-25 14:50:44 -0700836 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500837 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500838 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500839 deps += [ "//third_party/cpu-features" ]
840 }
mtklein06c35c02016-09-20 12:28:12 -0700841 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700842 libs += [
843 "EGL",
844 "GLESv2",
845 "log",
846 ]
847 }
848
mtkleinc04ff472016-06-23 10:29:30 -0700849 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700850 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700851 }
852
853 if (is_mac) {
854 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700855 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700856 "src/ports/SkFontHost_mac.cpp",
857 "src/ports/SkImageEncoder_CG.cpp",
858 "src/ports/SkImageGeneratorCG.cpp",
859 ]
mtklein09e61f72016-08-23 13:35:28 -0700860 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400861 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
862 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700863 "ApplicationServices.framework",
864 "OpenGL.framework",
865 ]
mtkleinc04ff472016-06-23 10:29:30 -0700866 }
abarth6fc8ff02016-07-15 15:15:15 -0700867
Mike Klein7d302882016-11-03 14:06:31 -0400868 if (is_ios) {
869 sources += [
870 "src/ports/SkDebug_stdio.cpp",
871 "src/ports/SkFontHost_mac.cpp",
872 "src/ports/SkImageEncoder_CG.cpp",
873 "src/ports/SkImageGeneratorCG.cpp",
874 ]
875 libs += [
876 "CoreFoundation.framework",
877 "CoreGraphics.framework",
878 "CoreText.framework",
879 "ImageIO.framework",
880 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400881
882 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
883 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400884 ]
885 }
886
abarth6fc8ff02016-07-15 15:15:15 -0700887 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700888 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700889 }
mtkleinc04ff472016-06-23 10:29:30 -0700890}
891
mtkleinc095df52016-08-24 12:23:52 -0700892# Targets guarded by skia_enable_tools may use //third_party freely.
893if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500894 # Used by gn_to_bp.py to list our public include dirs.
895 source_set("public") {
896 configs += [ ":skia_public" ]
897 }
898
Mike Kleinc36dedf2016-11-18 09:35:28 -0500899 config("skia.h_config") {
900 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500901 if (skia_use_vulkan) {
902 # So we can get the header which includes vulkan
903 include_dirs += [ "tools/gpu/vk" ]
904 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500905 }
906 action("skia.h") {
907 public_configs = [ ":skia.h_config" ]
908 skia_h = "$target_gen_dir/skia.h"
909 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400910 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000911 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500912 depfile = "$skia_h.deps"
913 outputs = [
914 skia_h,
915 ]
916 }
917
918 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500919 executable("fiddle") {
920 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500921 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500922 "tools/fiddle/draw.cpp",
923 "tools/fiddle/fiddle_main.cpp",
924 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400925
926 if (skia_use_egl) {
927 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400928 } else {
929 sources += [ "tools/fiddle/null_context.cpp" ]
930 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400931 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500932 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400933 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500934 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500935 ":skia",
936 ":skia.h",
937 ]
938 }
939 }
940
941 if (skia_enable_gpu) {
942 source_set("public_headers_warnings_check") {
943 sources = [
944 "tools/public_headers_warnings_check.cpp",
945 ]
946 configs -= [ "//gn:warnings_except_public_headers" ]
947 deps = [
948 ":skia",
949 ":skia.h",
950 ]
951 }
952 }
953
mtkleinc095df52016-08-24 12:23:52 -0700954 template("test_lib") {
955 config(target_name + "_config") {
956 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700957 if (defined(invoker.public_defines)) {
958 defines = invoker.public_defines
959 }
mtklein25c81d42016-07-27 13:55:26 -0700960 }
mtkleinc095df52016-08-24 12:23:52 -0700961 source_set(target_name) {
962 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
963 public_configs = [
964 ":" + target_name + "_config",
965 ":skia_private",
966 ]
967
968 if (!defined(deps)) {
969 deps = []
970 }
971 deps += [ ":skia" ]
972 testonly = true
973 }
mtklein25c81d42016-07-27 13:55:26 -0700974 }
mtklein25c81d42016-07-27 13:55:26 -0700975
Mike Kleine6682eb2017-01-05 10:54:57 -0500976 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -0500977 if (is_ios) {
978 app_name = target_name
979 gen_path = target_gen_dir
980
981 action("${app_name}_generate_info_plist") {
982 script = "//gn/gen_plist_ios.py"
983 outputs = [
984 "$gen_path/${app_name}_Info.plist",
985 ]
986 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
987 }
988
989 bundle_data("${app_name}_bundle_info_plist") {
990 public_deps = [
991 ":${app_name}_generate_info_plist",
992 ]
993 sources = [
994 "$gen_path/${app_name}_Info.plist",
995 ]
996 outputs = [
997 "{{bundle_root_dir}}/Info.plist",
998 ]
999 }
1000
Jim Van Verth329c5a62017-11-29 11:42:33 -05001001 bundle_ios_data =
1002 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1003
1004 if (bundle_ios_data) {
1005 has_skps =
1006 "True" == exec_script("//gn/checkdir.py",
1007 [ rebase_path("skps", root_build_dir) ],
1008 "trim string")
1009 bundle_data("${app_name}_bundle_resources") {
1010 sources = [
1011 "resources",
1012 ]
1013 outputs = [
1014 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1015 "{{bundle_resources_dir}}/data/resources",
1016 ]
1017 }
1018
1019 if (has_skps) {
1020 bundle_data("${app_name}_bundle_skps") {
1021 sources = [
1022 "skps",
1023 ]
1024 outputs = [
1025 # Store in same folder as resources
1026 "{{bundle_resources_dir}}/data/skps",
1027 ]
1028 }
1029 }
1030 }
1031
Jim Van Verth443a9132017-11-28 09:45:26 -05001032 executable("${app_name}_generate_executable") {
1033 forward_variables_from(invoker,
1034 "*",
1035 [
1036 "output_name",
1037 "visibility",
1038 "is_shared_library",
1039 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001040 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001041 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001042 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1043 }
1044
1045 bundle_data("${app_name}_bundle_executable") {
1046 public_deps = [
1047 ":${app_name}_generate_executable",
1048 ]
1049 sources = [
1050 "$gen_path/$app_name",
1051 ]
1052 outputs = [
1053 "{{bundle_executable_dir}}/$app_name",
1054 ]
1055 testonly = true
1056 }
1057
1058 create_bundle("$app_name") {
1059 product_type = "com.apple.product-type.application"
1060 testonly = true
1061
1062 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1063 bundle_resources_dir = bundle_root_dir
1064 bundle_executable_dir = bundle_root_dir
1065 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1066
1067 deps = [
1068 ":${app_name}_bundle_executable",
1069 ":${app_name}_bundle_info_plist",
1070 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001071 if (bundle_ios_data) {
1072 deps += [ ":${app_name}_bundle_resources" ]
1073 if (has_skps) {
1074 deps += [ ":${app_name}_bundle_skps" ]
1075 }
1076 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001077
1078 # should only code sign when running on a device, not the simulator
1079 if (target_cpu != "x64") {
1080 code_signing_script = "//gn/codesign_ios.py"
1081 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1082 code_signing_outputs = [
1083 "$bundle_root_dir/_CodeSignature/CodeResources",
1084 "$bundle_root_dir/embedded.mobileprovision",
1085 ]
1086 code_signing_args =
1087 [ rebase_path("$bundle_root_dir", root_build_dir) ]
1088 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001089 }
1090 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001091 # !is_ios
1092
1093 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1094 shared_library("lib" + target_name) {
1095 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1096 configs += [ ":skia_private" ]
1097 testonly = true
1098 }
1099 } else {
1100 _executable = target_name
1101 executable(_executable) {
1102 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1103 configs += [ ":skia_private" ]
1104 testonly = true
1105 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001106 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001107 if (is_android && skia_android_serial != "" && defined(_executable)) {
1108 action("push_" + target_name) {
1109 script = "gn/push_to_android.py"
1110 deps = [
1111 ":" + _executable,
1112 ]
1113 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1114 outputs = [
1115 _stamp,
1116 ]
1117 args = [
1118 rebase_path("$root_build_dir/$_executable"),
1119 skia_android_serial,
1120 rebase_path(_stamp),
1121 ]
1122 testonly = true
1123 }
Mike Klein7d921032017-01-05 12:20:41 -05001124 }
1125 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001126 }
1127
mtkleinc095df52016-08-24 12:23:52 -07001128 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001129 public_include_dirs = []
1130 if (skia_enable_gpu) {
1131 public_defines = []
1132 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001133
1134 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001135 sources = [
1136 "tools/gpu/GrContextFactory.cpp",
1137 "tools/gpu/GrTest.cpp",
1138 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001139 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001140 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001141 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001142 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1143 "tools/gpu/gl/debug/GrBufferObj.cpp",
1144 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1145 "tools/gpu/gl/debug/GrProgramObj.cpp",
1146 "tools/gpu/gl/debug/GrShaderObj.cpp",
1147 "tools/gpu/gl/debug/GrTextureObj.cpp",
1148 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1149 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001150 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001151 ]
1152 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001153
Kevin Lubick4a24e102017-03-29 11:19:01 -04001154 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001155 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001156 } else if (is_ios) {
1157 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1158 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001159 } else if (is_linux) {
1160 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001161 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001162 } else if (is_mac) {
1163 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001164 } else if (is_win) {
1165 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1166 libs += [
1167 "Gdi32.lib",
1168 "OpenGL32.lib",
1169 ]
mtklein38925aa2016-09-21 10:11:25 -07001170 }
mtklein6ef69992016-09-14 06:12:09 -07001171
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001172 cflags_objcc = [ "-fobjc-arc" ]
1173
Mike Kleinc168a3a2016-11-14 14:53:13 +00001174 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001175 deps += [ "//third_party/angle2" ]
1176 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1177 }
mtkleind68f9b02016-09-23 13:18:41 -07001178 if (skia_use_vulkan) {
1179 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001180 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001181 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001182 if (skia_use_metal) {
1183 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1184 }
mtkleina627b5c2016-09-20 13:36:47 -07001185 }
mtklein25c81d42016-07-27 13:55:26 -07001186 }
mtklein25c81d42016-07-27 13:55:26 -07001187
mtkleinc095df52016-08-24 12:23:52 -07001188 test_lib("flags") {
1189 public_include_dirs = [ "tools/flags" ]
1190 sources = [
1191 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001192 ]
1193 }
1194 test_lib("common_flags") {
1195 public_include_dirs = [ "tools/flags" ]
1196 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001197 "tools/flags/SkCommonFlags.cpp",
1198 "tools/flags/SkCommonFlagsConfig.cpp",
1199 ]
1200 deps = [
mtklein046cb562016-09-16 10:23:12 -07001201 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001202 ":gpu_tool_utils",
1203 ]
1204 }
mtklein25c81d42016-07-27 13:55:26 -07001205
mtkleinc095df52016-08-24 12:23:52 -07001206 test_lib("tool_utils") {
1207 public_include_dirs = [
1208 "tools",
1209 "tools/debugger",
1210 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001211 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001212 ]
1213 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001214 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001215 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001216 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001217 "tools/ProcStats.cpp",
1218 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001219 "tools/SkRandomScalerContext.cpp",
1220 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001221 "tools/UrlDataManager.cpp",
1222 "tools/debugger/SkDebugCanvas.cpp",
1223 "tools/debugger/SkDrawCommand.cpp",
1224 "tools/debugger/SkJsonWriteBuffer.cpp",
1225 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001226 "tools/picture_utils.cpp",
1227 "tools/random_parse_path.cpp",
1228 "tools/sk_tool_utils.cpp",
1229 "tools/sk_tool_utils_font.cpp",
1230 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001231 "tools/trace/SkChromeTracingTracer.cpp",
1232 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001233 "tools/trace/SkDebugfTracer.cpp",
1234 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001235 "tools/trace/SkEventTracingPriv.cpp",
1236 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001237 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001238 libs = []
1239 if (is_ios) {
1240 sources += [ "tools/ios_utils.m" ]
1241 libs += [ "Foundation.framework" ]
1242 }
mtkleinc095df52016-08-24 12:23:52 -07001243 deps = [
mtklein046cb562016-09-16 10:23:12 -07001244 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001245 ":flags",
1246 "//third_party/libpng",
1247 ]
1248 public_deps = [
1249 "//third_party/jsoncpp",
1250 ]
1251 }
mtklein25c81d42016-07-27 13:55:26 -07001252
Mike Klein6e744122016-10-27 12:21:40 -04001253 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001254 test_lib("gm") {
1255 public_include_dirs = [ "gm" ]
1256 sources = gm_sources
1257 deps = [
scroggo19b91532016-10-24 09:03:26 -07001258 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001259 ":gpu_tool_utils",
1260 ":skia",
1261 ":tool_utils",
1262 ]
1263 }
mtklein25c81d42016-07-27 13:55:26 -07001264
Mike Klein6e744122016-10-27 12:21:40 -04001265 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001266 test_lib("tests") {
1267 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001268 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001269 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001270 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001271 }
mtkleinc095df52016-08-24 12:23:52 -07001272 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001273 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001274 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001275 ":skia",
1276 ":tool_utils",
1277 "//third_party/libpng",
1278 "//third_party/zlib",
1279 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001280 public_deps = [
1281 ":gpu_tool_utils", # Test.h #includes headers from this target.
1282 ]
mtkleinc095df52016-08-24 12:23:52 -07001283 }
mtklein2f3416d2016-08-02 16:02:05 -07001284
Mike Klein6e744122016-10-27 12:21:40 -04001285 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001286 test_lib("bench") {
1287 public_include_dirs = [ "bench" ]
1288 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001289 deps = [
1290 ":flags",
1291 ":gm",
1292 ":gpu_tool_utils",
1293 ":skia",
1294 ":tool_utils",
1295 ]
1296 }
mtklein2b6870c2016-07-28 14:17:33 -07001297
mtkleinc095df52016-08-24 12:23:52 -07001298 test_lib("experimental_svg_model") {
1299 public_include_dirs = [ "experimental/svg/model" ]
1300 sources = [
1301 "experimental/svg/model/SkSVGAttribute.cpp",
1302 "experimental/svg/model/SkSVGAttributeParser.cpp",
1303 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001304 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001305 "experimental/svg/model/SkSVGContainer.cpp",
1306 "experimental/svg/model/SkSVGDOM.cpp",
1307 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001308 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001309 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001310 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001311 "experimental/svg/model/SkSVGNode.cpp",
1312 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001313 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001314 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001315 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001316 "experimental/svg/model/SkSVGRect.cpp",
1317 "experimental/svg/model/SkSVGRenderContext.cpp",
1318 "experimental/svg/model/SkSVGSVG.cpp",
1319 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001320 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001321 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001322 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001323 "experimental/svg/model/SkSVGValue.cpp",
1324 ]
1325 deps = [
1326 ":skia",
1327 ]
1328 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001329
Kevin Lubickebf648e2017-09-21 13:45:16 -04001330 if (target_cpu != "wasm") {
1331 test_lib("views") {
1332 public_include_dirs = [ "include/views" ]
1333 sources = [
1334 "src/views/SkEvent.cpp",
1335 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001336 "src/views/SkTouchGesture.cpp",
1337 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001338 ]
Brian Osman34755e22016-12-05 09:46:02 -05001339 }
Brian Osman16adfa32016-10-18 14:42:44 -04001340 }
1341
Mike Klein38af9432016-11-11 11:39:44 -05001342 if (skia_use_lua) {
1343 test_lib("lua") {
1344 public_include_dirs = []
1345 sources = [
1346 "src/utils/SkLua.cpp",
1347 "src/utils/SkLuaCanvas.cpp",
1348 ]
1349 deps = [
1350 "//third_party/lua",
1351 ]
1352 }
1353
Mike Kleine6682eb2017-01-05 10:54:57 -05001354 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001355 sources = [
1356 "tools/lua/lua_app.cpp",
1357 ]
1358 deps = [
1359 ":lua",
1360 ":skia",
1361 "//third_party/lua",
1362 ]
Mike Klein38af9432016-11-11 11:39:44 -05001363 }
1364
Mike Kleine6682eb2017-01-05 10:54:57 -05001365 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001366 sources = [
1367 "tools/lua/lua_pictures.cpp",
1368 ]
1369 deps = [
1370 ":flags",
1371 ":lua",
1372 ":skia",
1373 ":tool_utils",
1374 "//third_party/lua",
1375 ]
Mike Klein38af9432016-11-11 11:39:44 -05001376 }
1377 }
1378
Cary Clark8032b982017-07-28 11:04:54 -04001379 test_app("bookmaker") {
1380 sources = [
1381 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001382 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001383 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001384 "tools/bookmaker/fiddleParser.cpp",
1385 "tools/bookmaker/includeParser.cpp",
1386 "tools/bookmaker/includeWriter.cpp",
1387 "tools/bookmaker/mdOut.cpp",
1388 "tools/bookmaker/parserCommon.cpp",
1389 "tools/bookmaker/spellCheck.cpp",
1390 ]
1391 deps = [
1392 ":flags",
1393 ":skia",
1394 ":tool_utils",
1395 ]
1396 }
1397
Kevin Lubickebf648e2017-09-21 13:45:16 -04001398 if (target_cpu != "wasm") {
1399 import("gn/samples.gni")
1400 test_lib("samples") {
1401 public_include_dirs = [ "samplecode" ]
1402 include_dirs = [ "experimental" ]
1403 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001404 # Relocating these files here, so that clients don't try to build them while they're
1405 # still in active development. Clang's thread safety analysis gets tripped up by
1406 # conditional locks.
1407 "src/core/SkThreadedBMPDevice.cpp",
1408 "src/core/SkThreadedBMPDevice.h",
1409 ]
1410 deps = [
1411 ":experimental_svg_model",
1412 ":flags",
1413 ":gm",
1414 ":tool_utils",
1415 ":views",
1416 ":xml",
1417 ]
Mike Klein38af9432016-11-11 11:39:44 -05001418
Kevin Lubickebf648e2017-09-21 13:45:16 -04001419 if (skia_use_lua) {
1420 sources += [ "samplecode/SampleLua.cpp" ]
1421 deps += [
1422 ":lua",
1423 "//third_party/lua",
1424 ]
1425 }
1426 }
1427 test_app("dm") {
1428 sources = [
1429 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001430 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001431 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001432 "dm/DMJsonWriter.cpp",
1433 "dm/DMSrcSink.cpp",
1434 ]
1435 include_dirs = [ "tests" ]
1436 deps = [
1437 ":common_flags",
1438 ":experimental_svg_model",
1439 ":flags",
1440 ":gm",
1441 ":gpu_tool_utils",
1442 ":skia",
1443 ":tests",
1444 ":tool_utils",
1445 "//third_party/jsoncpp",
1446 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001447 ]
1448 }
Brian Osman16adfa32016-10-18 14:42:44 -04001449 }
1450
Mike Klein06432b22017-03-21 13:14:33 -04001451 test_app("ok") {
1452 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001453 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001454 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001455 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001456 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001457 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001458 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001459 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001460 ]
1461 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001462 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001463 ":gm",
1464 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001465 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001466 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001467 ]
1468 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001469 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001470 sources = [
1471 "bench/nanobench.cpp",
1472 ]
1473 deps = [
1474 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001475 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001476 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001477 ":flags",
1478 ":gm",
1479 ":gpu_tool_utils",
1480 ":skia",
1481 ":tool_utils",
1482 "//third_party/jsoncpp",
1483 ]
mtklein2b6870c2016-07-28 14:17:33 -07001484 }
halcanary19a97202016-08-03 15:08:04 -07001485
Ravi Mistry10d36c52017-01-31 09:49:18 -05001486 test_app("skpinfo") {
1487 sources = [
1488 "tools/skpinfo.cpp",
1489 ]
1490 deps = [
1491 ":flags",
1492 ":skia",
1493 ]
1494 }
1495
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001496 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001497 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001498 sources = [
1499 "tools/skpbench/skpbench.cpp",
1500 ]
1501 deps = [
1502 ":flags",
1503 ":gpu_tool_utils",
1504 ":skia",
1505 ":tool_utils",
1506 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001507 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001508 }
1509
Mike Klein7d302882016-11-03 14:06:31 -04001510 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001511 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001512 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001513 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001514 "tools/shape/SkShaper_harfbuzz.cpp",
1515 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001516 ]
1517 deps = [
1518 ":skia",
1519 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001520 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001521 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001522 }
halcanary19a97202016-08-03 15:08:04 -07001523 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001524 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001525 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001526 "tools/shape/SkShaper_primitive.cpp",
1527 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001528 ]
1529 deps = [
1530 ":skia",
1531 ]
halcanary3eee9d92016-09-10 07:01:53 -07001532 }
mtklein046cb562016-09-16 10:23:12 -07001533
Matt Sarett9f1c4032017-05-17 10:06:32 -04001534 test_app("create_flutter_test_images") {
1535 sources = [
1536 "tools/create_flutter_test_images.cpp",
1537 ]
1538 deps = [
1539 ":skia",
1540 ":tool_utils",
1541 ]
1542 }
1543
Ben Wagner219f3622017-07-17 15:32:25 -04001544 test_app("create_test_font") {
1545 sources = [
1546 "tools/create_test_font.cpp",
1547 ]
1548 deps = [
1549 ":skia",
1550 ]
1551 assert_no_deps = [
1552 # tool_utils requires the output of this app.
1553 ":tool_utils",
1554 ]
1555 }
1556
Mike Kleine6682eb2017-01-05 10:54:57 -05001557 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001558 sources = [
1559 "tools/get_images_from_skps.cpp",
1560 ]
1561 deps = [
1562 ":flags",
1563 ":skia",
1564 "//third_party/jsoncpp",
1565 ]
mtklein046cb562016-09-16 10:23:12 -07001566 }
mtkleinecbc5262016-09-22 11:51:24 -07001567
Mike Kleine6682eb2017-01-05 10:54:57 -05001568 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001569 sources = [
1570 "tools/colorspaceinfo.cpp",
1571 ]
1572 deps = [
1573 ":flags",
1574 ":skia",
1575 ":tool_utils",
1576 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001577 }
1578
Kevin Lubickebf648e2017-09-21 13:45:16 -04001579 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001580 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001581 sources = [
1582 "tools/skiaserve/Request.cpp",
1583 "tools/skiaserve/Response.cpp",
1584 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001585 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1586 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1587 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1588 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1589 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1590 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1591 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1592 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1593 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001594 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1595 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001596 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1597 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1598 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1599 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1600 ]
1601 deps = [
1602 ":flags",
1603 ":gpu_tool_utils",
1604 ":skia",
1605 ":tool_utils",
1606 "//third_party/jsoncpp",
1607 "//third_party/libmicrohttpd",
1608 "//third_party/libpng",
1609 ]
Mike Klein7d302882016-11-03 14:06:31 -04001610 }
mtkleinecbc5262016-09-22 11:51:24 -07001611 }
kjlubick14f984b2016-10-03 11:49:45 -07001612
Mike Kleine6682eb2017-01-05 10:54:57 -05001613 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001614 sources = [
1615 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001616 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001617 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001618 "fuzz/FuzzGradients.cpp",
1619 "fuzz/FuzzParsePath.cpp",
1620 "fuzz/FuzzPathop.cpp",
1621 "fuzz/FuzzScaleToSides.cpp",
1622 "fuzz/fuzz.cpp",
1623 ]
1624 deps = [
1625 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001626 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001627 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001628 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001629 ]
kjlubick14f984b2016-10-03 11:49:45 -07001630 }
Mike Klein38312422016-10-05 15:41:01 -04001631
Mike Kleine6682eb2017-01-05 10:54:57 -05001632 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001633 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001634 rebase_path("tests/skia_test.cpp"),
1635 rebase_path("tests/Test.cpp"),
1636 ]
caryclark9feb6322016-10-25 08:58:26 -07001637 deps = [
1638 ":flags",
1639 ":gpu_tool_utils",
1640 ":skia",
1641 ":tool_utils",
1642 ]
caryclark9feb6322016-10-25 08:58:26 -07001643 }
1644
Mike Kleine6682eb2017-01-05 10:54:57 -05001645 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001646 sources = [
1647 "tools/DumpRecord.cpp",
1648 "tools/dump_record.cpp",
1649 ]
1650 deps = [
1651 ":flags",
1652 ":skia",
1653 ]
Mike Klein38312422016-10-05 15:41:01 -04001654 }
bungemanfe917272016-10-13 17:36:40 -04001655
Mike Kleine6682eb2017-01-05 10:54:57 -05001656 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001657 sources = [
1658 "tools/skdiff/skdiff.cpp",
1659 "tools/skdiff/skdiff_html.cpp",
1660 "tools/skdiff/skdiff_main.cpp",
1661 "tools/skdiff/skdiff_utils.cpp",
1662 ]
1663 deps = [
1664 ":skia",
1665 ":tool_utils",
1666 ]
bungemanfe917272016-10-13 17:36:40 -04001667 }
halcanarya73d76a2016-10-17 13:19:02 -07001668
Mike Kleine6682eb2017-01-05 10:54:57 -05001669 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001670 sources = [
1671 "tools/skp_parser.cpp",
1672 ]
1673 deps = [
1674 ":skia",
1675 ":tool_utils",
1676 "//third_party/jsoncpp",
1677 ]
halcanarya73d76a2016-10-17 13:19:02 -07001678 }
Brian Osman16adfa32016-10-18 14:42:44 -04001679
Hal Canary75427132017-10-11 16:00:31 -04001680 if (!is_win) {
1681 test_app("gpucts") {
1682 sources = [
1683 "dm/DMGpuTestProcs.cpp",
1684 "tools/gpucts/gm_knowledge.c",
1685 "tools/gpucts/gm_runner.cpp",
1686 "tools/gpucts/gpucts.cpp",
1687 ]
1688 deps = [
1689 ":gm",
1690 ":gpu_tool_utils",
1691 ":skia",
1692 ":tests",
1693 "//third_party/googletest",
1694 ]
1695 }
1696 }
1697
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001698 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001699 test_lib("sk_app") {
1700 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001701 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001702 "tools/sk_app/CommandSet.cpp",
1703 "tools/sk_app/GLWindowContext.cpp",
1704 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001705 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001706 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001707
Jim Van Verth4e56a912016-10-21 10:58:52 -04001708 if (is_android) {
1709 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001710 "tools/sk_app/android/GLWindowContext_android.cpp",
1711 "tools/sk_app/android/RasterWindowContext_android.cpp",
1712 "tools/sk_app/android/Window_android.cpp",
1713 "tools/sk_app/android/main_android.cpp",
1714 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001715 ]
Brian Osman462334e2017-02-09 11:22:57 -05001716 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001717 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001718 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001719 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1720 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1721 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001722 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001723 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001724 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001725 libs += [
1726 "GL",
1727 "X11",
1728 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001729 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001730 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001731 "tools/sk_app/win/GLWindowContext_win.cpp",
1732 "tools/sk_app/win/RasterWindowContext_win.cpp",
1733 "tools/sk_app/win/Window_win.cpp",
1734 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001735 ]
Brian Salomon194db172017-08-17 14:37:06 -04001736 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001737 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001738 }
Mike Klein43c25262016-10-20 10:17:47 -04001739 } else if (is_mac) {
1740 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001741 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1742 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1743 "tools/sk_app/mac/Window_mac.cpp",
1744 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001745 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001746 libs += [
1747 "QuartzCore.framework",
1748 "Cocoa.framework",
1749 "Foundation.framework",
1750 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001751 } else if (is_ios) {
1752 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001753 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1754 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1755 "tools/sk_app/ios/Window_ios.cpp",
1756 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001757 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001758 }
1759
1760 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001761 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001762 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001763 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001764 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001765 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001766 libs += [ "X11-xcb" ]
1767 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001768 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001769 }
1770 }
1771
Brian Osman16adfa32016-10-18 14:42:44 -04001772 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001773 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001774 ":skia",
1775 ":tool_utils",
1776 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001777 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001778 if (is_android) {
1779 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001780 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001781 deps += [ "//third_party/libsdl" ]
1782 }
Brian Salomon194db172017-08-17 14:37:06 -04001783 if (skia_use_angle) {
1784 deps += [ "//third_party/angle2" ]
1785 }
Mike Kleina92c3832016-12-08 09:49:39 -05001786 }
Brian Osman16adfa32016-10-18 14:42:44 -04001787 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001788
Brian Osmaneff04b52017-11-21 13:18:02 -05001789 if (skia_enable_gpu) {
1790 test_app("viewer") {
1791 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001792 if (is_ios) {
1793 bundle_ios_data = true
1794 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001795 sources = [
1796 "tools/viewer/GMSlide.cpp",
1797 "tools/viewer/ImageSlide.cpp",
1798 "tools/viewer/SKPSlide.cpp",
1799 "tools/viewer/SampleSlide.cpp",
1800 "tools/viewer/Viewer.cpp",
1801 ]
1802 libs = []
1803
1804 include_dirs = []
1805 deps = [
1806 ":flags",
1807 ":gm",
1808 ":gpu_tool_utils",
1809 ":samples",
1810 ":sk_app",
1811 ":skia",
1812 ":tool_utils",
1813 ":views",
1814 "//third_party/imgui",
1815 "//third_party/jsoncpp",
1816 ]
1817 }
1818 }
1819
1820 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1821 test_app("HelloWorld") {
1822 sources = [
1823 "example/HelloWorld.cpp",
1824 ]
1825 libs = []
1826
1827 include_dirs = []
1828 deps = [
1829 ":flags",
1830 ":gpu_tool_utils",
1831 ":sk_app",
1832 ":skia",
1833 ":tool_utils",
1834 ":views",
1835 ]
1836 }
1837 }
1838
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001839 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001840 test_app("SkiaSDLExample") {
1841 sources = [
1842 "example/SkiaSDLExample.cpp",
1843 ]
1844 libs = []
1845 include_dirs = []
1846 deps = [
1847 ":gpu_tool_utils",
1848 ":skia",
1849 "//third_party/libsdl",
1850 ]
1851 }
1852 }
1853
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001854 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1855 action_foreach("generate_mocs") {
1856 script = "gn/call.py"
1857 sources = [
1858 "tools/mdbviz/MainWindow.h",
1859 ]
1860 outputs = [
1861 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1862 ]
1863 args = [
1864 "$skia_qt_path" + "/bin/moc",
1865 "{{source}}",
1866 "-o",
1867 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1868 ]
1869 }
1870 action_foreach("generate_resources") {
1871 script = "gn/call.py"
1872 sources = [
1873 "tools/mdbviz/resources.qrc",
1874 ]
1875 outputs = [
1876 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1877 ]
1878 args = [
1879 "$skia_qt_path" + "/bin/rcc",
1880 "{{source}}",
1881 "-o",
1882 "gen/mdbviz/{{source_name_part}}_res.cpp",
1883 ]
1884 }
1885 test_app("mdbviz") {
1886 if (is_win) {
1887 # on Windows we need to disable some exception handling warnings due to the Qt headers
1888 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1889 }
1890 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001891 "tools/UrlDataManager.cpp",
1892 "tools/debugger/SkDebugCanvas.cpp",
1893 "tools/debugger/SkDrawCommand.cpp",
1894 "tools/debugger/SkJsonWriteBuffer.cpp",
1895 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001896 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001897 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001898 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001899 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001900
1901 # generated files
1902 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1903 "$target_gen_dir/mdbviz/resources_res.cpp",
1904 ]
1905 lib_dirs = [ "$skia_qt_path/lib" ]
1906 libs = [
1907 "Qt5Core.lib",
1908 "Qt5Gui.lib",
1909 "Qt5Widgets.lib",
1910 ]
1911 include_dirs = [
1912 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001913 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001914 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001915 "tools",
1916 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001917 ]
1918 deps = [
1919 ":generate_mocs",
1920 ":generate_resources",
1921 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001922 "//third_party/jsoncpp",
1923 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001924 ]
1925 }
1926 }
1927
Mike Kleine459afd2017-03-03 09:21:30 -05001928 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001929 copy("gdbserver") {
1930 sources = [
1931 "$ndk/$ndk_gdbserver",
1932 ]
1933 outputs = [
1934 "$root_out_dir/gdbserver",
1935 ]
1936 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001937 }
mtklein25c81d42016-07-27 13:55:26 -07001938}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001939
1940if (skia_jumper_clang != "") {
1941 action("regen_jumper") {
1942 script = "src/jumper/build_stages.py"
1943
1944 inputs = [
1945 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001946 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001947 ]
1948
1949 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1950 outputs = [
1951 "$target_out_dir/" +
1952 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1953 "$target_out_dir/" +
1954 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1955 ]
1956
1957 args = [
1958 skia_jumper_clang,
1959 skia_jumper_objdump,
1960 skia_jumper_ccache,
1961 ] + rebase_path(inputs) + rebase_path(outputs)
1962 }
1963}