blob: e58a6e17198a9f8ce8ee195bba203fbc44ddfcd6 [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 Klein26a60492018-10-15 10:38:25 -040019 skia_enable_flutter_defines = false
20}
21
22declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000023 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040024 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070025 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070026 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070027 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040028 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070029 skia_use_libjpeg_turbo = true
30 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070031 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050032 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040033 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040034 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040035 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070036 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040037 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040038 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070039 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070040
Mike Klein7d921032017-01-05 12:20:41 -050041 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040042 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000043 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050044 skia_enable_discrete_gpu = true
Hal Canaryff2742e2018-01-30 11:35:47 -050045 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000046 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040047 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050048 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040049 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040050 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050051 skia_enable_tools = is_skia_dev_build
52 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielda16cce2018-08-01 09:23:57 -040053 skia_vulkan_header = "" # temporary as we remove the use from clients
Robert Phillipsa6d2d702017-09-01 12:17:03 -040054 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040055 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070056 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070057 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040058
Hal Canary4689b542018-01-31 11:54:14 -050059 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050060 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040061
62 skia_llvm_path = ""
63 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040064
65 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070066}
Brian Salomon23d73ea2016-10-27 13:31:37 -040067declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040068 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040069 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050070 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040071
Mike Klein4d598a32016-10-31 13:44:49 -040072 if (is_android) {
73 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070074 } else if (is_fuchsia) {
75 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040076 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040077 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
78 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040079 }
Jim Van Verth4e502972017-12-07 15:16:10 -050080
81 if (is_ios) {
82 skia_ios_identity = ".*Google.*"
83 skia_ios_profile = "Google Development"
84 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040085}
Brian Salomon789e25e2016-09-30 13:41:03 -040086
Adam Barth54ef74a2017-10-13 10:59:38 -070087if (defined(skia_settings)) {
88 import(skia_settings)
89}
90
Brian Osmanc9a42472018-05-31 13:17:12 -040091# Our tools require static linking (they use non-exported symbols), and the GPU backend.
92skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070093
mtkleina45be612016-08-29 15:22:10 -070094fontmgr_android_enabled = skia_use_expat && skia_use_freetype
95
mtklein1211e0c2016-07-26 13:55:45 -070096skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070097 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070098 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/codec",
100 "include/config",
101 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -0400102 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400104 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500106 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700107 "include/pathops",
108 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700109 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700110 "include/utils",
111 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700112]
113
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500114if (skia_enable_atlas_text) {
115 skia_public_includes += [ "include/atlastext" ]
116}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000117
mtkleinc04ff472016-06-23 10:29:30 -0700118# Skia public API, generally provided by :skia.
119config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700120 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400121 defines = []
122 if (is_component_build) {
123 defines += [ "SKIA_DLL" ]
124 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400125 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700126 defines += [ "SK_SAMPLES_FOR_X" ]
127 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400128 if (skia_enable_flutter_defines) {
129 defines += flutter_defines
130 }
mtklein06c35c02016-09-20 12:28:12 -0700131 if (!skia_enable_gpu) {
132 defines += [ "SK_SUPPORT_GPU=0" ]
133 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500134 if (skia_enable_atlas_text) {
135 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
136 }
mtkleinc04ff472016-06-23 10:29:30 -0700137}
138
139# Skia internal APIs, used by Skia itself and a few test tools.
140config("skia_private") {
141 visibility = [ ":*" ]
142
143 include_dirs = [
144 "include/private",
145 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700146 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/core",
148 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700149 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700150 "src/image",
151 "src/images",
152 "src/lazy",
153 "src/opts",
154 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700155 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/ports",
157 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400158 "src/shaders",
159 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700160 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700161 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700162 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500163 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700164 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700165 ]
mtklein150d1132016-08-01 06:56:40 -0700166
Mike Reeda9e241d2017-05-03 10:52:00 -0400167 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700168 if (is_android) {
169 defines += [
170 "SK_GAMMA_EXPONENT=1.4",
171 "SK_GAMMA_CONTRAST=0.0",
172 ]
173 }
mtklein88a7ac02016-09-14 11:16:49 -0700174 if (is_official_build || is_android) {
175 # TODO(bsalomon): it'd be nice to make Android normal.
176 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
177 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400178 libs = []
179 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500180 if (skia_enable_gpu) {
181 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500182 if (is_skia_dev_build && skia_use_vulkan) {
183 include_dirs += [ "tools/gpu/vk" ]
184 }
Brian Salomon03e05842017-02-23 12:23:47 -0500185 }
Brian Osman34755e22016-12-05 09:46:02 -0500186 if (skia_use_angle) {
187 defines += [ "SK_ANGLE" ]
188 }
Brian Osman3f375d02016-12-28 11:19:22 -0500189 if (skia_enable_discrete_gpu) {
190 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
191 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400192 if (!is_official_build) {
193 defines += [ "GR_TEST_UTILS=1" ]
194 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400195 if (skia_llvm_path != "") {
196 defines += [ "SK_LLVM_AVAILABLE" ]
197 include_dirs += [ "$skia_llvm_path/include" ]
198 libs += [ skia_llvm_lib ]
199 lib_dirs += [ "$skia_llvm_path/lib/" ]
200 }
mtkleinc04ff472016-06-23 10:29:30 -0700201}
202
203# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
204config("skia_library") {
205 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700206 defines = [ "SKIA_IMPLEMENTATION=1" ]
207}
208
209skia_library_configs = [
210 ":skia_public",
211 ":skia_private",
212 ":skia_library",
213]
214
mtklein9b8583d2016-08-24 17:32:30 -0700215# Use for CPU-specific Skia code that needs particular compiler flags.
216template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500217 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700218 if (invoker.enabled) {
219 source_set(target_name) {
220 forward_variables_from(invoker, "*")
221 configs += skia_library_configs
222 }
223 } else {
224 # If not enabled, a phony empty target that swallows all otherwise unused variables.
225 source_set(target_name) {
226 forward_variables_from(invoker,
227 "*",
228 [
229 "sources",
230 "cflags",
231 ])
232 }
233 }
anmittala7eaf2e2016-08-17 13:57:26 -0700234}
235
mtklein422310d2016-08-16 18:28:43 -0700236is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700237
mtklein7d6fb2c2016-08-25 14:50:44 -0700238opts("none") {
239 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700241 cflags = []
242}
243
mtklein7d6fb2c2016-08-25 14:50:44 -0700244opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700245 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700247 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700248}
249
250opts("arm64") {
251 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700252 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700253 cflags = []
254}
255
256opts("crc32") {
257 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700259 cflags = [ "-march=armv8-a+crc" ]
260}
261
mtklein9b8583d2016-08-24 17:32:30 -0700262opts("sse2") {
263 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400265 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400266 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
267 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400268 cflags = [ "-msse2" ]
269 }
mtklein9b8583d2016-08-24 17:32:30 -0700270}
mtkleinc04ff472016-06-23 10:29:30 -0700271
mtklein9b8583d2016-08-24 17:32:30 -0700272opts("ssse3") {
273 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700274 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400275 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400276 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
277 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400278 cflags = [ "-mssse3" ]
279 }
mtklein9b8583d2016-08-24 17:32:30 -0700280}
mtkleinc04ff472016-06-23 10:29:30 -0700281
mtklein9b8583d2016-08-24 17:32:30 -0700282opts("sse41") {
283 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700284 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400285 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400286 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
287 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400288 cflags = [ "-msse4.1" ]
289 }
mtklein9b8583d2016-08-24 17:32:30 -0700290}
mtklein4e976072016-08-08 09:06:27 -0700291
mtklein9b8583d2016-08-24 17:32:30 -0700292opts("sse42") {
293 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700294 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400295 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400296 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
297 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400298 cflags = [ "-msse4.2" ]
299 }
mtklein9b8583d2016-08-24 17:32:30 -0700300}
301
302opts("avx") {
303 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700304 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400305 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000306 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400307 } else {
308 cflags = [ "-mavx" ]
309 }
mtkleinc04ff472016-06-23 10:29:30 -0700310}
311
Mike Klein1b9b7d52018-02-27 10:37:40 -0500312opts("hsw") {
313 enabled = is_x86
314 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400315 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500316 cflags = [ "/arch:AVX2" ]
317 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000318 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500319 }
320
321 # Oddly, clang-cl doesn't recognize this as a valid flag.
322 # If it ever does, it'd nice to move this up with -mavx2 and co.
323 if (is_clang && !is_win) {
324 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
325 # but nice to have, generating slightly better code for paths without explicit FMAs.
326 cflags += [ "-ffp-contract=fast" ]
327 }
328}
329
mtkleinc095df52016-08-24 12:23:52 -0700330# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700331template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500332 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700333 if (invoker.enabled) {
334 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.public_defines)) {
336 defines = invoker.public_defines
337 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600338 if (defined(invoker.public_configs)) {
339 configs = invoker.public_configs
340 }
mtklein457b42a2016-08-23 13:56:37 -0700341 }
342 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700343 forward_variables_from(invoker,
344 "*",
345 [
346 "public_defines",
347 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700348 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700349 ])
mtklein457b42a2016-08-23 13:56:37 -0700350 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700351 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700352 if (defined(invoker.configs_to_remove)) {
353 configs -= invoker.configs_to_remove
354 }
mtklein457b42a2016-08-23 13:56:37 -0700355 }
356 } else {
mtklein457b42a2016-08-23 13:56:37 -0700357 source_set(target_name) {
358 forward_variables_from(invoker,
359 "*",
360 [
361 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400362 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700363 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700364 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700365 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700366 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700367 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700368 ])
mtkleincd01b032016-08-31 04:58:19 -0700369 if (defined(invoker.sources_when_disabled)) {
370 sources = invoker.sources_when_disabled
371 }
372 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700373 }
mtkleineb3c4252016-08-23 07:38:09 -0700374 }
mtklein457b42a2016-08-23 13:56:37 -0700375}
mtklein457b42a2016-08-23 13:56:37 -0700376
mtkleina45be612016-08-29 15:22:10 -0700377optional("fontmgr_android") {
378 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700382 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700383 ]
384 sources = [
385 "src/ports/SkFontMgr_android.cpp",
386 "src/ports/SkFontMgr_android_factory.cpp",
387 "src/ports/SkFontMgr_android_parser.cpp",
388 ]
389}
390
mtkleind2e39db2016-09-07 07:52:55 -0700391optional("fontmgr_custom") {
Kevin Lubick217056c2018-09-20 17:39:31 -0400392 enabled = (is_linux || target_cpu == "wasm") && skia_use_freetype &&
393 !skia_use_fontconfig
mtkleind2e39db2016-09-07 07:52:55 -0700394
395 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500396 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700397 ]
398 sources = [
399 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500400 "src/ports/SkFontMgr_custom.h",
401 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700402 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500403 "src/ports/SkFontMgr_custom_embedded.cpp",
404 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700405 ]
406}
407
Hal Canaryff2742e2018-01-30 11:35:47 -0500408optional("fontmgr_empty") {
409 enabled = skia_enable_fontmgr_empty
410 sources = [
411 "src/ports/SkFontMgr_empty_factory.cpp",
412 ]
413}
414
mtklein3cc22182016-08-29 13:26:14 -0700415optional("fontmgr_fontconfig") {
416 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700417
418 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500419 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700420 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700421 ]
422 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700423 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700424 "src/ports/SkFontConfigInterface_direct.cpp",
425 "src/ports/SkFontConfigInterface_direct_factory.cpp",
426 "src/ports/SkFontMgr_FontConfigInterface.cpp",
427 "src/ports/SkFontMgr_fontconfig.cpp",
428 "src/ports/SkFontMgr_fontconfig_factory.cpp",
429 ]
430}
431
mtkleincdedd0e2016-09-12 15:15:44 -0700432optional("fontmgr_fuchsia") {
433 enabled = is_fuchsia && skia_use_freetype
434
435 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500436 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700437 ]
438 sources = [
439 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500440 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700441 "src/ports/SkFontMgr_custom_empty_factory.cpp",
442 ]
443}
444
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700445if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400446 executable("sksllex") {
447 sources = [
448 "src/sksl/lex/Main.cpp",
449 "src/sksl/lex/NFA.cpp",
450 "src/sksl/lex/RegexNode.cpp",
451 "src/sksl/lex/RegexParser.cpp",
452 ]
453 include_dirs = [ "src/sksl/lex" ]
454 }
455
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700456 action("run_sksllex") {
457 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400458 deps = [
459 ":sksllex(//gn/toolchain:$host_toolchain)",
460 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700461 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700462 "src/sksl/lex/sksl.lex",
463 ]
464
465 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
466 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
467 outputs = [
468 "$target_out_dir/" +
469 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
470 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
471 # confused due to the same file being named by two different paths
472 ]
473 sksllex_path = "$root_out_dir/"
474 sksllex_path += "sksllex"
475 if (host_os == "win") {
476 sksllex_path += ".exe"
477 }
478 args = [
479 rebase_path(sksllex_path),
480 rebase_path("bin/clang-format"),
481 rebase_path("src"),
482 ]
483 }
484} else {
485 group("run_sksllex") {
486 }
487}
488
489if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400490 executable("skslc") {
491 defines = [ "SKSL_STANDALONE" ]
492 sources = [
493 "src/sksl/SkSLMain.cpp",
494 ]
495 sources += skia_sksl_sources
496 include_dirs = [
497 "src/gpu",
498 "src/sksl",
499 ]
500 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500501 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400502 "//third_party/spirv-tools",
503 ]
504 }
505
506 skia_gpu_processor_outputs = []
507 foreach(src, skia_gpu_processor_sources) {
508 dir = get_path_info(src, "dir")
509 name = get_path_info(src, "name")
510
511 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
512 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
513 skia_gpu_processor_outputs += [
514 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
515 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
516 # confused due to the same file being named by two different paths
517 ]
518 }
519
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500520 action("create_sksl_enums") {
521 script = "gn/create_sksl_enums.py"
522 sources = [
523 "include/private/GrSharedEnums.h",
524 ]
525 outputs = [
526 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500527 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500528 ]
529 args = [
530 rebase_path(sources[0]),
531 rebase_path(outputs[0]),
532 ]
533 }
534
Ethan Nicholas762466e2017-06-29 10:03:38 -0400535 action("compile_processors") {
536 script = "gn/compile_processors.py"
537 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400539 ":skslc(//gn/toolchain:$host_toolchain)",
540 ]
541 sources = skia_gpu_processor_sources
542 outputs = skia_gpu_processor_outputs
543 skslc_path = "$root_out_dir/"
544 if (host_toolchain != default_toolchain_name) {
545 skslc_path += "$host_toolchain/"
546 }
547 skslc_path += "skslc"
548 if (host_os == "win") {
549 skslc_path += ".exe"
550 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400551 args = [
552 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400553 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400554 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400555 args += rebase_path(skia_gpu_processor_sources)
556 }
557} else {
558 skia_gpu_processor_outputs = []
559 group("compile_processors") {
560 }
561}
562
mtklein06c35c02016-09-20 12:28:12 -0700563optional("gpu") {
564 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400565 deps = [
566 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700567 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400568 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700569 if (skia_generate_workarounds) {
570 deps += [ ":workaround_list" ]
571 }
mtkleine9fb3d52016-09-20 15:11:46 -0700572 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600573 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400574 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700575
Brian Salomon3d6801e2017-12-11 10:06:31 -0500576 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400577 if (!skia_enable_ccpr) {
578 sources -= skia_ccpr_sources
579 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
580 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400581 if (!skia_enable_nvpr) {
582 sources -= skia_nvpr_sources
583 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
584 }
mtklein06c35c02016-09-20 12:28:12 -0700585
586 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500587 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700588 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400589 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700590 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400591 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400592
593 # this lib is required to link against AHardwareBuffer
594 if (defined(ndk_api) && ndk_api >= 26) {
595 libs += [ "android" ]
596 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400597 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500598 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400599 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700600 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500601 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400602 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700603 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500604 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800605 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400607 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400609 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700610 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700612 }
mtkleine9fb3d52016-09-20 15:11:46 -0700613
614 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400615 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400616 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700617 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700618 if (skia_enable_vulkan_debug_layers) {
619 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
620 }
mtkleine9fb3d52016-09-20 15:11:46 -0700621 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400622
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400623 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400624 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400625 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
626 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400627
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400628 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400629 if (skia_use_metal) {
630 public_defines += [ "SK_METAL" ]
631 sources += skia_metal_sources
632 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400633 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400634 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400635 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500636
637 if (skia_enable_atlas_text) {
638 sources += skia_atlas_text_sources
639 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400640
641 if (is_debug) {
642 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
643 }
mtklein06c35c02016-09-20 12:28:12 -0700644}
645
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400646optional("heif") {
647 enabled = skia_use_libheif
648 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
649
650 deps = []
651
652 sources = [
653 "src/codec/SkHeifCodec.cpp",
654 ]
655}
656
mtklein63213812016-08-24 09:55:56 -0700657optional("jpeg") {
658 enabled = skia_use_libjpeg_turbo
659 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
660
mtklein63213812016-08-24 09:55:56 -0700661 deps = [
662 "//third_party/libjpeg-turbo:libjpeg",
663 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400664 public = [
665 "include/encode/SkJpegEncoder.h",
666 ]
mtklein63213812016-08-24 09:55:56 -0700667 sources = [
668 "src/codec/SkJpegCodec.cpp",
669 "src/codec/SkJpegDecoderMgr.cpp",
670 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700671 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400672 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700673 ]
674}
675
676optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500677 enabled = skia_use_zlib && skia_enable_pdf
678 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700679
mtklein63213812016-08-24 09:55:56 -0700680 deps = [
681 "//third_party/zlib",
682 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400683 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700684 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400685 }
brettwb9447282016-09-01 14:24:39 -0700686 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700687 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700688
689 if (skia_use_sfntly) {
690 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500691 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700692 }
693}
694
695optional("png") {
696 enabled = skia_use_libpng
697 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
698
mtklein63213812016-08-24 09:55:56 -0700699 deps = [
700 "//third_party/libpng",
701 ]
702 sources = [
703 "src/codec/SkIcoCodec.cpp",
704 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400705 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700706 ]
707}
708
scroggof84ad642016-10-31 09:02:57 -0700709optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400710 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700711 public_defines = [ "SK_CODEC_DECODES_RAW" ]
712
713 deps = [
714 "//third_party/dng_sdk",
715 "//third_party/libjpeg-turbo:libjpeg",
716 "//third_party/piex",
717 ]
718
719 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
720 # Skia.
721 configs_to_remove = [ "//gn:no_exceptions" ]
722
723 sources = [
724 "src/codec/SkRawAdapterCodec.cpp",
725 "src/codec/SkRawCodec.cpp",
726 ]
727}
728
Mike Klein852a8cb2018-05-15 10:46:58 -0400729import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400730source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400731 cflags = []
732 if (!is_win || is_clang) {
733 cflags += [
734 "-w",
735 "-std=c11",
736 ]
737 }
738
739 public = [
740 "third_party/skcms/skcms.h",
741 ]
742 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
743}
744
mtklein3cc22182016-08-29 13:26:14 -0700745optional("typeface_freetype") {
746 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700747
748 deps = [
749 "//third_party/freetype2",
750 ]
751 sources = [
752 "src/ports/SkFontHost_FreeType.cpp",
753 "src/ports/SkFontHost_FreeType_common.cpp",
754 ]
755}
756
mtklein457b42a2016-08-23 13:56:37 -0700757optional("webp") {
758 enabled = skia_use_libwebp
759 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
760
mtklein457b42a2016-08-23 13:56:37 -0700761 deps = [
762 "//third_party/libwebp",
763 ]
764 sources = [
765 "src/codec/SkWebpAdapterCodec.cpp",
766 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400767 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700768 ]
mtkleineb3c4252016-08-23 07:38:09 -0700769}
770
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400771optional("wuffs") {
772 enabled = skia_use_wuffs
773 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
774
775 deps = [
776 "//third_party/wuffs",
777 ]
778 sources = [
779 "src/codec/SkWuffsCodec.cpp",
780 ]
781}
782
mtklein63213812016-08-24 09:55:56 -0700783optional("xml") {
784 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000785 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700786
mtklein63213812016-08-24 09:55:56 -0700787 deps = [
788 "//third_party/expat",
789 ]
790 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500791 "src/svg/SkSVGCanvas.cpp",
792 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700793 "src/xml/SkDOM.cpp",
794 "src/xml/SkXMLParser.cpp",
795 "src/xml/SkXMLWriter.cpp",
796 ]
797}
798
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700799if (skia_enable_gpu && skia_generate_workarounds) {
800 action("workaround_list") {
801 script = "tools/build_workaround_header.py"
802
803 inputs = [
804 "src/gpu/gpu_workaround_list.txt",
805 ]
806
807 # see comments in skia_compile_processors about out dir path shenanigans.
808 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700809 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700810
811 outputs = [
812 "$root_out_dir/$output_file",
813 ]
814 args = [
815 "--output-file",
816 "$output_file",
817 ]
818
819 foreach(file, inputs) {
820 args += [ rebase_path(file, root_build_dir) ]
821 }
822 }
823}
824
mtkleinc04ff472016-06-23 10:29:30 -0700825component("skia") {
826 public_configs = [ ":skia_public" ]
827 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700828
Mike Klein607b0a72018-11-07 16:17:34 -0500829 public_deps = [
Mike Klein607b0a72018-11-07 16:17:34 -0500830 ":gpu",
831 ":pdf",
832 ":skcms",
833 ]
834
mtkleinc04ff472016-06-23 10:29:30 -0700835 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700836 ":arm64",
837 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700838 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000839 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700840 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700841 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700842 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500843 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700844 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700845 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400846 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500847 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700848 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700849 ":none",
mtklein63213812016-08-24 09:55:56 -0700850 ":png",
scroggof84ad642016-10-31 09:02:57 -0700851 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700852 ":sse2",
853 ":sse41",
854 ":sse42",
855 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700856 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400857 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700858 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700859 ]
860
Kevin Lubick134be1d2018-10-30 15:05:04 -0400861 if (skia_enable_nima) {
862 deps += [ "//third_party/Nima-Cpp" ]
863 }
864
Chinmay Garde43f115c2016-11-16 15:04:12 -0800865 # This file (and all GN files in Skia) are designed to work with an
866 # empty sources assignment filter; we handle all that explicitly.
867 # We clear the filter here for clients who may have set up a global filter.
868 set_sources_assignment_filter([])
869
mtkleinc04ff472016-06-23 10:29:30 -0700870 sources = []
brettwb9447282016-09-01 14:24:39 -0700871 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700872 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500873 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000874 sources += skia_effects_sources
875 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700876 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400877 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500878 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700879 "src/android/SkBitmapRegionCodec.cpp",
880 "src/android/SkBitmapRegionDecoder.cpp",
881 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400882 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700883 "src/codec/SkBmpCodec.cpp",
884 "src/codec/SkBmpMaskCodec.cpp",
885 "src/codec/SkBmpRLECodec.cpp",
886 "src/codec/SkBmpStandardCodec.cpp",
887 "src/codec/SkCodec.cpp",
888 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400889 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400890 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700891 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700892 "src/codec/SkMaskSwizzler.cpp",
893 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700894 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700895 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700896 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700897 "src/codec/SkSwizzler.cpp",
898 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700899 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700900 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000901 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700902 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700903 "src/ports/SkMemory_malloc.cpp",
904 "src/ports/SkOSFile_stdio.cpp",
905 "src/sfnt/SkOTTable_name.cpp",
906 "src/sfnt/SkOTUtils.cpp",
907 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700908 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700909 ]
brettwb9447282016-09-01 14:24:39 -0700910
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400911 defines = []
912 if (!skia_enable_skpicture) {
913 defines = [ "SK_DISABLE_SKPICTURE" ]
914 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000915 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400916 sources += [ "src/core/SkPicture_none.cpp" ]
917 }
918
mtklein7d6fb2c2016-08-25 14:50:44 -0700919 libs = []
920
mtkleinc04ff472016-06-23 10:29:30 -0700921 if (is_win) {
922 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400923 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700924 "src/ports/SkDebug_win.cpp",
925 "src/ports/SkFontHost_win.cpp",
926 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500927 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700928 "src/ports/SkImageEncoder_WIC.cpp",
929 "src/ports/SkImageGeneratorWIC.cpp",
930 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700931 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700932 "src/ports/SkScalerContext_win_dw.cpp",
933 "src/ports/SkTLS_win.cpp",
934 "src/ports/SkTypeface_win_dw.cpp",
935 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400936 libs += [
937 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500938 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400939 "Ole32.lib",
940 "OleAut32.lib",
941 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500942 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400943 ]
mtkleinc04ff472016-06-23 10:29:30 -0700944 } else {
945 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700946 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700947 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700948 "src/ports/SkTLS_pthread.cpp",
949 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400950 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700951 }
952
mtklein7d6fb2c2016-08-25 14:50:44 -0700953 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500954 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500955 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500956 deps += [ "//third_party/cpu-features" ]
957 }
mtklein06c35c02016-09-20 12:28:12 -0700958 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700959 libs += [
960 "EGL",
961 "GLESv2",
962 "log",
963 ]
964 }
965
Kevin Lubick217056c2018-09-20 17:39:31 -0400966 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700967 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400968 if (skia_use_egl) {
969 libs += [ "GLESv2" ]
970 }
mtkleinc04ff472016-06-23 10:29:30 -0700971 }
972
973 if (is_mac) {
974 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700975 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700976 "src/ports/SkFontHost_mac.cpp",
977 "src/ports/SkImageEncoder_CG.cpp",
978 "src/ports/SkImageGeneratorCG.cpp",
979 ]
mtklein09e61f72016-08-23 13:35:28 -0700980 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400981 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
982 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700983 "ApplicationServices.framework",
984 "OpenGL.framework",
985 ]
mtkleinc04ff472016-06-23 10:29:30 -0700986 }
abarth6fc8ff02016-07-15 15:15:15 -0700987
Mike Klein7d302882016-11-03 14:06:31 -0400988 if (is_ios) {
989 sources += [
990 "src/ports/SkDebug_stdio.cpp",
991 "src/ports/SkFontHost_mac.cpp",
992 "src/ports/SkImageEncoder_CG.cpp",
993 "src/ports/SkImageGeneratorCG.cpp",
994 ]
995 libs += [
996 "CoreFoundation.framework",
997 "CoreGraphics.framework",
998 "CoreText.framework",
999 "ImageIO.framework",
1000 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001001
1002 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1003 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001004 ]
1005 }
1006
abarth6fc8ff02016-07-15 15:15:15 -07001007 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001008 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001009 }
mtkleinc04ff472016-06-23 10:29:30 -07001010}
1011
Kevin Lubickcbcff382018-10-02 09:02:18 -04001012static_library("pathkit") {
1013 public_configs = [ ":skia_public" ]
1014 configs += skia_library_configs
1015
1016 deps = [
1017 ":arm64",
1018 ":armv7",
1019 ":avx",
1020 ":crc32",
1021 ":hsw",
1022 ":none",
1023 ":sse2",
1024 ":sse41",
1025 ":sse42",
1026 ":ssse3",
1027 ]
1028
1029 # This file (and all GN files in Skia) are designed to work with an
1030 # empty sources assignment filter; we handle all that explicitly.
1031 # We clear the filter here for clients who may have set up a global filter.
1032 set_sources_assignment_filter([])
1033
1034 sources = []
1035 sources += skia_pathops_sources
1036 sources += [
1037 "src/core/SkAnalyticEdge.cpp",
1038 "src/core/SkArenaAlloc.cpp",
1039 "src/core/SkCubicMap.cpp",
1040 "src/core/SkEdge.cpp",
1041 "src/core/SkEdgeBuilder.cpp",
1042 "src/core/SkEdgeClipper.cpp",
1043 "src/core/SkGeometry.cpp",
1044 "src/core/SkLineClipper.cpp",
1045 "src/core/SkMallocPixelRef.cpp",
1046 "src/core/SkMath.cpp",
1047 "src/core/SkMatrix.cpp",
1048 "src/core/SkOpts.cpp",
1049 "src/core/SkPaint.cpp",
1050 "src/core/SkPath.cpp",
1051 "src/core/SkPathEffect.cpp",
1052 "src/core/SkPathMeasure.cpp",
1053 "src/core/SkPathRef.cpp",
1054 "src/core/SkPoint.cpp",
1055 "src/core/SkRRect.cpp",
1056 "src/core/SkRect.cpp",
1057 "src/core/SkSemaphore.cpp",
1058 "src/core/SkStream.cpp",
1059 "src/core/SkString.cpp",
1060 "src/core/SkStringUtils.cpp",
1061 "src/core/SkStroke.cpp",
1062 "src/core/SkStrokeRec.cpp",
1063 "src/core/SkStrokerPriv.cpp",
1064 "src/core/SkThreadID.cpp",
1065 "src/core/SkUtils.cpp",
1066 "src/effects/SkDashPathEffect.cpp",
1067 "src/effects/SkTrimPathEffect.cpp",
1068 "src/ports/SkDebug_stdio.cpp",
1069 "src/ports/SkMemory_malloc.cpp",
1070 "src/utils/SkDashPath.cpp",
1071 "src/utils/SkParse.cpp",
1072 "src/utils/SkParsePath.cpp",
1073 "src/utils/SkUTF.cpp",
1074 ]
1075}
1076
mtkleinc095df52016-08-24 12:23:52 -07001077# Targets guarded by skia_enable_tools may use //third_party freely.
1078if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001079 # Used by gn_to_bp.py to list our public include dirs.
1080 source_set("public") {
1081 configs += [ ":skia_public" ]
1082 }
1083
Mike Kleinc36dedf2016-11-18 09:35:28 -05001084 config("skia.h_config") {
1085 include_dirs = [ "$target_gen_dir" ]
1086 }
1087 action("skia.h") {
1088 public_configs = [ ":skia.h_config" ]
1089 skia_h = "$target_gen_dir/skia.h"
1090 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001091
1092 # TODO: would be cool to not hard-code these here, but how?
1093 module_public_includes = [
1094 "modules/sksg/include",
1095 "modules/skottie/include",
1096 ]
1097 args =
1098 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1099 [ rebase_path(skia_h, root_build_dir) ] +
1100 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001101 depfile = "$skia_h.deps"
1102 outputs = [
1103 skia_h,
1104 ]
1105 }
1106
Brian Osmanc9a42472018-05-31 13:17:12 -04001107 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001108 executable("fiddle") {
1109 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001110 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001111 "tools/fiddle/draw.cpp",
1112 "tools/fiddle/fiddle_main.cpp",
1113 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001114
1115 if (skia_use_egl) {
1116 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001117 } else {
1118 sources += [ "tools/fiddle/null_context.cpp" ]
1119 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001120 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001121 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001122 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001123 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001124 ":skia",
1125 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001126 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001127 ]
1128 }
1129 }
1130
Brian Osmanc9a42472018-05-31 13:17:12 -04001131 source_set("public_headers_warnings_check") {
1132 sources = [
1133 "tools/public_headers_warnings_check.cpp",
1134 ]
1135 configs -= [ "//gn:warnings_except_public_headers" ]
1136 deps = [
1137 ":skia",
1138 ":skia.h",
1139 "modules/skottie",
1140 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001141 }
1142
mtkleinc095df52016-08-24 12:23:52 -07001143 template("test_lib") {
1144 config(target_name + "_config") {
1145 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001146 if (defined(invoker.public_defines)) {
1147 defines = invoker.public_defines
1148 }
mtklein25c81d42016-07-27 13:55:26 -07001149 }
mtkleinc095df52016-08-24 12:23:52 -07001150 source_set(target_name) {
1151 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1152 public_configs = [
1153 ":" + target_name + "_config",
1154 ":skia_private",
1155 ]
1156
1157 if (!defined(deps)) {
1158 deps = []
1159 }
1160 deps += [ ":skia" ]
1161 testonly = true
1162 }
mtklein25c81d42016-07-27 13:55:26 -07001163 }
mtklein25c81d42016-07-27 13:55:26 -07001164
Mike Kleine6682eb2017-01-05 10:54:57 -05001165 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001166 if (is_ios) {
1167 app_name = target_name
1168 gen_path = target_gen_dir
1169
1170 action("${app_name}_generate_info_plist") {
1171 script = "//gn/gen_plist_ios.py"
1172 outputs = [
1173 "$gen_path/${app_name}_Info.plist",
1174 ]
1175 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1176 }
1177
1178 bundle_data("${app_name}_bundle_info_plist") {
1179 public_deps = [
1180 ":${app_name}_generate_info_plist",
1181 ]
1182 sources = [
1183 "$gen_path/${app_name}_Info.plist",
1184 ]
1185 outputs = [
1186 "{{bundle_root_dir}}/Info.plist",
1187 ]
1188 }
1189
Jim Van Verth329c5a62017-11-29 11:42:33 -05001190 bundle_ios_data =
1191 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1192
1193 if (bundle_ios_data) {
1194 has_skps =
1195 "True" == exec_script("//gn/checkdir.py",
1196 [ rebase_path("skps", root_build_dir) ],
1197 "trim string")
1198 bundle_data("${app_name}_bundle_resources") {
1199 sources = [
1200 "resources",
1201 ]
1202 outputs = [
1203 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1204 "{{bundle_resources_dir}}/data/resources",
1205 ]
1206 }
1207
1208 if (has_skps) {
1209 bundle_data("${app_name}_bundle_skps") {
1210 sources = [
1211 "skps",
1212 ]
1213 outputs = [
1214 # Store in same folder as resources
1215 "{{bundle_resources_dir}}/data/skps",
1216 ]
1217 }
1218 }
1219 }
1220
Jim Van Verth443a9132017-11-28 09:45:26 -05001221 executable("${app_name}_generate_executable") {
1222 forward_variables_from(invoker,
1223 "*",
1224 [
1225 "output_name",
1226 "visibility",
1227 "is_shared_library",
1228 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001229 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001230 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001231 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1232 }
1233
1234 bundle_data("${app_name}_bundle_executable") {
1235 public_deps = [
1236 ":${app_name}_generate_executable",
1237 ]
1238 sources = [
1239 "$gen_path/$app_name",
1240 ]
1241 outputs = [
1242 "{{bundle_executable_dir}}/$app_name",
1243 ]
1244 testonly = true
1245 }
1246
1247 create_bundle("$app_name") {
1248 product_type = "com.apple.product-type.application"
1249 testonly = true
1250
1251 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1252 bundle_resources_dir = bundle_root_dir
1253 bundle_executable_dir = bundle_root_dir
1254 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1255
1256 deps = [
1257 ":${app_name}_bundle_executable",
1258 ":${app_name}_bundle_info_plist",
1259 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001260 if (bundle_ios_data) {
1261 deps += [ ":${app_name}_bundle_resources" ]
1262 if (has_skps) {
1263 deps += [ ":${app_name}_bundle_skps" ]
1264 }
1265 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001266
1267 # should only code sign when running on a device, not the simulator
1268 if (target_cpu != "x64") {
1269 code_signing_script = "//gn/codesign_ios.py"
1270 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1271 code_signing_outputs = [
1272 "$bundle_root_dir/_CodeSignature/CodeResources",
1273 "$bundle_root_dir/embedded.mobileprovision",
1274 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001275 code_signing_args = [
1276 rebase_path("$bundle_root_dir", root_build_dir),
1277 skia_ios_identity,
1278 skia_ios_profile,
1279 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001280 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001281 }
1282 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001283 # !is_ios
1284
1285 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1286 shared_library("lib" + target_name) {
1287 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1288 configs += [ ":skia_private" ]
1289 testonly = true
1290 }
1291 } else {
1292 _executable = target_name
1293 executable(_executable) {
1294 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1295 configs += [ ":skia_private" ]
1296 testonly = true
1297 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001298 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001299 if (is_android && skia_android_serial != "" && defined(_executable)) {
1300 action("push_" + target_name) {
1301 script = "gn/push_to_android.py"
1302 deps = [
1303 ":" + _executable,
1304 ]
1305 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1306 outputs = [
1307 _stamp,
1308 ]
1309 args = [
1310 rebase_path("$root_build_dir/$_executable"),
1311 skia_android_serial,
1312 rebase_path(_stamp),
1313 ]
1314 testonly = true
1315 }
Mike Klein7d921032017-01-05 12:20:41 -05001316 }
1317 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001318 }
1319
Greg Danielda16cce2018-08-01 09:23:57 -04001320 config("moltenvk_config") {
1321 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1322 if (is_ios) {
1323 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1324 } else {
1325 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1326 }
1327 cflags = [ "-F$moltenvk_framework_path" ]
1328 ldflags = [ "-F$moltenvk_framework_path" ]
1329 libs = [
1330 "MoltenVK.framework",
1331 "Metal.framework",
1332 "IOSurface.framework",
1333 "QuartzCore.framework",
1334 "Foundation.framework",
1335 ]
1336 if (is_ios) {
1337 libs += [ "UIKit.framework" ]
1338 } else {
1339 libs += [ "IOKit.framework" ]
1340 }
1341 defines = [ "SK_MOLTENVK" ]
1342 }
1343 }
1344
1345 source_set("moltenvk") {
1346 public_configs = [ ":moltenvk_config" ]
1347 }
1348
mtkleinc095df52016-08-24 12:23:52 -07001349 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001350 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001351 public_defines = []
1352 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001353
Brian Osmanc9a42472018-05-31 13:17:12 -04001354 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001355 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001356 sources = [
1357 "tools/gpu/GrContextFactory.cpp",
1358 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001359 "tools/gpu/MemoryCache.cpp",
1360 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001361 "tools/gpu/ProxyUtils.cpp",
1362 "tools/gpu/TestContext.cpp",
1363 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1364 "tools/gpu/gl/GLTestContext.cpp",
1365 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001366 "tools/gpu/gl/null/NullGLTestContext.cpp",
1367 "tools/gpu/mock/MockTestContext.cpp",
1368 ]
1369 libs = []
1370
1371 if (is_android || skia_use_egl) {
1372 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1373 } else if (is_ios) {
1374 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1375 libs += [ "OpenGLES.framework" ]
1376 } else if (is_linux) {
1377 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001378 libs += [
1379 "GLU",
1380 "X11",
1381 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001382 } else if (is_mac) {
1383 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1384 } else if (is_win) {
1385 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1386 libs += [
1387 "Gdi32.lib",
1388 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001389 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001390 }
mtklein25c81d42016-07-27 13:55:26 -07001391
Brian Osmanc9a42472018-05-31 13:17:12 -04001392 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001393
Brian Osmanc9a42472018-05-31 13:17:12 -04001394 if (skia_use_angle) {
1395 deps += [ "//third_party/angle2" ]
1396 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1397 }
Greg Danielb4d89562018-10-03 18:44:49 +00001398 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001399 if (skia_use_vulkan) {
1400 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1401 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001402 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1403 public_deps += [ ":moltenvk" ]
1404 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001405 }
1406 if (skia_use_metal) {
1407 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001408 }
mtklein25c81d42016-07-27 13:55:26 -07001409 }
mtklein25c81d42016-07-27 13:55:26 -07001410
mtkleinc095df52016-08-24 12:23:52 -07001411 test_lib("flags") {
1412 public_include_dirs = [ "tools/flags" ]
1413 sources = [
1414 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001415 ]
1416 }
1417 test_lib("common_flags") {
1418 public_include_dirs = [ "tools/flags" ]
1419 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001420 "tools/flags/SkCommonFlags.cpp",
1421 "tools/flags/SkCommonFlagsConfig.cpp",
1422 ]
1423 deps = [
mtklein046cb562016-09-16 10:23:12 -07001424 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001425 ]
1426 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001427 ":gpu_tool_utils",
1428 ]
1429 }
mtklein25c81d42016-07-27 13:55:26 -07001430
mtkleinc095df52016-08-24 12:23:52 -07001431 test_lib("tool_utils") {
1432 public_include_dirs = [
1433 "tools",
1434 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001435 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001436 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001437 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001438 ]
1439 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001440 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001441 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001442 "tools/DDLPromiseImageHelper.cpp",
1443 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001444 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001445 "tools/ProcStats.cpp",
1446 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001447 "tools/UrlDataManager.cpp",
1448 "tools/debugger/SkDebugCanvas.cpp",
1449 "tools/debugger/SkDrawCommand.cpp",
1450 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001451 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001452 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001453 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001454 "tools/fonts/SkTestFontMgr.h",
1455 "tools/fonts/SkTestSVGTypeface.cpp",
1456 "tools/fonts/SkTestSVGTypeface.h",
1457 "tools/fonts/SkTestTypeface.cpp",
1458 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001459 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001460 "tools/random_parse_path.cpp",
1461 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001462 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001463 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001464 "tools/trace/SkChromeTracingTracer.cpp",
1465 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001466 "tools/trace/SkDebugfTracer.cpp",
1467 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001468 "tools/trace/SkEventTracingPriv.cpp",
1469 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001470 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001471 libs = []
1472 if (is_ios) {
1473 sources += [ "tools/ios_utils.m" ]
1474 libs += [ "Foundation.framework" ]
1475 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001476 defines = []
1477 if (skia_tools_require_resources) {
1478 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1479 }
mtkleinc095df52016-08-24 12:23:52 -07001480 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001481 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001482 ":flags",
1483 "//third_party/libpng",
1484 ]
1485 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001486 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001487 "//third_party/jsoncpp",
1488 ]
1489 }
mtklein25c81d42016-07-27 13:55:26 -07001490
Mike Klein6e744122016-10-27 12:21:40 -04001491 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001492 test_lib("gm") {
1493 public_include_dirs = [ "gm" ]
1494 sources = gm_sources
1495 deps = [
scroggo19b91532016-10-24 09:03:26 -07001496 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001497 ":skia",
1498 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001499 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001500 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001501 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001502 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001503 public_deps = [
1504 ":gpu_tool_utils",
1505 ]
mtkleinc095df52016-08-24 12:23:52 -07001506 }
mtklein25c81d42016-07-27 13:55:26 -07001507
Mike Klein6e744122016-10-27 12:21:40 -04001508 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001509 test_lib("tests") {
1510 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001511 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001512 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001513 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001514 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001515 if (!(skia_use_freetype && skia_use_fontconfig)) {
1516 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1517 }
mtkleinc095df52016-08-24 12:23:52 -07001518 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001519 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001520 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001521 ":skia",
1522 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001523 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001524 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001525 "//third_party/libpng",
1526 "//third_party/zlib",
1527 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001528 public_deps = [
1529 ":gpu_tool_utils", # Test.h #includes headers from this target.
1530 ]
mtkleinc095df52016-08-24 12:23:52 -07001531 }
mtklein2f3416d2016-08-02 16:02:05 -07001532
Mike Klein6e744122016-10-27 12:21:40 -04001533 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001534 test_lib("bench") {
1535 public_include_dirs = [ "bench" ]
1536 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001537 deps = [
1538 ":flags",
1539 ":gm",
1540 ":gpu_tool_utils",
1541 ":skia",
1542 ":tool_utils",
1543 ]
1544 }
mtklein2b6870c2016-07-28 14:17:33 -07001545
mtkleinc095df52016-08-24 12:23:52 -07001546 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001547 public_include_dirs = []
1548 if (skia_use_expat) {
1549 public_include_dirs += [ "experimental/svg/model" ]
1550 sources = [
1551 "experimental/svg/model/SkSVGAttribute.cpp",
1552 "experimental/svg/model/SkSVGAttributeParser.cpp",
1553 "experimental/svg/model/SkSVGCircle.cpp",
1554 "experimental/svg/model/SkSVGClipPath.cpp",
1555 "experimental/svg/model/SkSVGContainer.cpp",
1556 "experimental/svg/model/SkSVGDOM.cpp",
1557 "experimental/svg/model/SkSVGEllipse.cpp",
1558 "experimental/svg/model/SkSVGGradient.cpp",
1559 "experimental/svg/model/SkSVGLine.cpp",
1560 "experimental/svg/model/SkSVGLinearGradient.cpp",
1561 "experimental/svg/model/SkSVGNode.cpp",
1562 "experimental/svg/model/SkSVGPath.cpp",
1563 "experimental/svg/model/SkSVGPattern.cpp",
1564 "experimental/svg/model/SkSVGPoly.cpp",
1565 "experimental/svg/model/SkSVGRadialGradient.cpp",
1566 "experimental/svg/model/SkSVGRect.cpp",
1567 "experimental/svg/model/SkSVGRenderContext.cpp",
1568 "experimental/svg/model/SkSVGSVG.cpp",
1569 "experimental/svg/model/SkSVGShape.cpp",
1570 "experimental/svg/model/SkSVGStop.cpp",
1571 "experimental/svg/model/SkSVGTransformableNode.cpp",
1572 "experimental/svg/model/SkSVGUse.cpp",
1573 "experimental/svg/model/SkSVGValue.cpp",
1574 ]
1575 deps = [
1576 ":skia",
1577 ":xml",
1578 ]
1579 }
mtkleinc095df52016-08-24 12:23:52 -07001580 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001581
Mike Klein38af9432016-11-11 11:39:44 -05001582 if (skia_use_lua) {
1583 test_lib("lua") {
1584 public_include_dirs = []
1585 sources = [
1586 "src/utils/SkLua.cpp",
1587 "src/utils/SkLuaCanvas.cpp",
1588 ]
1589 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001590 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001591 "//third_party/lua",
1592 ]
1593 }
1594
Mike Kleine6682eb2017-01-05 10:54:57 -05001595 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001596 sources = [
1597 "tools/lua/lua_app.cpp",
1598 ]
1599 deps = [
1600 ":lua",
1601 ":skia",
1602 "//third_party/lua",
1603 ]
Mike Klein38af9432016-11-11 11:39:44 -05001604 }
1605
Mike Kleine6682eb2017-01-05 10:54:57 -05001606 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001607 sources = [
1608 "tools/lua/lua_pictures.cpp",
1609 ]
1610 deps = [
1611 ":flags",
1612 ":lua",
1613 ":skia",
1614 ":tool_utils",
1615 "//third_party/lua",
1616 ]
Mike Klein38af9432016-11-11 11:39:44 -05001617 }
1618 }
1619
Cary Clark8032b982017-07-28 11:04:54 -04001620 test_app("bookmaker") {
1621 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001622 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001623 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001624 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001625 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001626 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001627 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001628 "tools/bookmaker/includeParser.cpp",
1629 "tools/bookmaker/includeWriter.cpp",
1630 "tools/bookmaker/mdOut.cpp",
1631 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001632 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001633 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001634 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001635 ]
1636 deps = [
1637 ":flags",
1638 ":skia",
1639 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001640 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001641 ]
1642 }
1643
Florin Malitabfe876a2018-09-02 12:33:59 -04001644 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001645 test_app("skottie_tool") {
1646 deps = [
1647 "modules/skottie:tool",
1648 ]
1649 }
1650 }
1651
Kevin Lubickebf648e2017-09-21 13:45:16 -04001652 if (target_cpu != "wasm") {
1653 import("gn/samples.gni")
1654 test_lib("samples") {
1655 public_include_dirs = [ "samplecode" ]
1656 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001657 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001658 public_deps = [
1659 ":tool_utils",
1660 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001661 deps = [
1662 ":experimental_svg_model",
1663 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001664 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001665 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001666 ]
Mike Klein38af9432016-11-11 11:39:44 -05001667
Ruiqi Maof5101492018-06-29 14:32:21 -04001668 # NIMA does not build on Windows clang
1669 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001670 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001671 deps += [ "//third_party/Nima-Cpp" ]
1672 }
1673
Kevin Lubickebf648e2017-09-21 13:45:16 -04001674 if (skia_use_lua) {
1675 sources += [ "samplecode/SampleLua.cpp" ]
1676 deps += [
1677 ":lua",
1678 "//third_party/lua",
1679 ]
1680 }
1681 }
Mike Klein7af351a2018-07-27 09:54:43 -04001682 test_app("imgcvt") {
1683 sources = [
1684 "tools/imgcvt.cpp",
1685 ]
1686 deps = [
1687 ":skcms",
1688 ":skia",
1689 ]
1690 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001691 test_app("dm") {
1692 sources = [
1693 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001694 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001695 "dm/DMJsonWriter.cpp",
1696 "dm/DMSrcSink.cpp",
1697 ]
1698 include_dirs = [ "tests" ]
1699 deps = [
1700 ":common_flags",
1701 ":experimental_svg_model",
1702 ":flags",
1703 ":gm",
1704 ":gpu_tool_utils",
1705 ":skia",
1706 ":tests",
1707 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001708 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001709 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001710 "//third_party/jsoncpp",
1711 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001712 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001713
1714 # NIMA does not build on Windows clang
1715 if (!is_win || !is_clang) {
1716 deps += [ "//third_party/Nima-Cpp" ]
1717 }
Mike Klein38af9432016-11-11 11:39:44 -05001718 }
Brian Osman16adfa32016-10-18 14:42:44 -04001719 }
1720
Mike Kleina8a51ce2018-01-09 12:34:11 -05001721 if (!is_win) {
1722 test_app("remote_demo") {
1723 sources = [
1724 "tools/remote_demo.cpp",
1725 ]
1726 deps = [
1727 ":skia",
1728 ]
1729 }
1730 }
1731
Mike Kleine6682eb2017-01-05 10:54:57 -05001732 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001733 sources = [
1734 "bench/nanobench.cpp",
1735 ]
1736 deps = [
1737 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001738 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001739 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001740 ":flags",
1741 ":gm",
1742 ":gpu_tool_utils",
1743 ":skia",
1744 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001745 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001746 "//third_party/jsoncpp",
1747 ]
mtklein2b6870c2016-07-28 14:17:33 -07001748 }
halcanary19a97202016-08-03 15:08:04 -07001749
Ravi Mistry10d36c52017-01-31 09:49:18 -05001750 test_app("skpinfo") {
1751 sources = [
1752 "tools/skpinfo.cpp",
1753 ]
1754 deps = [
1755 ":flags",
1756 ":skia",
1757 ]
1758 }
1759
Brian Osmanc9a42472018-05-31 13:17:12 -04001760 test_app("skpbench") {
1761 sources = [
1762 "tools/skpbench/skpbench.cpp",
1763 ]
1764 deps = [
1765 ":flags",
1766 ":gpu_tool_utils",
1767 ":skia",
1768 ":tool_utils",
1769 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001770 }
1771
Mike Kleine6682eb2017-01-05 10:54:57 -05001772 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001773 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001774 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001775 ]
1776 deps = [
1777 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001778 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001779 ]
halcanary3eee9d92016-09-10 07:01:53 -07001780 }
mtklein046cb562016-09-16 10:23:12 -07001781
Ben Wagner219f3622017-07-17 15:32:25 -04001782 test_app("create_test_font") {
1783 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001784 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001785 ]
1786 deps = [
1787 ":skia",
1788 ]
1789 assert_no_deps = [
1790 # tool_utils requires the output of this app.
1791 ":tool_utils",
1792 ]
1793 }
1794
Florin Malita5d3ff432018-07-31 16:38:43 -04001795 if (skia_use_expat) {
1796 test_app("create_test_font_color") {
1797 sources = [
1798 "tools/fonts/create_test_font_color.cpp",
1799 ]
1800 deps = [
1801 ":flags",
1802 ":skia",
1803 ":tool_utils",
1804 ]
1805 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001806 }
1807
Mike Kleine6682eb2017-01-05 10:54:57 -05001808 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001809 sources = [
1810 "tools/get_images_from_skps.cpp",
1811 ]
1812 deps = [
1813 ":flags",
1814 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001815 ]
mtklein046cb562016-09-16 10:23:12 -07001816 }
mtkleinecbc5262016-09-22 11:51:24 -07001817
Kevin Lubickebf648e2017-09-21 13:45:16 -04001818 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001819 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001820 sources = [
1821 "tools/skiaserve/Request.cpp",
1822 "tools/skiaserve/Response.cpp",
1823 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001824 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1825 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1826 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1827 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1828 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1829 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1830 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1831 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1832 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001833 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1834 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001835 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1836 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1837 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1838 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1839 ]
1840 deps = [
1841 ":flags",
1842 ":gpu_tool_utils",
1843 ":skia",
1844 ":tool_utils",
1845 "//third_party/jsoncpp",
1846 "//third_party/libmicrohttpd",
1847 "//third_party/libpng",
1848 ]
Mike Klein7d302882016-11-03 14:06:31 -04001849 }
mtkleinecbc5262016-09-22 11:51:24 -07001850 }
kjlubick14f984b2016-10-03 11:49:45 -07001851
Mike Kleine6682eb2017-01-05 10:54:57 -05001852 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001853 include_dirs = [
1854 "tools",
1855 "tools/debugger",
1856 ]
kjlubick14f984b2016-10-03 11:49:45 -07001857 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001858 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001859 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001860 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001861 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001862 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001863 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001864 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001865 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001866 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001867 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001868 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001869 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001870 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001871 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1872 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001873 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001874 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001875 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001876 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001877 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1878 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001879 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001880 "tools/UrlDataManager.cpp",
1881 "tools/debugger/SkDebugCanvas.cpp",
1882 "tools/debugger/SkDrawCommand.cpp",
1883 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001884 ]
1885 deps = [
1886 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001887 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001888 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001889 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001890 "//third_party/jsoncpp",
1891 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001892 ]
kjlubick14f984b2016-10-03 11:49:45 -07001893 }
Mike Klein38312422016-10-05 15:41:01 -04001894
Mike Kleine6682eb2017-01-05 10:54:57 -05001895 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001896 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001897 rebase_path("tests/skia_test.cpp"),
1898 rebase_path("tests/Test.cpp"),
1899 ]
caryclark9feb6322016-10-25 08:58:26 -07001900 deps = [
1901 ":flags",
1902 ":gpu_tool_utils",
1903 ":skia",
1904 ":tool_utils",
1905 ]
caryclark9feb6322016-10-25 08:58:26 -07001906 }
1907
Mike Kleine6682eb2017-01-05 10:54:57 -05001908 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001909 sources = [
1910 "tools/DumpRecord.cpp",
1911 "tools/dump_record.cpp",
1912 ]
1913 deps = [
1914 ":flags",
1915 ":skia",
1916 ]
Mike Klein38312422016-10-05 15:41:01 -04001917 }
bungemanfe917272016-10-13 17:36:40 -04001918
Mike Kleine6682eb2017-01-05 10:54:57 -05001919 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001920 sources = [
1921 "tools/skdiff/skdiff.cpp",
1922 "tools/skdiff/skdiff_html.cpp",
1923 "tools/skdiff/skdiff_main.cpp",
1924 "tools/skdiff/skdiff_utils.cpp",
1925 ]
1926 deps = [
1927 ":skia",
1928 ":tool_utils",
1929 ]
bungemanfe917272016-10-13 17:36:40 -04001930 }
halcanarya73d76a2016-10-17 13:19:02 -07001931
Mike Kleine6682eb2017-01-05 10:54:57 -05001932 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001933 sources = [
1934 "tools/skp_parser.cpp",
1935 ]
1936 deps = [
1937 ":skia",
1938 ":tool_utils",
1939 "//third_party/jsoncpp",
1940 ]
halcanarya73d76a2016-10-17 13:19:02 -07001941 }
Brian Osman16adfa32016-10-18 14:42:44 -04001942
Brian Osmanc9a42472018-05-31 13:17:12 -04001943 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001944 test_lib("skqp_lib") {
1945 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001946 defines =
1947 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001948 if (skia_skqp_enable_driver_correctness_workarounds) {
1949 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1950 }
Hal Canary75427132017-10-11 16:00:31 -04001951 sources = [
1952 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001953 "tools/skqp/gm_knowledge.cpp",
1954 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001955 ]
1956 deps = [
1957 ":gm",
1958 ":gpu_tool_utils",
1959 ":skia",
1960 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001961 ":tool_utils",
1962 ]
1963 }
1964 test_app("skqp") {
1965 sources = [
1966 "tools/skqp/skqp.cpp",
1967 ]
1968 deps = [
1969 ":skia",
1970 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001971 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001972 "//third_party/googletest",
1973 ]
1974 }
1975 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001976 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001977 test_app("skqp_app") {
1978 is_shared_library = true
1979 sources = [
1980 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1981 ]
1982 deps = [
1983 ":skia",
1984 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001985 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001986 ]
1987 libs = [ "android" ]
1988 }
1989 }
Stan Iliev93151722018-08-02 11:10:52 -04001990 if (is_android && skia_enable_gpu) {
1991 test_app("skottie_android") {
1992 is_shared_library = true
1993
1994 sources = [
1995 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
1996 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
1997 ]
1998 libs = []
1999
2000 include_dirs = []
2001 deps = [
2002 ":skia",
2003 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002004 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002005 ]
2006 }
2007 }
Hal Canary75427132017-10-11 16:00:31 -04002008
Hal Canarya9de7602018-01-19 13:08:23 -05002009 test_app("list_gms") {
2010 sources = [
2011 "tools/list_gms.cpp",
2012 ]
2013 deps = [
2014 ":gm",
2015 ":skia",
2016 ]
2017 }
2018 test_app("list_gpu_unit_tests") {
2019 sources = [
2020 "dm/DMGpuTestProcs.cpp",
2021 "tools/list_gpu_unit_tests.cpp",
2022 ]
2023 deps = [
2024 ":skia",
2025 ":tests",
2026 ]
2027 }
2028
Brian Osmanc9a42472018-05-31 13:17:12 -04002029 test_lib("sk_app") {
2030 public_include_dirs = [ "tools/sk_app" ]
2031 sources = [
2032 "tools/sk_app/CommandSet.cpp",
2033 "tools/sk_app/GLWindowContext.cpp",
2034 "tools/sk_app/Window.cpp",
2035 ]
2036 libs = []
2037
2038 if (is_android) {
2039 sources += [
2040 "tools/sk_app/android/GLWindowContext_android.cpp",
2041 "tools/sk_app/android/RasterWindowContext_android.cpp",
2042 "tools/sk_app/android/Window_android.cpp",
2043 "tools/sk_app/android/main_android.cpp",
2044 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002045 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002046 libs += [ "android" ]
2047 } else if (is_linux) {
2048 sources += [
2049 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2050 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2051 "tools/sk_app/unix/Window_unix.cpp",
2052 "tools/sk_app/unix/keysym2ucs.c",
2053 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002054 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002055 libs += [
2056 "GL",
2057 "X11",
2058 ]
2059 } else if (is_win) {
2060 sources += [
2061 "tools/sk_app/win/GLWindowContext_win.cpp",
2062 "tools/sk_app/win/RasterWindowContext_win.cpp",
2063 "tools/sk_app/win/Window_win.cpp",
2064 "tools/sk_app/win/main_win.cpp",
2065 ]
Brian Salomon194db172017-08-17 14:37:06 -04002066 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002067 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002068 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002069 } else if (is_mac) {
2070 sources += [
2071 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2072 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2073 "tools/sk_app/mac/Window_mac.cpp",
2074 "tools/sk_app/mac/main_mac.cpp",
2075 ]
2076 libs += [
2077 "QuartzCore.framework",
2078 "Cocoa.framework",
2079 "Foundation.framework",
2080 ]
2081 } else if (is_ios) {
2082 sources += [
2083 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2084 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2085 "tools/sk_app/ios/Window_ios.cpp",
2086 "tools/sk_app/ios/main_ios.cpp",
2087 ]
2088 }
2089
2090 if (skia_use_vulkan) {
2091 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2092 if (is_android) {
2093 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2094 } else if (is_linux) {
2095 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2096 libs += [ "X11-xcb" ]
2097 } else if (is_win) {
2098 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2099 }
2100 }
2101
2102 deps = [
2103 ":gpu_tool_utils",
2104 ":skia",
2105 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002106 ]
2107 if (is_android) {
2108 deps += [ "//third_party/native_app_glue" ]
2109 } else if (is_mac || is_ios) {
2110 deps += [ "//third_party/libsdl" ]
2111 }
2112 if (skia_use_angle) {
2113 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002114 }
Brian Osman16adfa32016-10-18 14:42:44 -04002115 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002116
Brian Osmanc9a42472018-05-31 13:17:12 -04002117 test_app("viewer") {
2118 is_shared_library = is_android
2119 if (is_ios) {
2120 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002121 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002122 sources = [
2123 "tools/viewer/BisectSlide.cpp",
2124 "tools/viewer/GMSlide.cpp",
2125 "tools/viewer/ImGuiLayer.cpp",
2126 "tools/viewer/ImageSlide.cpp",
2127 "tools/viewer/SKPSlide.cpp",
2128 "tools/viewer/SampleSlide.cpp",
2129 "tools/viewer/SkottieSlide.cpp",
2130 "tools/viewer/SlideDir.cpp",
2131 "tools/viewer/StatsLayer.cpp",
2132 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002133 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002134 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002135 "tools/viewer/Viewer.cpp",
2136 ]
2137 libs = []
2138
Kevin Lubickd9699322018-10-30 15:08:53 -04002139 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002140 deps = [
2141 ":experimental_svg_model",
2142 ":flags",
2143 ":gm",
2144 ":gpu_tool_utils",
2145 ":samples",
2146 ":sk_app",
2147 ":skia",
2148 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002149 "modules/skottie",
2150 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002151 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002152 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002153 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002154
2155 # NIMA does not build on Windows clang
2156 if (!is_win || !is_clang) {
2157 sources += [ "tools/viewer/NIMASlide.cpp" ]
2158 deps += [ "//third_party/Nima-Cpp" ]
2159 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002160 }
2161
ziadbbceddbc2018-06-19 13:57:15 -04002162 if (is_android) {
2163 test_app("arcore") {
2164 is_shared_library = true
2165 configs = [
2166 ":skia_public",
2167 "gn:default",
2168 ]
2169
2170 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2171 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2172 sources = []
2173 sources += skia_core_sources
2174 sources += skia_utils_sources
2175 sources += skia_xps_sources
2176 sources += [
2177 "src/android/SkAndroidFrameworkUtils.cpp",
2178 "src/android/SkAnimatedImage.cpp",
2179 "src/android/SkBitmapRegionCodec.cpp",
2180 "src/android/SkBitmapRegionDecoder.cpp",
2181 "src/codec/SkAndroidCodec.cpp",
2182 "src/codec/SkBmpBaseCodec.cpp",
2183 "src/codec/SkBmpCodec.cpp",
2184 "src/codec/SkBmpMaskCodec.cpp",
2185 "src/codec/SkBmpRLECodec.cpp",
2186 "src/codec/SkBmpStandardCodec.cpp",
2187 "src/codec/SkCodec.cpp",
2188 "src/codec/SkCodecImageGenerator.cpp",
2189 "src/codec/SkColorTable.cpp",
2190 "src/codec/SkGifCodec.cpp",
2191 "src/codec/SkMaskSwizzler.cpp",
2192 "src/codec/SkMasks.cpp",
2193 "src/codec/SkSampledCodec.cpp",
2194 "src/codec/SkSampler.cpp",
2195 "src/codec/SkStreamBuffer.cpp",
2196 "src/codec/SkSwizzler.cpp",
2197 "src/codec/SkWbmpCodec.cpp",
2198 "src/images/SkImageEncoder.cpp",
2199 "src/ports/SkDiscardableMemory_none.cpp",
2200 "src/ports/SkImageGenerator_skia.cpp",
2201 "src/ports/SkMemory_malloc.cpp",
2202 "src/ports/SkOSFile_stdio.cpp",
2203 "src/sfnt/SkOTTable_name.cpp",
2204 "src/sfnt/SkOTUtils.cpp",
2205 "src/utils/mac/SkStream_mac.cpp",
2206 "third_party/gif/SkGifImageReader.cpp",
2207 ]
2208 deps = [
2209 ":tool_utils",
2210 "modules/skottie",
2211 "modules/skshaper",
2212 ]
2213 }
2214 }
2215
Brian Osmanc9a42472018-05-31 13:17:12 -04002216 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002217 test_app("HelloWorld") {
2218 sources = [
2219 "example/HelloWorld.cpp",
2220 ]
2221 libs = []
2222
2223 include_dirs = []
2224 deps = [
2225 ":flags",
2226 ":gpu_tool_utils",
2227 ":sk_app",
2228 ":skia",
2229 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002230 ]
2231 }
2232 }
2233
Brian Osmanc9a42472018-05-31 13:17:12 -04002234 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002235 test_app("SkiaSDLExample") {
2236 sources = [
2237 "example/SkiaSDLExample.cpp",
2238 ]
2239 libs = []
2240 include_dirs = []
2241 deps = [
2242 ":gpu_tool_utils",
2243 ":skia",
2244 "//third_party/libsdl",
2245 ]
2246 }
2247 }
2248
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002249 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2250 action_foreach("generate_mocs") {
2251 script = "gn/call.py"
2252 sources = [
2253 "tools/mdbviz/MainWindow.h",
2254 ]
2255 outputs = [
2256 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2257 ]
2258 args = [
2259 "$skia_qt_path" + "/bin/moc",
2260 "{{source}}",
2261 "-o",
2262 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2263 ]
2264 }
2265 action_foreach("generate_resources") {
2266 script = "gn/call.py"
2267 sources = [
2268 "tools/mdbviz/resources.qrc",
2269 ]
2270 outputs = [
2271 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2272 ]
2273 args = [
2274 "$skia_qt_path" + "/bin/rcc",
2275 "{{source}}",
2276 "-o",
2277 "gen/mdbviz/{{source_name_part}}_res.cpp",
2278 ]
2279 }
2280 test_app("mdbviz") {
2281 if (is_win) {
2282 # on Windows we need to disable some exception handling warnings due to the Qt headers
2283 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2284 }
2285 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002286 "tools/UrlDataManager.cpp",
2287 "tools/debugger/SkDebugCanvas.cpp",
2288 "tools/debugger/SkDrawCommand.cpp",
2289 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002290 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002291 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002292 "tools/mdbviz/main.cpp",
2293
2294 # generated files
2295 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2296 "$target_gen_dir/mdbviz/resources_res.cpp",
2297 ]
2298 lib_dirs = [ "$skia_qt_path/lib" ]
2299 libs = [
2300 "Qt5Core.lib",
2301 "Qt5Gui.lib",
2302 "Qt5Widgets.lib",
2303 ]
2304 include_dirs = [
2305 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002306 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002307 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002308 "tools",
2309 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002310 ]
2311 deps = [
2312 ":generate_mocs",
2313 ":generate_resources",
2314 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002315 "//third_party/jsoncpp",
2316 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002317 ]
2318 }
2319 }
2320
Mike Kleine459afd2017-03-03 09:21:30 -05002321 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002322 copy("gdbserver") {
2323 sources = [
2324 "$ndk/$ndk_gdbserver",
2325 ]
2326 outputs = [
2327 "$root_out_dir/gdbserver",
2328 ]
2329 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002330 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002331
2332 if (skia_use_opencl) {
2333 test_app("hello-opencl") {
2334 sources = [
2335 "src/compute/common/cl/assert_cl.c",
2336 "src/compute/common/cl/find_cl.c",
2337 "tools/hello-opencl.cpp",
2338 ]
2339 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002340 if (is_linux) {
2341 libs = [ "OpenCL" ]
2342 } else if (is_win) {
2343 libs = [ "OpenCL.lib" ]
2344 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002345 }
2346 }
mtklein25c81d42016-07-27 13:55:26 -07002347}