blob: c889c8befca09f593c0e9449bdb6ad564053f648 [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 = [
scroggof84ad642016-10-31 09:02:57 -0700724 "src/codec/SkRawCodec.cpp",
725 ]
726}
727
Mike Klein852a8cb2018-05-15 10:46:58 -0400728import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400729source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400730 cflags = []
731 if (!is_win || is_clang) {
732 cflags += [
733 "-w",
734 "-std=c11",
735 ]
736 }
737
738 public = [
739 "third_party/skcms/skcms.h",
740 ]
741 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
742}
743
mtklein3cc22182016-08-29 13:26:14 -0700744optional("typeface_freetype") {
745 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700746
747 deps = [
748 "//third_party/freetype2",
749 ]
750 sources = [
751 "src/ports/SkFontHost_FreeType.cpp",
752 "src/ports/SkFontHost_FreeType_common.cpp",
753 ]
754}
755
mtklein457b42a2016-08-23 13:56:37 -0700756optional("webp") {
757 enabled = skia_use_libwebp
758 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
759
mtklein457b42a2016-08-23 13:56:37 -0700760 deps = [
761 "//third_party/libwebp",
762 ]
763 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700764 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400765 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700766 ]
mtkleineb3c4252016-08-23 07:38:09 -0700767}
768
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400769optional("wuffs") {
770 enabled = skia_use_wuffs
771 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
772
773 deps = [
774 "//third_party/wuffs",
775 ]
776 sources = [
777 "src/codec/SkWuffsCodec.cpp",
778 ]
779}
780
mtklein63213812016-08-24 09:55:56 -0700781optional("xml") {
782 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000783 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700784
mtklein63213812016-08-24 09:55:56 -0700785 deps = [
786 "//third_party/expat",
787 ]
788 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500789 "src/svg/SkSVGCanvas.cpp",
790 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700791 "src/xml/SkDOM.cpp",
792 "src/xml/SkXMLParser.cpp",
793 "src/xml/SkXMLWriter.cpp",
794 ]
795}
796
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700797if (skia_enable_gpu && skia_generate_workarounds) {
798 action("workaround_list") {
799 script = "tools/build_workaround_header.py"
800
801 inputs = [
802 "src/gpu/gpu_workaround_list.txt",
803 ]
804
805 # see comments in skia_compile_processors about out dir path shenanigans.
806 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700807 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700808
809 outputs = [
810 "$root_out_dir/$output_file",
811 ]
812 args = [
813 "--output-file",
814 "$output_file",
815 ]
816
817 foreach(file, inputs) {
818 args += [ rebase_path(file, root_build_dir) ]
819 }
820 }
821}
822
mtkleinc04ff472016-06-23 10:29:30 -0700823component("skia") {
824 public_configs = [ ":skia_public" ]
825 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700826
Mike Klein607b0a72018-11-07 16:17:34 -0500827 public_deps = [
Mike Klein607b0a72018-11-07 16:17:34 -0500828 ":gpu",
829 ":pdf",
830 ":skcms",
831 ]
832
mtkleinc04ff472016-06-23 10:29:30 -0700833 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700834 ":arm64",
835 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700836 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000837 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700838 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700839 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700840 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500841 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700842 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700843 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400844 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500845 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700846 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700847 ":none",
mtklein63213812016-08-24 09:55:56 -0700848 ":png",
scroggof84ad642016-10-31 09:02:57 -0700849 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700850 ":sse2",
851 ":sse41",
852 ":sse42",
853 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700854 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400855 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700856 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700857 ]
858
Kevin Lubick134be1d2018-10-30 15:05:04 -0400859 if (skia_enable_nima) {
860 deps += [ "//third_party/Nima-Cpp" ]
861 }
862
Chinmay Garde43f115c2016-11-16 15:04:12 -0800863 # This file (and all GN files in Skia) are designed to work with an
864 # empty sources assignment filter; we handle all that explicitly.
865 # We clear the filter here for clients who may have set up a global filter.
866 set_sources_assignment_filter([])
867
mtkleinc04ff472016-06-23 10:29:30 -0700868 sources = []
brettwb9447282016-09-01 14:24:39 -0700869 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700870 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500871 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000872 sources += skia_effects_sources
873 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700874 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400875 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500876 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700877 "src/android/SkBitmapRegionCodec.cpp",
878 "src/android/SkBitmapRegionDecoder.cpp",
879 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100880 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400881 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700882 "src/codec/SkBmpCodec.cpp",
883 "src/codec/SkBmpMaskCodec.cpp",
884 "src/codec/SkBmpRLECodec.cpp",
885 "src/codec/SkBmpStandardCodec.cpp",
886 "src/codec/SkCodec.cpp",
887 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400888 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400889 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700890 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700891 "src/codec/SkMaskSwizzler.cpp",
892 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700893 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700894 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700895 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700896 "src/codec/SkSwizzler.cpp",
897 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700898 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700899 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000900 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700901 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700902 "src/ports/SkMemory_malloc.cpp",
903 "src/ports/SkOSFile_stdio.cpp",
904 "src/sfnt/SkOTTable_name.cpp",
905 "src/sfnt/SkOTUtils.cpp",
906 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700907 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700908 ]
brettwb9447282016-09-01 14:24:39 -0700909
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400910 defines = []
911 if (!skia_enable_skpicture) {
912 defines = [ "SK_DISABLE_SKPICTURE" ]
913 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000914 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400915 sources += [ "src/core/SkPicture_none.cpp" ]
916 }
917
mtklein7d6fb2c2016-08-25 14:50:44 -0700918 libs = []
919
mtkleinc04ff472016-06-23 10:29:30 -0700920 if (is_win) {
921 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400922 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700923 "src/ports/SkDebug_win.cpp",
924 "src/ports/SkFontHost_win.cpp",
925 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500926 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700927 "src/ports/SkImageEncoder_WIC.cpp",
928 "src/ports/SkImageGeneratorWIC.cpp",
929 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700930 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700931 "src/ports/SkScalerContext_win_dw.cpp",
932 "src/ports/SkTLS_win.cpp",
933 "src/ports/SkTypeface_win_dw.cpp",
934 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400935 libs += [
936 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500937 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400938 "Ole32.lib",
939 "OleAut32.lib",
940 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500941 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400942 ]
mtkleinc04ff472016-06-23 10:29:30 -0700943 } else {
944 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700945 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700946 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700947 "src/ports/SkTLS_pthread.cpp",
948 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400949 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700950 }
951
mtklein7d6fb2c2016-08-25 14:50:44 -0700952 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500953 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500954 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500955 deps += [ "//third_party/cpu-features" ]
956 }
mtklein06c35c02016-09-20 12:28:12 -0700957 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700958 libs += [
959 "EGL",
960 "GLESv2",
961 "log",
962 ]
963 }
964
Kevin Lubick217056c2018-09-20 17:39:31 -0400965 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700966 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400967 if (skia_use_egl) {
968 libs += [ "GLESv2" ]
969 }
mtkleinc04ff472016-06-23 10:29:30 -0700970 }
971
972 if (is_mac) {
973 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700974 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700975 "src/ports/SkFontHost_mac.cpp",
976 "src/ports/SkImageEncoder_CG.cpp",
977 "src/ports/SkImageGeneratorCG.cpp",
978 ]
mtklein09e61f72016-08-23 13:35:28 -0700979 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400980 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
981 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700982 "ApplicationServices.framework",
983 "OpenGL.framework",
984 ]
mtkleinc04ff472016-06-23 10:29:30 -0700985 }
abarth6fc8ff02016-07-15 15:15:15 -0700986
Mike Klein7d302882016-11-03 14:06:31 -0400987 if (is_ios) {
988 sources += [
989 "src/ports/SkDebug_stdio.cpp",
990 "src/ports/SkFontHost_mac.cpp",
991 "src/ports/SkImageEncoder_CG.cpp",
992 "src/ports/SkImageGeneratorCG.cpp",
993 ]
994 libs += [
995 "CoreFoundation.framework",
996 "CoreGraphics.framework",
997 "CoreText.framework",
998 "ImageIO.framework",
999 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001000
1001 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1002 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001003 ]
1004 }
1005
abarth6fc8ff02016-07-15 15:15:15 -07001006 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001007 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001008 }
mtkleinc04ff472016-06-23 10:29:30 -07001009}
1010
Kevin Lubickcbcff382018-10-02 09:02:18 -04001011static_library("pathkit") {
1012 public_configs = [ ":skia_public" ]
1013 configs += skia_library_configs
1014
1015 deps = [
1016 ":arm64",
1017 ":armv7",
1018 ":avx",
1019 ":crc32",
1020 ":hsw",
1021 ":none",
1022 ":sse2",
1023 ":sse41",
1024 ":sse42",
1025 ":ssse3",
1026 ]
1027
1028 # This file (and all GN files in Skia) are designed to work with an
1029 # empty sources assignment filter; we handle all that explicitly.
1030 # We clear the filter here for clients who may have set up a global filter.
1031 set_sources_assignment_filter([])
1032
1033 sources = []
1034 sources += skia_pathops_sources
1035 sources += [
1036 "src/core/SkAnalyticEdge.cpp",
1037 "src/core/SkArenaAlloc.cpp",
1038 "src/core/SkCubicMap.cpp",
1039 "src/core/SkEdge.cpp",
1040 "src/core/SkEdgeBuilder.cpp",
1041 "src/core/SkEdgeClipper.cpp",
1042 "src/core/SkGeometry.cpp",
1043 "src/core/SkLineClipper.cpp",
1044 "src/core/SkMallocPixelRef.cpp",
1045 "src/core/SkMath.cpp",
1046 "src/core/SkMatrix.cpp",
1047 "src/core/SkOpts.cpp",
1048 "src/core/SkPaint.cpp",
1049 "src/core/SkPath.cpp",
1050 "src/core/SkPathEffect.cpp",
1051 "src/core/SkPathMeasure.cpp",
1052 "src/core/SkPathRef.cpp",
1053 "src/core/SkPoint.cpp",
1054 "src/core/SkRRect.cpp",
1055 "src/core/SkRect.cpp",
1056 "src/core/SkSemaphore.cpp",
1057 "src/core/SkStream.cpp",
1058 "src/core/SkString.cpp",
1059 "src/core/SkStringUtils.cpp",
1060 "src/core/SkStroke.cpp",
1061 "src/core/SkStrokeRec.cpp",
1062 "src/core/SkStrokerPriv.cpp",
1063 "src/core/SkThreadID.cpp",
1064 "src/core/SkUtils.cpp",
1065 "src/effects/SkDashPathEffect.cpp",
1066 "src/effects/SkTrimPathEffect.cpp",
1067 "src/ports/SkDebug_stdio.cpp",
1068 "src/ports/SkMemory_malloc.cpp",
1069 "src/utils/SkDashPath.cpp",
1070 "src/utils/SkParse.cpp",
1071 "src/utils/SkParsePath.cpp",
1072 "src/utils/SkUTF.cpp",
1073 ]
1074}
1075
mtkleinc095df52016-08-24 12:23:52 -07001076# Targets guarded by skia_enable_tools may use //third_party freely.
1077if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001078 # Used by gn_to_bp.py to list our public include dirs.
1079 source_set("public") {
1080 configs += [ ":skia_public" ]
1081 }
1082
Mike Kleinc36dedf2016-11-18 09:35:28 -05001083 config("skia.h_config") {
1084 include_dirs = [ "$target_gen_dir" ]
1085 }
1086 action("skia.h") {
1087 public_configs = [ ":skia.h_config" ]
1088 skia_h = "$target_gen_dir/skia.h"
1089 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001090
1091 # TODO: would be cool to not hard-code these here, but how?
1092 module_public_includes = [
1093 "modules/sksg/include",
1094 "modules/skottie/include",
1095 ]
1096 args =
1097 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1098 [ rebase_path(skia_h, root_build_dir) ] +
1099 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001100 depfile = "$skia_h.deps"
1101 outputs = [
1102 skia_h,
1103 ]
1104 }
1105
Brian Osmanc9a42472018-05-31 13:17:12 -04001106 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001107 executable("fiddle") {
1108 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001109 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001110 "tools/fiddle/draw.cpp",
1111 "tools/fiddle/fiddle_main.cpp",
1112 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001113
1114 if (skia_use_egl) {
1115 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001116 } else {
1117 sources += [ "tools/fiddle/null_context.cpp" ]
1118 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001119 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001120 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001121 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001122 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001123 ":skia",
1124 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001125 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001126 ]
1127 }
1128 }
1129
Brian Osmanc9a42472018-05-31 13:17:12 -04001130 source_set("public_headers_warnings_check") {
1131 sources = [
1132 "tools/public_headers_warnings_check.cpp",
1133 ]
1134 configs -= [ "//gn:warnings_except_public_headers" ]
1135 deps = [
1136 ":skia",
1137 ":skia.h",
1138 "modules/skottie",
1139 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001140 }
1141
mtkleinc095df52016-08-24 12:23:52 -07001142 template("test_lib") {
1143 config(target_name + "_config") {
1144 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001145 if (defined(invoker.public_defines)) {
1146 defines = invoker.public_defines
1147 }
mtklein25c81d42016-07-27 13:55:26 -07001148 }
mtkleinc095df52016-08-24 12:23:52 -07001149 source_set(target_name) {
1150 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1151 public_configs = [
1152 ":" + target_name + "_config",
1153 ":skia_private",
1154 ]
1155
1156 if (!defined(deps)) {
1157 deps = []
1158 }
1159 deps += [ ":skia" ]
1160 testonly = true
1161 }
mtklein25c81d42016-07-27 13:55:26 -07001162 }
mtklein25c81d42016-07-27 13:55:26 -07001163
Mike Kleine6682eb2017-01-05 10:54:57 -05001164 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001165 if (is_ios) {
1166 app_name = target_name
1167 gen_path = target_gen_dir
1168
1169 action("${app_name}_generate_info_plist") {
1170 script = "//gn/gen_plist_ios.py"
1171 outputs = [
1172 "$gen_path/${app_name}_Info.plist",
1173 ]
1174 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1175 }
1176
1177 bundle_data("${app_name}_bundle_info_plist") {
1178 public_deps = [
1179 ":${app_name}_generate_info_plist",
1180 ]
1181 sources = [
1182 "$gen_path/${app_name}_Info.plist",
1183 ]
1184 outputs = [
1185 "{{bundle_root_dir}}/Info.plist",
1186 ]
1187 }
1188
Jim Van Verth329c5a62017-11-29 11:42:33 -05001189 bundle_ios_data =
1190 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1191
1192 if (bundle_ios_data) {
1193 has_skps =
1194 "True" == exec_script("//gn/checkdir.py",
1195 [ rebase_path("skps", root_build_dir) ],
1196 "trim string")
1197 bundle_data("${app_name}_bundle_resources") {
1198 sources = [
1199 "resources",
1200 ]
1201 outputs = [
1202 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1203 "{{bundle_resources_dir}}/data/resources",
1204 ]
1205 }
1206
1207 if (has_skps) {
1208 bundle_data("${app_name}_bundle_skps") {
1209 sources = [
1210 "skps",
1211 ]
1212 outputs = [
1213 # Store in same folder as resources
1214 "{{bundle_resources_dir}}/data/skps",
1215 ]
1216 }
1217 }
1218 }
1219
Jim Van Verth443a9132017-11-28 09:45:26 -05001220 executable("${app_name}_generate_executable") {
1221 forward_variables_from(invoker,
1222 "*",
1223 [
1224 "output_name",
1225 "visibility",
1226 "is_shared_library",
1227 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001228 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001229 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001230 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1231 }
1232
1233 bundle_data("${app_name}_bundle_executable") {
1234 public_deps = [
1235 ":${app_name}_generate_executable",
1236 ]
1237 sources = [
1238 "$gen_path/$app_name",
1239 ]
1240 outputs = [
1241 "{{bundle_executable_dir}}/$app_name",
1242 ]
1243 testonly = true
1244 }
1245
1246 create_bundle("$app_name") {
1247 product_type = "com.apple.product-type.application"
1248 testonly = true
1249
1250 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1251 bundle_resources_dir = bundle_root_dir
1252 bundle_executable_dir = bundle_root_dir
1253 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1254
1255 deps = [
1256 ":${app_name}_bundle_executable",
1257 ":${app_name}_bundle_info_plist",
1258 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001259 if (bundle_ios_data) {
1260 deps += [ ":${app_name}_bundle_resources" ]
1261 if (has_skps) {
1262 deps += [ ":${app_name}_bundle_skps" ]
1263 }
1264 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001265
1266 # should only code sign when running on a device, not the simulator
1267 if (target_cpu != "x64") {
1268 code_signing_script = "//gn/codesign_ios.py"
1269 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1270 code_signing_outputs = [
1271 "$bundle_root_dir/_CodeSignature/CodeResources",
1272 "$bundle_root_dir/embedded.mobileprovision",
1273 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001274 code_signing_args = [
1275 rebase_path("$bundle_root_dir", root_build_dir),
1276 skia_ios_identity,
1277 skia_ios_profile,
1278 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001279 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001280 }
1281 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001282 # !is_ios
1283
1284 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1285 shared_library("lib" + target_name) {
1286 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1287 configs += [ ":skia_private" ]
1288 testonly = true
1289 }
1290 } else {
1291 _executable = target_name
1292 executable(_executable) {
1293 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1294 configs += [ ":skia_private" ]
1295 testonly = true
1296 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001297 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001298 if (is_android && skia_android_serial != "" && defined(_executable)) {
1299 action("push_" + target_name) {
1300 script = "gn/push_to_android.py"
1301 deps = [
1302 ":" + _executable,
1303 ]
1304 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1305 outputs = [
1306 _stamp,
1307 ]
1308 args = [
1309 rebase_path("$root_build_dir/$_executable"),
1310 skia_android_serial,
1311 rebase_path(_stamp),
1312 ]
1313 testonly = true
1314 }
Mike Klein7d921032017-01-05 12:20:41 -05001315 }
1316 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001317 }
1318
Greg Danielda16cce2018-08-01 09:23:57 -04001319 config("moltenvk_config") {
1320 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1321 if (is_ios) {
1322 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1323 } else {
1324 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1325 }
1326 cflags = [ "-F$moltenvk_framework_path" ]
1327 ldflags = [ "-F$moltenvk_framework_path" ]
1328 libs = [
1329 "MoltenVK.framework",
1330 "Metal.framework",
1331 "IOSurface.framework",
1332 "QuartzCore.framework",
1333 "Foundation.framework",
1334 ]
1335 if (is_ios) {
1336 libs += [ "UIKit.framework" ]
1337 } else {
1338 libs += [ "IOKit.framework" ]
1339 }
1340 defines = [ "SK_MOLTENVK" ]
1341 }
1342 }
1343
1344 source_set("moltenvk") {
1345 public_configs = [ ":moltenvk_config" ]
1346 }
1347
mtkleinc095df52016-08-24 12:23:52 -07001348 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001349 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001350 public_defines = []
1351 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001352
Brian Osmanc9a42472018-05-31 13:17:12 -04001353 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001354 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001355 sources = [
1356 "tools/gpu/GrContextFactory.cpp",
1357 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001358 "tools/gpu/MemoryCache.cpp",
1359 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001360 "tools/gpu/ProxyUtils.cpp",
1361 "tools/gpu/TestContext.cpp",
1362 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1363 "tools/gpu/gl/GLTestContext.cpp",
1364 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001365 "tools/gpu/gl/null/NullGLTestContext.cpp",
1366 "tools/gpu/mock/MockTestContext.cpp",
1367 ]
1368 libs = []
1369
1370 if (is_android || skia_use_egl) {
1371 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1372 } else if (is_ios) {
1373 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1374 libs += [ "OpenGLES.framework" ]
1375 } else if (is_linux) {
1376 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001377 libs += [
1378 "GLU",
1379 "X11",
1380 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001381 } else if (is_mac) {
1382 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1383 } else if (is_win) {
1384 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1385 libs += [
1386 "Gdi32.lib",
1387 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001388 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001389 }
mtklein25c81d42016-07-27 13:55:26 -07001390
Brian Osmanc9a42472018-05-31 13:17:12 -04001391 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001392
Brian Osmanc9a42472018-05-31 13:17:12 -04001393 if (skia_use_angle) {
1394 deps += [ "//third_party/angle2" ]
1395 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1396 }
Greg Danielb4d89562018-10-03 18:44:49 +00001397 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001398 if (skia_use_vulkan) {
1399 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1400 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001401 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1402 public_deps += [ ":moltenvk" ]
1403 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001404 }
1405 if (skia_use_metal) {
1406 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001407 }
mtklein25c81d42016-07-27 13:55:26 -07001408 }
mtklein25c81d42016-07-27 13:55:26 -07001409
mtkleinc095df52016-08-24 12:23:52 -07001410 test_lib("flags") {
1411 public_include_dirs = [ "tools/flags" ]
1412 sources = [
1413 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001414 ]
1415 }
1416 test_lib("common_flags") {
1417 public_include_dirs = [ "tools/flags" ]
1418 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001419 "tools/flags/SkCommonFlags.cpp",
1420 "tools/flags/SkCommonFlagsConfig.cpp",
1421 ]
1422 deps = [
mtklein046cb562016-09-16 10:23:12 -07001423 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001424 ]
1425 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001426 ":gpu_tool_utils",
1427 ]
1428 }
mtklein25c81d42016-07-27 13:55:26 -07001429
mtkleinc095df52016-08-24 12:23:52 -07001430 test_lib("tool_utils") {
1431 public_include_dirs = [
1432 "tools",
1433 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001434 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001435 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001436 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001437 ]
1438 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001439 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001440 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001441 "tools/DDLPromiseImageHelper.cpp",
1442 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001443 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001444 "tools/ProcStats.cpp",
1445 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001446 "tools/UrlDataManager.cpp",
1447 "tools/debugger/SkDebugCanvas.cpp",
1448 "tools/debugger/SkDrawCommand.cpp",
1449 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001450 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001451 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001452 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001453 "tools/fonts/SkTestFontMgr.h",
1454 "tools/fonts/SkTestSVGTypeface.cpp",
1455 "tools/fonts/SkTestSVGTypeface.h",
1456 "tools/fonts/SkTestTypeface.cpp",
1457 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001458 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001459 "tools/random_parse_path.cpp",
1460 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001461 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001462 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001463 "tools/trace/SkChromeTracingTracer.cpp",
1464 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001465 "tools/trace/SkDebugfTracer.cpp",
1466 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001467 "tools/trace/SkEventTracingPriv.cpp",
1468 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001469 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001470 libs = []
1471 if (is_ios) {
1472 sources += [ "tools/ios_utils.m" ]
1473 libs += [ "Foundation.framework" ]
1474 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001475 defines = []
1476 if (skia_tools_require_resources) {
1477 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1478 }
mtkleinc095df52016-08-24 12:23:52 -07001479 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001480 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001481 ":flags",
1482 "//third_party/libpng",
1483 ]
1484 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001485 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001486 "//third_party/jsoncpp",
1487 ]
1488 }
mtklein25c81d42016-07-27 13:55:26 -07001489
Mike Klein6e744122016-10-27 12:21:40 -04001490 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001491 test_lib("gm") {
1492 public_include_dirs = [ "gm" ]
1493 sources = gm_sources
1494 deps = [
scroggo19b91532016-10-24 09:03:26 -07001495 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001496 ":skia",
1497 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001498 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001499 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001500 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001501 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001502 public_deps = [
1503 ":gpu_tool_utils",
1504 ]
mtkleinc095df52016-08-24 12:23:52 -07001505 }
mtklein25c81d42016-07-27 13:55:26 -07001506
Mike Klein6e744122016-10-27 12:21:40 -04001507 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001508 test_lib("tests") {
1509 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001510 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001511 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001512 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001513 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001514 if (!(skia_use_freetype && skia_use_fontconfig)) {
1515 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1516 }
mtkleinc095df52016-08-24 12:23:52 -07001517 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001518 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001519 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001520 ":skia",
1521 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001522 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001523 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001524 "//third_party/libpng",
1525 "//third_party/zlib",
1526 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001527 public_deps = [
1528 ":gpu_tool_utils", # Test.h #includes headers from this target.
1529 ]
mtkleinc095df52016-08-24 12:23:52 -07001530 }
mtklein2f3416d2016-08-02 16:02:05 -07001531
Mike Klein6e744122016-10-27 12:21:40 -04001532 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001533 test_lib("bench") {
1534 public_include_dirs = [ "bench" ]
1535 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001536 deps = [
1537 ":flags",
1538 ":gm",
1539 ":gpu_tool_utils",
1540 ":skia",
1541 ":tool_utils",
1542 ]
1543 }
mtklein2b6870c2016-07-28 14:17:33 -07001544
mtkleinc095df52016-08-24 12:23:52 -07001545 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001546 public_include_dirs = []
1547 if (skia_use_expat) {
1548 public_include_dirs += [ "experimental/svg/model" ]
1549 sources = [
1550 "experimental/svg/model/SkSVGAttribute.cpp",
1551 "experimental/svg/model/SkSVGAttributeParser.cpp",
1552 "experimental/svg/model/SkSVGCircle.cpp",
1553 "experimental/svg/model/SkSVGClipPath.cpp",
1554 "experimental/svg/model/SkSVGContainer.cpp",
1555 "experimental/svg/model/SkSVGDOM.cpp",
1556 "experimental/svg/model/SkSVGEllipse.cpp",
1557 "experimental/svg/model/SkSVGGradient.cpp",
1558 "experimental/svg/model/SkSVGLine.cpp",
1559 "experimental/svg/model/SkSVGLinearGradient.cpp",
1560 "experimental/svg/model/SkSVGNode.cpp",
1561 "experimental/svg/model/SkSVGPath.cpp",
1562 "experimental/svg/model/SkSVGPattern.cpp",
1563 "experimental/svg/model/SkSVGPoly.cpp",
1564 "experimental/svg/model/SkSVGRadialGradient.cpp",
1565 "experimental/svg/model/SkSVGRect.cpp",
1566 "experimental/svg/model/SkSVGRenderContext.cpp",
1567 "experimental/svg/model/SkSVGSVG.cpp",
1568 "experimental/svg/model/SkSVGShape.cpp",
1569 "experimental/svg/model/SkSVGStop.cpp",
1570 "experimental/svg/model/SkSVGTransformableNode.cpp",
1571 "experimental/svg/model/SkSVGUse.cpp",
1572 "experimental/svg/model/SkSVGValue.cpp",
1573 ]
1574 deps = [
1575 ":skia",
1576 ":xml",
1577 ]
1578 }
mtkleinc095df52016-08-24 12:23:52 -07001579 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001580
Mike Klein38af9432016-11-11 11:39:44 -05001581 if (skia_use_lua) {
1582 test_lib("lua") {
1583 public_include_dirs = []
1584 sources = [
1585 "src/utils/SkLua.cpp",
1586 "src/utils/SkLuaCanvas.cpp",
1587 ]
1588 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001589 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001590 "//third_party/lua",
1591 ]
1592 }
1593
Mike Kleine6682eb2017-01-05 10:54:57 -05001594 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001595 sources = [
1596 "tools/lua/lua_app.cpp",
1597 ]
1598 deps = [
1599 ":lua",
1600 ":skia",
1601 "//third_party/lua",
1602 ]
Mike Klein38af9432016-11-11 11:39:44 -05001603 }
1604
Mike Kleine6682eb2017-01-05 10:54:57 -05001605 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001606 sources = [
1607 "tools/lua/lua_pictures.cpp",
1608 ]
1609 deps = [
1610 ":flags",
1611 ":lua",
1612 ":skia",
1613 ":tool_utils",
1614 "//third_party/lua",
1615 ]
Mike Klein38af9432016-11-11 11:39:44 -05001616 }
1617 }
1618
Cary Clark8032b982017-07-28 11:04:54 -04001619 test_app("bookmaker") {
1620 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001621 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001622 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001623 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001624 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001625 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001626 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001627 "tools/bookmaker/includeParser.cpp",
1628 "tools/bookmaker/includeWriter.cpp",
1629 "tools/bookmaker/mdOut.cpp",
1630 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001631 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001632 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001633 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001634 ]
1635 deps = [
1636 ":flags",
1637 ":skia",
1638 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001639 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001640 ]
1641 }
1642
Florin Malitabfe876a2018-09-02 12:33:59 -04001643 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001644 test_app("skottie_tool") {
1645 deps = [
1646 "modules/skottie:tool",
1647 ]
1648 }
1649 }
1650
Kevin Lubickebf648e2017-09-21 13:45:16 -04001651 if (target_cpu != "wasm") {
1652 import("gn/samples.gni")
1653 test_lib("samples") {
1654 public_include_dirs = [ "samplecode" ]
1655 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001656 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001657 public_deps = [
1658 ":tool_utils",
1659 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001660 deps = [
1661 ":experimental_svg_model",
1662 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001663 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001664 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001665 ]
Mike Klein38af9432016-11-11 11:39:44 -05001666
Ruiqi Maof5101492018-06-29 14:32:21 -04001667 # NIMA does not build on Windows clang
1668 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001669 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001670 deps += [ "//third_party/Nima-Cpp" ]
1671 }
1672
Kevin Lubickebf648e2017-09-21 13:45:16 -04001673 if (skia_use_lua) {
1674 sources += [ "samplecode/SampleLua.cpp" ]
1675 deps += [
1676 ":lua",
1677 "//third_party/lua",
1678 ]
1679 }
1680 }
Mike Klein7af351a2018-07-27 09:54:43 -04001681 test_app("imgcvt") {
1682 sources = [
1683 "tools/imgcvt.cpp",
1684 ]
1685 deps = [
1686 ":skcms",
1687 ":skia",
1688 ]
1689 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001690 test_app("dm") {
1691 sources = [
1692 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001693 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001694 "dm/DMJsonWriter.cpp",
1695 "dm/DMSrcSink.cpp",
1696 ]
1697 include_dirs = [ "tests" ]
1698 deps = [
1699 ":common_flags",
1700 ":experimental_svg_model",
1701 ":flags",
1702 ":gm",
1703 ":gpu_tool_utils",
1704 ":skia",
1705 ":tests",
1706 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001707 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001708 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001709 "//third_party/jsoncpp",
1710 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001711 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001712
1713 # NIMA does not build on Windows clang
1714 if (!is_win || !is_clang) {
1715 deps += [ "//third_party/Nima-Cpp" ]
1716 }
Mike Klein38af9432016-11-11 11:39:44 -05001717 }
Brian Osman16adfa32016-10-18 14:42:44 -04001718 }
1719
Mike Kleina8a51ce2018-01-09 12:34:11 -05001720 if (!is_win) {
1721 test_app("remote_demo") {
1722 sources = [
1723 "tools/remote_demo.cpp",
1724 ]
1725 deps = [
1726 ":skia",
1727 ]
1728 }
1729 }
1730
Mike Kleine6682eb2017-01-05 10:54:57 -05001731 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001732 sources = [
1733 "bench/nanobench.cpp",
1734 ]
1735 deps = [
1736 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001737 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001738 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001739 ":flags",
1740 ":gm",
1741 ":gpu_tool_utils",
1742 ":skia",
1743 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001744 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001745 "//third_party/jsoncpp",
1746 ]
mtklein2b6870c2016-07-28 14:17:33 -07001747 }
halcanary19a97202016-08-03 15:08:04 -07001748
Ravi Mistry10d36c52017-01-31 09:49:18 -05001749 test_app("skpinfo") {
1750 sources = [
1751 "tools/skpinfo.cpp",
1752 ]
1753 deps = [
1754 ":flags",
1755 ":skia",
1756 ]
1757 }
1758
Brian Osmanc9a42472018-05-31 13:17:12 -04001759 test_app("skpbench") {
1760 sources = [
1761 "tools/skpbench/skpbench.cpp",
1762 ]
1763 deps = [
1764 ":flags",
1765 ":gpu_tool_utils",
1766 ":skia",
1767 ":tool_utils",
1768 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001769 }
1770
Mike Kleine6682eb2017-01-05 10:54:57 -05001771 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001772 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001773 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001774 ]
1775 deps = [
1776 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001777 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001778 ]
halcanary3eee9d92016-09-10 07:01:53 -07001779 }
mtklein046cb562016-09-16 10:23:12 -07001780
Ben Wagner219f3622017-07-17 15:32:25 -04001781 test_app("create_test_font") {
1782 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001783 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001784 ]
1785 deps = [
1786 ":skia",
1787 ]
1788 assert_no_deps = [
1789 # tool_utils requires the output of this app.
1790 ":tool_utils",
1791 ]
1792 }
1793
Florin Malita5d3ff432018-07-31 16:38:43 -04001794 if (skia_use_expat) {
1795 test_app("create_test_font_color") {
1796 sources = [
1797 "tools/fonts/create_test_font_color.cpp",
1798 ]
1799 deps = [
1800 ":flags",
1801 ":skia",
1802 ":tool_utils",
1803 ]
1804 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001805 }
1806
Mike Kleine6682eb2017-01-05 10:54:57 -05001807 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001808 sources = [
1809 "tools/get_images_from_skps.cpp",
1810 ]
1811 deps = [
1812 ":flags",
1813 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001814 ]
mtklein046cb562016-09-16 10:23:12 -07001815 }
mtkleinecbc5262016-09-22 11:51:24 -07001816
Kevin Lubickebf648e2017-09-21 13:45:16 -04001817 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001818 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001819 sources = [
1820 "tools/skiaserve/Request.cpp",
1821 "tools/skiaserve/Response.cpp",
1822 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001823 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1824 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1825 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1826 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1827 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1828 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1829 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1830 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1831 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001832 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1833 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001834 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1835 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1836 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1837 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1838 ]
1839 deps = [
1840 ":flags",
1841 ":gpu_tool_utils",
1842 ":skia",
1843 ":tool_utils",
1844 "//third_party/jsoncpp",
1845 "//third_party/libmicrohttpd",
1846 "//third_party/libpng",
1847 ]
Mike Klein7d302882016-11-03 14:06:31 -04001848 }
mtkleinecbc5262016-09-22 11:51:24 -07001849 }
kjlubick14f984b2016-10-03 11:49:45 -07001850
Mike Kleine6682eb2017-01-05 10:54:57 -05001851 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001852 include_dirs = [
1853 "tools",
1854 "tools/debugger",
1855 ]
kjlubick14f984b2016-10-03 11:49:45 -07001856 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001857 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001858 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001859 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001860 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001861 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001862 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001863 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001864 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001865 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001866 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001867 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001868 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001869 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001870 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1871 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001872 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001873 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001874 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001875 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001876 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1877 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001878 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001879 "tools/UrlDataManager.cpp",
1880 "tools/debugger/SkDebugCanvas.cpp",
1881 "tools/debugger/SkDrawCommand.cpp",
1882 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001883 ]
1884 deps = [
1885 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001886 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001887 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001888 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001889 "//third_party/jsoncpp",
1890 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001891 ]
kjlubick14f984b2016-10-03 11:49:45 -07001892 }
Mike Klein38312422016-10-05 15:41:01 -04001893
Mike Kleine6682eb2017-01-05 10:54:57 -05001894 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001895 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001896 rebase_path("tests/skia_test.cpp"),
1897 rebase_path("tests/Test.cpp"),
1898 ]
caryclark9feb6322016-10-25 08:58:26 -07001899 deps = [
1900 ":flags",
1901 ":gpu_tool_utils",
1902 ":skia",
1903 ":tool_utils",
1904 ]
caryclark9feb6322016-10-25 08:58:26 -07001905 }
1906
Mike Kleine6682eb2017-01-05 10:54:57 -05001907 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001908 sources = [
1909 "tools/DumpRecord.cpp",
1910 "tools/dump_record.cpp",
1911 ]
1912 deps = [
1913 ":flags",
1914 ":skia",
1915 ]
Mike Klein38312422016-10-05 15:41:01 -04001916 }
bungemanfe917272016-10-13 17:36:40 -04001917
Mike Kleine6682eb2017-01-05 10:54:57 -05001918 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001919 sources = [
1920 "tools/skdiff/skdiff.cpp",
1921 "tools/skdiff/skdiff_html.cpp",
1922 "tools/skdiff/skdiff_main.cpp",
1923 "tools/skdiff/skdiff_utils.cpp",
1924 ]
1925 deps = [
1926 ":skia",
1927 ":tool_utils",
1928 ]
bungemanfe917272016-10-13 17:36:40 -04001929 }
halcanarya73d76a2016-10-17 13:19:02 -07001930
Mike Kleine6682eb2017-01-05 10:54:57 -05001931 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001932 sources = [
1933 "tools/skp_parser.cpp",
1934 ]
1935 deps = [
1936 ":skia",
1937 ":tool_utils",
1938 "//third_party/jsoncpp",
1939 ]
halcanarya73d76a2016-10-17 13:19:02 -07001940 }
Brian Osman16adfa32016-10-18 14:42:44 -04001941
Brian Osmanc9a42472018-05-31 13:17:12 -04001942 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001943 test_lib("skqp_lib") {
1944 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001945 defines =
1946 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001947 if (skia_skqp_enable_driver_correctness_workarounds) {
1948 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1949 }
Hal Canary75427132017-10-11 16:00:31 -04001950 sources = [
1951 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001952 "tools/skqp/gm_knowledge.cpp",
1953 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001954 ]
1955 deps = [
1956 ":gm",
1957 ":gpu_tool_utils",
1958 ":skia",
1959 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001960 ":tool_utils",
1961 ]
1962 }
1963 test_app("skqp") {
1964 sources = [
1965 "tools/skqp/skqp.cpp",
1966 ]
1967 deps = [
1968 ":skia",
1969 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001970 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001971 "//third_party/googletest",
1972 ]
1973 }
1974 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001975 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001976 test_app("skqp_app") {
1977 is_shared_library = true
1978 sources = [
1979 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1980 ]
1981 deps = [
1982 ":skia",
1983 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001984 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001985 ]
1986 libs = [ "android" ]
1987 }
1988 }
Stan Iliev93151722018-08-02 11:10:52 -04001989 if (is_android && skia_enable_gpu) {
1990 test_app("skottie_android") {
1991 is_shared_library = true
1992
1993 sources = [
1994 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
1995 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
1996 ]
1997 libs = []
1998
1999 include_dirs = []
2000 deps = [
2001 ":skia",
2002 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002003 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002004 ]
2005 }
2006 }
Hal Canary75427132017-10-11 16:00:31 -04002007
Hal Canarya9de7602018-01-19 13:08:23 -05002008 test_app("list_gms") {
2009 sources = [
2010 "tools/list_gms.cpp",
2011 ]
2012 deps = [
2013 ":gm",
2014 ":skia",
2015 ]
2016 }
2017 test_app("list_gpu_unit_tests") {
2018 sources = [
2019 "dm/DMGpuTestProcs.cpp",
2020 "tools/list_gpu_unit_tests.cpp",
2021 ]
2022 deps = [
2023 ":skia",
2024 ":tests",
2025 ]
2026 }
2027
Brian Osmanc9a42472018-05-31 13:17:12 -04002028 test_lib("sk_app") {
2029 public_include_dirs = [ "tools/sk_app" ]
2030 sources = [
2031 "tools/sk_app/CommandSet.cpp",
2032 "tools/sk_app/GLWindowContext.cpp",
2033 "tools/sk_app/Window.cpp",
2034 ]
2035 libs = []
2036
2037 if (is_android) {
2038 sources += [
2039 "tools/sk_app/android/GLWindowContext_android.cpp",
2040 "tools/sk_app/android/RasterWindowContext_android.cpp",
2041 "tools/sk_app/android/Window_android.cpp",
2042 "tools/sk_app/android/main_android.cpp",
2043 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002044 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002045 libs += [ "android" ]
2046 } else if (is_linux) {
2047 sources += [
2048 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2049 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2050 "tools/sk_app/unix/Window_unix.cpp",
2051 "tools/sk_app/unix/keysym2ucs.c",
2052 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002053 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002054 libs += [
2055 "GL",
2056 "X11",
2057 ]
2058 } else if (is_win) {
2059 sources += [
2060 "tools/sk_app/win/GLWindowContext_win.cpp",
2061 "tools/sk_app/win/RasterWindowContext_win.cpp",
2062 "tools/sk_app/win/Window_win.cpp",
2063 "tools/sk_app/win/main_win.cpp",
2064 ]
Brian Salomon194db172017-08-17 14:37:06 -04002065 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002066 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002067 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002068 } else if (is_mac) {
2069 sources += [
2070 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2071 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2072 "tools/sk_app/mac/Window_mac.cpp",
2073 "tools/sk_app/mac/main_mac.cpp",
2074 ]
2075 libs += [
2076 "QuartzCore.framework",
2077 "Cocoa.framework",
2078 "Foundation.framework",
2079 ]
2080 } else if (is_ios) {
2081 sources += [
2082 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2083 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2084 "tools/sk_app/ios/Window_ios.cpp",
2085 "tools/sk_app/ios/main_ios.cpp",
2086 ]
2087 }
2088
2089 if (skia_use_vulkan) {
2090 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2091 if (is_android) {
2092 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2093 } else if (is_linux) {
2094 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2095 libs += [ "X11-xcb" ]
2096 } else if (is_win) {
2097 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2098 }
2099 }
2100
2101 deps = [
2102 ":gpu_tool_utils",
2103 ":skia",
2104 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002105 ]
2106 if (is_android) {
2107 deps += [ "//third_party/native_app_glue" ]
2108 } else if (is_mac || is_ios) {
2109 deps += [ "//third_party/libsdl" ]
2110 }
2111 if (skia_use_angle) {
2112 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002113 }
Brian Osman16adfa32016-10-18 14:42:44 -04002114 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002115
Brian Osmanc9a42472018-05-31 13:17:12 -04002116 test_app("viewer") {
2117 is_shared_library = is_android
2118 if (is_ios) {
2119 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002120 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002121 sources = [
2122 "tools/viewer/BisectSlide.cpp",
2123 "tools/viewer/GMSlide.cpp",
2124 "tools/viewer/ImGuiLayer.cpp",
2125 "tools/viewer/ImageSlide.cpp",
2126 "tools/viewer/SKPSlide.cpp",
2127 "tools/viewer/SampleSlide.cpp",
2128 "tools/viewer/SkottieSlide.cpp",
2129 "tools/viewer/SlideDir.cpp",
2130 "tools/viewer/StatsLayer.cpp",
2131 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002132 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002133 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002134 "tools/viewer/Viewer.cpp",
2135 ]
2136 libs = []
2137
Kevin Lubickd9699322018-10-30 15:08:53 -04002138 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002139 deps = [
2140 ":experimental_svg_model",
2141 ":flags",
2142 ":gm",
2143 ":gpu_tool_utils",
2144 ":samples",
2145 ":sk_app",
2146 ":skia",
2147 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002148 "modules/skottie",
2149 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002150 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002151 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002152 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002153
2154 # NIMA does not build on Windows clang
2155 if (!is_win || !is_clang) {
2156 sources += [ "tools/viewer/NIMASlide.cpp" ]
2157 deps += [ "//third_party/Nima-Cpp" ]
2158 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002159 }
2160
ziadbbceddbc2018-06-19 13:57:15 -04002161 if (is_android) {
2162 test_app("arcore") {
2163 is_shared_library = true
2164 configs = [
2165 ":skia_public",
2166 "gn:default",
2167 ]
2168
2169 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2170 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2171 sources = []
2172 sources += skia_core_sources
2173 sources += skia_utils_sources
2174 sources += skia_xps_sources
2175 sources += [
2176 "src/android/SkAndroidFrameworkUtils.cpp",
2177 "src/android/SkAnimatedImage.cpp",
2178 "src/android/SkBitmapRegionCodec.cpp",
2179 "src/android/SkBitmapRegionDecoder.cpp",
2180 "src/codec/SkAndroidCodec.cpp",
2181 "src/codec/SkBmpBaseCodec.cpp",
2182 "src/codec/SkBmpCodec.cpp",
2183 "src/codec/SkBmpMaskCodec.cpp",
2184 "src/codec/SkBmpRLECodec.cpp",
2185 "src/codec/SkBmpStandardCodec.cpp",
2186 "src/codec/SkCodec.cpp",
2187 "src/codec/SkCodecImageGenerator.cpp",
2188 "src/codec/SkColorTable.cpp",
2189 "src/codec/SkGifCodec.cpp",
2190 "src/codec/SkMaskSwizzler.cpp",
2191 "src/codec/SkMasks.cpp",
2192 "src/codec/SkSampledCodec.cpp",
2193 "src/codec/SkSampler.cpp",
2194 "src/codec/SkStreamBuffer.cpp",
2195 "src/codec/SkSwizzler.cpp",
2196 "src/codec/SkWbmpCodec.cpp",
2197 "src/images/SkImageEncoder.cpp",
2198 "src/ports/SkDiscardableMemory_none.cpp",
2199 "src/ports/SkImageGenerator_skia.cpp",
2200 "src/ports/SkMemory_malloc.cpp",
2201 "src/ports/SkOSFile_stdio.cpp",
2202 "src/sfnt/SkOTTable_name.cpp",
2203 "src/sfnt/SkOTUtils.cpp",
2204 "src/utils/mac/SkStream_mac.cpp",
2205 "third_party/gif/SkGifImageReader.cpp",
2206 ]
2207 deps = [
2208 ":tool_utils",
2209 "modules/skottie",
2210 "modules/skshaper",
2211 ]
2212 }
2213 }
2214
Brian Osmanc9a42472018-05-31 13:17:12 -04002215 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002216 test_app("HelloWorld") {
2217 sources = [
2218 "example/HelloWorld.cpp",
2219 ]
2220 libs = []
2221
2222 include_dirs = []
2223 deps = [
2224 ":flags",
2225 ":gpu_tool_utils",
2226 ":sk_app",
2227 ":skia",
2228 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002229 ]
2230 }
2231 }
2232
Brian Osmanc9a42472018-05-31 13:17:12 -04002233 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002234 test_app("SkiaSDLExample") {
2235 sources = [
2236 "example/SkiaSDLExample.cpp",
2237 ]
2238 libs = []
2239 include_dirs = []
2240 deps = [
2241 ":gpu_tool_utils",
2242 ":skia",
2243 "//third_party/libsdl",
2244 ]
2245 }
2246 }
2247
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002248 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2249 action_foreach("generate_mocs") {
2250 script = "gn/call.py"
2251 sources = [
2252 "tools/mdbviz/MainWindow.h",
2253 ]
2254 outputs = [
2255 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2256 ]
2257 args = [
2258 "$skia_qt_path" + "/bin/moc",
2259 "{{source}}",
2260 "-o",
2261 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2262 ]
2263 }
2264 action_foreach("generate_resources") {
2265 script = "gn/call.py"
2266 sources = [
2267 "tools/mdbviz/resources.qrc",
2268 ]
2269 outputs = [
2270 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2271 ]
2272 args = [
2273 "$skia_qt_path" + "/bin/rcc",
2274 "{{source}}",
2275 "-o",
2276 "gen/mdbviz/{{source_name_part}}_res.cpp",
2277 ]
2278 }
2279 test_app("mdbviz") {
2280 if (is_win) {
2281 # on Windows we need to disable some exception handling warnings due to the Qt headers
2282 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2283 }
2284 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002285 "tools/UrlDataManager.cpp",
2286 "tools/debugger/SkDebugCanvas.cpp",
2287 "tools/debugger/SkDrawCommand.cpp",
2288 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002289 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002290 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002291 "tools/mdbviz/main.cpp",
2292
2293 # generated files
2294 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2295 "$target_gen_dir/mdbviz/resources_res.cpp",
2296 ]
2297 lib_dirs = [ "$skia_qt_path/lib" ]
2298 libs = [
2299 "Qt5Core.lib",
2300 "Qt5Gui.lib",
2301 "Qt5Widgets.lib",
2302 ]
2303 include_dirs = [
2304 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002305 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002306 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002307 "tools",
2308 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002309 ]
2310 deps = [
2311 ":generate_mocs",
2312 ":generate_resources",
2313 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002314 "//third_party/jsoncpp",
2315 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002316 ]
2317 }
2318 }
2319
Mike Kleine459afd2017-03-03 09:21:30 -05002320 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002321 copy("gdbserver") {
2322 sources = [
2323 "$ndk/$ndk_gdbserver",
2324 ]
2325 outputs = [
2326 "$root_out_dir/gdbserver",
2327 ]
2328 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002329 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002330
2331 if (skia_use_opencl) {
2332 test_app("hello-opencl") {
2333 sources = [
2334 "src/compute/common/cl/assert_cl.c",
2335 "src/compute/common/cl/find_cl.c",
2336 "tools/hello-opencl.cpp",
2337 ]
2338 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002339 if (is_linux) {
2340 libs = [ "OpenCL" ]
2341 } else if (is_win) {
2342 libs = [ "OpenCL.lib" ]
2343 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002344 }
2345 }
mtklein25c81d42016-07-27 13:55:26 -07002346}