blob: 888c3260c048a3fda4df1a24958e0b48f51b3b0a [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
51 skia_jumper_clang = ""
52 skia_jumper_objdump = ""
53 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070054}
Brian Salomon23d73ea2016-10-27 13:31:37 -040055declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040056 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040057 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050058 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040059
Mike Klein4d598a32016-10-31 13:44:49 -040060 if (is_android) {
61 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070062 } else if (is_fuchsia) {
63 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040064 } else {
65 skia_use_vulkan = skia_vulkan_sdk != ""
66 }
Jim Van Verth4e502972017-12-07 15:16:10 -050067
68 if (is_ios) {
69 skia_ios_identity = ".*Google.*"
70 skia_ios_profile = "Google Development"
71 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040072}
Greg Danielec6ae522017-04-25 13:38:26 -040073declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050074 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040075 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000076 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040077 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050078 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040079 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050080 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040081 }
Greg Danielec6ae522017-04-25 13:38:26 -040082 }
83}
Brian Salomon789e25e2016-09-30 13:41:03 -040084
Adam Barth54ef74a2017-10-13 10:59:38 -070085if (defined(skia_settings)) {
86 import(skia_settings)
87}
88
mtklein38925aa2016-09-21 10:11:25 -070089# Our tools require static linking (they use non-exported symbols).
90skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070091
mtkleina45be612016-08-29 15:22:10 -070092fontmgr_android_enabled = skia_use_expat && skia_use_freetype
93
mtklein1211e0c2016-07-26 13:55:45 -070094skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070095 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070096 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/codec",
98 "include/config",
99 "include/core",
100 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400101 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700102 "include/gpu",
103 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500104 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/pathops",
106 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700107 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/utils",
109 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700110]
111
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000112if (skia_use_vulkan) {
113 skia_public_includes += [ "include/gpu/vk" ]
114}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500115if (skia_enable_atlas_text) {
116 skia_public_includes += [ "include/atlastext" ]
117}
Greg Daniele5ddff52017-07-05 16:49:36 -0400118if (skia_use_metal) {
119 skia_public_includes += [ "include/gpu/mtl" ]
120}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000121
mtkleinc04ff472016-06-23 10:29:30 -0700122# Skia public API, generally provided by :skia.
123config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700124 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500125 if (skia_tools_vulkan_header_dir != "") {
126 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400127 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400128 defines = []
129 if (is_component_build) {
130 defines += [ "SKIA_DLL" ]
131 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400132 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700133 defines += [ "SK_SAMPLES_FOR_X" ]
134 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400135 if (skia_enable_flutter_defines) {
136 defines += flutter_defines
137 }
mtklein06c35c02016-09-20 12:28:12 -0700138 if (!skia_enable_gpu) {
139 defines += [ "SK_SUPPORT_GPU=0" ]
140 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500141 if (skia_enable_atlas_text) {
142 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
143 }
mtkleinc04ff472016-06-23 10:29:30 -0700144}
145
146# Skia internal APIs, used by Skia itself and a few test tools.
147config("skia_private") {
148 visibility = [ ":*" ]
149
150 include_dirs = [
151 "include/private",
152 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700153 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700154 "src/core",
155 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700156 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700157 "src/image",
158 "src/images",
159 "src/lazy",
160 "src/opts",
161 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700162 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700163 "src/ports",
164 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400165 "src/shaders",
166 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700167 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700168 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700169 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500170 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700171 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700172 ]
mtklein150d1132016-08-01 06:56:40 -0700173
Mike Reeda9e241d2017-05-03 10:52:00 -0400174 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700175 if (is_android) {
176 defines += [
177 "SK_GAMMA_EXPONENT=1.4",
178 "SK_GAMMA_CONTRAST=0.0",
179 ]
180 }
mtklein88a7ac02016-09-14 11:16:49 -0700181 if (is_official_build || is_android) {
182 # TODO(bsalomon): it'd be nice to make Android normal.
183 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
184 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400185 libs = []
186 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500187 if (skia_enable_gpu) {
188 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500189 if (is_skia_dev_build && skia_use_vulkan) {
190 include_dirs += [ "tools/gpu/vk" ]
191 }
Brian Salomon03e05842017-02-23 12:23:47 -0500192 }
Brian Osman34755e22016-12-05 09:46:02 -0500193 if (skia_use_angle) {
194 defines += [ "SK_ANGLE" ]
195 }
Brian Osman3f375d02016-12-28 11:19:22 -0500196 if (skia_enable_discrete_gpu) {
197 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
198 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400199 if (!is_official_build) {
200 defines += [ "GR_TEST_UTILS=1" ]
201 }
mtkleinc04ff472016-06-23 10:29:30 -0700202}
203
204# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
205config("skia_library") {
206 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700207 defines = [ "SKIA_IMPLEMENTATION=1" ]
208}
209
210skia_library_configs = [
211 ":skia_public",
212 ":skia_private",
213 ":skia_library",
214]
215
mtklein9b8583d2016-08-24 17:32:30 -0700216# Use for CPU-specific Skia code that needs particular compiler flags.
217template("opts") {
218 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 Kleinc722f792017-07-31 11:57:21 -0400305 if (!is_clang && 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
mtkleinc095df52016-08-24 12:23:52 -0700312# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700313template("optional") {
314 if (invoker.enabled) {
315 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700316 if (defined(invoker.public_defines)) {
317 defines = invoker.public_defines
318 }
mtklein457b42a2016-08-23 13:56:37 -0700319 }
320 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700321 forward_variables_from(invoker,
322 "*",
323 [
324 "public_defines",
325 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700326 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700327 ])
mtklein457b42a2016-08-23 13:56:37 -0700328 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700329 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700330 if (defined(invoker.configs_to_remove)) {
331 configs -= invoker.configs_to_remove
332 }
mtklein457b42a2016-08-23 13:56:37 -0700333 }
334 } else {
mtklein457b42a2016-08-23 13:56:37 -0700335 source_set(target_name) {
336 forward_variables_from(invoker,
337 "*",
338 [
339 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700340 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700341 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700342 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700343 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700344 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700345 ])
mtkleincd01b032016-08-31 04:58:19 -0700346 if (defined(invoker.sources_when_disabled)) {
347 sources = invoker.sources_when_disabled
348 }
349 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700350 }
mtkleineb3c4252016-08-23 07:38:09 -0700351 }
mtklein457b42a2016-08-23 13:56:37 -0700352}
mtklein457b42a2016-08-23 13:56:37 -0700353
Mike Kleina04bb452017-02-09 12:24:07 -0500354optional("effects") {
355 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400356 deps = [
357 ":compile_processors",
358 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500359 sources =
360 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
361 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
362}
363
mtkleina45be612016-08-29 15:22:10 -0700364optional("fontmgr_android") {
365 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700366
367 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500368 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700369 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700370 ]
371 sources = [
372 "src/ports/SkFontMgr_android.cpp",
373 "src/ports/SkFontMgr_android_factory.cpp",
374 "src/ports/SkFontMgr_android_parser.cpp",
375 ]
376}
377
mtkleind2e39db2016-09-07 07:52:55 -0700378optional("fontmgr_custom") {
379 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
380
381 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500382 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700383 ]
384 sources = [
385 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500386 "src/ports/SkFontMgr_custom.h",
387 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700388 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500389 "src/ports/SkFontMgr_custom_embedded.cpp",
390 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700391 ]
392}
393
Hal Canaryff2742e2018-01-30 11:35:47 -0500394optional("fontmgr_empty") {
395 enabled = skia_enable_fontmgr_empty
396 sources = [
397 "src/ports/SkFontMgr_empty_factory.cpp",
398 ]
399}
400
mtklein3cc22182016-08-29 13:26:14 -0700401optional("fontmgr_fontconfig") {
402 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700403
404 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500405 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700406 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700407 ]
408 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700409 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700410 "src/ports/SkFontConfigInterface_direct.cpp",
411 "src/ports/SkFontConfigInterface_direct_factory.cpp",
412 "src/ports/SkFontMgr_FontConfigInterface.cpp",
413 "src/ports/SkFontMgr_fontconfig.cpp",
414 "src/ports/SkFontMgr_fontconfig_factory.cpp",
415 ]
416}
417
mtkleincdedd0e2016-09-12 15:15:44 -0700418optional("fontmgr_fuchsia") {
419 enabled = is_fuchsia && skia_use_freetype
420
421 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500422 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700423 ]
424 sources = [
425 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500426 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700427 "src/ports/SkFontMgr_custom_empty_factory.cpp",
428 ]
429}
430
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700431if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400432 executable("sksllex") {
433 sources = [
434 "src/sksl/lex/Main.cpp",
435 "src/sksl/lex/NFA.cpp",
436 "src/sksl/lex/RegexNode.cpp",
437 "src/sksl/lex/RegexParser.cpp",
438 ]
439 include_dirs = [ "src/sksl/lex" ]
440 }
441
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700442 action("run_sksllex") {
443 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400444 deps = [
445 ":sksllex(//gn/toolchain:$host_toolchain)",
446 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700447 sources = [
448 "src/sksl/lex/layout.lex",
449 "src/sksl/lex/sksl.lex",
450 ]
451
452 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
453 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
454 outputs = [
455 "$target_out_dir/" +
456 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
457 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
458 # confused due to the same file being named by two different paths
459 ]
460 sksllex_path = "$root_out_dir/"
461 sksllex_path += "sksllex"
462 if (host_os == "win") {
463 sksllex_path += ".exe"
464 }
465 args = [
466 rebase_path(sksllex_path),
467 rebase_path("bin/clang-format"),
468 rebase_path("src"),
469 ]
470 }
471} else {
472 group("run_sksllex") {
473 }
474}
475
476if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400477 executable("skslc") {
478 defines = [ "SKSL_STANDALONE" ]
479 sources = [
480 "src/sksl/SkSLMain.cpp",
481 ]
482 sources += skia_sksl_sources
483 include_dirs = [
484 "src/gpu",
485 "src/sksl",
486 ]
487 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500488 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400489 "//third_party/spirv-tools",
490 ]
491 }
492
493 skia_gpu_processor_outputs = []
494 foreach(src, skia_gpu_processor_sources) {
495 dir = get_path_info(src, "dir")
496 name = get_path_info(src, "name")
497
498 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
499 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
500 skia_gpu_processor_outputs += [
501 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
502 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
503 # confused due to the same file being named by two different paths
504 ]
505 }
506
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 action("create_sksl_enums") {
508 script = "gn/create_sksl_enums.py"
509 sources = [
510 "include/private/GrSharedEnums.h",
511 ]
512 outputs = [
513 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500514 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500515 ]
516 args = [
517 rebase_path(sources[0]),
518 rebase_path(outputs[0]),
519 ]
520 }
521
Ethan Nicholas762466e2017-06-29 10:03:38 -0400522 action("compile_processors") {
523 script = "gn/compile_processors.py"
524 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500525 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400526 ":skslc(//gn/toolchain:$host_toolchain)",
527 ]
528 sources = skia_gpu_processor_sources
529 outputs = skia_gpu_processor_outputs
530 skslc_path = "$root_out_dir/"
531 if (host_toolchain != default_toolchain_name) {
532 skslc_path += "$host_toolchain/"
533 }
534 skslc_path += "skslc"
535 if (host_os == "win") {
536 skslc_path += ".exe"
537 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400538 args = [
539 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400540 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400541 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400542 args += rebase_path(skia_gpu_processor_sources)
543 }
544} else {
545 skia_gpu_processor_outputs = []
546 group("compile_processors") {
547 }
548}
549
mtklein06c35c02016-09-20 12:28:12 -0700550optional("gpu") {
551 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400552 deps = [
553 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700554 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400555 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700556 public_defines = []
557
Brian Salomon3d6801e2017-12-11 10:06:31 -0500558 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700559
560 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500561 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700562 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400563 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700564 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500565 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400566
567 # this lib is required to link against AHardwareBuffer
568 if (defined(ndk_api) && ndk_api >= 26) {
569 libs += [ "android" ]
570 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400571 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500572 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400573 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700574 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500575 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500576 libs += [
577 "GL",
578 "GLU",
579 ]
mtklein06c35c02016-09-20 12:28:12 -0700580 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500581 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800582 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500583 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400584 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500585 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400586 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700587 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500588 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700589 }
mtkleine9fb3d52016-09-20 15:11:46 -0700590
591 if (skia_use_vulkan) {
592 public_defines += [ "SK_VULKAN" ]
593 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700594 if (skia_enable_vulkan_debug_layers) {
595 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
596 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500597 if (skia_vulkan_header != "") {
598 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
599 } else {
600 if (is_skia_dev_build) {
601 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
602 }
603 }
mtkleine9fb3d52016-09-20 15:11:46 -0700604 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400605 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400606 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400607 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
608 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400609
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400610 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400611 if (skia_use_metal) {
612 public_defines += [ "SK_METAL" ]
613 sources += skia_metal_sources
614 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400615 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400616 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500617
618 if (skia_enable_atlas_text) {
619 sources += skia_atlas_text_sources
620 }
mtklein06c35c02016-09-20 12:28:12 -0700621}
622
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400623optional("heif") {
624 enabled = skia_use_libheif
625 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
626
627 deps = []
628
629 sources = [
630 "src/codec/SkHeifCodec.cpp",
631 ]
632}
633
mtklein63213812016-08-24 09:55:56 -0700634optional("jpeg") {
635 enabled = skia_use_libjpeg_turbo
636 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
637
mtklein63213812016-08-24 09:55:56 -0700638 deps = [
639 "//third_party/libjpeg-turbo:libjpeg",
640 ]
641 sources = [
642 "src/codec/SkJpegCodec.cpp",
643 "src/codec/SkJpegDecoderMgr.cpp",
644 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700645 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400646 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700647 ]
648}
649
650optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500651 enabled = skia_use_zlib && skia_enable_pdf
652 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700653
mtklein63213812016-08-24 09:55:56 -0700654 deps = [
655 "//third_party/zlib",
656 ]
brettwb9447282016-09-01 14:24:39 -0700657 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700658 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700659
660 if (skia_use_sfntly) {
661 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500662 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700663 }
664}
665
666optional("png") {
667 enabled = skia_use_libpng
668 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
669
mtklein63213812016-08-24 09:55:56 -0700670 deps = [
671 "//third_party/libpng",
672 ]
673 sources = [
674 "src/codec/SkIcoCodec.cpp",
675 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400676 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700677 ]
678}
679
scroggof84ad642016-10-31 09:02:57 -0700680optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400681 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700682 public_defines = [ "SK_CODEC_DECODES_RAW" ]
683
684 deps = [
685 "//third_party/dng_sdk",
686 "//third_party/libjpeg-turbo:libjpeg",
687 "//third_party/piex",
688 ]
689
690 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
691 # Skia.
692 configs_to_remove = [ "//gn:no_exceptions" ]
693
694 sources = [
695 "src/codec/SkRawAdapterCodec.cpp",
696 "src/codec/SkRawCodec.cpp",
697 ]
698}
699
Mike Kleinfb333552018-01-25 12:49:37 -0500700optional("skcms") {
701 enabled = skia_use_skcms
702
703 deps = [
704 "//third_party/skcms",
705 ]
706 sources = [
707 # TODO
708 ]
709}
710
mtklein3cc22182016-08-29 13:26:14 -0700711optional("typeface_freetype") {
712 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700713
714 deps = [
715 "//third_party/freetype2",
716 ]
717 sources = [
718 "src/ports/SkFontHost_FreeType.cpp",
719 "src/ports/SkFontHost_FreeType_common.cpp",
720 ]
721}
722
mtklein457b42a2016-08-23 13:56:37 -0700723optional("webp") {
724 enabled = skia_use_libwebp
725 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
726
mtklein457b42a2016-08-23 13:56:37 -0700727 deps = [
728 "//third_party/libwebp",
729 ]
730 sources = [
731 "src/codec/SkWebpAdapterCodec.cpp",
732 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400733 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700734 ]
mtkleineb3c4252016-08-23 07:38:09 -0700735}
736
mtklein63213812016-08-24 09:55:56 -0700737optional("xml") {
738 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000739 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700740
mtklein63213812016-08-24 09:55:56 -0700741 deps = [
742 "//third_party/expat",
743 ]
744 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500745 "src/svg/SkSVGCanvas.cpp",
746 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700747 "src/xml/SkDOM.cpp",
748 "src/xml/SkXMLParser.cpp",
749 "src/xml/SkXMLWriter.cpp",
750 ]
751}
752
mtkleinc04ff472016-06-23 10:29:30 -0700753component("skia") {
754 public_configs = [ ":skia_public" ]
755 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700756
757 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700758 ":arm64",
759 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700760 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700761 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500762 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700763 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700764 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500765 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700766 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700767 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700768 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400769 ":heif",
mtklein63213812016-08-24 09:55:56 -0700770 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700771 ":none",
mtklein63213812016-08-24 09:55:56 -0700772 ":pdf",
773 ":png",
scroggof84ad642016-10-31 09:02:57 -0700774 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500775 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700776 ":sse2",
777 ":sse41",
778 ":sse42",
779 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700780 ":webp",
mtklein63213812016-08-24 09:55:56 -0700781 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700782 ]
783
Chinmay Garde43f115c2016-11-16 15:04:12 -0800784 # This file (and all GN files in Skia) are designed to work with an
785 # empty sources assignment filter; we handle all that explicitly.
786 # We clear the filter here for clients who may have set up a global filter.
787 set_sources_assignment_filter([])
788
mtkleinc04ff472016-06-23 10:29:30 -0700789 sources = []
brettwb9447282016-09-01 14:24:39 -0700790 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700791 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500792 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700793 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400794 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500795 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700796 "src/android/SkBitmapRegionCodec.cpp",
797 "src/android/SkBitmapRegionDecoder.cpp",
798 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400799 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700800 "src/codec/SkBmpCodec.cpp",
801 "src/codec/SkBmpMaskCodec.cpp",
802 "src/codec/SkBmpRLECodec.cpp",
803 "src/codec/SkBmpStandardCodec.cpp",
804 "src/codec/SkCodec.cpp",
805 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700806 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700807 "src/codec/SkMaskSwizzler.cpp",
808 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700809 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700810 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700811 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700812 "src/codec/SkSwizzler.cpp",
813 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700814 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700815 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700816 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700817 "src/ports/SkMemory_malloc.cpp",
818 "src/ports/SkOSFile_stdio.cpp",
819 "src/sfnt/SkOTTable_name.cpp",
820 "src/sfnt/SkOTUtils.cpp",
821 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700822 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700823 ]
brettwb9447282016-09-01 14:24:39 -0700824
mtklein7d6fb2c2016-08-25 14:50:44 -0700825 libs = []
826
mtkleinc04ff472016-06-23 10:29:30 -0700827 if (is_win) {
828 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400829 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700830 "src/ports/SkDebug_win.cpp",
831 "src/ports/SkFontHost_win.cpp",
832 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500833 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700834 "src/ports/SkImageEncoder_WIC.cpp",
835 "src/ports/SkImageGeneratorWIC.cpp",
836 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700837 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700838 "src/ports/SkScalerContext_win_dw.cpp",
839 "src/ports/SkTLS_win.cpp",
840 "src/ports/SkTypeface_win_dw.cpp",
841 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400842 libs += [
843 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500844 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400845 "Ole32.lib",
846 "OleAut32.lib",
847 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500848 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400849 ]
mtkleinc04ff472016-06-23 10:29:30 -0700850 } else {
851 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700852 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700853 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700854 "src/ports/SkTLS_pthread.cpp",
855 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400856 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700857 }
858
mtklein7d6fb2c2016-08-25 14:50:44 -0700859 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500860 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500861 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500862 deps += [ "//third_party/cpu-features" ]
863 }
mtklein06c35c02016-09-20 12:28:12 -0700864 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700865 libs += [
866 "EGL",
867 "GLESv2",
868 "log",
869 ]
870 }
871
mtkleinc04ff472016-06-23 10:29:30 -0700872 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700873 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700874 }
875
876 if (is_mac) {
877 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700878 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700879 "src/ports/SkFontHost_mac.cpp",
880 "src/ports/SkImageEncoder_CG.cpp",
881 "src/ports/SkImageGeneratorCG.cpp",
882 ]
mtklein09e61f72016-08-23 13:35:28 -0700883 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400884 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
885 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700886 "ApplicationServices.framework",
887 "OpenGL.framework",
888 ]
mtkleinc04ff472016-06-23 10:29:30 -0700889 }
abarth6fc8ff02016-07-15 15:15:15 -0700890
Mike Klein7d302882016-11-03 14:06:31 -0400891 if (is_ios) {
892 sources += [
893 "src/ports/SkDebug_stdio.cpp",
894 "src/ports/SkFontHost_mac.cpp",
895 "src/ports/SkImageEncoder_CG.cpp",
896 "src/ports/SkImageGeneratorCG.cpp",
897 ]
898 libs += [
899 "CoreFoundation.framework",
900 "CoreGraphics.framework",
901 "CoreText.framework",
902 "ImageIO.framework",
903 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400904
905 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
906 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400907 ]
908 }
909
abarth6fc8ff02016-07-15 15:15:15 -0700910 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700911 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700912 }
mtkleinc04ff472016-06-23 10:29:30 -0700913}
914
mtkleinc095df52016-08-24 12:23:52 -0700915# Targets guarded by skia_enable_tools may use //third_party freely.
916if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500917 # Used by gn_to_bp.py to list our public include dirs.
918 source_set("public") {
919 configs += [ ":skia_public" ]
920 }
921
Mike Kleinc36dedf2016-11-18 09:35:28 -0500922 config("skia.h_config") {
923 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500924 if (skia_use_vulkan) {
925 # So we can get the header which includes vulkan
926 include_dirs += [ "tools/gpu/vk" ]
927 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500928 }
929 action("skia.h") {
930 public_configs = [ ":skia.h_config" ]
931 skia_h = "$target_gen_dir/skia.h"
932 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400933 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000934 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500935 depfile = "$skia_h.deps"
936 outputs = [
937 skia_h,
938 ]
939 }
940
941 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500942 executable("fiddle") {
943 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500944 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500945 "tools/fiddle/draw.cpp",
946 "tools/fiddle/fiddle_main.cpp",
947 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400948
949 if (skia_use_egl) {
950 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400951 } else {
952 sources += [ "tools/fiddle/null_context.cpp" ]
953 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400954 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500955 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400956 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500957 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500958 ":skia",
959 ":skia.h",
960 ]
961 }
962 }
963
964 if (skia_enable_gpu) {
965 source_set("public_headers_warnings_check") {
966 sources = [
967 "tools/public_headers_warnings_check.cpp",
968 ]
969 configs -= [ "//gn:warnings_except_public_headers" ]
970 deps = [
971 ":skia",
972 ":skia.h",
973 ]
974 }
975 }
976
mtkleinc095df52016-08-24 12:23:52 -0700977 template("test_lib") {
978 config(target_name + "_config") {
979 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700980 if (defined(invoker.public_defines)) {
981 defines = invoker.public_defines
982 }
mtklein25c81d42016-07-27 13:55:26 -0700983 }
mtkleinc095df52016-08-24 12:23:52 -0700984 source_set(target_name) {
985 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
986 public_configs = [
987 ":" + target_name + "_config",
988 ":skia_private",
989 ]
990
991 if (!defined(deps)) {
992 deps = []
993 }
994 deps += [ ":skia" ]
995 testonly = true
996 }
mtklein25c81d42016-07-27 13:55:26 -0700997 }
mtklein25c81d42016-07-27 13:55:26 -0700998
Mike Kleine6682eb2017-01-05 10:54:57 -0500999 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001000 if (is_ios) {
1001 app_name = target_name
1002 gen_path = target_gen_dir
1003
1004 action("${app_name}_generate_info_plist") {
1005 script = "//gn/gen_plist_ios.py"
1006 outputs = [
1007 "$gen_path/${app_name}_Info.plist",
1008 ]
1009 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1010 }
1011
1012 bundle_data("${app_name}_bundle_info_plist") {
1013 public_deps = [
1014 ":${app_name}_generate_info_plist",
1015 ]
1016 sources = [
1017 "$gen_path/${app_name}_Info.plist",
1018 ]
1019 outputs = [
1020 "{{bundle_root_dir}}/Info.plist",
1021 ]
1022 }
1023
Jim Van Verth329c5a62017-11-29 11:42:33 -05001024 bundle_ios_data =
1025 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1026
1027 if (bundle_ios_data) {
1028 has_skps =
1029 "True" == exec_script("//gn/checkdir.py",
1030 [ rebase_path("skps", root_build_dir) ],
1031 "trim string")
1032 bundle_data("${app_name}_bundle_resources") {
1033 sources = [
1034 "resources",
1035 ]
1036 outputs = [
1037 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1038 "{{bundle_resources_dir}}/data/resources",
1039 ]
1040 }
1041
1042 if (has_skps) {
1043 bundle_data("${app_name}_bundle_skps") {
1044 sources = [
1045 "skps",
1046 ]
1047 outputs = [
1048 # Store in same folder as resources
1049 "{{bundle_resources_dir}}/data/skps",
1050 ]
1051 }
1052 }
1053 }
1054
Jim Van Verth443a9132017-11-28 09:45:26 -05001055 executable("${app_name}_generate_executable") {
1056 forward_variables_from(invoker,
1057 "*",
1058 [
1059 "output_name",
1060 "visibility",
1061 "is_shared_library",
1062 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001063 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001064 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001065 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1066 }
1067
1068 bundle_data("${app_name}_bundle_executable") {
1069 public_deps = [
1070 ":${app_name}_generate_executable",
1071 ]
1072 sources = [
1073 "$gen_path/$app_name",
1074 ]
1075 outputs = [
1076 "{{bundle_executable_dir}}/$app_name",
1077 ]
1078 testonly = true
1079 }
1080
1081 create_bundle("$app_name") {
1082 product_type = "com.apple.product-type.application"
1083 testonly = true
1084
1085 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1086 bundle_resources_dir = bundle_root_dir
1087 bundle_executable_dir = bundle_root_dir
1088 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1089
1090 deps = [
1091 ":${app_name}_bundle_executable",
1092 ":${app_name}_bundle_info_plist",
1093 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001094 if (bundle_ios_data) {
1095 deps += [ ":${app_name}_bundle_resources" ]
1096 if (has_skps) {
1097 deps += [ ":${app_name}_bundle_skps" ]
1098 }
1099 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001100
1101 # should only code sign when running on a device, not the simulator
1102 if (target_cpu != "x64") {
1103 code_signing_script = "//gn/codesign_ios.py"
1104 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1105 code_signing_outputs = [
1106 "$bundle_root_dir/_CodeSignature/CodeResources",
1107 "$bundle_root_dir/embedded.mobileprovision",
1108 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001109 code_signing_args = [
1110 rebase_path("$bundle_root_dir", root_build_dir),
1111 skia_ios_identity,
1112 skia_ios_profile,
1113 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001114 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001115 }
1116 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001117 # !is_ios
1118
1119 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1120 shared_library("lib" + target_name) {
1121 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1122 configs += [ ":skia_private" ]
1123 testonly = true
1124 }
1125 } else {
1126 _executable = target_name
1127 executable(_executable) {
1128 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1129 configs += [ ":skia_private" ]
1130 testonly = true
1131 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001132 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001133 if (is_android && skia_android_serial != "" && defined(_executable)) {
1134 action("push_" + target_name) {
1135 script = "gn/push_to_android.py"
1136 deps = [
1137 ":" + _executable,
1138 ]
1139 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1140 outputs = [
1141 _stamp,
1142 ]
1143 args = [
1144 rebase_path("$root_build_dir/$_executable"),
1145 skia_android_serial,
1146 rebase_path(_stamp),
1147 ]
1148 testonly = true
1149 }
Mike Klein7d921032017-01-05 12:20:41 -05001150 }
1151 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001152 }
1153
mtkleinc095df52016-08-24 12:23:52 -07001154 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001155 public_include_dirs = []
1156 if (skia_enable_gpu) {
1157 public_defines = []
1158 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001159
1160 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001161 sources = [
1162 "tools/gpu/GrContextFactory.cpp",
1163 "tools/gpu/GrTest.cpp",
1164 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001165 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001166 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001167 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001168 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1169 "tools/gpu/gl/debug/GrBufferObj.cpp",
1170 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1171 "tools/gpu/gl/debug/GrProgramObj.cpp",
1172 "tools/gpu/gl/debug/GrShaderObj.cpp",
1173 "tools/gpu/gl/debug/GrTextureObj.cpp",
1174 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1175 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001176 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001177 ]
1178 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001179
Kevin Lubick4a24e102017-03-29 11:19:01 -04001180 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001181 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001182 } else if (is_ios) {
1183 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1184 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001185 } else if (is_linux) {
1186 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001187 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001188 } else if (is_mac) {
1189 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001190 } else if (is_win) {
1191 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1192 libs += [
1193 "Gdi32.lib",
1194 "OpenGL32.lib",
1195 ]
mtklein38925aa2016-09-21 10:11:25 -07001196 }
mtklein6ef69992016-09-14 06:12:09 -07001197
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001198 cflags_objcc = [ "-fobjc-arc" ]
1199
Mike Kleinc168a3a2016-11-14 14:53:13 +00001200 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001201 deps += [ "//third_party/angle2" ]
1202 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1203 }
mtkleind68f9b02016-09-23 13:18:41 -07001204 if (skia_use_vulkan) {
1205 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001206 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001207 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001208 if (skia_use_metal) {
1209 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1210 }
mtkleina627b5c2016-09-20 13:36:47 -07001211 }
mtklein25c81d42016-07-27 13:55:26 -07001212 }
mtklein25c81d42016-07-27 13:55:26 -07001213
mtkleinc095df52016-08-24 12:23:52 -07001214 test_lib("flags") {
1215 public_include_dirs = [ "tools/flags" ]
1216 sources = [
1217 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001218 ]
1219 }
1220 test_lib("common_flags") {
1221 public_include_dirs = [ "tools/flags" ]
1222 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001223 "tools/flags/SkCommonFlags.cpp",
1224 "tools/flags/SkCommonFlagsConfig.cpp",
1225 ]
1226 deps = [
mtklein046cb562016-09-16 10:23:12 -07001227 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001228 ":gpu_tool_utils",
1229 ]
1230 }
mtklein25c81d42016-07-27 13:55:26 -07001231
mtkleinc095df52016-08-24 12:23:52 -07001232 test_lib("tool_utils") {
1233 public_include_dirs = [
1234 "tools",
1235 "tools/debugger",
1236 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001237 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001238 ]
1239 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001240 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001241 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001242 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001243 "tools/ProcStats.cpp",
1244 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001245 "tools/SkRandomScalerContext.cpp",
1246 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001247 "tools/UrlDataManager.cpp",
1248 "tools/debugger/SkDebugCanvas.cpp",
1249 "tools/debugger/SkDrawCommand.cpp",
1250 "tools/debugger/SkJsonWriteBuffer.cpp",
1251 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001252 "tools/picture_utils.cpp",
1253 "tools/random_parse_path.cpp",
1254 "tools/sk_tool_utils.cpp",
1255 "tools/sk_tool_utils_font.cpp",
1256 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001257 "tools/trace/SkChromeTracingTracer.cpp",
1258 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001259 "tools/trace/SkDebugfTracer.cpp",
1260 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001261 "tools/trace/SkEventTracingPriv.cpp",
1262 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001263 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001264 libs = []
1265 if (is_ios) {
1266 sources += [ "tools/ios_utils.m" ]
1267 libs += [ "Foundation.framework" ]
1268 }
mtkleinc095df52016-08-24 12:23:52 -07001269 deps = [
mtklein046cb562016-09-16 10:23:12 -07001270 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001271 ":flags",
1272 "//third_party/libpng",
1273 ]
1274 public_deps = [
1275 "//third_party/jsoncpp",
1276 ]
1277 }
mtklein25c81d42016-07-27 13:55:26 -07001278
Mike Klein6e744122016-10-27 12:21:40 -04001279 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001280 test_lib("gm") {
1281 public_include_dirs = [ "gm" ]
1282 sources = gm_sources
1283 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001284 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001285 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001286 ":gpu_tool_utils",
1287 ":skia",
1288 ":tool_utils",
1289 ]
1290 }
mtklein25c81d42016-07-27 13:55:26 -07001291
Mike Klein6e744122016-10-27 12:21:40 -04001292 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001293 test_lib("tests") {
1294 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001295 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001296 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001297 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001298 }
mtkleinc095df52016-08-24 12:23:52 -07001299 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001300 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001301 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001302 ":skia",
1303 ":tool_utils",
1304 "//third_party/libpng",
1305 "//third_party/zlib",
1306 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001307 if (skia_use_expat) {
1308 deps += [ ":experimental_svg_model" ]
1309 }
Mike Kleind63442d2017-03-27 14:16:04 -04001310 public_deps = [
1311 ":gpu_tool_utils", # Test.h #includes headers from this target.
1312 ]
mtkleinc095df52016-08-24 12:23:52 -07001313 }
mtklein2f3416d2016-08-02 16:02:05 -07001314
Mike Klein6e744122016-10-27 12:21:40 -04001315 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001316 test_lib("bench") {
1317 public_include_dirs = [ "bench" ]
1318 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001319 deps = [
1320 ":flags",
1321 ":gm",
1322 ":gpu_tool_utils",
1323 ":skia",
1324 ":tool_utils",
1325 ]
1326 }
mtklein2b6870c2016-07-28 14:17:33 -07001327
Florin Malita54f65c42018-01-16 17:04:30 -05001328 test_lib("experimental_skottie") {
1329 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001330 include_dirs = [ "tools" ]
1331 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001332 "experimental/skottie/Skottie.cpp",
1333 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001334 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001335 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001336 ]
1337 deps = [
1338 ":experimental_sksg",
1339 ":skia",
1340 "//third_party/jsoncpp",
1341 ]
1342 }
1343
mtkleinc095df52016-08-24 12:23:52 -07001344 test_lib("experimental_svg_model") {
1345 public_include_dirs = [ "experimental/svg/model" ]
1346 sources = [
1347 "experimental/svg/model/SkSVGAttribute.cpp",
1348 "experimental/svg/model/SkSVGAttributeParser.cpp",
1349 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001350 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001351 "experimental/svg/model/SkSVGContainer.cpp",
1352 "experimental/svg/model/SkSVGDOM.cpp",
1353 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001354 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001355 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001356 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001357 "experimental/svg/model/SkSVGNode.cpp",
1358 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001359 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001360 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001361 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001362 "experimental/svg/model/SkSVGRect.cpp",
1363 "experimental/svg/model/SkSVGRenderContext.cpp",
1364 "experimental/svg/model/SkSVGSVG.cpp",
1365 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001366 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001367 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001368 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001369 "experimental/svg/model/SkSVGValue.cpp",
1370 ]
1371 deps = [
1372 ":skia",
1373 ]
1374 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001375
Florin Malita4aa44412017-12-19 12:21:02 -05001376 test_lib("experimental_sksg") {
1377 public_include_dirs = [
1378 "experimental/sksg",
1379 "experimental/sksg/effects",
1380 "experimental/sksg/geometry",
1381 "experimental/sksg/paint",
1382 ]
1383 sources = [
1384 "experimental/sksg/SkSGDraw.cpp",
1385 "experimental/sksg/SkSGEffectNode.cpp",
1386 "experimental/sksg/SkSGGeometryNode.cpp",
1387 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001388 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001389 "experimental/sksg/SkSGInvalidationController.cpp",
1390 "experimental/sksg/SkSGNode.cpp",
1391 "experimental/sksg/SkSGPaintNode.cpp",
1392 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001393 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001394 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001395 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001396 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001397 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001398 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001399 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001400 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001401 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001402 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001403 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001404 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001405 ]
1406 deps = [
1407 ":skia",
1408 ]
1409 }
1410
Kevin Lubickebf648e2017-09-21 13:45:16 -04001411 if (target_cpu != "wasm") {
1412 test_lib("views") {
1413 public_include_dirs = [ "include/views" ]
1414 sources = [
1415 "src/views/SkEvent.cpp",
1416 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001417 "src/views/SkTouchGesture.cpp",
1418 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001419 ]
Brian Osman34755e22016-12-05 09:46:02 -05001420 }
Brian Osman16adfa32016-10-18 14:42:44 -04001421 }
1422
Mike Klein38af9432016-11-11 11:39:44 -05001423 if (skia_use_lua) {
1424 test_lib("lua") {
1425 public_include_dirs = []
1426 sources = [
1427 "src/utils/SkLua.cpp",
1428 "src/utils/SkLuaCanvas.cpp",
1429 ]
1430 deps = [
1431 "//third_party/lua",
1432 ]
1433 }
1434
Mike Kleine6682eb2017-01-05 10:54:57 -05001435 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001436 sources = [
1437 "tools/lua/lua_app.cpp",
1438 ]
1439 deps = [
1440 ":lua",
1441 ":skia",
1442 "//third_party/lua",
1443 ]
Mike Klein38af9432016-11-11 11:39:44 -05001444 }
1445
Mike Kleine6682eb2017-01-05 10:54:57 -05001446 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001447 sources = [
1448 "tools/lua/lua_pictures.cpp",
1449 ]
1450 deps = [
1451 ":flags",
1452 ":lua",
1453 ":skia",
1454 ":tool_utils",
1455 "//third_party/lua",
1456 ]
Mike Klein38af9432016-11-11 11:39:44 -05001457 }
1458 }
1459
Cary Clark8032b982017-07-28 11:04:54 -04001460 test_app("bookmaker") {
1461 sources = [
1462 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001463 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001464 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001465 "tools/bookmaker/fiddleParser.cpp",
1466 "tools/bookmaker/includeParser.cpp",
1467 "tools/bookmaker/includeWriter.cpp",
1468 "tools/bookmaker/mdOut.cpp",
1469 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001470 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001471 "tools/bookmaker/spellCheck.cpp",
1472 ]
1473 deps = [
1474 ":flags",
1475 ":skia",
1476 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001477 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001478 ]
1479 }
1480
Kevin Lubickebf648e2017-09-21 13:45:16 -04001481 if (target_cpu != "wasm") {
1482 import("gn/samples.gni")
1483 test_lib("samples") {
1484 public_include_dirs = [ "samplecode" ]
1485 include_dirs = [ "experimental" ]
1486 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001487 # Relocating these files here, so that clients don't try to build them while they're
1488 # still in active development. Clang's thread safety analysis gets tripped up by
1489 # conditional locks.
1490 "src/core/SkThreadedBMPDevice.cpp",
1491 "src/core/SkThreadedBMPDevice.h",
1492 ]
1493 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001494 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001495 ":experimental_svg_model",
1496 ":flags",
1497 ":gm",
1498 ":tool_utils",
1499 ":views",
1500 ":xml",
1501 ]
Mike Klein38af9432016-11-11 11:39:44 -05001502
Kevin Lubickebf648e2017-09-21 13:45:16 -04001503 if (skia_use_lua) {
1504 sources += [ "samplecode/SampleLua.cpp" ]
1505 deps += [
1506 ":lua",
1507 "//third_party/lua",
1508 ]
1509 }
1510 }
1511 test_app("dm") {
1512 sources = [
1513 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001514 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001515 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001516 "dm/DMJsonWriter.cpp",
1517 "dm/DMSrcSink.cpp",
1518 ]
1519 include_dirs = [ "tests" ]
1520 deps = [
1521 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001522 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001523 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001524 ":experimental_svg_model",
1525 ":flags",
1526 ":gm",
1527 ":gpu_tool_utils",
1528 ":skia",
1529 ":tests",
1530 ":tool_utils",
1531 "//third_party/jsoncpp",
1532 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001533 ]
1534 }
Brian Osman16adfa32016-10-18 14:42:44 -04001535 }
1536
Mike Kleina8a51ce2018-01-09 12:34:11 -05001537 if (!is_win) {
1538 test_app("remote_demo") {
1539 sources = [
1540 "tools/remote_demo.cpp",
1541 ]
1542 deps = [
1543 ":skia",
1544 ]
1545 }
1546 }
1547
Mike Klein06432b22017-03-21 13:14:33 -04001548 test_app("ok") {
1549 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001550 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001551 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001552 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001553 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001554 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001555 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001556 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001557 ]
1558 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001559 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001560 ":gm",
1561 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001562 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001563 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001564 ]
1565 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001566 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001567 sources = [
1568 "bench/nanobench.cpp",
1569 ]
1570 deps = [
1571 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001572 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001573 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001574 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001575 ":flags",
1576 ":gm",
1577 ":gpu_tool_utils",
1578 ":skia",
1579 ":tool_utils",
1580 "//third_party/jsoncpp",
1581 ]
mtklein2b6870c2016-07-28 14:17:33 -07001582 }
halcanary19a97202016-08-03 15:08:04 -07001583
Ravi Mistry10d36c52017-01-31 09:49:18 -05001584 test_app("skpinfo") {
1585 sources = [
1586 "tools/skpinfo.cpp",
1587 ]
1588 deps = [
1589 ":flags",
1590 ":skia",
1591 ]
1592 }
1593
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001594 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001595 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001596 sources = [
1597 "tools/skpbench/skpbench.cpp",
1598 ]
1599 deps = [
1600 ":flags",
1601 ":gpu_tool_utils",
1602 ":skia",
1603 ":tool_utils",
1604 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001605 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001606 }
1607
Mike Klein7d302882016-11-03 14:06:31 -04001608 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001609 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001610 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001611 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001612 "tools/shape/SkShaper_harfbuzz.cpp",
1613 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001614 ]
1615 deps = [
1616 ":skia",
1617 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001618 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001619 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001620 }
halcanary19a97202016-08-03 15:08:04 -07001621 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001622 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001623 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001624 "tools/shape/SkShaper_primitive.cpp",
1625 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001626 ]
1627 deps = [
1628 ":skia",
1629 ]
halcanary3eee9d92016-09-10 07:01:53 -07001630 }
mtklein046cb562016-09-16 10:23:12 -07001631
Matt Sarett9f1c4032017-05-17 10:06:32 -04001632 test_app("create_flutter_test_images") {
1633 sources = [
1634 "tools/create_flutter_test_images.cpp",
1635 ]
1636 deps = [
1637 ":skia",
1638 ":tool_utils",
1639 ]
1640 }
1641
Ben Wagner219f3622017-07-17 15:32:25 -04001642 test_app("create_test_font") {
1643 sources = [
1644 "tools/create_test_font.cpp",
1645 ]
1646 deps = [
1647 ":skia",
1648 ]
1649 assert_no_deps = [
1650 # tool_utils requires the output of this app.
1651 ":tool_utils",
1652 ]
1653 }
1654
Mike Kleine6682eb2017-01-05 10:54:57 -05001655 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001656 sources = [
1657 "tools/get_images_from_skps.cpp",
1658 ]
1659 deps = [
1660 ":flags",
1661 ":skia",
1662 "//third_party/jsoncpp",
1663 ]
mtklein046cb562016-09-16 10:23:12 -07001664 }
mtkleinecbc5262016-09-22 11:51:24 -07001665
Mike Kleine6682eb2017-01-05 10:54:57 -05001666 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001667 sources = [
1668 "tools/colorspaceinfo.cpp",
1669 ]
1670 deps = [
1671 ":flags",
1672 ":skia",
1673 ":tool_utils",
1674 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001675 }
1676
Kevin Lubickebf648e2017-09-21 13:45:16 -04001677 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001678 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001679 sources = [
1680 "tools/skiaserve/Request.cpp",
1681 "tools/skiaserve/Response.cpp",
1682 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001683 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1684 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1685 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1686 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1687 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1688 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1689 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1690 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1691 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001692 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1693 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001694 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1695 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1696 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1697 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1698 ]
1699 deps = [
1700 ":flags",
1701 ":gpu_tool_utils",
1702 ":skia",
1703 ":tool_utils",
1704 "//third_party/jsoncpp",
1705 "//third_party/libmicrohttpd",
1706 "//third_party/libpng",
1707 ]
Mike Klein7d302882016-11-03 14:06:31 -04001708 }
mtkleinecbc5262016-09-22 11:51:24 -07001709 }
kjlubick14f984b2016-10-03 11:49:45 -07001710
Mike Kleine6682eb2017-01-05 10:54:57 -05001711 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001712 include_dirs = [
1713 "tools",
1714 "tools/debugger",
1715 ]
kjlubick14f984b2016-10-03 11:49:45 -07001716 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001717 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001718 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001719 "fuzz/FuzzGradients.cpp",
1720 "fuzz/FuzzParsePath.cpp",
1721 "fuzz/FuzzPathop.cpp",
1722 "fuzz/FuzzScaleToSides.cpp",
1723 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001724 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1725 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001726 "tools/UrlDataManager.cpp",
1727 "tools/debugger/SkDebugCanvas.cpp",
1728 "tools/debugger/SkDrawCommand.cpp",
1729 "tools/debugger/SkJsonWriteBuffer.cpp",
1730 "tools/debugger/SkObjectParser.cpp",
1731 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001732 ]
1733 deps = [
1734 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001735 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001736 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001737 "//third_party/jsoncpp",
1738 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001739 ]
kjlubick14f984b2016-10-03 11:49:45 -07001740 }
Mike Klein38312422016-10-05 15:41:01 -04001741
Mike Kleine6682eb2017-01-05 10:54:57 -05001742 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001743 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001744 rebase_path("tests/skia_test.cpp"),
1745 rebase_path("tests/Test.cpp"),
1746 ]
caryclark9feb6322016-10-25 08:58:26 -07001747 deps = [
1748 ":flags",
1749 ":gpu_tool_utils",
1750 ":skia",
1751 ":tool_utils",
1752 ]
caryclark9feb6322016-10-25 08:58:26 -07001753 }
1754
Mike Kleine6682eb2017-01-05 10:54:57 -05001755 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001756 sources = [
1757 "tools/DumpRecord.cpp",
1758 "tools/dump_record.cpp",
1759 ]
1760 deps = [
1761 ":flags",
1762 ":skia",
1763 ]
Mike Klein38312422016-10-05 15:41:01 -04001764 }
bungemanfe917272016-10-13 17:36:40 -04001765
Mike Kleine6682eb2017-01-05 10:54:57 -05001766 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001767 sources = [
1768 "tools/skdiff/skdiff.cpp",
1769 "tools/skdiff/skdiff_html.cpp",
1770 "tools/skdiff/skdiff_main.cpp",
1771 "tools/skdiff/skdiff_utils.cpp",
1772 ]
1773 deps = [
1774 ":skia",
1775 ":tool_utils",
1776 ]
bungemanfe917272016-10-13 17:36:40 -04001777 }
halcanarya73d76a2016-10-17 13:19:02 -07001778
Mike Kleine6682eb2017-01-05 10:54:57 -05001779 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001780 sources = [
1781 "tools/skp_parser.cpp",
1782 ]
1783 deps = [
1784 ":skia",
1785 ":tool_utils",
1786 "//third_party/jsoncpp",
1787 ]
halcanarya73d76a2016-10-17 13:19:02 -07001788 }
Brian Osman16adfa32016-10-18 14:42:44 -04001789
Hal Canaryd7b38452017-12-11 17:46:26 -05001790 if (!is_win && skia_enable_gpu) {
1791 test_lib("skqp_lib") {
1792 public_include_dirs = [ "tools/skqp" ]
Hal Canary75427132017-10-11 16:00:31 -04001793 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001794 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001795 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001796 "tools/skqp/gm_knowledge.cpp",
1797 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001798 ]
1799 deps = [
1800 ":gm",
1801 ":gpu_tool_utils",
1802 ":skia",
1803 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001804 ":tool_utils",
1805 ]
1806 }
1807 test_app("skqp") {
1808 sources = [
1809 "tools/skqp/skqp.cpp",
1810 ]
1811 deps = [
1812 ":skia",
1813 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001814 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001815 "//third_party/googletest",
1816 ]
1817 }
1818 }
Hal Canary28f89382017-12-12 09:42:14 -05001819 if (is_android && skia_enable_gpu) {
1820 test_app("skqp_app") {
1821 is_shared_library = true
1822 sources = [
1823 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1824 ]
1825 deps = [
1826 ":skia",
1827 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001828 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001829 ]
1830 libs = [ "android" ]
1831 }
1832 }
Hal Canary75427132017-10-11 16:00:31 -04001833
Hal Canarya9de7602018-01-19 13:08:23 -05001834 test_app("list_gms") {
1835 sources = [
1836 "tools/list_gms.cpp",
1837 ]
1838 deps = [
1839 ":gm",
1840 ":skia",
1841 ]
1842 }
1843 test_app("list_gpu_unit_tests") {
1844 sources = [
1845 "dm/DMGpuTestProcs.cpp",
1846 "tools/list_gpu_unit_tests.cpp",
1847 ]
1848 deps = [
1849 ":skia",
1850 ":tests",
1851 ]
1852 }
1853
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001854 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001855 test_lib("sk_app") {
1856 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001857 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001858 "tools/sk_app/CommandSet.cpp",
1859 "tools/sk_app/GLWindowContext.cpp",
1860 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001861 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001862 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001863
Jim Van Verth4e56a912016-10-21 10:58:52 -04001864 if (is_android) {
1865 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001866 "tools/sk_app/android/GLWindowContext_android.cpp",
1867 "tools/sk_app/android/RasterWindowContext_android.cpp",
1868 "tools/sk_app/android/Window_android.cpp",
1869 "tools/sk_app/android/main_android.cpp",
1870 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001871 ]
Brian Osman462334e2017-02-09 11:22:57 -05001872 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001873 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001874 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001875 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1876 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1877 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001878 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001879 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001880 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001881 libs += [
1882 "GL",
1883 "X11",
1884 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001885 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001886 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001887 "tools/sk_app/win/GLWindowContext_win.cpp",
1888 "tools/sk_app/win/RasterWindowContext_win.cpp",
1889 "tools/sk_app/win/Window_win.cpp",
1890 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001891 ]
Brian Salomon194db172017-08-17 14:37:06 -04001892 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001893 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001894 }
Mike Klein43c25262016-10-20 10:17:47 -04001895 } else if (is_mac) {
1896 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001897 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1898 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1899 "tools/sk_app/mac/Window_mac.cpp",
1900 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001901 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001902 libs += [
1903 "QuartzCore.framework",
1904 "Cocoa.framework",
1905 "Foundation.framework",
1906 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001907 } else if (is_ios) {
1908 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001909 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1910 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1911 "tools/sk_app/ios/Window_ios.cpp",
1912 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001913 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001914 }
1915
1916 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001917 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001918 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001919 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001920 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001921 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001922 libs += [ "X11-xcb" ]
1923 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001924 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001925 }
1926 }
1927
Brian Osman16adfa32016-10-18 14:42:44 -04001928 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001929 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001930 ":skia",
1931 ":tool_utils",
1932 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001933 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001934 if (is_android) {
1935 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001936 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001937 deps += [ "//third_party/libsdl" ]
1938 }
Brian Salomon194db172017-08-17 14:37:06 -04001939 if (skia_use_angle) {
1940 deps += [ "//third_party/angle2" ]
1941 }
Mike Kleina92c3832016-12-08 09:49:39 -05001942 }
Brian Osman16adfa32016-10-18 14:42:44 -04001943 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001944
Brian Osmaneff04b52017-11-21 13:18:02 -05001945 if (skia_enable_gpu) {
1946 test_app("viewer") {
1947 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001948 if (is_ios) {
1949 bundle_ios_data = true
1950 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001951 sources = [
1952 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001953 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001954 "tools/viewer/ImageSlide.cpp",
1955 "tools/viewer/SKPSlide.cpp",
1956 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001957 "tools/viewer/SkottieSlide.cpp",
1958 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001959 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001960 "tools/viewer/Viewer.cpp",
1961 ]
1962 libs = []
1963
1964 include_dirs = []
1965 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001966 ":experimental_skottie",
Brian Osmaneff04b52017-11-21 13:18:02 -05001967 ":flags",
1968 ":gm",
1969 ":gpu_tool_utils",
1970 ":samples",
1971 ":sk_app",
1972 ":skia",
1973 ":tool_utils",
1974 ":views",
1975 "//third_party/imgui",
1976 "//third_party/jsoncpp",
1977 ]
1978 }
1979 }
1980
1981 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1982 test_app("HelloWorld") {
1983 sources = [
1984 "example/HelloWorld.cpp",
1985 ]
1986 libs = []
1987
1988 include_dirs = []
1989 deps = [
1990 ":flags",
1991 ":gpu_tool_utils",
1992 ":sk_app",
1993 ":skia",
1994 ":tool_utils",
1995 ":views",
1996 ]
1997 }
1998 }
1999
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002000 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002001 test_app("SkiaSDLExample") {
2002 sources = [
2003 "example/SkiaSDLExample.cpp",
2004 ]
2005 libs = []
2006 include_dirs = []
2007 deps = [
2008 ":gpu_tool_utils",
2009 ":skia",
2010 "//third_party/libsdl",
2011 ]
2012 }
2013 }
2014
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002015 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2016 action_foreach("generate_mocs") {
2017 script = "gn/call.py"
2018 sources = [
2019 "tools/mdbviz/MainWindow.h",
2020 ]
2021 outputs = [
2022 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2023 ]
2024 args = [
2025 "$skia_qt_path" + "/bin/moc",
2026 "{{source}}",
2027 "-o",
2028 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2029 ]
2030 }
2031 action_foreach("generate_resources") {
2032 script = "gn/call.py"
2033 sources = [
2034 "tools/mdbviz/resources.qrc",
2035 ]
2036 outputs = [
2037 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2038 ]
2039 args = [
2040 "$skia_qt_path" + "/bin/rcc",
2041 "{{source}}",
2042 "-o",
2043 "gen/mdbviz/{{source_name_part}}_res.cpp",
2044 ]
2045 }
2046 test_app("mdbviz") {
2047 if (is_win) {
2048 # on Windows we need to disable some exception handling warnings due to the Qt headers
2049 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2050 }
2051 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002052 "tools/UrlDataManager.cpp",
2053 "tools/debugger/SkDebugCanvas.cpp",
2054 "tools/debugger/SkDrawCommand.cpp",
2055 "tools/debugger/SkJsonWriteBuffer.cpp",
2056 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002057 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002058 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002059 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002060 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002061
2062 # generated files
2063 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2064 "$target_gen_dir/mdbviz/resources_res.cpp",
2065 ]
2066 lib_dirs = [ "$skia_qt_path/lib" ]
2067 libs = [
2068 "Qt5Core.lib",
2069 "Qt5Gui.lib",
2070 "Qt5Widgets.lib",
2071 ]
2072 include_dirs = [
2073 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002074 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002075 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002076 "tools",
2077 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002078 ]
2079 deps = [
2080 ":generate_mocs",
2081 ":generate_resources",
2082 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002083 "//third_party/jsoncpp",
2084 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002085 ]
2086 }
2087 }
2088
Mike Kleine459afd2017-03-03 09:21:30 -05002089 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002090 copy("gdbserver") {
2091 sources = [
2092 "$ndk/$ndk_gdbserver",
2093 ]
2094 outputs = [
2095 "$root_out_dir/gdbserver",
2096 ]
2097 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002098 }
mtklein25c81d42016-07-27 13:55:26 -07002099}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002100
2101if (skia_jumper_clang != "") {
2102 action("regen_jumper") {
2103 script = "src/jumper/build_stages.py"
2104
2105 inputs = [
2106 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002107 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002108 ]
2109
2110 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2111 outputs = [
2112 "$target_out_dir/" +
2113 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2114 "$target_out_dir/" +
2115 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2116 ]
2117
2118 args = [
2119 skia_jumper_clang,
2120 skia_jumper_objdump,
2121 skia_jumper_ccache,
2122 ] + rebase_path(inputs) + rebase_path(outputs)
2123 }
2124}