blob: bfb4be027cbb7319015ff7a30e2f2a3ba1fc2bf8 [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
Brian Salomon3d6801e2017-12-11 10:06:31 -0500549 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700550
551 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500552 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700553 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400554 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700555 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500556 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_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) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500563 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400564 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700565 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500566 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_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) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500572 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800573 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500574 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400575 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500576 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400577 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700578 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500579 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700580 }
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 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001086 code_signing_args = [
1087 rebase_path("$bundle_root_dir", root_build_dir),
1088 skia_ios_identity,
1089 skia_ios_profile,
1090 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001091 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001092 }
1093 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001094 # !is_ios
1095
1096 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1097 shared_library("lib" + target_name) {
1098 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1099 configs += [ ":skia_private" ]
1100 testonly = true
1101 }
1102 } else {
1103 _executable = target_name
1104 executable(_executable) {
1105 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1106 configs += [ ":skia_private" ]
1107 testonly = true
1108 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001109 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001110 if (is_android && skia_android_serial != "" && defined(_executable)) {
1111 action("push_" + target_name) {
1112 script = "gn/push_to_android.py"
1113 deps = [
1114 ":" + _executable,
1115 ]
1116 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1117 outputs = [
1118 _stamp,
1119 ]
1120 args = [
1121 rebase_path("$root_build_dir/$_executable"),
1122 skia_android_serial,
1123 rebase_path(_stamp),
1124 ]
1125 testonly = true
1126 }
Mike Klein7d921032017-01-05 12:20:41 -05001127 }
1128 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001129 }
1130
mtkleinc095df52016-08-24 12:23:52 -07001131 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001132 public_include_dirs = []
1133 if (skia_enable_gpu) {
1134 public_defines = []
1135 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001136
1137 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001138 sources = [
1139 "tools/gpu/GrContextFactory.cpp",
1140 "tools/gpu/GrTest.cpp",
1141 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001142 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001143 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001144 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001145 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1146 "tools/gpu/gl/debug/GrBufferObj.cpp",
1147 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1148 "tools/gpu/gl/debug/GrProgramObj.cpp",
1149 "tools/gpu/gl/debug/GrShaderObj.cpp",
1150 "tools/gpu/gl/debug/GrTextureObj.cpp",
1151 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1152 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001153 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001154 ]
1155 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001156
Kevin Lubick4a24e102017-03-29 11:19:01 -04001157 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001158 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001159 } else if (is_ios) {
1160 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1161 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001162 } else if (is_linux) {
1163 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001164 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001165 } else if (is_mac) {
1166 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001167 } else if (is_win) {
1168 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1169 libs += [
1170 "Gdi32.lib",
1171 "OpenGL32.lib",
1172 ]
mtklein38925aa2016-09-21 10:11:25 -07001173 }
mtklein6ef69992016-09-14 06:12:09 -07001174
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001175 cflags_objcc = [ "-fobjc-arc" ]
1176
Mike Kleinc168a3a2016-11-14 14:53:13 +00001177 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001178 deps += [ "//third_party/angle2" ]
1179 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1180 }
mtkleind68f9b02016-09-23 13:18:41 -07001181 if (skia_use_vulkan) {
1182 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001183 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001184 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001185 if (skia_use_metal) {
1186 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1187 }
mtkleina627b5c2016-09-20 13:36:47 -07001188 }
mtklein25c81d42016-07-27 13:55:26 -07001189 }
mtklein25c81d42016-07-27 13:55:26 -07001190
mtkleinc095df52016-08-24 12:23:52 -07001191 test_lib("flags") {
1192 public_include_dirs = [ "tools/flags" ]
1193 sources = [
1194 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001195 ]
1196 }
1197 test_lib("common_flags") {
1198 public_include_dirs = [ "tools/flags" ]
1199 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001200 "tools/flags/SkCommonFlags.cpp",
1201 "tools/flags/SkCommonFlagsConfig.cpp",
1202 ]
1203 deps = [
mtklein046cb562016-09-16 10:23:12 -07001204 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001205 ":gpu_tool_utils",
1206 ]
1207 }
mtklein25c81d42016-07-27 13:55:26 -07001208
mtkleinc095df52016-08-24 12:23:52 -07001209 test_lib("tool_utils") {
1210 public_include_dirs = [
1211 "tools",
1212 "tools/debugger",
1213 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001214 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001215 ]
1216 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001217 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001218 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001219 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001220 "tools/ProcStats.cpp",
1221 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001222 "tools/SkRandomScalerContext.cpp",
1223 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001224 "tools/UrlDataManager.cpp",
1225 "tools/debugger/SkDebugCanvas.cpp",
1226 "tools/debugger/SkDrawCommand.cpp",
1227 "tools/debugger/SkJsonWriteBuffer.cpp",
1228 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001229 "tools/picture_utils.cpp",
1230 "tools/random_parse_path.cpp",
1231 "tools/sk_tool_utils.cpp",
1232 "tools/sk_tool_utils_font.cpp",
1233 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001234 "tools/trace/SkChromeTracingTracer.cpp",
1235 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001236 "tools/trace/SkDebugfTracer.cpp",
1237 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001238 "tools/trace/SkEventTracingPriv.cpp",
1239 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001240 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001241 libs = []
1242 if (is_ios) {
1243 sources += [ "tools/ios_utils.m" ]
1244 libs += [ "Foundation.framework" ]
1245 }
mtkleinc095df52016-08-24 12:23:52 -07001246 deps = [
mtklein046cb562016-09-16 10:23:12 -07001247 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001248 ":flags",
1249 "//third_party/libpng",
1250 ]
1251 public_deps = [
1252 "//third_party/jsoncpp",
1253 ]
1254 }
mtklein25c81d42016-07-27 13:55:26 -07001255
Mike Klein6e744122016-10-27 12:21:40 -04001256 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001257 test_lib("gm") {
1258 public_include_dirs = [ "gm" ]
1259 sources = gm_sources
1260 deps = [
scroggo19b91532016-10-24 09:03:26 -07001261 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001262 ":gpu_tool_utils",
1263 ":skia",
1264 ":tool_utils",
1265 ]
1266 }
mtklein25c81d42016-07-27 13:55:26 -07001267
Mike Klein6e744122016-10-27 12:21:40 -04001268 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001269 test_lib("tests") {
1270 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001271 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001272 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001273 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001274 }
mtkleinc095df52016-08-24 12:23:52 -07001275 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001276 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001277 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001278 ":skia",
1279 ":tool_utils",
1280 "//third_party/libpng",
1281 "//third_party/zlib",
1282 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001283 public_deps = [
1284 ":gpu_tool_utils", # Test.h #includes headers from this target.
1285 ]
mtkleinc095df52016-08-24 12:23:52 -07001286 }
mtklein2f3416d2016-08-02 16:02:05 -07001287
Mike Klein6e744122016-10-27 12:21:40 -04001288 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001289 test_lib("bench") {
1290 public_include_dirs = [ "bench" ]
1291 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001292 deps = [
1293 ":flags",
1294 ":gm",
1295 ":gpu_tool_utils",
1296 ":skia",
1297 ":tool_utils",
1298 ]
1299 }
mtklein2b6870c2016-07-28 14:17:33 -07001300
mtkleinc095df52016-08-24 12:23:52 -07001301 test_lib("experimental_svg_model") {
1302 public_include_dirs = [ "experimental/svg/model" ]
1303 sources = [
1304 "experimental/svg/model/SkSVGAttribute.cpp",
1305 "experimental/svg/model/SkSVGAttributeParser.cpp",
1306 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001307 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001308 "experimental/svg/model/SkSVGContainer.cpp",
1309 "experimental/svg/model/SkSVGDOM.cpp",
1310 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001311 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001312 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001313 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001314 "experimental/svg/model/SkSVGNode.cpp",
1315 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001316 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001317 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001318 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001319 "experimental/svg/model/SkSVGRect.cpp",
1320 "experimental/svg/model/SkSVGRenderContext.cpp",
1321 "experimental/svg/model/SkSVGSVG.cpp",
1322 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001323 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001324 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001325 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001326 "experimental/svg/model/SkSVGValue.cpp",
1327 ]
1328 deps = [
1329 ":skia",
1330 ]
1331 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001332
Kevin Lubickebf648e2017-09-21 13:45:16 -04001333 if (target_cpu != "wasm") {
1334 test_lib("views") {
1335 public_include_dirs = [ "include/views" ]
1336 sources = [
1337 "src/views/SkEvent.cpp",
1338 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001339 "src/views/SkTouchGesture.cpp",
1340 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001341 ]
Brian Osman34755e22016-12-05 09:46:02 -05001342 }
Brian Osman16adfa32016-10-18 14:42:44 -04001343 }
1344
Mike Klein38af9432016-11-11 11:39:44 -05001345 if (skia_use_lua) {
1346 test_lib("lua") {
1347 public_include_dirs = []
1348 sources = [
1349 "src/utils/SkLua.cpp",
1350 "src/utils/SkLuaCanvas.cpp",
1351 ]
1352 deps = [
1353 "//third_party/lua",
1354 ]
1355 }
1356
Mike Kleine6682eb2017-01-05 10:54:57 -05001357 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001358 sources = [
1359 "tools/lua/lua_app.cpp",
1360 ]
1361 deps = [
1362 ":lua",
1363 ":skia",
1364 "//third_party/lua",
1365 ]
Mike Klein38af9432016-11-11 11:39:44 -05001366 }
1367
Mike Kleine6682eb2017-01-05 10:54:57 -05001368 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001369 sources = [
1370 "tools/lua/lua_pictures.cpp",
1371 ]
1372 deps = [
1373 ":flags",
1374 ":lua",
1375 ":skia",
1376 ":tool_utils",
1377 "//third_party/lua",
1378 ]
Mike Klein38af9432016-11-11 11:39:44 -05001379 }
1380 }
1381
Cary Clark8032b982017-07-28 11:04:54 -04001382 test_app("bookmaker") {
1383 sources = [
1384 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001385 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001386 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001387 "tools/bookmaker/fiddleParser.cpp",
1388 "tools/bookmaker/includeParser.cpp",
1389 "tools/bookmaker/includeWriter.cpp",
1390 "tools/bookmaker/mdOut.cpp",
1391 "tools/bookmaker/parserCommon.cpp",
1392 "tools/bookmaker/spellCheck.cpp",
1393 ]
1394 deps = [
1395 ":flags",
1396 ":skia",
1397 ":tool_utils",
1398 ]
1399 }
1400
Kevin Lubickebf648e2017-09-21 13:45:16 -04001401 if (target_cpu != "wasm") {
1402 import("gn/samples.gni")
1403 test_lib("samples") {
1404 public_include_dirs = [ "samplecode" ]
1405 include_dirs = [ "experimental" ]
1406 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001407 # Relocating these files here, so that clients don't try to build them while they're
1408 # still in active development. Clang's thread safety analysis gets tripped up by
1409 # conditional locks.
1410 "src/core/SkThreadedBMPDevice.cpp",
1411 "src/core/SkThreadedBMPDevice.h",
1412 ]
1413 deps = [
1414 ":experimental_svg_model",
1415 ":flags",
1416 ":gm",
1417 ":tool_utils",
1418 ":views",
1419 ":xml",
1420 ]
Mike Klein38af9432016-11-11 11:39:44 -05001421
Kevin Lubickebf648e2017-09-21 13:45:16 -04001422 if (skia_use_lua) {
1423 sources += [ "samplecode/SampleLua.cpp" ]
1424 deps += [
1425 ":lua",
1426 "//third_party/lua",
1427 ]
1428 }
1429 }
1430 test_app("dm") {
1431 sources = [
1432 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001433 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001434 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001435 "dm/DMJsonWriter.cpp",
1436 "dm/DMSrcSink.cpp",
1437 ]
1438 include_dirs = [ "tests" ]
1439 deps = [
1440 ":common_flags",
1441 ":experimental_svg_model",
1442 ":flags",
1443 ":gm",
1444 ":gpu_tool_utils",
1445 ":skia",
1446 ":tests",
1447 ":tool_utils",
1448 "//third_party/jsoncpp",
1449 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001450 ]
1451 }
Brian Osman16adfa32016-10-18 14:42:44 -04001452 }
1453
Mike Klein06432b22017-03-21 13:14:33 -04001454 test_app("ok") {
1455 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001456 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001457 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001458 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001459 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001460 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001461 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001462 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001463 ]
1464 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001465 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001466 ":gm",
1467 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001468 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001469 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001470 ]
1471 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001472 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001473 sources = [
1474 "bench/nanobench.cpp",
1475 ]
1476 deps = [
1477 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001478 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001479 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001480 ":flags",
1481 ":gm",
1482 ":gpu_tool_utils",
1483 ":skia",
1484 ":tool_utils",
1485 "//third_party/jsoncpp",
1486 ]
mtklein2b6870c2016-07-28 14:17:33 -07001487 }
halcanary19a97202016-08-03 15:08:04 -07001488
Ravi Mistry10d36c52017-01-31 09:49:18 -05001489 test_app("skpinfo") {
1490 sources = [
1491 "tools/skpinfo.cpp",
1492 ]
1493 deps = [
1494 ":flags",
1495 ":skia",
1496 ]
1497 }
1498
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001499 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001500 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001501 sources = [
1502 "tools/skpbench/skpbench.cpp",
1503 ]
1504 deps = [
1505 ":flags",
1506 ":gpu_tool_utils",
1507 ":skia",
1508 ":tool_utils",
1509 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001510 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001511 }
1512
Mike Klein7d302882016-11-03 14:06:31 -04001513 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001514 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001515 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001516 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001517 "tools/shape/SkShaper_harfbuzz.cpp",
1518 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001519 ]
1520 deps = [
1521 ":skia",
1522 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001523 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001524 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001525 }
halcanary19a97202016-08-03 15:08:04 -07001526 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001527 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001528 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001529 "tools/shape/SkShaper_primitive.cpp",
1530 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001531 ]
1532 deps = [
1533 ":skia",
1534 ]
halcanary3eee9d92016-09-10 07:01:53 -07001535 }
mtklein046cb562016-09-16 10:23:12 -07001536
Matt Sarett9f1c4032017-05-17 10:06:32 -04001537 test_app("create_flutter_test_images") {
1538 sources = [
1539 "tools/create_flutter_test_images.cpp",
1540 ]
1541 deps = [
1542 ":skia",
1543 ":tool_utils",
1544 ]
1545 }
1546
Ben Wagner219f3622017-07-17 15:32:25 -04001547 test_app("create_test_font") {
1548 sources = [
1549 "tools/create_test_font.cpp",
1550 ]
1551 deps = [
1552 ":skia",
1553 ]
1554 assert_no_deps = [
1555 # tool_utils requires the output of this app.
1556 ":tool_utils",
1557 ]
1558 }
1559
Mike Kleine6682eb2017-01-05 10:54:57 -05001560 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001561 sources = [
1562 "tools/get_images_from_skps.cpp",
1563 ]
1564 deps = [
1565 ":flags",
1566 ":skia",
1567 "//third_party/jsoncpp",
1568 ]
mtklein046cb562016-09-16 10:23:12 -07001569 }
mtkleinecbc5262016-09-22 11:51:24 -07001570
Mike Kleine6682eb2017-01-05 10:54:57 -05001571 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001572 sources = [
1573 "tools/colorspaceinfo.cpp",
1574 ]
1575 deps = [
1576 ":flags",
1577 ":skia",
1578 ":tool_utils",
1579 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001580 }
1581
Kevin Lubickebf648e2017-09-21 13:45:16 -04001582 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001583 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001584 sources = [
1585 "tools/skiaserve/Request.cpp",
1586 "tools/skiaserve/Response.cpp",
1587 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001588 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1589 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1590 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1591 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1592 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1593 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1594 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1595 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1596 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001597 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1598 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001599 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1600 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1601 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1602 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1603 ]
1604 deps = [
1605 ":flags",
1606 ":gpu_tool_utils",
1607 ":skia",
1608 ":tool_utils",
1609 "//third_party/jsoncpp",
1610 "//third_party/libmicrohttpd",
1611 "//third_party/libpng",
1612 ]
Mike Klein7d302882016-11-03 14:06:31 -04001613 }
mtkleinecbc5262016-09-22 11:51:24 -07001614 }
kjlubick14f984b2016-10-03 11:49:45 -07001615
Mike Kleine6682eb2017-01-05 10:54:57 -05001616 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001617 sources = [
1618 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001619 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001620 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001621 "fuzz/FuzzGradients.cpp",
1622 "fuzz/FuzzParsePath.cpp",
1623 "fuzz/FuzzPathop.cpp",
1624 "fuzz/FuzzScaleToSides.cpp",
1625 "fuzz/fuzz.cpp",
1626 ]
1627 deps = [
1628 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001629 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001630 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001631 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001632 ]
kjlubick14f984b2016-10-03 11:49:45 -07001633 }
Mike Klein38312422016-10-05 15:41:01 -04001634
Mike Kleine6682eb2017-01-05 10:54:57 -05001635 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001636 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001637 rebase_path("tests/skia_test.cpp"),
1638 rebase_path("tests/Test.cpp"),
1639 ]
caryclark9feb6322016-10-25 08:58:26 -07001640 deps = [
1641 ":flags",
1642 ":gpu_tool_utils",
1643 ":skia",
1644 ":tool_utils",
1645 ]
caryclark9feb6322016-10-25 08:58:26 -07001646 }
1647
Mike Kleine6682eb2017-01-05 10:54:57 -05001648 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001649 sources = [
1650 "tools/DumpRecord.cpp",
1651 "tools/dump_record.cpp",
1652 ]
1653 deps = [
1654 ":flags",
1655 ":skia",
1656 ]
Mike Klein38312422016-10-05 15:41:01 -04001657 }
bungemanfe917272016-10-13 17:36:40 -04001658
Mike Kleine6682eb2017-01-05 10:54:57 -05001659 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001660 sources = [
1661 "tools/skdiff/skdiff.cpp",
1662 "tools/skdiff/skdiff_html.cpp",
1663 "tools/skdiff/skdiff_main.cpp",
1664 "tools/skdiff/skdiff_utils.cpp",
1665 ]
1666 deps = [
1667 ":skia",
1668 ":tool_utils",
1669 ]
bungemanfe917272016-10-13 17:36:40 -04001670 }
halcanarya73d76a2016-10-17 13:19:02 -07001671
Mike Kleine6682eb2017-01-05 10:54:57 -05001672 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001673 sources = [
1674 "tools/skp_parser.cpp",
1675 ]
1676 deps = [
1677 ":skia",
1678 ":tool_utils",
1679 "//third_party/jsoncpp",
1680 ]
halcanarya73d76a2016-10-17 13:19:02 -07001681 }
Brian Osman16adfa32016-10-18 14:42:44 -04001682
Hal Canary75427132017-10-11 16:00:31 -04001683 if (!is_win) {
1684 test_app("gpucts") {
1685 sources = [
1686 "dm/DMGpuTestProcs.cpp",
1687 "tools/gpucts/gm_knowledge.c",
1688 "tools/gpucts/gm_runner.cpp",
1689 "tools/gpucts/gpucts.cpp",
1690 ]
1691 deps = [
1692 ":gm",
1693 ":gpu_tool_utils",
1694 ":skia",
1695 ":tests",
1696 "//third_party/googletest",
1697 ]
1698 }
1699 }
1700
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001701 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001702 test_lib("sk_app") {
1703 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001704 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001705 "tools/sk_app/CommandSet.cpp",
1706 "tools/sk_app/GLWindowContext.cpp",
1707 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001708 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001709 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001710
Jim Van Verth4e56a912016-10-21 10:58:52 -04001711 if (is_android) {
1712 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001713 "tools/sk_app/android/GLWindowContext_android.cpp",
1714 "tools/sk_app/android/RasterWindowContext_android.cpp",
1715 "tools/sk_app/android/Window_android.cpp",
1716 "tools/sk_app/android/main_android.cpp",
1717 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001718 ]
Brian Osman462334e2017-02-09 11:22:57 -05001719 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001720 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001721 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001722 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1723 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1724 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001725 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001726 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001727 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001728 libs += [
1729 "GL",
1730 "X11",
1731 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001732 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001733 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001734 "tools/sk_app/win/GLWindowContext_win.cpp",
1735 "tools/sk_app/win/RasterWindowContext_win.cpp",
1736 "tools/sk_app/win/Window_win.cpp",
1737 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001738 ]
Brian Salomon194db172017-08-17 14:37:06 -04001739 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001740 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001741 }
Mike Klein43c25262016-10-20 10:17:47 -04001742 } else if (is_mac) {
1743 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001744 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1745 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1746 "tools/sk_app/mac/Window_mac.cpp",
1747 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001748 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001749 libs += [
1750 "QuartzCore.framework",
1751 "Cocoa.framework",
1752 "Foundation.framework",
1753 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001754 } else if (is_ios) {
1755 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001756 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1757 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1758 "tools/sk_app/ios/Window_ios.cpp",
1759 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001760 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001761 }
1762
1763 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001764 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001765 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001766 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001767 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001768 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001769 libs += [ "X11-xcb" ]
1770 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001771 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001772 }
1773 }
1774
Brian Osman16adfa32016-10-18 14:42:44 -04001775 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001776 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001777 ":skia",
1778 ":tool_utils",
1779 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001780 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001781 if (is_android) {
1782 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001783 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001784 deps += [ "//third_party/libsdl" ]
1785 }
Brian Salomon194db172017-08-17 14:37:06 -04001786 if (skia_use_angle) {
1787 deps += [ "//third_party/angle2" ]
1788 }
Mike Kleina92c3832016-12-08 09:49:39 -05001789 }
Brian Osman16adfa32016-10-18 14:42:44 -04001790 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001791
Brian Osmaneff04b52017-11-21 13:18:02 -05001792 if (skia_enable_gpu) {
1793 test_app("viewer") {
1794 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001795 if (is_ios) {
1796 bundle_ios_data = true
1797 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001798 sources = [
1799 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001800 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001801 "tools/viewer/ImageSlide.cpp",
1802 "tools/viewer/SKPSlide.cpp",
1803 "tools/viewer/SampleSlide.cpp",
1804 "tools/viewer/Viewer.cpp",
1805 ]
1806 libs = []
1807
1808 include_dirs = []
1809 deps = [
1810 ":flags",
1811 ":gm",
1812 ":gpu_tool_utils",
1813 ":samples",
1814 ":sk_app",
1815 ":skia",
1816 ":tool_utils",
1817 ":views",
1818 "//third_party/imgui",
1819 "//third_party/jsoncpp",
1820 ]
1821 }
1822 }
1823
1824 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1825 test_app("HelloWorld") {
1826 sources = [
1827 "example/HelloWorld.cpp",
1828 ]
1829 libs = []
1830
1831 include_dirs = []
1832 deps = [
1833 ":flags",
1834 ":gpu_tool_utils",
1835 ":sk_app",
1836 ":skia",
1837 ":tool_utils",
1838 ":views",
1839 ]
1840 }
1841 }
1842
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001843 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001844 test_app("SkiaSDLExample") {
1845 sources = [
1846 "example/SkiaSDLExample.cpp",
1847 ]
1848 libs = []
1849 include_dirs = []
1850 deps = [
1851 ":gpu_tool_utils",
1852 ":skia",
1853 "//third_party/libsdl",
1854 ]
1855 }
1856 }
1857
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001858 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1859 action_foreach("generate_mocs") {
1860 script = "gn/call.py"
1861 sources = [
1862 "tools/mdbviz/MainWindow.h",
1863 ]
1864 outputs = [
1865 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1866 ]
1867 args = [
1868 "$skia_qt_path" + "/bin/moc",
1869 "{{source}}",
1870 "-o",
1871 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1872 ]
1873 }
1874 action_foreach("generate_resources") {
1875 script = "gn/call.py"
1876 sources = [
1877 "tools/mdbviz/resources.qrc",
1878 ]
1879 outputs = [
1880 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1881 ]
1882 args = [
1883 "$skia_qt_path" + "/bin/rcc",
1884 "{{source}}",
1885 "-o",
1886 "gen/mdbviz/{{source_name_part}}_res.cpp",
1887 ]
1888 }
1889 test_app("mdbviz") {
1890 if (is_win) {
1891 # on Windows we need to disable some exception handling warnings due to the Qt headers
1892 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1893 }
1894 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001895 "tools/UrlDataManager.cpp",
1896 "tools/debugger/SkDebugCanvas.cpp",
1897 "tools/debugger/SkDrawCommand.cpp",
1898 "tools/debugger/SkJsonWriteBuffer.cpp",
1899 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001900 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001901 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001902 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001903 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001904
1905 # generated files
1906 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1907 "$target_gen_dir/mdbviz/resources_res.cpp",
1908 ]
1909 lib_dirs = [ "$skia_qt_path/lib" ]
1910 libs = [
1911 "Qt5Core.lib",
1912 "Qt5Gui.lib",
1913 "Qt5Widgets.lib",
1914 ]
1915 include_dirs = [
1916 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001917 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001918 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001919 "tools",
1920 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001921 ]
1922 deps = [
1923 ":generate_mocs",
1924 ":generate_resources",
1925 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001926 "//third_party/jsoncpp",
1927 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001928 ]
1929 }
1930 }
1931
Mike Kleine459afd2017-03-03 09:21:30 -05001932 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001933 copy("gdbserver") {
1934 sources = [
1935 "$ndk/$ndk_gdbserver",
1936 ]
1937 outputs = [
1938 "$root_out_dir/gdbserver",
1939 ]
1940 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001941 }
mtklein25c81d42016-07-27 13:55:26 -07001942}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001943
1944if (skia_jumper_clang != "") {
1945 action("regen_jumper") {
1946 script = "src/jumper/build_stages.py"
1947
1948 inputs = [
1949 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001950 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001951 ]
1952
1953 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1954 outputs = [
1955 "$target_out_dir/" +
1956 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1957 "$target_out_dir/" +
1958 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1959 ]
1960
1961 args = [
1962 skia_jumper_clang,
1963 skia_jumper_objdump,
1964 skia_jumper_ccache,
1965 ] + rebase_path(inputs) + rebase_path(outputs)
1966 }
1967}