blob: ee55eaa118ef000ccfcac575eeec99fb098294f4 [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
Mike Klein33ad63a2018-11-11 07:17:00 -0500563optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700564 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
Mike Klein33ad63a2018-11-11 07:17:00 -0500823# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
824# TODO: rename :gpu_for_real back to :gpu when cleaning up.
825source_set("effects") {
826}
827source_set("gpu") {
828}
829
mtkleinc04ff472016-06-23 10:29:30 -0700830component("skia") {
831 public_configs = [ ":skia_public" ]
832 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700833
Mike Klein607b0a72018-11-07 16:17:34 -0500834 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500835 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500836 ":pdf",
837 ":skcms",
838 ]
839
mtkleinc04ff472016-06-23 10:29:30 -0700840 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700841 ":arm64",
842 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700843 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000844 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700845 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700846 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700847 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500848 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700849 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700850 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400851 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500852 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700853 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700854 ":none",
mtklein63213812016-08-24 09:55:56 -0700855 ":png",
scroggof84ad642016-10-31 09:02:57 -0700856 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700857 ":sse2",
858 ":sse41",
859 ":sse42",
860 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700861 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400862 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700863 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700864 ]
865
Kevin Lubick134be1d2018-10-30 15:05:04 -0400866 if (skia_enable_nima) {
867 deps += [ "//third_party/Nima-Cpp" ]
868 }
869
Chinmay Garde43f115c2016-11-16 15:04:12 -0800870 # This file (and all GN files in Skia) are designed to work with an
871 # empty sources assignment filter; we handle all that explicitly.
872 # We clear the filter here for clients who may have set up a global filter.
873 set_sources_assignment_filter([])
874
mtkleinc04ff472016-06-23 10:29:30 -0700875 sources = []
brettwb9447282016-09-01 14:24:39 -0700876 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700877 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500878 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000879 sources += skia_effects_sources
880 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700881 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400882 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500883 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700884 "src/android/SkBitmapRegionCodec.cpp",
885 "src/android/SkBitmapRegionDecoder.cpp",
886 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100887 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400888 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700889 "src/codec/SkBmpCodec.cpp",
890 "src/codec/SkBmpMaskCodec.cpp",
891 "src/codec/SkBmpRLECodec.cpp",
892 "src/codec/SkBmpStandardCodec.cpp",
893 "src/codec/SkCodec.cpp",
894 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400895 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400896 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700897 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700898 "src/codec/SkMaskSwizzler.cpp",
899 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700900 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700901 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700902 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700903 "src/codec/SkSwizzler.cpp",
904 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700905 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700906 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000907 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700908 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700909 "src/ports/SkMemory_malloc.cpp",
910 "src/ports/SkOSFile_stdio.cpp",
911 "src/sfnt/SkOTTable_name.cpp",
912 "src/sfnt/SkOTUtils.cpp",
913 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700914 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700915 ]
brettwb9447282016-09-01 14:24:39 -0700916
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400917 defines = []
918 if (!skia_enable_skpicture) {
919 defines = [ "SK_DISABLE_SKPICTURE" ]
920 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000921 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400922 sources += [ "src/core/SkPicture_none.cpp" ]
923 }
924
mtklein7d6fb2c2016-08-25 14:50:44 -0700925 libs = []
926
mtkleinc04ff472016-06-23 10:29:30 -0700927 if (is_win) {
928 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400929 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700930 "src/ports/SkDebug_win.cpp",
931 "src/ports/SkFontHost_win.cpp",
932 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500933 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700934 "src/ports/SkImageEncoder_WIC.cpp",
935 "src/ports/SkImageGeneratorWIC.cpp",
936 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700937 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700938 "src/ports/SkScalerContext_win_dw.cpp",
939 "src/ports/SkTLS_win.cpp",
940 "src/ports/SkTypeface_win_dw.cpp",
941 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400942 libs += [
943 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500944 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400945 "Ole32.lib",
946 "OleAut32.lib",
947 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500948 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400949 ]
mtkleinc04ff472016-06-23 10:29:30 -0700950 } else {
951 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700952 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700953 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700954 "src/ports/SkTLS_pthread.cpp",
955 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400956 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700957 }
958
mtklein7d6fb2c2016-08-25 14:50:44 -0700959 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500960 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500961 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500962 deps += [ "//third_party/cpu-features" ]
963 }
mtklein06c35c02016-09-20 12:28:12 -0700964 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700965 libs += [
966 "EGL",
967 "GLESv2",
968 "log",
969 ]
970 }
971
Kevin Lubick217056c2018-09-20 17:39:31 -0400972 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700973 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400974 if (skia_use_egl) {
975 libs += [ "GLESv2" ]
976 }
mtkleinc04ff472016-06-23 10:29:30 -0700977 }
978
979 if (is_mac) {
980 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700981 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700982 "src/ports/SkFontHost_mac.cpp",
983 "src/ports/SkImageEncoder_CG.cpp",
984 "src/ports/SkImageGeneratorCG.cpp",
985 ]
mtklein09e61f72016-08-23 13:35:28 -0700986 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400987 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
988 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700989 "ApplicationServices.framework",
990 "OpenGL.framework",
991 ]
mtkleinc04ff472016-06-23 10:29:30 -0700992 }
abarth6fc8ff02016-07-15 15:15:15 -0700993
Mike Klein7d302882016-11-03 14:06:31 -0400994 if (is_ios) {
995 sources += [
996 "src/ports/SkDebug_stdio.cpp",
997 "src/ports/SkFontHost_mac.cpp",
998 "src/ports/SkImageEncoder_CG.cpp",
999 "src/ports/SkImageGeneratorCG.cpp",
1000 ]
1001 libs += [
1002 "CoreFoundation.framework",
1003 "CoreGraphics.framework",
1004 "CoreText.framework",
1005 "ImageIO.framework",
1006 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001007
1008 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1009 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001010 ]
1011 }
1012
abarth6fc8ff02016-07-15 15:15:15 -07001013 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001014 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001015 }
mtkleinc04ff472016-06-23 10:29:30 -07001016}
1017
Kevin Lubickcbcff382018-10-02 09:02:18 -04001018static_library("pathkit") {
1019 public_configs = [ ":skia_public" ]
1020 configs += skia_library_configs
1021
1022 deps = [
1023 ":arm64",
1024 ":armv7",
1025 ":avx",
1026 ":crc32",
1027 ":hsw",
1028 ":none",
1029 ":sse2",
1030 ":sse41",
1031 ":sse42",
1032 ":ssse3",
1033 ]
1034
1035 # This file (and all GN files in Skia) are designed to work with an
1036 # empty sources assignment filter; we handle all that explicitly.
1037 # We clear the filter here for clients who may have set up a global filter.
1038 set_sources_assignment_filter([])
1039
1040 sources = []
1041 sources += skia_pathops_sources
1042 sources += [
1043 "src/core/SkAnalyticEdge.cpp",
1044 "src/core/SkArenaAlloc.cpp",
1045 "src/core/SkCubicMap.cpp",
1046 "src/core/SkEdge.cpp",
1047 "src/core/SkEdgeBuilder.cpp",
1048 "src/core/SkEdgeClipper.cpp",
1049 "src/core/SkGeometry.cpp",
1050 "src/core/SkLineClipper.cpp",
1051 "src/core/SkMallocPixelRef.cpp",
1052 "src/core/SkMath.cpp",
1053 "src/core/SkMatrix.cpp",
1054 "src/core/SkOpts.cpp",
1055 "src/core/SkPaint.cpp",
1056 "src/core/SkPath.cpp",
1057 "src/core/SkPathEffect.cpp",
1058 "src/core/SkPathMeasure.cpp",
1059 "src/core/SkPathRef.cpp",
1060 "src/core/SkPoint.cpp",
1061 "src/core/SkRRect.cpp",
1062 "src/core/SkRect.cpp",
1063 "src/core/SkSemaphore.cpp",
1064 "src/core/SkStream.cpp",
1065 "src/core/SkString.cpp",
1066 "src/core/SkStringUtils.cpp",
1067 "src/core/SkStroke.cpp",
1068 "src/core/SkStrokeRec.cpp",
1069 "src/core/SkStrokerPriv.cpp",
1070 "src/core/SkThreadID.cpp",
1071 "src/core/SkUtils.cpp",
1072 "src/effects/SkDashPathEffect.cpp",
1073 "src/effects/SkTrimPathEffect.cpp",
1074 "src/ports/SkDebug_stdio.cpp",
1075 "src/ports/SkMemory_malloc.cpp",
1076 "src/utils/SkDashPath.cpp",
1077 "src/utils/SkParse.cpp",
1078 "src/utils/SkParsePath.cpp",
1079 "src/utils/SkUTF.cpp",
1080 ]
1081}
1082
mtkleinc095df52016-08-24 12:23:52 -07001083# Targets guarded by skia_enable_tools may use //third_party freely.
1084if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001085 # Used by gn_to_bp.py to list our public include dirs.
1086 source_set("public") {
1087 configs += [ ":skia_public" ]
1088 }
1089
Mike Kleinc36dedf2016-11-18 09:35:28 -05001090 config("skia.h_config") {
1091 include_dirs = [ "$target_gen_dir" ]
1092 }
1093 action("skia.h") {
1094 public_configs = [ ":skia.h_config" ]
1095 skia_h = "$target_gen_dir/skia.h"
1096 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001097
1098 # TODO: would be cool to not hard-code these here, but how?
1099 module_public_includes = [
1100 "modules/sksg/include",
1101 "modules/skottie/include",
1102 ]
1103 args =
1104 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1105 [ rebase_path(skia_h, root_build_dir) ] +
1106 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001107 depfile = "$skia_h.deps"
1108 outputs = [
1109 skia_h,
1110 ]
1111 }
1112
Brian Osmanc9a42472018-05-31 13:17:12 -04001113 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001114 executable("fiddle") {
1115 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001116 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001117 "tools/fiddle/draw.cpp",
1118 "tools/fiddle/fiddle_main.cpp",
1119 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001120
1121 if (skia_use_egl) {
1122 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001123 } else {
1124 sources += [ "tools/fiddle/null_context.cpp" ]
1125 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001126 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001127 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001128 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001129 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001130 ":skia",
1131 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001132 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001133 ]
1134 }
1135 }
1136
Brian Osmanc9a42472018-05-31 13:17:12 -04001137 source_set("public_headers_warnings_check") {
1138 sources = [
1139 "tools/public_headers_warnings_check.cpp",
1140 ]
1141 configs -= [ "//gn:warnings_except_public_headers" ]
1142 deps = [
1143 ":skia",
1144 ":skia.h",
1145 "modules/skottie",
1146 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001147 }
1148
mtkleinc095df52016-08-24 12:23:52 -07001149 template("test_lib") {
1150 config(target_name + "_config") {
1151 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001152 if (defined(invoker.public_defines)) {
1153 defines = invoker.public_defines
1154 }
mtklein25c81d42016-07-27 13:55:26 -07001155 }
mtkleinc095df52016-08-24 12:23:52 -07001156 source_set(target_name) {
1157 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1158 public_configs = [
1159 ":" + target_name + "_config",
1160 ":skia_private",
1161 ]
1162
1163 if (!defined(deps)) {
1164 deps = []
1165 }
1166 deps += [ ":skia" ]
1167 testonly = true
1168 }
mtklein25c81d42016-07-27 13:55:26 -07001169 }
mtklein25c81d42016-07-27 13:55:26 -07001170
Mike Kleine6682eb2017-01-05 10:54:57 -05001171 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001172 if (is_ios) {
1173 app_name = target_name
1174 gen_path = target_gen_dir
1175
1176 action("${app_name}_generate_info_plist") {
1177 script = "//gn/gen_plist_ios.py"
1178 outputs = [
1179 "$gen_path/${app_name}_Info.plist",
1180 ]
1181 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1182 }
1183
1184 bundle_data("${app_name}_bundle_info_plist") {
1185 public_deps = [
1186 ":${app_name}_generate_info_plist",
1187 ]
1188 sources = [
1189 "$gen_path/${app_name}_Info.plist",
1190 ]
1191 outputs = [
1192 "{{bundle_root_dir}}/Info.plist",
1193 ]
1194 }
1195
Jim Van Verth329c5a62017-11-29 11:42:33 -05001196 bundle_ios_data =
1197 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1198
1199 if (bundle_ios_data) {
1200 has_skps =
1201 "True" == exec_script("//gn/checkdir.py",
1202 [ rebase_path("skps", root_build_dir) ],
1203 "trim string")
1204 bundle_data("${app_name}_bundle_resources") {
1205 sources = [
1206 "resources",
1207 ]
1208 outputs = [
1209 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1210 "{{bundle_resources_dir}}/data/resources",
1211 ]
1212 }
1213
1214 if (has_skps) {
1215 bundle_data("${app_name}_bundle_skps") {
1216 sources = [
1217 "skps",
1218 ]
1219 outputs = [
1220 # Store in same folder as resources
1221 "{{bundle_resources_dir}}/data/skps",
1222 ]
1223 }
1224 }
1225 }
1226
Jim Van Verth443a9132017-11-28 09:45:26 -05001227 executable("${app_name}_generate_executable") {
1228 forward_variables_from(invoker,
1229 "*",
1230 [
1231 "output_name",
1232 "visibility",
1233 "is_shared_library",
1234 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001235 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001236 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001237 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1238 }
1239
1240 bundle_data("${app_name}_bundle_executable") {
1241 public_deps = [
1242 ":${app_name}_generate_executable",
1243 ]
1244 sources = [
1245 "$gen_path/$app_name",
1246 ]
1247 outputs = [
1248 "{{bundle_executable_dir}}/$app_name",
1249 ]
1250 testonly = true
1251 }
1252
1253 create_bundle("$app_name") {
1254 product_type = "com.apple.product-type.application"
1255 testonly = true
1256
1257 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1258 bundle_resources_dir = bundle_root_dir
1259 bundle_executable_dir = bundle_root_dir
1260 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1261
1262 deps = [
1263 ":${app_name}_bundle_executable",
1264 ":${app_name}_bundle_info_plist",
1265 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001266 if (bundle_ios_data) {
1267 deps += [ ":${app_name}_bundle_resources" ]
1268 if (has_skps) {
1269 deps += [ ":${app_name}_bundle_skps" ]
1270 }
1271 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001272
1273 # should only code sign when running on a device, not the simulator
1274 if (target_cpu != "x64") {
1275 code_signing_script = "//gn/codesign_ios.py"
1276 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1277 code_signing_outputs = [
1278 "$bundle_root_dir/_CodeSignature/CodeResources",
1279 "$bundle_root_dir/embedded.mobileprovision",
1280 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001281 code_signing_args = [
1282 rebase_path("$bundle_root_dir", root_build_dir),
1283 skia_ios_identity,
1284 skia_ios_profile,
1285 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001286 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001287 }
1288 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001289 # !is_ios
1290
1291 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1292 shared_library("lib" + target_name) {
1293 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1294 configs += [ ":skia_private" ]
1295 testonly = true
1296 }
1297 } else {
1298 _executable = target_name
1299 executable(_executable) {
1300 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1301 configs += [ ":skia_private" ]
1302 testonly = true
1303 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001304 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001305 if (is_android && skia_android_serial != "" && defined(_executable)) {
1306 action("push_" + target_name) {
1307 script = "gn/push_to_android.py"
1308 deps = [
1309 ":" + _executable,
1310 ]
1311 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1312 outputs = [
1313 _stamp,
1314 ]
1315 args = [
1316 rebase_path("$root_build_dir/$_executable"),
1317 skia_android_serial,
1318 rebase_path(_stamp),
1319 ]
1320 testonly = true
1321 }
Mike Klein7d921032017-01-05 12:20:41 -05001322 }
1323 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001324 }
1325
Greg Danielda16cce2018-08-01 09:23:57 -04001326 config("moltenvk_config") {
1327 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1328 if (is_ios) {
1329 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1330 } else {
1331 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1332 }
1333 cflags = [ "-F$moltenvk_framework_path" ]
1334 ldflags = [ "-F$moltenvk_framework_path" ]
1335 libs = [
1336 "MoltenVK.framework",
1337 "Metal.framework",
1338 "IOSurface.framework",
1339 "QuartzCore.framework",
1340 "Foundation.framework",
1341 ]
1342 if (is_ios) {
1343 libs += [ "UIKit.framework" ]
1344 } else {
1345 libs += [ "IOKit.framework" ]
1346 }
1347 defines = [ "SK_MOLTENVK" ]
1348 }
1349 }
1350
1351 source_set("moltenvk") {
1352 public_configs = [ ":moltenvk_config" ]
1353 }
1354
mtkleinc095df52016-08-24 12:23:52 -07001355 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001356 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001357 public_defines = []
1358 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001359
Brian Osmanc9a42472018-05-31 13:17:12 -04001360 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001361 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001362 sources = [
1363 "tools/gpu/GrContextFactory.cpp",
1364 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001365 "tools/gpu/MemoryCache.cpp",
1366 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001367 "tools/gpu/ProxyUtils.cpp",
1368 "tools/gpu/TestContext.cpp",
1369 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1370 "tools/gpu/gl/GLTestContext.cpp",
1371 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001372 "tools/gpu/gl/null/NullGLTestContext.cpp",
1373 "tools/gpu/mock/MockTestContext.cpp",
1374 ]
1375 libs = []
1376
1377 if (is_android || skia_use_egl) {
1378 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1379 } else if (is_ios) {
1380 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1381 libs += [ "OpenGLES.framework" ]
1382 } else if (is_linux) {
1383 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001384 libs += [
1385 "GLU",
1386 "X11",
1387 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001388 } else if (is_mac) {
1389 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1390 } else if (is_win) {
1391 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1392 libs += [
1393 "Gdi32.lib",
1394 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001395 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001396 }
mtklein25c81d42016-07-27 13:55:26 -07001397
Brian Osmanc9a42472018-05-31 13:17:12 -04001398 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001399
Brian Osmanc9a42472018-05-31 13:17:12 -04001400 if (skia_use_angle) {
1401 deps += [ "//third_party/angle2" ]
1402 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1403 }
Greg Danielb4d89562018-10-03 18:44:49 +00001404 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001405 if (skia_use_vulkan) {
1406 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1407 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001408 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1409 public_deps += [ ":moltenvk" ]
1410 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001411 }
1412 if (skia_use_metal) {
1413 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001414 }
mtklein25c81d42016-07-27 13:55:26 -07001415 }
mtklein25c81d42016-07-27 13:55:26 -07001416
mtkleinc095df52016-08-24 12:23:52 -07001417 test_lib("flags") {
1418 public_include_dirs = [ "tools/flags" ]
1419 sources = [
1420 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001421 ]
1422 }
1423 test_lib("common_flags") {
1424 public_include_dirs = [ "tools/flags" ]
1425 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001426 "tools/flags/SkCommonFlags.cpp",
1427 "tools/flags/SkCommonFlagsConfig.cpp",
1428 ]
1429 deps = [
mtklein046cb562016-09-16 10:23:12 -07001430 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001431 ]
1432 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001433 ":gpu_tool_utils",
1434 ]
1435 }
mtklein25c81d42016-07-27 13:55:26 -07001436
mtkleinc095df52016-08-24 12:23:52 -07001437 test_lib("tool_utils") {
1438 public_include_dirs = [
1439 "tools",
1440 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001441 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001442 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001443 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001444 ]
1445 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001446 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001447 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001448 "tools/DDLPromiseImageHelper.cpp",
1449 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001450 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001451 "tools/ProcStats.cpp",
1452 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001453 "tools/UrlDataManager.cpp",
1454 "tools/debugger/SkDebugCanvas.cpp",
1455 "tools/debugger/SkDrawCommand.cpp",
1456 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001457 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001458 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001459 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001460 "tools/fonts/SkTestFontMgr.h",
1461 "tools/fonts/SkTestSVGTypeface.cpp",
1462 "tools/fonts/SkTestSVGTypeface.h",
1463 "tools/fonts/SkTestTypeface.cpp",
1464 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001465 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001466 "tools/random_parse_path.cpp",
1467 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001468 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001469 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001470 "tools/trace/SkChromeTracingTracer.cpp",
1471 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001472 "tools/trace/SkDebugfTracer.cpp",
1473 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001474 "tools/trace/SkEventTracingPriv.cpp",
1475 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001476 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001477 libs = []
1478 if (is_ios) {
1479 sources += [ "tools/ios_utils.m" ]
1480 libs += [ "Foundation.framework" ]
1481 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001482 defines = []
1483 if (skia_tools_require_resources) {
1484 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1485 }
mtkleinc095df52016-08-24 12:23:52 -07001486 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001487 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001488 ":flags",
1489 "//third_party/libpng",
1490 ]
1491 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001492 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001493 "//third_party/jsoncpp",
1494 ]
1495 }
mtklein25c81d42016-07-27 13:55:26 -07001496
Mike Klein6e744122016-10-27 12:21:40 -04001497 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001498 test_lib("gm") {
1499 public_include_dirs = [ "gm" ]
1500 sources = gm_sources
1501 deps = [
scroggo19b91532016-10-24 09:03:26 -07001502 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001503 ":skia",
1504 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001505 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001506 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001507 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001508 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001509 public_deps = [
1510 ":gpu_tool_utils",
1511 ]
mtkleinc095df52016-08-24 12:23:52 -07001512 }
mtklein25c81d42016-07-27 13:55:26 -07001513
Mike Klein6e744122016-10-27 12:21:40 -04001514 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001515 test_lib("tests") {
1516 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001517 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001518 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001519 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001520 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001521 if (!(skia_use_freetype && skia_use_fontconfig)) {
1522 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1523 }
mtkleinc095df52016-08-24 12:23:52 -07001524 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001525 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001526 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001527 ":skia",
1528 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001529 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001530 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001531 "//third_party/libpng",
1532 "//third_party/zlib",
1533 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001534 public_deps = [
1535 ":gpu_tool_utils", # Test.h #includes headers from this target.
1536 ]
mtkleinc095df52016-08-24 12:23:52 -07001537 }
mtklein2f3416d2016-08-02 16:02:05 -07001538
Mike Klein6e744122016-10-27 12:21:40 -04001539 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001540 test_lib("bench") {
1541 public_include_dirs = [ "bench" ]
1542 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001543 deps = [
1544 ":flags",
1545 ":gm",
1546 ":gpu_tool_utils",
1547 ":skia",
1548 ":tool_utils",
1549 ]
1550 }
mtklein2b6870c2016-07-28 14:17:33 -07001551
mtkleinc095df52016-08-24 12:23:52 -07001552 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001553 public_include_dirs = []
1554 if (skia_use_expat) {
1555 public_include_dirs += [ "experimental/svg/model" ]
1556 sources = [
1557 "experimental/svg/model/SkSVGAttribute.cpp",
1558 "experimental/svg/model/SkSVGAttributeParser.cpp",
1559 "experimental/svg/model/SkSVGCircle.cpp",
1560 "experimental/svg/model/SkSVGClipPath.cpp",
1561 "experimental/svg/model/SkSVGContainer.cpp",
1562 "experimental/svg/model/SkSVGDOM.cpp",
1563 "experimental/svg/model/SkSVGEllipse.cpp",
1564 "experimental/svg/model/SkSVGGradient.cpp",
1565 "experimental/svg/model/SkSVGLine.cpp",
1566 "experimental/svg/model/SkSVGLinearGradient.cpp",
1567 "experimental/svg/model/SkSVGNode.cpp",
1568 "experimental/svg/model/SkSVGPath.cpp",
1569 "experimental/svg/model/SkSVGPattern.cpp",
1570 "experimental/svg/model/SkSVGPoly.cpp",
1571 "experimental/svg/model/SkSVGRadialGradient.cpp",
1572 "experimental/svg/model/SkSVGRect.cpp",
1573 "experimental/svg/model/SkSVGRenderContext.cpp",
1574 "experimental/svg/model/SkSVGSVG.cpp",
1575 "experimental/svg/model/SkSVGShape.cpp",
1576 "experimental/svg/model/SkSVGStop.cpp",
1577 "experimental/svg/model/SkSVGTransformableNode.cpp",
1578 "experimental/svg/model/SkSVGUse.cpp",
1579 "experimental/svg/model/SkSVGValue.cpp",
1580 ]
1581 deps = [
1582 ":skia",
1583 ":xml",
1584 ]
1585 }
mtkleinc095df52016-08-24 12:23:52 -07001586 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001587
Mike Klein38af9432016-11-11 11:39:44 -05001588 if (skia_use_lua) {
1589 test_lib("lua") {
1590 public_include_dirs = []
1591 sources = [
1592 "src/utils/SkLua.cpp",
1593 "src/utils/SkLuaCanvas.cpp",
1594 ]
1595 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001596 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001597 "//third_party/lua",
1598 ]
1599 }
1600
Mike Kleine6682eb2017-01-05 10:54:57 -05001601 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001602 sources = [
1603 "tools/lua/lua_app.cpp",
1604 ]
1605 deps = [
1606 ":lua",
1607 ":skia",
1608 "//third_party/lua",
1609 ]
Mike Klein38af9432016-11-11 11:39:44 -05001610 }
1611
Mike Kleine6682eb2017-01-05 10:54:57 -05001612 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001613 sources = [
1614 "tools/lua/lua_pictures.cpp",
1615 ]
1616 deps = [
1617 ":flags",
1618 ":lua",
1619 ":skia",
1620 ":tool_utils",
1621 "//third_party/lua",
1622 ]
Mike Klein38af9432016-11-11 11:39:44 -05001623 }
1624 }
1625
Cary Clark8032b982017-07-28 11:04:54 -04001626 test_app("bookmaker") {
1627 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001628 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001629 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001630 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001631 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001632 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001633 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001634 "tools/bookmaker/includeParser.cpp",
1635 "tools/bookmaker/includeWriter.cpp",
1636 "tools/bookmaker/mdOut.cpp",
1637 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001638 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001639 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001640 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001641 ]
1642 deps = [
1643 ":flags",
1644 ":skia",
1645 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001646 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001647 ]
1648 }
1649
Florin Malitabfe876a2018-09-02 12:33:59 -04001650 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001651 test_app("skottie_tool") {
1652 deps = [
1653 "modules/skottie:tool",
1654 ]
1655 }
1656 }
1657
Kevin Lubickebf648e2017-09-21 13:45:16 -04001658 if (target_cpu != "wasm") {
1659 import("gn/samples.gni")
1660 test_lib("samples") {
1661 public_include_dirs = [ "samplecode" ]
1662 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001663 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001664 public_deps = [
1665 ":tool_utils",
1666 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001667 deps = [
1668 ":experimental_svg_model",
1669 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001670 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001671 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001672 ]
Mike Klein38af9432016-11-11 11:39:44 -05001673
Ruiqi Maof5101492018-06-29 14:32:21 -04001674 # NIMA does not build on Windows clang
1675 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001676 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001677 deps += [ "//third_party/Nima-Cpp" ]
1678 }
1679
Kevin Lubickebf648e2017-09-21 13:45:16 -04001680 if (skia_use_lua) {
1681 sources += [ "samplecode/SampleLua.cpp" ]
1682 deps += [
1683 ":lua",
1684 "//third_party/lua",
1685 ]
1686 }
1687 }
Mike Klein7af351a2018-07-27 09:54:43 -04001688 test_app("imgcvt") {
1689 sources = [
1690 "tools/imgcvt.cpp",
1691 ]
1692 deps = [
1693 ":skcms",
1694 ":skia",
1695 ]
1696 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001697 test_app("dm") {
1698 sources = [
1699 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001700 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001701 "dm/DMJsonWriter.cpp",
1702 "dm/DMSrcSink.cpp",
1703 ]
1704 include_dirs = [ "tests" ]
1705 deps = [
1706 ":common_flags",
1707 ":experimental_svg_model",
1708 ":flags",
1709 ":gm",
1710 ":gpu_tool_utils",
1711 ":skia",
1712 ":tests",
1713 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001714 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001715 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001716 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001717 "//third_party/jsoncpp",
1718 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001719 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001720
1721 # NIMA does not build on Windows clang
1722 if (!is_win || !is_clang) {
1723 deps += [ "//third_party/Nima-Cpp" ]
1724 }
Mike Klein38af9432016-11-11 11:39:44 -05001725 }
Brian Osman16adfa32016-10-18 14:42:44 -04001726 }
1727
Mike Kleina8a51ce2018-01-09 12:34:11 -05001728 if (!is_win) {
1729 test_app("remote_demo") {
1730 sources = [
1731 "tools/remote_demo.cpp",
1732 ]
1733 deps = [
1734 ":skia",
1735 ]
1736 }
1737 }
1738
Mike Kleine6682eb2017-01-05 10:54:57 -05001739 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001740 sources = [
1741 "bench/nanobench.cpp",
1742 ]
1743 deps = [
1744 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001745 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001746 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001747 ":flags",
1748 ":gm",
1749 ":gpu_tool_utils",
1750 ":skia",
1751 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001752 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001753 "//third_party/jsoncpp",
1754 ]
mtklein2b6870c2016-07-28 14:17:33 -07001755 }
halcanary19a97202016-08-03 15:08:04 -07001756
Ravi Mistry10d36c52017-01-31 09:49:18 -05001757 test_app("skpinfo") {
1758 sources = [
1759 "tools/skpinfo.cpp",
1760 ]
1761 deps = [
1762 ":flags",
1763 ":skia",
1764 ]
1765 }
1766
Brian Osmanc9a42472018-05-31 13:17:12 -04001767 test_app("skpbench") {
1768 sources = [
1769 "tools/skpbench/skpbench.cpp",
1770 ]
1771 deps = [
1772 ":flags",
1773 ":gpu_tool_utils",
1774 ":skia",
1775 ":tool_utils",
1776 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001777 }
1778
Mike Kleine6682eb2017-01-05 10:54:57 -05001779 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001780 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001781 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001782 ]
1783 deps = [
1784 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001785 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001786 ]
halcanary3eee9d92016-09-10 07:01:53 -07001787 }
mtklein046cb562016-09-16 10:23:12 -07001788
Ben Wagner219f3622017-07-17 15:32:25 -04001789 test_app("create_test_font") {
1790 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001791 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001792 ]
1793 deps = [
1794 ":skia",
1795 ]
1796 assert_no_deps = [
1797 # tool_utils requires the output of this app.
1798 ":tool_utils",
1799 ]
1800 }
1801
Florin Malita5d3ff432018-07-31 16:38:43 -04001802 if (skia_use_expat) {
1803 test_app("create_test_font_color") {
1804 sources = [
1805 "tools/fonts/create_test_font_color.cpp",
1806 ]
1807 deps = [
1808 ":flags",
1809 ":skia",
1810 ":tool_utils",
1811 ]
1812 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001813 }
1814
Mike Kleine6682eb2017-01-05 10:54:57 -05001815 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001816 sources = [
1817 "tools/get_images_from_skps.cpp",
1818 ]
1819 deps = [
1820 ":flags",
1821 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001822 ]
mtklein046cb562016-09-16 10:23:12 -07001823 }
mtkleinecbc5262016-09-22 11:51:24 -07001824
Kevin Lubickebf648e2017-09-21 13:45:16 -04001825 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001826 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001827 sources = [
1828 "tools/skiaserve/Request.cpp",
1829 "tools/skiaserve/Response.cpp",
1830 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001831 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1832 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1833 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1834 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1835 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1836 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1837 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1838 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1839 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001840 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1841 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001842 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1843 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1844 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1845 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1846 ]
1847 deps = [
1848 ":flags",
1849 ":gpu_tool_utils",
1850 ":skia",
1851 ":tool_utils",
1852 "//third_party/jsoncpp",
1853 "//third_party/libmicrohttpd",
1854 "//third_party/libpng",
1855 ]
Mike Klein7d302882016-11-03 14:06:31 -04001856 }
mtkleinecbc5262016-09-22 11:51:24 -07001857 }
kjlubick14f984b2016-10-03 11:49:45 -07001858
Mike Kleine6682eb2017-01-05 10:54:57 -05001859 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001860 include_dirs = [
1861 "tools",
1862 "tools/debugger",
1863 ]
kjlubick14f984b2016-10-03 11:49:45 -07001864 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001865 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001866 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001867 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001868 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001869 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001870 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001871 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001872 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001873 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001874 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001875 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001876 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001877 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001878 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1879 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001880 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001881 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001882 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001883 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001884 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1885 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001886 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001887 "tools/UrlDataManager.cpp",
1888 "tools/debugger/SkDebugCanvas.cpp",
1889 "tools/debugger/SkDrawCommand.cpp",
1890 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001891 ]
1892 deps = [
1893 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001894 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001895 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001896 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001897 "//third_party/jsoncpp",
1898 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001899 ]
kjlubick14f984b2016-10-03 11:49:45 -07001900 }
Mike Klein38312422016-10-05 15:41:01 -04001901
Mike Kleine6682eb2017-01-05 10:54:57 -05001902 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001903 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001904 rebase_path("tests/skia_test.cpp"),
1905 rebase_path("tests/Test.cpp"),
1906 ]
caryclark9feb6322016-10-25 08:58:26 -07001907 deps = [
1908 ":flags",
1909 ":gpu_tool_utils",
1910 ":skia",
1911 ":tool_utils",
1912 ]
caryclark9feb6322016-10-25 08:58:26 -07001913 }
1914
Mike Kleine6682eb2017-01-05 10:54:57 -05001915 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001916 sources = [
1917 "tools/DumpRecord.cpp",
1918 "tools/dump_record.cpp",
1919 ]
1920 deps = [
1921 ":flags",
1922 ":skia",
1923 ]
Mike Klein38312422016-10-05 15:41:01 -04001924 }
bungemanfe917272016-10-13 17:36:40 -04001925
Mike Kleine6682eb2017-01-05 10:54:57 -05001926 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001927 sources = [
1928 "tools/skdiff/skdiff.cpp",
1929 "tools/skdiff/skdiff_html.cpp",
1930 "tools/skdiff/skdiff_main.cpp",
1931 "tools/skdiff/skdiff_utils.cpp",
1932 ]
1933 deps = [
1934 ":skia",
1935 ":tool_utils",
1936 ]
bungemanfe917272016-10-13 17:36:40 -04001937 }
halcanarya73d76a2016-10-17 13:19:02 -07001938
Mike Kleine6682eb2017-01-05 10:54:57 -05001939 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001940 sources = [
1941 "tools/skp_parser.cpp",
1942 ]
1943 deps = [
1944 ":skia",
1945 ":tool_utils",
1946 "//third_party/jsoncpp",
1947 ]
halcanarya73d76a2016-10-17 13:19:02 -07001948 }
Brian Osman16adfa32016-10-18 14:42:44 -04001949
Brian Osmanc9a42472018-05-31 13:17:12 -04001950 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001951 test_lib("skqp_lib") {
1952 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001953 defines =
1954 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001955 if (skia_skqp_enable_driver_correctness_workarounds) {
1956 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1957 }
Hal Canary75427132017-10-11 16:00:31 -04001958 sources = [
1959 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001960 "tools/skqp/gm_knowledge.cpp",
1961 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001962 ]
1963 deps = [
1964 ":gm",
1965 ":gpu_tool_utils",
1966 ":skia",
1967 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001968 ":tool_utils",
1969 ]
1970 }
1971 test_app("skqp") {
1972 sources = [
1973 "tools/skqp/skqp.cpp",
1974 ]
1975 deps = [
1976 ":skia",
1977 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001978 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001979 "//third_party/googletest",
1980 ]
1981 }
1982 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001983 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001984 test_app("skqp_app") {
1985 is_shared_library = true
1986 sources = [
1987 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1988 ]
1989 deps = [
1990 ":skia",
1991 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001992 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001993 ]
1994 libs = [ "android" ]
1995 }
1996 }
Stan Iliev93151722018-08-02 11:10:52 -04001997 if (is_android && skia_enable_gpu) {
1998 test_app("skottie_android") {
1999 is_shared_library = true
2000
2001 sources = [
2002 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2003 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2004 ]
2005 libs = []
2006
2007 include_dirs = []
2008 deps = [
2009 ":skia",
2010 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002011 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002012 ]
2013 }
2014 }
Hal Canary75427132017-10-11 16:00:31 -04002015
Hal Canarya9de7602018-01-19 13:08:23 -05002016 test_app("list_gms") {
2017 sources = [
2018 "tools/list_gms.cpp",
2019 ]
2020 deps = [
2021 ":gm",
2022 ":skia",
2023 ]
2024 }
2025 test_app("list_gpu_unit_tests") {
2026 sources = [
2027 "dm/DMGpuTestProcs.cpp",
2028 "tools/list_gpu_unit_tests.cpp",
2029 ]
2030 deps = [
2031 ":skia",
2032 ":tests",
2033 ]
2034 }
2035
Brian Osmanc9a42472018-05-31 13:17:12 -04002036 test_lib("sk_app") {
2037 public_include_dirs = [ "tools/sk_app" ]
2038 sources = [
2039 "tools/sk_app/CommandSet.cpp",
2040 "tools/sk_app/GLWindowContext.cpp",
2041 "tools/sk_app/Window.cpp",
2042 ]
2043 libs = []
2044
2045 if (is_android) {
2046 sources += [
2047 "tools/sk_app/android/GLWindowContext_android.cpp",
2048 "tools/sk_app/android/RasterWindowContext_android.cpp",
2049 "tools/sk_app/android/Window_android.cpp",
2050 "tools/sk_app/android/main_android.cpp",
2051 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002052 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002053 libs += [ "android" ]
2054 } else if (is_linux) {
2055 sources += [
2056 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2057 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2058 "tools/sk_app/unix/Window_unix.cpp",
2059 "tools/sk_app/unix/keysym2ucs.c",
2060 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002061 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002062 libs += [
2063 "GL",
2064 "X11",
2065 ]
2066 } else if (is_win) {
2067 sources += [
2068 "tools/sk_app/win/GLWindowContext_win.cpp",
2069 "tools/sk_app/win/RasterWindowContext_win.cpp",
2070 "tools/sk_app/win/Window_win.cpp",
2071 "tools/sk_app/win/main_win.cpp",
2072 ]
Brian Salomon194db172017-08-17 14:37:06 -04002073 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002074 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002075 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002076 } else if (is_mac) {
2077 sources += [
2078 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2079 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2080 "tools/sk_app/mac/Window_mac.cpp",
2081 "tools/sk_app/mac/main_mac.cpp",
2082 ]
2083 libs += [
2084 "QuartzCore.framework",
2085 "Cocoa.framework",
2086 "Foundation.framework",
2087 ]
2088 } else if (is_ios) {
2089 sources += [
2090 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2091 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2092 "tools/sk_app/ios/Window_ios.cpp",
2093 "tools/sk_app/ios/main_ios.cpp",
2094 ]
2095 }
2096
2097 if (skia_use_vulkan) {
2098 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2099 if (is_android) {
2100 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2101 } else if (is_linux) {
2102 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2103 libs += [ "X11-xcb" ]
2104 } else if (is_win) {
2105 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2106 }
2107 }
2108
2109 deps = [
2110 ":gpu_tool_utils",
2111 ":skia",
2112 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002113 ]
2114 if (is_android) {
2115 deps += [ "//third_party/native_app_glue" ]
2116 } else if (is_mac || is_ios) {
2117 deps += [ "//third_party/libsdl" ]
2118 }
2119 if (skia_use_angle) {
2120 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002121 }
Brian Osman16adfa32016-10-18 14:42:44 -04002122 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002123
Brian Osmanc9a42472018-05-31 13:17:12 -04002124 test_app("viewer") {
2125 is_shared_library = is_android
2126 if (is_ios) {
2127 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002128 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002129 sources = [
2130 "tools/viewer/BisectSlide.cpp",
2131 "tools/viewer/GMSlide.cpp",
2132 "tools/viewer/ImGuiLayer.cpp",
2133 "tools/viewer/ImageSlide.cpp",
2134 "tools/viewer/SKPSlide.cpp",
2135 "tools/viewer/SampleSlide.cpp",
2136 "tools/viewer/SkottieSlide.cpp",
2137 "tools/viewer/SlideDir.cpp",
2138 "tools/viewer/StatsLayer.cpp",
2139 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002140 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002141 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002142 "tools/viewer/Viewer.cpp",
2143 ]
2144 libs = []
2145
Kevin Lubickd9699322018-10-30 15:08:53 -04002146 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002147 deps = [
2148 ":experimental_svg_model",
2149 ":flags",
2150 ":gm",
2151 ":gpu_tool_utils",
2152 ":samples",
2153 ":sk_app",
2154 ":skia",
2155 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002156 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002157 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002158 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002159 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002160 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002161 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002162
2163 # NIMA does not build on Windows clang
2164 if (!is_win || !is_clang) {
2165 sources += [ "tools/viewer/NIMASlide.cpp" ]
2166 deps += [ "//third_party/Nima-Cpp" ]
2167 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002168 }
2169
ziadbbceddbc2018-06-19 13:57:15 -04002170 if (is_android) {
2171 test_app("arcore") {
2172 is_shared_library = true
2173 configs = [
2174 ":skia_public",
2175 "gn:default",
2176 ]
2177
2178 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2179 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2180 sources = []
2181 sources += skia_core_sources
2182 sources += skia_utils_sources
2183 sources += skia_xps_sources
2184 sources += [
2185 "src/android/SkAndroidFrameworkUtils.cpp",
2186 "src/android/SkAnimatedImage.cpp",
2187 "src/android/SkBitmapRegionCodec.cpp",
2188 "src/android/SkBitmapRegionDecoder.cpp",
2189 "src/codec/SkAndroidCodec.cpp",
2190 "src/codec/SkBmpBaseCodec.cpp",
2191 "src/codec/SkBmpCodec.cpp",
2192 "src/codec/SkBmpMaskCodec.cpp",
2193 "src/codec/SkBmpRLECodec.cpp",
2194 "src/codec/SkBmpStandardCodec.cpp",
2195 "src/codec/SkCodec.cpp",
2196 "src/codec/SkCodecImageGenerator.cpp",
2197 "src/codec/SkColorTable.cpp",
2198 "src/codec/SkGifCodec.cpp",
2199 "src/codec/SkMaskSwizzler.cpp",
2200 "src/codec/SkMasks.cpp",
2201 "src/codec/SkSampledCodec.cpp",
2202 "src/codec/SkSampler.cpp",
2203 "src/codec/SkStreamBuffer.cpp",
2204 "src/codec/SkSwizzler.cpp",
2205 "src/codec/SkWbmpCodec.cpp",
2206 "src/images/SkImageEncoder.cpp",
2207 "src/ports/SkDiscardableMemory_none.cpp",
2208 "src/ports/SkImageGenerator_skia.cpp",
2209 "src/ports/SkMemory_malloc.cpp",
2210 "src/ports/SkOSFile_stdio.cpp",
2211 "src/sfnt/SkOTTable_name.cpp",
2212 "src/sfnt/SkOTUtils.cpp",
2213 "src/utils/mac/SkStream_mac.cpp",
2214 "third_party/gif/SkGifImageReader.cpp",
2215 ]
2216 deps = [
2217 ":tool_utils",
2218 "modules/skottie",
2219 "modules/skshaper",
2220 ]
2221 }
2222 }
2223
Brian Osmanc9a42472018-05-31 13:17:12 -04002224 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002225 test_app("HelloWorld") {
2226 sources = [
2227 "example/HelloWorld.cpp",
2228 ]
2229 libs = []
2230
2231 include_dirs = []
2232 deps = [
2233 ":flags",
2234 ":gpu_tool_utils",
2235 ":sk_app",
2236 ":skia",
2237 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002238 ]
2239 }
2240 }
2241
Brian Osmanc9a42472018-05-31 13:17:12 -04002242 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002243 test_app("SkiaSDLExample") {
2244 sources = [
2245 "example/SkiaSDLExample.cpp",
2246 ]
2247 libs = []
2248 include_dirs = []
2249 deps = [
2250 ":gpu_tool_utils",
2251 ":skia",
2252 "//third_party/libsdl",
2253 ]
2254 }
2255 }
2256
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002257 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2258 action_foreach("generate_mocs") {
2259 script = "gn/call.py"
2260 sources = [
2261 "tools/mdbviz/MainWindow.h",
2262 ]
2263 outputs = [
2264 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2265 ]
2266 args = [
2267 "$skia_qt_path" + "/bin/moc",
2268 "{{source}}",
2269 "-o",
2270 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2271 ]
2272 }
2273 action_foreach("generate_resources") {
2274 script = "gn/call.py"
2275 sources = [
2276 "tools/mdbviz/resources.qrc",
2277 ]
2278 outputs = [
2279 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2280 ]
2281 args = [
2282 "$skia_qt_path" + "/bin/rcc",
2283 "{{source}}",
2284 "-o",
2285 "gen/mdbviz/{{source_name_part}}_res.cpp",
2286 ]
2287 }
2288 test_app("mdbviz") {
2289 if (is_win) {
2290 # on Windows we need to disable some exception handling warnings due to the Qt headers
2291 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2292 }
2293 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002294 "tools/UrlDataManager.cpp",
2295 "tools/debugger/SkDebugCanvas.cpp",
2296 "tools/debugger/SkDrawCommand.cpp",
2297 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002298 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002299 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002300 "tools/mdbviz/main.cpp",
2301
2302 # generated files
2303 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2304 "$target_gen_dir/mdbviz/resources_res.cpp",
2305 ]
2306 lib_dirs = [ "$skia_qt_path/lib" ]
2307 libs = [
2308 "Qt5Core.lib",
2309 "Qt5Gui.lib",
2310 "Qt5Widgets.lib",
2311 ]
2312 include_dirs = [
2313 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002314 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002315 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002316 "tools",
2317 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002318 ]
2319 deps = [
2320 ":generate_mocs",
2321 ":generate_resources",
2322 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002323 "//third_party/jsoncpp",
2324 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002325 ]
2326 }
2327 }
2328
Mike Kleine459afd2017-03-03 09:21:30 -05002329 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002330 copy("gdbserver") {
2331 sources = [
2332 "$ndk/$ndk_gdbserver",
2333 ]
2334 outputs = [
2335 "$root_out_dir/gdbserver",
2336 ]
2337 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002338 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002339
2340 if (skia_use_opencl) {
2341 test_app("hello-opencl") {
2342 sources = [
2343 "src/compute/common/cl/assert_cl.c",
2344 "src/compute/common/cl/find_cl.c",
2345 "tools/hello-opencl.cpp",
2346 ]
2347 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002348 if (is_linux) {
2349 libs = [ "OpenCL" ]
2350 } else if (is_win) {
2351 libs = [ "OpenCL.lib" ]
2352 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002353 }
2354 }
mtklein25c81d42016-07-27 13:55:26 -07002355}