blob: 5bc5376242ec7d65c5af461a4dca5cd7e32632c5 [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 }
Jim Van Verth4e502972017-12-07 15:16:10 -050065
66 if (is_ios) {
67 skia_ios_identity = ".*Google.*"
68 skia_ios_profile = "Google Development"
69 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040070}
Greg Danielec6ae522017-04-25 13:38:26 -040071declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050072 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040073 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000074 # 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 -040075 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050076 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040077 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050078 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040079 }
Greg Danielec6ae522017-04-25 13:38:26 -040080 }
81}
Brian Salomon789e25e2016-09-30 13:41:03 -040082
Adam Barth54ef74a2017-10-13 10:59:38 -070083if (defined(skia_settings)) {
84 import(skia_settings)
85}
86
mtklein38925aa2016-09-21 10:11:25 -070087# Our tools require static linking (they use non-exported symbols).
88skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070089
mtkleina45be612016-08-29 15:22:10 -070090fontmgr_android_enabled = skia_use_expat && skia_use_freetype
91
mtklein1211e0c2016-07-26 13:55:45 -070092skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070093 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070094 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/codec",
96 "include/config",
97 "include/core",
98 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040099 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/gpu",
101 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500102 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/pathops",
104 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700105 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/utils",
107 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700108]
109
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000110if (skia_use_vulkan) {
111 skia_public_includes += [ "include/gpu/vk" ]
112}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500113if (skia_enable_atlas_text) {
114 skia_public_includes += [ "include/atlastext" ]
115}
Greg Daniele5ddff52017-07-05 16:49:36 -0400116if (skia_use_metal) {
117 skia_public_includes += [ "include/gpu/mtl" ]
118}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000119
mtkleinc04ff472016-06-23 10:29:30 -0700120# Skia public API, generally provided by :skia.
121config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700122 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500123 if (skia_tools_vulkan_header_dir != "") {
124 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400125 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400126 defines = []
127 if (is_component_build) {
128 defines += [ "SKIA_DLL" ]
129 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400130 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700131 defines += [ "SK_SAMPLES_FOR_X" ]
132 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400133 if (skia_enable_flutter_defines) {
134 defines += flutter_defines
135 }
mtklein06c35c02016-09-20 12:28:12 -0700136 if (!skia_enable_gpu) {
137 defines += [ "SK_SUPPORT_GPU=0" ]
138 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500139 if (skia_enable_atlas_text) {
140 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
141 }
mtkleinc04ff472016-06-23 10:29:30 -0700142}
143
144# Skia internal APIs, used by Skia itself and a few test tools.
145config("skia_private") {
146 visibility = [ ":*" ]
147
148 include_dirs = [
149 "include/private",
150 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700151 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700152 "src/core",
153 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700154 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/image",
156 "src/images",
157 "src/lazy",
158 "src/opts",
159 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700160 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700161 "src/ports",
162 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400163 "src/shaders",
164 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700165 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700166 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700167 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500168 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700169 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700170 ]
mtklein150d1132016-08-01 06:56:40 -0700171
Mike Reeda9e241d2017-05-03 10:52:00 -0400172 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700173 if (is_android) {
174 defines += [
175 "SK_GAMMA_EXPONENT=1.4",
176 "SK_GAMMA_CONTRAST=0.0",
177 ]
178 }
mtklein88a7ac02016-09-14 11:16:49 -0700179 if (is_official_build || is_android) {
180 # TODO(bsalomon): it'd be nice to make Android normal.
181 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
182 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400183 libs = []
184 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500185 if (skia_enable_gpu) {
186 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500187 if (is_skia_dev_build && skia_use_vulkan) {
188 include_dirs += [ "tools/gpu/vk" ]
189 }
Brian Salomon03e05842017-02-23 12:23:47 -0500190 }
Brian Osman34755e22016-12-05 09:46:02 -0500191 if (skia_use_angle) {
192 defines += [ "SK_ANGLE" ]
193 }
Brian Osman3f375d02016-12-28 11:19:22 -0500194 if (skia_enable_discrete_gpu) {
195 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
196 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400197 if (!is_official_build) {
198 defines += [ "GR_TEST_UTILS=1" ]
199 }
mtkleinc04ff472016-06-23 10:29:30 -0700200}
201
202# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
203config("skia_library") {
204 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700205 defines = [ "SKIA_IMPLEMENTATION=1" ]
206}
207
208skia_library_configs = [
209 ":skia_public",
210 ":skia_private",
211 ":skia_library",
212]
213
mtklein9b8583d2016-08-24 17:32:30 -0700214# Use for CPU-specific Skia code that needs particular compiler flags.
215template("opts") {
216 if (invoker.enabled) {
217 source_set(target_name) {
218 forward_variables_from(invoker, "*")
219 configs += skia_library_configs
220 }
221 } else {
222 # If not enabled, a phony empty target that swallows all otherwise unused variables.
223 source_set(target_name) {
224 forward_variables_from(invoker,
225 "*",
226 [
227 "sources",
228 "cflags",
229 ])
230 }
231 }
anmittala7eaf2e2016-08-17 13:57:26 -0700232}
233
mtklein422310d2016-08-16 18:28:43 -0700234is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700235
mtklein7d6fb2c2016-08-25 14:50:44 -0700236opts("none") {
237 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700239 cflags = []
240}
241
mtklein7d6fb2c2016-08-25 14:50:44 -0700242opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700243 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700245 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700246}
247
248opts("arm64") {
249 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700251 cflags = []
252}
253
254opts("crc32") {
255 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700257 cflags = [ "-march=armv8-a+crc" ]
258}
259
mtklein9b8583d2016-08-24 17:32:30 -0700260opts("sse2") {
261 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700262 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400263 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400264 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
265 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400266 cflags = [ "-msse2" ]
267 }
mtklein9b8583d2016-08-24 17:32:30 -0700268}
mtkleinc04ff472016-06-23 10:29:30 -0700269
mtklein9b8583d2016-08-24 17:32:30 -0700270opts("ssse3") {
271 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700272 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400273 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400274 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
275 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400276 cflags = [ "-mssse3" ]
277 }
mtklein9b8583d2016-08-24 17:32:30 -0700278}
mtkleinc04ff472016-06-23 10:29:30 -0700279
mtklein9b8583d2016-08-24 17:32:30 -0700280opts("sse41") {
281 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700282 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400283 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400284 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
285 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400286 cflags = [ "-msse4.1" ]
287 }
mtklein9b8583d2016-08-24 17:32:30 -0700288}
mtklein4e976072016-08-08 09:06:27 -0700289
mtklein9b8583d2016-08-24 17:32:30 -0700290opts("sse42") {
291 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700292 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400293 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400294 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
295 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400296 cflags = [ "-msse4.2" ]
297 }
mtklein9b8583d2016-08-24 17:32:30 -0700298}
299
300opts("avx") {
301 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700302 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400303 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000304 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400305 } else {
306 cflags = [ "-mavx" ]
307 }
mtkleinc04ff472016-06-23 10:29:30 -0700308}
309
mtkleinc095df52016-08-24 12:23:52 -0700310# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700311template("optional") {
312 if (invoker.enabled) {
313 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700314 if (defined(invoker.public_defines)) {
315 defines = invoker.public_defines
316 }
mtklein457b42a2016-08-23 13:56:37 -0700317 }
318 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700319 forward_variables_from(invoker,
320 "*",
321 [
322 "public_defines",
323 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700324 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700325 ])
mtklein457b42a2016-08-23 13:56:37 -0700326 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700327 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700328 if (defined(invoker.configs_to_remove)) {
329 configs -= invoker.configs_to_remove
330 }
mtklein457b42a2016-08-23 13:56:37 -0700331 }
332 } else {
mtklein457b42a2016-08-23 13:56:37 -0700333 source_set(target_name) {
334 forward_variables_from(invoker,
335 "*",
336 [
337 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700338 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700339 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700340 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700341 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700342 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700343 ])
mtkleincd01b032016-08-31 04:58:19 -0700344 if (defined(invoker.sources_when_disabled)) {
345 sources = invoker.sources_when_disabled
346 }
347 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700348 }
mtkleineb3c4252016-08-23 07:38:09 -0700349 }
mtklein457b42a2016-08-23 13:56:37 -0700350}
mtklein457b42a2016-08-23 13:56:37 -0700351
Mike Kleina04bb452017-02-09 12:24:07 -0500352optional("effects") {
353 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400354 deps = [
355 ":compile_processors",
356 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500357 sources =
358 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
359 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
360}
361
mtkleina45be612016-08-29 15:22:10 -0700362optional("fontmgr_android") {
363 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700364
365 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500366 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700367 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700368 ]
369 sources = [
370 "src/ports/SkFontMgr_android.cpp",
371 "src/ports/SkFontMgr_android_factory.cpp",
372 "src/ports/SkFontMgr_android_parser.cpp",
373 ]
374}
375
mtkleind2e39db2016-09-07 07:52:55 -0700376optional("fontmgr_custom") {
377 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
378
379 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500380 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700381 ]
382 sources = [
383 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500384 "src/ports/SkFontMgr_custom.h",
385 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700386 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500387 "src/ports/SkFontMgr_custom_embedded.cpp",
388 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700389 ]
390}
391
mtklein3cc22182016-08-29 13:26:14 -0700392optional("fontmgr_fontconfig") {
393 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700394
395 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500396 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700397 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700398 ]
399 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700400 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700401 "src/ports/SkFontConfigInterface_direct.cpp",
402 "src/ports/SkFontConfigInterface_direct_factory.cpp",
403 "src/ports/SkFontMgr_FontConfigInterface.cpp",
404 "src/ports/SkFontMgr_fontconfig.cpp",
405 "src/ports/SkFontMgr_fontconfig_factory.cpp",
406 ]
407}
408
mtkleincdedd0e2016-09-12 15:15:44 -0700409optional("fontmgr_fuchsia") {
410 enabled = is_fuchsia && skia_use_freetype
411
412 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500413 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700414 ]
415 sources = [
416 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500417 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700418 "src/ports/SkFontMgr_custom_empty_factory.cpp",
419 ]
420}
421
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700422if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400423 executable("sksllex") {
424 sources = [
425 "src/sksl/lex/Main.cpp",
426 "src/sksl/lex/NFA.cpp",
427 "src/sksl/lex/RegexNode.cpp",
428 "src/sksl/lex/RegexParser.cpp",
429 ]
430 include_dirs = [ "src/sksl/lex" ]
431 }
432
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700433 action("run_sksllex") {
434 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400435 deps = [
436 ":sksllex(//gn/toolchain:$host_toolchain)",
437 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700438 sources = [
439 "src/sksl/lex/layout.lex",
440 "src/sksl/lex/sksl.lex",
441 ]
442
443 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
444 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
445 outputs = [
446 "$target_out_dir/" +
447 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
448 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
449 # confused due to the same file being named by two different paths
450 ]
451 sksllex_path = "$root_out_dir/"
452 sksllex_path += "sksllex"
453 if (host_os == "win") {
454 sksllex_path += ".exe"
455 }
456 args = [
457 rebase_path(sksllex_path),
458 rebase_path("bin/clang-format"),
459 rebase_path("src"),
460 ]
461 }
462} else {
463 group("run_sksllex") {
464 }
465}
466
467if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400468 executable("skslc") {
469 defines = [ "SKSL_STANDALONE" ]
470 sources = [
471 "src/sksl/SkSLMain.cpp",
472 ]
473 sources += skia_sksl_sources
474 include_dirs = [
475 "src/gpu",
476 "src/sksl",
477 ]
478 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500479 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400480 "//third_party/spirv-tools",
481 ]
482 }
483
484 skia_gpu_processor_outputs = []
485 foreach(src, skia_gpu_processor_sources) {
486 dir = get_path_info(src, "dir")
487 name = get_path_info(src, "name")
488
489 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
490 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
491 skia_gpu_processor_outputs += [
492 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
493 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
494 # confused due to the same file being named by two different paths
495 ]
496 }
497
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500498 action("create_sksl_enums") {
499 script = "gn/create_sksl_enums.py"
500 sources = [
501 "include/private/GrSharedEnums.h",
502 ]
503 outputs = [
504 "$target_out_dir/" +
505 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
506 ]
507 args = [
508 rebase_path(sources[0]),
509 rebase_path(outputs[0]),
510 ]
511 }
512
Ethan Nicholas762466e2017-06-29 10:03:38 -0400513 action("compile_processors") {
514 script = "gn/compile_processors.py"
515 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500516 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400517 ":skslc(//gn/toolchain:$host_toolchain)",
518 ]
519 sources = skia_gpu_processor_sources
520 outputs = skia_gpu_processor_outputs
521 skslc_path = "$root_out_dir/"
522 if (host_toolchain != default_toolchain_name) {
523 skslc_path += "$host_toolchain/"
524 }
525 skslc_path += "skslc"
526 if (host_os == "win") {
527 skslc_path += ".exe"
528 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400529 args = [
530 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400531 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400532 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400533 args += rebase_path(skia_gpu_processor_sources)
534 }
535} else {
536 skia_gpu_processor_outputs = []
537 group("compile_processors") {
538 }
539}
540
mtklein06c35c02016-09-20 12:28:12 -0700541optional("gpu") {
542 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400543 deps = [
544 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700545 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400546 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700547 public_defines = []
548
Mike Klein29b3e582017-02-09 11:57:32 -0500549 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400550 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
551 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700552
553 # These paths need to be absolute to match the ones produced by shared_sources.gni.
554 sources -= get_path_info([
555 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
556 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
557 ],
558 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400559 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700560 if (is_android) {
561 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400562
563 # this lib is required to link against AHardwareBuffer
564 if (defined(ndk_api) && ndk_api >= 26) {
565 libs += [ "android" ]
566 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400567 } else if (skia_use_egl) {
568 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
569 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700570 } else if (is_linux) {
571 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500572 libs += [
573 "GL",
574 "GLU",
575 ]
mtklein06c35c02016-09-20 12:28:12 -0700576 } else if (is_mac) {
577 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800578 } else if (is_ios) {
579 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400580 } else if (is_win) {
581 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
582 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700583 } else {
584 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
585 }
mtkleine9fb3d52016-09-20 15:11:46 -0700586
587 if (skia_use_vulkan) {
588 public_defines += [ "SK_VULKAN" ]
589 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700590 if (skia_enable_vulkan_debug_layers) {
591 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
592 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500593 if (skia_vulkan_header != "") {
594 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
595 } else {
596 if (is_skia_dev_build) {
597 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
598 }
599 }
mtkleine9fb3d52016-09-20 15:11:46 -0700600 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400601 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400602 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400603 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
604 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400605
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400606 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400607 if (skia_use_metal) {
608 public_defines += [ "SK_METAL" ]
609 sources += skia_metal_sources
610 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400611 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400612 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500613
614 if (skia_enable_atlas_text) {
615 sources += skia_atlas_text_sources
616 }
mtklein06c35c02016-09-20 12:28:12 -0700617}
618
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400619optional("heif") {
620 enabled = skia_use_libheif
621 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
622
623 deps = []
624
625 sources = [
626 "src/codec/SkHeifCodec.cpp",
627 ]
628}
629
mtklein63213812016-08-24 09:55:56 -0700630optional("jpeg") {
631 enabled = skia_use_libjpeg_turbo
632 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
633
mtklein63213812016-08-24 09:55:56 -0700634 deps = [
635 "//third_party/libjpeg-turbo:libjpeg",
636 ]
637 sources = [
638 "src/codec/SkJpegCodec.cpp",
639 "src/codec/SkJpegDecoderMgr.cpp",
640 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700641 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400642 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700643 ]
644}
645
646optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500647 enabled = skia_use_zlib && skia_enable_pdf
648 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700649
mtklein63213812016-08-24 09:55:56 -0700650 deps = [
651 "//third_party/zlib",
652 ]
brettwb9447282016-09-01 14:24:39 -0700653 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700654 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700655
656 if (skia_use_sfntly) {
657 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500658 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700659 }
660}
661
662optional("png") {
663 enabled = skia_use_libpng
664 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
665
mtklein63213812016-08-24 09:55:56 -0700666 deps = [
667 "//third_party/libpng",
668 ]
669 sources = [
670 "src/codec/SkIcoCodec.cpp",
671 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400672 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700673 ]
674}
675
scroggof84ad642016-10-31 09:02:57 -0700676optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400677 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700678 public_defines = [ "SK_CODEC_DECODES_RAW" ]
679
680 deps = [
681 "//third_party/dng_sdk",
682 "//third_party/libjpeg-turbo:libjpeg",
683 "//third_party/piex",
684 ]
685
686 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
687 # Skia.
688 configs_to_remove = [ "//gn:no_exceptions" ]
689
690 sources = [
691 "src/codec/SkRawAdapterCodec.cpp",
692 "src/codec/SkRawCodec.cpp",
693 ]
694}
695
mtklein3cc22182016-08-29 13:26:14 -0700696optional("typeface_freetype") {
697 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700698
699 deps = [
700 "//third_party/freetype2",
701 ]
702 sources = [
703 "src/ports/SkFontHost_FreeType.cpp",
704 "src/ports/SkFontHost_FreeType_common.cpp",
705 ]
706}
707
mtklein457b42a2016-08-23 13:56:37 -0700708optional("webp") {
709 enabled = skia_use_libwebp
710 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
711
mtklein457b42a2016-08-23 13:56:37 -0700712 deps = [
713 "//third_party/libwebp",
714 ]
715 sources = [
716 "src/codec/SkWebpAdapterCodec.cpp",
717 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400718 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700719 ]
mtkleineb3c4252016-08-23 07:38:09 -0700720}
721
mtklein63213812016-08-24 09:55:56 -0700722optional("xml") {
723 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000724 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700725
mtklein63213812016-08-24 09:55:56 -0700726 deps = [
727 "//third_party/expat",
728 ]
729 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500730 "src/svg/SkSVGCanvas.cpp",
731 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700732 "src/xml/SkDOM.cpp",
733 "src/xml/SkXMLParser.cpp",
734 "src/xml/SkXMLWriter.cpp",
735 ]
736}
737
mtkleinc04ff472016-06-23 10:29:30 -0700738component("skia") {
739 public_configs = [ ":skia_public" ]
740 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700741
742 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700743 ":arm64",
744 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700745 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700746 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500747 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700748 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700749 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700750 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700751 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700752 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400753 ":heif",
mtklein63213812016-08-24 09:55:56 -0700754 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700755 ":none",
mtklein63213812016-08-24 09:55:56 -0700756 ":pdf",
757 ":png",
scroggof84ad642016-10-31 09:02:57 -0700758 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700759 ":sse2",
760 ":sse41",
761 ":sse42",
762 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700763 ":webp",
mtklein63213812016-08-24 09:55:56 -0700764 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700765 ]
766
Chinmay Garde43f115c2016-11-16 15:04:12 -0800767 # This file (and all GN files in Skia) are designed to work with an
768 # empty sources assignment filter; we handle all that explicitly.
769 # We clear the filter here for clients who may have set up a global filter.
770 set_sources_assignment_filter([])
771
mtkleinc04ff472016-06-23 10:29:30 -0700772 sources = []
brettwb9447282016-09-01 14:24:39 -0700773 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700774 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500775 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700776 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400777 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700778 "src/android/SkBitmapRegionCodec.cpp",
779 "src/android/SkBitmapRegionDecoder.cpp",
780 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400781 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700782 "src/codec/SkBmpCodec.cpp",
783 "src/codec/SkBmpMaskCodec.cpp",
784 "src/codec/SkBmpRLECodec.cpp",
785 "src/codec/SkBmpStandardCodec.cpp",
786 "src/codec/SkCodec.cpp",
787 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700788 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700789 "src/codec/SkMaskSwizzler.cpp",
790 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700791 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700792 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700793 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700794 "src/codec/SkSwizzler.cpp",
795 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700796 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700797 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700798 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700799 "src/ports/SkMemory_malloc.cpp",
800 "src/ports/SkOSFile_stdio.cpp",
801 "src/sfnt/SkOTTable_name.cpp",
802 "src/sfnt/SkOTUtils.cpp",
803 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700804 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700805 ]
brettwb9447282016-09-01 14:24:39 -0700806
mtklein7d6fb2c2016-08-25 14:50:44 -0700807 libs = []
808
mtkleinc04ff472016-06-23 10:29:30 -0700809 if (is_win) {
810 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400811 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700812 "src/ports/SkDebug_win.cpp",
813 "src/ports/SkFontHost_win.cpp",
814 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500815 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700816 "src/ports/SkImageEncoder_WIC.cpp",
817 "src/ports/SkImageGeneratorWIC.cpp",
818 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700819 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/ports/SkScalerContext_win_dw.cpp",
821 "src/ports/SkTLS_win.cpp",
822 "src/ports/SkTypeface_win_dw.cpp",
823 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400824 libs += [
825 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500826 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400827 "Ole32.lib",
828 "OleAut32.lib",
829 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500830 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400831 ]
mtkleinc04ff472016-06-23 10:29:30 -0700832 } else {
833 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700834 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700835 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700836 "src/ports/SkTLS_pthread.cpp",
837 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400838 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700839 }
840
mtklein7d6fb2c2016-08-25 14:50:44 -0700841 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500842 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500843 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500844 deps += [ "//third_party/cpu-features" ]
845 }
mtklein06c35c02016-09-20 12:28:12 -0700846 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700847 libs += [
848 "EGL",
849 "GLESv2",
850 "log",
851 ]
852 }
853
mtkleinc04ff472016-06-23 10:29:30 -0700854 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700855 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700856 }
857
858 if (is_mac) {
859 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700860 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700861 "src/ports/SkFontHost_mac.cpp",
862 "src/ports/SkImageEncoder_CG.cpp",
863 "src/ports/SkImageGeneratorCG.cpp",
864 ]
mtklein09e61f72016-08-23 13:35:28 -0700865 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400866 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
867 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700868 "ApplicationServices.framework",
869 "OpenGL.framework",
870 ]
mtkleinc04ff472016-06-23 10:29:30 -0700871 }
abarth6fc8ff02016-07-15 15:15:15 -0700872
Mike Klein7d302882016-11-03 14:06:31 -0400873 if (is_ios) {
874 sources += [
875 "src/ports/SkDebug_stdio.cpp",
876 "src/ports/SkFontHost_mac.cpp",
877 "src/ports/SkImageEncoder_CG.cpp",
878 "src/ports/SkImageGeneratorCG.cpp",
879 ]
880 libs += [
881 "CoreFoundation.framework",
882 "CoreGraphics.framework",
883 "CoreText.framework",
884 "ImageIO.framework",
885 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400886
887 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
888 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400889 ]
890 }
891
abarth6fc8ff02016-07-15 15:15:15 -0700892 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700893 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700894 }
mtkleinc04ff472016-06-23 10:29:30 -0700895}
896
mtkleinc095df52016-08-24 12:23:52 -0700897# Targets guarded by skia_enable_tools may use //third_party freely.
898if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500899 # Used by gn_to_bp.py to list our public include dirs.
900 source_set("public") {
901 configs += [ ":skia_public" ]
902 }
903
Mike Kleinc36dedf2016-11-18 09:35:28 -0500904 config("skia.h_config") {
905 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500906 if (skia_use_vulkan) {
907 # So we can get the header which includes vulkan
908 include_dirs += [ "tools/gpu/vk" ]
909 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500910 }
911 action("skia.h") {
912 public_configs = [ ":skia.h_config" ]
913 skia_h = "$target_gen_dir/skia.h"
914 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400915 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000916 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500917 depfile = "$skia_h.deps"
918 outputs = [
919 skia_h,
920 ]
921 }
922
923 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500924 executable("fiddle") {
925 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500926 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500927 "tools/fiddle/draw.cpp",
928 "tools/fiddle/fiddle_main.cpp",
929 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400930
931 if (skia_use_egl) {
932 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400933 } else {
934 sources += [ "tools/fiddle/null_context.cpp" ]
935 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400936 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500937 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400938 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500939 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500940 ":skia",
941 ":skia.h",
942 ]
943 }
944 }
945
946 if (skia_enable_gpu) {
947 source_set("public_headers_warnings_check") {
948 sources = [
949 "tools/public_headers_warnings_check.cpp",
950 ]
951 configs -= [ "//gn:warnings_except_public_headers" ]
952 deps = [
953 ":skia",
954 ":skia.h",
955 ]
956 }
957 }
958
mtkleinc095df52016-08-24 12:23:52 -0700959 template("test_lib") {
960 config(target_name + "_config") {
961 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700962 if (defined(invoker.public_defines)) {
963 defines = invoker.public_defines
964 }
mtklein25c81d42016-07-27 13:55:26 -0700965 }
mtkleinc095df52016-08-24 12:23:52 -0700966 source_set(target_name) {
967 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
968 public_configs = [
969 ":" + target_name + "_config",
970 ":skia_private",
971 ]
972
973 if (!defined(deps)) {
974 deps = []
975 }
976 deps += [ ":skia" ]
977 testonly = true
978 }
mtklein25c81d42016-07-27 13:55:26 -0700979 }
mtklein25c81d42016-07-27 13:55:26 -0700980
Mike Kleine6682eb2017-01-05 10:54:57 -0500981 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -0500982 if (is_ios) {
983 app_name = target_name
984 gen_path = target_gen_dir
985
986 action("${app_name}_generate_info_plist") {
987 script = "//gn/gen_plist_ios.py"
988 outputs = [
989 "$gen_path/${app_name}_Info.plist",
990 ]
991 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
992 }
993
994 bundle_data("${app_name}_bundle_info_plist") {
995 public_deps = [
996 ":${app_name}_generate_info_plist",
997 ]
998 sources = [
999 "$gen_path/${app_name}_Info.plist",
1000 ]
1001 outputs = [
1002 "{{bundle_root_dir}}/Info.plist",
1003 ]
1004 }
1005
Jim Van Verth329c5a62017-11-29 11:42:33 -05001006 bundle_ios_data =
1007 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1008
1009 if (bundle_ios_data) {
1010 has_skps =
1011 "True" == exec_script("//gn/checkdir.py",
1012 [ rebase_path("skps", root_build_dir) ],
1013 "trim string")
1014 bundle_data("${app_name}_bundle_resources") {
1015 sources = [
1016 "resources",
1017 ]
1018 outputs = [
1019 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1020 "{{bundle_resources_dir}}/data/resources",
1021 ]
1022 }
1023
1024 if (has_skps) {
1025 bundle_data("${app_name}_bundle_skps") {
1026 sources = [
1027 "skps",
1028 ]
1029 outputs = [
1030 # Store in same folder as resources
1031 "{{bundle_resources_dir}}/data/skps",
1032 ]
1033 }
1034 }
1035 }
1036
Jim Van Verth443a9132017-11-28 09:45:26 -05001037 executable("${app_name}_generate_executable") {
1038 forward_variables_from(invoker,
1039 "*",
1040 [
1041 "output_name",
1042 "visibility",
1043 "is_shared_library",
1044 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001045 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001046 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001047 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1048 }
1049
1050 bundle_data("${app_name}_bundle_executable") {
1051 public_deps = [
1052 ":${app_name}_generate_executable",
1053 ]
1054 sources = [
1055 "$gen_path/$app_name",
1056 ]
1057 outputs = [
1058 "{{bundle_executable_dir}}/$app_name",
1059 ]
1060 testonly = true
1061 }
1062
1063 create_bundle("$app_name") {
1064 product_type = "com.apple.product-type.application"
1065 testonly = true
1066
1067 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1068 bundle_resources_dir = bundle_root_dir
1069 bundle_executable_dir = bundle_root_dir
1070 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1071
1072 deps = [
1073 ":${app_name}_bundle_executable",
1074 ":${app_name}_bundle_info_plist",
1075 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001076 if (bundle_ios_data) {
1077 deps += [ ":${app_name}_bundle_resources" ]
1078 if (has_skps) {
1079 deps += [ ":${app_name}_bundle_skps" ]
1080 }
1081 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001082
1083 # should only code sign when running on a device, not the simulator
1084 if (target_cpu != "x64") {
1085 code_signing_script = "//gn/codesign_ios.py"
1086 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1087 code_signing_outputs = [
1088 "$bundle_root_dir/_CodeSignature/CodeResources",
1089 "$bundle_root_dir/embedded.mobileprovision",
1090 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001091 code_signing_args = [
1092 rebase_path("$bundle_root_dir", root_build_dir),
1093 skia_ios_identity,
1094 skia_ios_profile,
1095 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001096 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001097 }
1098 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001099 # !is_ios
1100
1101 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1102 shared_library("lib" + target_name) {
1103 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1104 configs += [ ":skia_private" ]
1105 testonly = true
1106 }
1107 } else {
1108 _executable = target_name
1109 executable(_executable) {
1110 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1111 configs += [ ":skia_private" ]
1112 testonly = true
1113 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001114 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001115 if (is_android && skia_android_serial != "" && defined(_executable)) {
1116 action("push_" + target_name) {
1117 script = "gn/push_to_android.py"
1118 deps = [
1119 ":" + _executable,
1120 ]
1121 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1122 outputs = [
1123 _stamp,
1124 ]
1125 args = [
1126 rebase_path("$root_build_dir/$_executable"),
1127 skia_android_serial,
1128 rebase_path(_stamp),
1129 ]
1130 testonly = true
1131 }
Mike Klein7d921032017-01-05 12:20:41 -05001132 }
1133 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001134 }
1135
mtkleinc095df52016-08-24 12:23:52 -07001136 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001137 public_include_dirs = []
1138 if (skia_enable_gpu) {
1139 public_defines = []
1140 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001141
1142 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001143 sources = [
1144 "tools/gpu/GrContextFactory.cpp",
1145 "tools/gpu/GrTest.cpp",
1146 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001147 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001148 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001149 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001150 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1151 "tools/gpu/gl/debug/GrBufferObj.cpp",
1152 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1153 "tools/gpu/gl/debug/GrProgramObj.cpp",
1154 "tools/gpu/gl/debug/GrShaderObj.cpp",
1155 "tools/gpu/gl/debug/GrTextureObj.cpp",
1156 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1157 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001158 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001159 ]
1160 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001161
Kevin Lubick4a24e102017-03-29 11:19:01 -04001162 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001163 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001164 } else if (is_ios) {
1165 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1166 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001167 } else if (is_linux) {
1168 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001169 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001170 } else if (is_mac) {
1171 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001172 } else if (is_win) {
1173 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1174 libs += [
1175 "Gdi32.lib",
1176 "OpenGL32.lib",
1177 ]
mtklein38925aa2016-09-21 10:11:25 -07001178 }
mtklein6ef69992016-09-14 06:12:09 -07001179
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001180 cflags_objcc = [ "-fobjc-arc" ]
1181
Mike Kleinc168a3a2016-11-14 14:53:13 +00001182 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001183 deps += [ "//third_party/angle2" ]
1184 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1185 }
mtkleind68f9b02016-09-23 13:18:41 -07001186 if (skia_use_vulkan) {
1187 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001188 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001189 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001190 if (skia_use_metal) {
1191 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1192 }
mtkleina627b5c2016-09-20 13:36:47 -07001193 }
mtklein25c81d42016-07-27 13:55:26 -07001194 }
mtklein25c81d42016-07-27 13:55:26 -07001195
mtkleinc095df52016-08-24 12:23:52 -07001196 test_lib("flags") {
1197 public_include_dirs = [ "tools/flags" ]
1198 sources = [
1199 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001200 ]
1201 }
1202 test_lib("common_flags") {
1203 public_include_dirs = [ "tools/flags" ]
1204 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001205 "tools/flags/SkCommonFlags.cpp",
1206 "tools/flags/SkCommonFlagsConfig.cpp",
1207 ]
1208 deps = [
mtklein046cb562016-09-16 10:23:12 -07001209 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001210 ":gpu_tool_utils",
1211 ]
1212 }
mtklein25c81d42016-07-27 13:55:26 -07001213
mtkleinc095df52016-08-24 12:23:52 -07001214 test_lib("tool_utils") {
1215 public_include_dirs = [
1216 "tools",
1217 "tools/debugger",
1218 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001219 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001220 ]
1221 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001222 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001223 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001224 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001225 "tools/ProcStats.cpp",
1226 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001227 "tools/SkRandomScalerContext.cpp",
1228 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001229 "tools/UrlDataManager.cpp",
1230 "tools/debugger/SkDebugCanvas.cpp",
1231 "tools/debugger/SkDrawCommand.cpp",
1232 "tools/debugger/SkJsonWriteBuffer.cpp",
1233 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001234 "tools/picture_utils.cpp",
1235 "tools/random_parse_path.cpp",
1236 "tools/sk_tool_utils.cpp",
1237 "tools/sk_tool_utils_font.cpp",
1238 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001239 "tools/trace/SkChromeTracingTracer.cpp",
1240 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001241 "tools/trace/SkDebugfTracer.cpp",
1242 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001243 "tools/trace/SkEventTracingPriv.cpp",
1244 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001245 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001246 libs = []
1247 if (is_ios) {
1248 sources += [ "tools/ios_utils.m" ]
1249 libs += [ "Foundation.framework" ]
1250 }
mtkleinc095df52016-08-24 12:23:52 -07001251 deps = [
mtklein046cb562016-09-16 10:23:12 -07001252 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001253 ":flags",
1254 "//third_party/libpng",
1255 ]
1256 public_deps = [
1257 "//third_party/jsoncpp",
1258 ]
1259 }
mtklein25c81d42016-07-27 13:55:26 -07001260
Mike Klein6e744122016-10-27 12:21:40 -04001261 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001262 test_lib("gm") {
1263 public_include_dirs = [ "gm" ]
1264 sources = gm_sources
1265 deps = [
scroggo19b91532016-10-24 09:03:26 -07001266 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001267 ":gpu_tool_utils",
1268 ":skia",
1269 ":tool_utils",
1270 ]
1271 }
mtklein25c81d42016-07-27 13:55:26 -07001272
Mike Klein6e744122016-10-27 12:21:40 -04001273 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001274 test_lib("tests") {
1275 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001276 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001277 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001278 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001279 }
mtkleinc095df52016-08-24 12:23:52 -07001280 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001281 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001282 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001283 ":skia",
1284 ":tool_utils",
1285 "//third_party/libpng",
1286 "//third_party/zlib",
1287 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001288 public_deps = [
1289 ":gpu_tool_utils", # Test.h #includes headers from this target.
1290 ]
mtkleinc095df52016-08-24 12:23:52 -07001291 }
mtklein2f3416d2016-08-02 16:02:05 -07001292
Mike Klein6e744122016-10-27 12:21:40 -04001293 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001294 test_lib("bench") {
1295 public_include_dirs = [ "bench" ]
1296 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001297 deps = [
1298 ":flags",
1299 ":gm",
1300 ":gpu_tool_utils",
1301 ":skia",
1302 ":tool_utils",
1303 ]
1304 }
mtklein2b6870c2016-07-28 14:17:33 -07001305
mtkleinc095df52016-08-24 12:23:52 -07001306 test_lib("experimental_svg_model") {
1307 public_include_dirs = [ "experimental/svg/model" ]
1308 sources = [
1309 "experimental/svg/model/SkSVGAttribute.cpp",
1310 "experimental/svg/model/SkSVGAttributeParser.cpp",
1311 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001312 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001313 "experimental/svg/model/SkSVGContainer.cpp",
1314 "experimental/svg/model/SkSVGDOM.cpp",
1315 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001316 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001317 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001318 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001319 "experimental/svg/model/SkSVGNode.cpp",
1320 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001321 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001322 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001323 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001324 "experimental/svg/model/SkSVGRect.cpp",
1325 "experimental/svg/model/SkSVGRenderContext.cpp",
1326 "experimental/svg/model/SkSVGSVG.cpp",
1327 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001328 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001329 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001330 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001331 "experimental/svg/model/SkSVGValue.cpp",
1332 ]
1333 deps = [
1334 ":skia",
1335 ]
1336 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001337
Kevin Lubickebf648e2017-09-21 13:45:16 -04001338 if (target_cpu != "wasm") {
1339 test_lib("views") {
1340 public_include_dirs = [ "include/views" ]
1341 sources = [
1342 "src/views/SkEvent.cpp",
1343 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001344 "src/views/SkTouchGesture.cpp",
1345 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001346 ]
Brian Osman34755e22016-12-05 09:46:02 -05001347 }
Brian Osman16adfa32016-10-18 14:42:44 -04001348 }
1349
Mike Klein38af9432016-11-11 11:39:44 -05001350 if (skia_use_lua) {
1351 test_lib("lua") {
1352 public_include_dirs = []
1353 sources = [
1354 "src/utils/SkLua.cpp",
1355 "src/utils/SkLuaCanvas.cpp",
1356 ]
1357 deps = [
1358 "//third_party/lua",
1359 ]
1360 }
1361
Mike Kleine6682eb2017-01-05 10:54:57 -05001362 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001363 sources = [
1364 "tools/lua/lua_app.cpp",
1365 ]
1366 deps = [
1367 ":lua",
1368 ":skia",
1369 "//third_party/lua",
1370 ]
Mike Klein38af9432016-11-11 11:39:44 -05001371 }
1372
Mike Kleine6682eb2017-01-05 10:54:57 -05001373 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001374 sources = [
1375 "tools/lua/lua_pictures.cpp",
1376 ]
1377 deps = [
1378 ":flags",
1379 ":lua",
1380 ":skia",
1381 ":tool_utils",
1382 "//third_party/lua",
1383 ]
Mike Klein38af9432016-11-11 11:39:44 -05001384 }
1385 }
1386
Cary Clark8032b982017-07-28 11:04:54 -04001387 test_app("bookmaker") {
1388 sources = [
1389 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001390 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001391 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001392 "tools/bookmaker/fiddleParser.cpp",
1393 "tools/bookmaker/includeParser.cpp",
1394 "tools/bookmaker/includeWriter.cpp",
1395 "tools/bookmaker/mdOut.cpp",
1396 "tools/bookmaker/parserCommon.cpp",
1397 "tools/bookmaker/spellCheck.cpp",
1398 ]
1399 deps = [
1400 ":flags",
1401 ":skia",
1402 ":tool_utils",
1403 ]
1404 }
1405
Kevin Lubickebf648e2017-09-21 13:45:16 -04001406 if (target_cpu != "wasm") {
1407 import("gn/samples.gni")
1408 test_lib("samples") {
1409 public_include_dirs = [ "samplecode" ]
1410 include_dirs = [ "experimental" ]
1411 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001412 # Relocating these files here, so that clients don't try to build them while they're
1413 # still in active development. Clang's thread safety analysis gets tripped up by
1414 # conditional locks.
1415 "src/core/SkThreadedBMPDevice.cpp",
1416 "src/core/SkThreadedBMPDevice.h",
1417 ]
1418 deps = [
1419 ":experimental_svg_model",
1420 ":flags",
1421 ":gm",
1422 ":tool_utils",
1423 ":views",
1424 ":xml",
1425 ]
Mike Klein38af9432016-11-11 11:39:44 -05001426
Kevin Lubickebf648e2017-09-21 13:45:16 -04001427 if (skia_use_lua) {
1428 sources += [ "samplecode/SampleLua.cpp" ]
1429 deps += [
1430 ":lua",
1431 "//third_party/lua",
1432 ]
1433 }
1434 }
1435 test_app("dm") {
1436 sources = [
1437 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001438 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001439 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001440 "dm/DMJsonWriter.cpp",
1441 "dm/DMSrcSink.cpp",
1442 ]
1443 include_dirs = [ "tests" ]
1444 deps = [
1445 ":common_flags",
1446 ":experimental_svg_model",
1447 ":flags",
1448 ":gm",
1449 ":gpu_tool_utils",
1450 ":skia",
1451 ":tests",
1452 ":tool_utils",
1453 "//third_party/jsoncpp",
1454 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001455 ]
1456 }
Brian Osman16adfa32016-10-18 14:42:44 -04001457 }
1458
Mike Klein06432b22017-03-21 13:14:33 -04001459 test_app("ok") {
1460 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001461 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001462 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001463 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001464 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001465 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001466 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001467 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001468 ]
1469 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001470 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001471 ":gm",
1472 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001473 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001474 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001475 ]
1476 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001477 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001478 sources = [
1479 "bench/nanobench.cpp",
1480 ]
1481 deps = [
1482 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001483 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001484 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001485 ":flags",
1486 ":gm",
1487 ":gpu_tool_utils",
1488 ":skia",
1489 ":tool_utils",
1490 "//third_party/jsoncpp",
1491 ]
mtklein2b6870c2016-07-28 14:17:33 -07001492 }
halcanary19a97202016-08-03 15:08:04 -07001493
Ravi Mistry10d36c52017-01-31 09:49:18 -05001494 test_app("skpinfo") {
1495 sources = [
1496 "tools/skpinfo.cpp",
1497 ]
1498 deps = [
1499 ":flags",
1500 ":skia",
1501 ]
1502 }
1503
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001504 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001505 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001506 sources = [
1507 "tools/skpbench/skpbench.cpp",
1508 ]
1509 deps = [
1510 ":flags",
1511 ":gpu_tool_utils",
1512 ":skia",
1513 ":tool_utils",
1514 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001515 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001516 }
1517
Mike Klein7d302882016-11-03 14:06:31 -04001518 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001519 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001520 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001521 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001522 "tools/shape/SkShaper_harfbuzz.cpp",
1523 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001524 ]
1525 deps = [
1526 ":skia",
1527 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001528 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001529 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001530 }
halcanary19a97202016-08-03 15:08:04 -07001531 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001532 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001533 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001534 "tools/shape/SkShaper_primitive.cpp",
1535 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001536 ]
1537 deps = [
1538 ":skia",
1539 ]
halcanary3eee9d92016-09-10 07:01:53 -07001540 }
mtklein046cb562016-09-16 10:23:12 -07001541
Matt Sarett9f1c4032017-05-17 10:06:32 -04001542 test_app("create_flutter_test_images") {
1543 sources = [
1544 "tools/create_flutter_test_images.cpp",
1545 ]
1546 deps = [
1547 ":skia",
1548 ":tool_utils",
1549 ]
1550 }
1551
Ben Wagner219f3622017-07-17 15:32:25 -04001552 test_app("create_test_font") {
1553 sources = [
1554 "tools/create_test_font.cpp",
1555 ]
1556 deps = [
1557 ":skia",
1558 ]
1559 assert_no_deps = [
1560 # tool_utils requires the output of this app.
1561 ":tool_utils",
1562 ]
1563 }
1564
Mike Kleine6682eb2017-01-05 10:54:57 -05001565 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001566 sources = [
1567 "tools/get_images_from_skps.cpp",
1568 ]
1569 deps = [
1570 ":flags",
1571 ":skia",
1572 "//third_party/jsoncpp",
1573 ]
mtklein046cb562016-09-16 10:23:12 -07001574 }
mtkleinecbc5262016-09-22 11:51:24 -07001575
Mike Kleine6682eb2017-01-05 10:54:57 -05001576 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001577 sources = [
1578 "tools/colorspaceinfo.cpp",
1579 ]
1580 deps = [
1581 ":flags",
1582 ":skia",
1583 ":tool_utils",
1584 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001585 }
1586
Kevin Lubickebf648e2017-09-21 13:45:16 -04001587 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001588 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001589 sources = [
1590 "tools/skiaserve/Request.cpp",
1591 "tools/skiaserve/Response.cpp",
1592 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001593 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1594 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1595 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1596 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1597 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1598 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1599 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1600 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1601 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001602 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1603 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001604 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1605 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1606 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1607 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1608 ]
1609 deps = [
1610 ":flags",
1611 ":gpu_tool_utils",
1612 ":skia",
1613 ":tool_utils",
1614 "//third_party/jsoncpp",
1615 "//third_party/libmicrohttpd",
1616 "//third_party/libpng",
1617 ]
Mike Klein7d302882016-11-03 14:06:31 -04001618 }
mtkleinecbc5262016-09-22 11:51:24 -07001619 }
kjlubick14f984b2016-10-03 11:49:45 -07001620
Mike Kleine6682eb2017-01-05 10:54:57 -05001621 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001622 sources = [
1623 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001624 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001625 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001626 "fuzz/FuzzGradients.cpp",
1627 "fuzz/FuzzParsePath.cpp",
1628 "fuzz/FuzzPathop.cpp",
1629 "fuzz/FuzzScaleToSides.cpp",
1630 "fuzz/fuzz.cpp",
1631 ]
1632 deps = [
1633 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001634 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001635 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001636 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001637 ]
kjlubick14f984b2016-10-03 11:49:45 -07001638 }
Mike Klein38312422016-10-05 15:41:01 -04001639
Mike Kleine6682eb2017-01-05 10:54:57 -05001640 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001641 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001642 rebase_path("tests/skia_test.cpp"),
1643 rebase_path("tests/Test.cpp"),
1644 ]
caryclark9feb6322016-10-25 08:58:26 -07001645 deps = [
1646 ":flags",
1647 ":gpu_tool_utils",
1648 ":skia",
1649 ":tool_utils",
1650 ]
caryclark9feb6322016-10-25 08:58:26 -07001651 }
1652
Mike Kleine6682eb2017-01-05 10:54:57 -05001653 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001654 sources = [
1655 "tools/DumpRecord.cpp",
1656 "tools/dump_record.cpp",
1657 ]
1658 deps = [
1659 ":flags",
1660 ":skia",
1661 ]
Mike Klein38312422016-10-05 15:41:01 -04001662 }
bungemanfe917272016-10-13 17:36:40 -04001663
Mike Kleine6682eb2017-01-05 10:54:57 -05001664 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001665 sources = [
1666 "tools/skdiff/skdiff.cpp",
1667 "tools/skdiff/skdiff_html.cpp",
1668 "tools/skdiff/skdiff_main.cpp",
1669 "tools/skdiff/skdiff_utils.cpp",
1670 ]
1671 deps = [
1672 ":skia",
1673 ":tool_utils",
1674 ]
bungemanfe917272016-10-13 17:36:40 -04001675 }
halcanarya73d76a2016-10-17 13:19:02 -07001676
Mike Kleine6682eb2017-01-05 10:54:57 -05001677 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001678 sources = [
1679 "tools/skp_parser.cpp",
1680 ]
1681 deps = [
1682 ":skia",
1683 ":tool_utils",
1684 "//third_party/jsoncpp",
1685 ]
halcanarya73d76a2016-10-17 13:19:02 -07001686 }
Brian Osman16adfa32016-10-18 14:42:44 -04001687
Hal Canary75427132017-10-11 16:00:31 -04001688 if (!is_win) {
1689 test_app("gpucts") {
1690 sources = [
1691 "dm/DMGpuTestProcs.cpp",
1692 "tools/gpucts/gm_knowledge.c",
1693 "tools/gpucts/gm_runner.cpp",
1694 "tools/gpucts/gpucts.cpp",
1695 ]
1696 deps = [
1697 ":gm",
1698 ":gpu_tool_utils",
1699 ":skia",
1700 ":tests",
1701 "//third_party/googletest",
1702 ]
1703 }
1704 }
1705
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001706 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001707 test_lib("sk_app") {
1708 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001709 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001710 "tools/sk_app/CommandSet.cpp",
1711 "tools/sk_app/GLWindowContext.cpp",
1712 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001713 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001714 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001715
Jim Van Verth4e56a912016-10-21 10:58:52 -04001716 if (is_android) {
1717 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001718 "tools/sk_app/android/GLWindowContext_android.cpp",
1719 "tools/sk_app/android/RasterWindowContext_android.cpp",
1720 "tools/sk_app/android/Window_android.cpp",
1721 "tools/sk_app/android/main_android.cpp",
1722 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001723 ]
Brian Osman462334e2017-02-09 11:22:57 -05001724 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001725 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001726 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001727 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1728 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1729 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001730 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001731 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001732 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001733 libs += [
1734 "GL",
1735 "X11",
1736 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001737 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001738 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001739 "tools/sk_app/win/GLWindowContext_win.cpp",
1740 "tools/sk_app/win/RasterWindowContext_win.cpp",
1741 "tools/sk_app/win/Window_win.cpp",
1742 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001743 ]
Brian Salomon194db172017-08-17 14:37:06 -04001744 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001745 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001746 }
Mike Klein43c25262016-10-20 10:17:47 -04001747 } else if (is_mac) {
1748 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001749 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1750 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1751 "tools/sk_app/mac/Window_mac.cpp",
1752 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001753 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001754 libs += [
1755 "QuartzCore.framework",
1756 "Cocoa.framework",
1757 "Foundation.framework",
1758 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001759 } else if (is_ios) {
1760 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001761 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1762 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1763 "tools/sk_app/ios/Window_ios.cpp",
1764 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001765 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001766 }
1767
1768 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001769 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001770 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001771 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001772 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001773 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001774 libs += [ "X11-xcb" ]
1775 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001776 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001777 }
1778 }
1779
Brian Osman16adfa32016-10-18 14:42:44 -04001780 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001781 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001782 ":skia",
1783 ":tool_utils",
1784 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001785 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001786 if (is_android) {
1787 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001788 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001789 deps += [ "//third_party/libsdl" ]
1790 }
Brian Salomon194db172017-08-17 14:37:06 -04001791 if (skia_use_angle) {
1792 deps += [ "//third_party/angle2" ]
1793 }
Mike Kleina92c3832016-12-08 09:49:39 -05001794 }
Brian Osman16adfa32016-10-18 14:42:44 -04001795 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001796
Brian Osmaneff04b52017-11-21 13:18:02 -05001797 if (skia_enable_gpu) {
1798 test_app("viewer") {
1799 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001800 if (is_ios) {
1801 bundle_ios_data = true
1802 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001803 sources = [
1804 "tools/viewer/GMSlide.cpp",
1805 "tools/viewer/ImageSlide.cpp",
1806 "tools/viewer/SKPSlide.cpp",
1807 "tools/viewer/SampleSlide.cpp",
1808 "tools/viewer/Viewer.cpp",
1809 ]
1810 libs = []
1811
1812 include_dirs = []
1813 deps = [
1814 ":flags",
1815 ":gm",
1816 ":gpu_tool_utils",
1817 ":samples",
1818 ":sk_app",
1819 ":skia",
1820 ":tool_utils",
1821 ":views",
1822 "//third_party/imgui",
1823 "//third_party/jsoncpp",
1824 ]
1825 }
1826 }
1827
1828 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1829 test_app("HelloWorld") {
1830 sources = [
1831 "example/HelloWorld.cpp",
1832 ]
1833 libs = []
1834
1835 include_dirs = []
1836 deps = [
1837 ":flags",
1838 ":gpu_tool_utils",
1839 ":sk_app",
1840 ":skia",
1841 ":tool_utils",
1842 ":views",
1843 ]
1844 }
1845 }
1846
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001847 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001848 test_app("SkiaSDLExample") {
1849 sources = [
1850 "example/SkiaSDLExample.cpp",
1851 ]
1852 libs = []
1853 include_dirs = []
1854 deps = [
1855 ":gpu_tool_utils",
1856 ":skia",
1857 "//third_party/libsdl",
1858 ]
1859 }
1860 }
1861
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001862 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1863 action_foreach("generate_mocs") {
1864 script = "gn/call.py"
1865 sources = [
1866 "tools/mdbviz/MainWindow.h",
1867 ]
1868 outputs = [
1869 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1870 ]
1871 args = [
1872 "$skia_qt_path" + "/bin/moc",
1873 "{{source}}",
1874 "-o",
1875 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1876 ]
1877 }
1878 action_foreach("generate_resources") {
1879 script = "gn/call.py"
1880 sources = [
1881 "tools/mdbviz/resources.qrc",
1882 ]
1883 outputs = [
1884 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1885 ]
1886 args = [
1887 "$skia_qt_path" + "/bin/rcc",
1888 "{{source}}",
1889 "-o",
1890 "gen/mdbviz/{{source_name_part}}_res.cpp",
1891 ]
1892 }
1893 test_app("mdbviz") {
1894 if (is_win) {
1895 # on Windows we need to disable some exception handling warnings due to the Qt headers
1896 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1897 }
1898 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001899 "tools/UrlDataManager.cpp",
1900 "tools/debugger/SkDebugCanvas.cpp",
1901 "tools/debugger/SkDrawCommand.cpp",
1902 "tools/debugger/SkJsonWriteBuffer.cpp",
1903 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001904 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001905 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001906 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001907 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001908
1909 # generated files
1910 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1911 "$target_gen_dir/mdbviz/resources_res.cpp",
1912 ]
1913 lib_dirs = [ "$skia_qt_path/lib" ]
1914 libs = [
1915 "Qt5Core.lib",
1916 "Qt5Gui.lib",
1917 "Qt5Widgets.lib",
1918 ]
1919 include_dirs = [
1920 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001921 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001922 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001923 "tools",
1924 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001925 ]
1926 deps = [
1927 ":generate_mocs",
1928 ":generate_resources",
1929 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001930 "//third_party/jsoncpp",
1931 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001932 ]
1933 }
1934 }
1935
Mike Kleine459afd2017-03-03 09:21:30 -05001936 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001937 copy("gdbserver") {
1938 sources = [
1939 "$ndk/$ndk_gdbserver",
1940 ]
1941 outputs = [
1942 "$root_out_dir/gdbserver",
1943 ]
1944 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001945 }
mtklein25c81d42016-07-27 13:55:26 -07001946}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001947
1948if (skia_jumper_clang != "") {
1949 action("regen_jumper") {
1950 script = "src/jumper/build_stages.py"
1951
1952 inputs = [
1953 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001954 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001955 ]
1956
1957 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1958 outputs = [
1959 "$target_out_dir/" +
1960 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1961 "$target_out_dir/" +
1962 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1963 ]
1964
1965 args = [
1966 skia_jumper_clang,
1967 skia_jumper_objdump,
1968 skia_jumper_ccache,
1969 ] + rebase_path(inputs) + rebase_path(outputs)
1970 }
1971}