blob: 9eb402214687cb23486471296314318a67a3b42d [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
Hal Canarya4935102017-12-08 13:35:47 -050034 skia_embed_resources = false
mtklein1bd72ba2016-09-16 07:45:52 -070035
Mike Klein7d921032017-01-05 12:20:41 -050036 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050037 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050038 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040039 skia_enable_flutter_defines = 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
mtklein3cc22182016-08-29 13:26:14 -0700394optional("fontmgr_fontconfig") {
395 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700399 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700400 ]
401 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700402 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700403 "src/ports/SkFontConfigInterface_direct.cpp",
404 "src/ports/SkFontConfigInterface_direct_factory.cpp",
405 "src/ports/SkFontMgr_FontConfigInterface.cpp",
406 "src/ports/SkFontMgr_fontconfig.cpp",
407 "src/ports/SkFontMgr_fontconfig_factory.cpp",
408 ]
409}
410
mtkleincdedd0e2016-09-12 15:15:44 -0700411optional("fontmgr_fuchsia") {
412 enabled = is_fuchsia && skia_use_freetype
413
414 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500415 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700416 ]
417 sources = [
418 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500419 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700420 "src/ports/SkFontMgr_custom_empty_factory.cpp",
421 ]
422}
423
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700424if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400425 executable("sksllex") {
426 sources = [
427 "src/sksl/lex/Main.cpp",
428 "src/sksl/lex/NFA.cpp",
429 "src/sksl/lex/RegexNode.cpp",
430 "src/sksl/lex/RegexParser.cpp",
431 ]
432 include_dirs = [ "src/sksl/lex" ]
433 }
434
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700435 action("run_sksllex") {
436 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400437 deps = [
438 ":sksllex(//gn/toolchain:$host_toolchain)",
439 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700440 sources = [
441 "src/sksl/lex/layout.lex",
442 "src/sksl/lex/sksl.lex",
443 ]
444
445 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
446 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
447 outputs = [
448 "$target_out_dir/" +
449 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
450 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
451 # confused due to the same file being named by two different paths
452 ]
453 sksllex_path = "$root_out_dir/"
454 sksllex_path += "sksllex"
455 if (host_os == "win") {
456 sksllex_path += ".exe"
457 }
458 args = [
459 rebase_path(sksllex_path),
460 rebase_path("bin/clang-format"),
461 rebase_path("src"),
462 ]
463 }
464} else {
465 group("run_sksllex") {
466 }
467}
468
469if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400470 executable("skslc") {
471 defines = [ "SKSL_STANDALONE" ]
472 sources = [
473 "src/sksl/SkSLMain.cpp",
474 ]
475 sources += skia_sksl_sources
476 include_dirs = [
477 "src/gpu",
478 "src/sksl",
479 ]
480 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500481 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400482 "//third_party/spirv-tools",
483 ]
484 }
485
486 skia_gpu_processor_outputs = []
487 foreach(src, skia_gpu_processor_sources) {
488 dir = get_path_info(src, "dir")
489 name = get_path_info(src, "name")
490
491 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
492 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
493 skia_gpu_processor_outputs += [
494 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
495 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
496 # confused due to the same file being named by two different paths
497 ]
498 }
499
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500500 action("create_sksl_enums") {
501 script = "gn/create_sksl_enums.py"
502 sources = [
503 "include/private/GrSharedEnums.h",
504 ]
505 outputs = [
506 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500507 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500508 ]
509 args = [
510 rebase_path(sources[0]),
511 rebase_path(outputs[0]),
512 ]
513 }
514
Ethan Nicholas762466e2017-06-29 10:03:38 -0400515 action("compile_processors") {
516 script = "gn/compile_processors.py"
517 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500518 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400519 ":skslc(//gn/toolchain:$host_toolchain)",
520 ]
521 sources = skia_gpu_processor_sources
522 outputs = skia_gpu_processor_outputs
523 skslc_path = "$root_out_dir/"
524 if (host_toolchain != default_toolchain_name) {
525 skslc_path += "$host_toolchain/"
526 }
527 skslc_path += "skslc"
528 if (host_os == "win") {
529 skslc_path += ".exe"
530 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400531 args = [
532 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400533 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400534 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400535 args += rebase_path(skia_gpu_processor_sources)
536 }
537} else {
538 skia_gpu_processor_outputs = []
539 group("compile_processors") {
540 }
541}
542
mtklein06c35c02016-09-20 12:28:12 -0700543optional("gpu") {
544 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 deps = [
546 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700547 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400548 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700549 public_defines = []
550
Brian Salomon3d6801e2017-12-11 10:06:31 -0500551 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700552
553 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500554 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700555 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400556 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700557 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500558 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400559
560 # this lib is required to link against AHardwareBuffer
561 if (defined(ndk_api) && ndk_api >= 26) {
562 libs += [ "android" ]
563 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400564 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500565 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400566 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700567 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500568 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500569 libs += [
570 "GL",
571 "GLU",
572 ]
mtklein06c35c02016-09-20 12:28:12 -0700573 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500574 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800575 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500576 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400577 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500578 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400579 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700580 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500581 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700582 }
mtkleine9fb3d52016-09-20 15:11:46 -0700583
584 if (skia_use_vulkan) {
585 public_defines += [ "SK_VULKAN" ]
586 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700587 if (skia_enable_vulkan_debug_layers) {
588 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
589 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500590 if (skia_vulkan_header != "") {
591 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
592 } else {
593 if (is_skia_dev_build) {
594 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
595 }
596 }
mtkleine9fb3d52016-09-20 15:11:46 -0700597 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400598 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400599 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400600 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
601 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400602
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400603 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400604 if (skia_use_metal) {
605 public_defines += [ "SK_METAL" ]
606 sources += skia_metal_sources
607 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400608 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400609 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500610
611 if (skia_enable_atlas_text) {
612 sources += skia_atlas_text_sources
613 }
mtklein06c35c02016-09-20 12:28:12 -0700614}
615
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400616optional("heif") {
617 enabled = skia_use_libheif
618 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
619
620 deps = []
621
622 sources = [
623 "src/codec/SkHeifCodec.cpp",
624 ]
625}
626
mtklein63213812016-08-24 09:55:56 -0700627optional("jpeg") {
628 enabled = skia_use_libjpeg_turbo
629 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
630
mtklein63213812016-08-24 09:55:56 -0700631 deps = [
632 "//third_party/libjpeg-turbo:libjpeg",
633 ]
634 sources = [
635 "src/codec/SkJpegCodec.cpp",
636 "src/codec/SkJpegDecoderMgr.cpp",
637 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700638 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400639 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700640 ]
641}
642
643optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500644 enabled = skia_use_zlib && skia_enable_pdf
645 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700646
mtklein63213812016-08-24 09:55:56 -0700647 deps = [
648 "//third_party/zlib",
649 ]
brettwb9447282016-09-01 14:24:39 -0700650 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700651 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700652
653 if (skia_use_sfntly) {
654 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500655 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700656 }
657}
658
659optional("png") {
660 enabled = skia_use_libpng
661 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
662
mtklein63213812016-08-24 09:55:56 -0700663 deps = [
664 "//third_party/libpng",
665 ]
666 sources = [
667 "src/codec/SkIcoCodec.cpp",
668 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400669 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700670 ]
671}
672
scroggof84ad642016-10-31 09:02:57 -0700673optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400674 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700675 public_defines = [ "SK_CODEC_DECODES_RAW" ]
676
677 deps = [
678 "//third_party/dng_sdk",
679 "//third_party/libjpeg-turbo:libjpeg",
680 "//third_party/piex",
681 ]
682
683 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
684 # Skia.
685 configs_to_remove = [ "//gn:no_exceptions" ]
686
687 sources = [
688 "src/codec/SkRawAdapterCodec.cpp",
689 "src/codec/SkRawCodec.cpp",
690 ]
691}
692
Mike Kleinfb333552018-01-25 12:49:37 -0500693optional("skcms") {
694 enabled = skia_use_skcms
695
696 deps = [
697 "//third_party/skcms",
698 ]
699 sources = [
700 # TODO
701 ]
702}
703
mtklein3cc22182016-08-29 13:26:14 -0700704optional("typeface_freetype") {
705 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700706
707 deps = [
708 "//third_party/freetype2",
709 ]
710 sources = [
711 "src/ports/SkFontHost_FreeType.cpp",
712 "src/ports/SkFontHost_FreeType_common.cpp",
713 ]
714}
715
mtklein457b42a2016-08-23 13:56:37 -0700716optional("webp") {
717 enabled = skia_use_libwebp
718 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
719
mtklein457b42a2016-08-23 13:56:37 -0700720 deps = [
721 "//third_party/libwebp",
722 ]
723 sources = [
724 "src/codec/SkWebpAdapterCodec.cpp",
725 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400726 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700727 ]
mtkleineb3c4252016-08-23 07:38:09 -0700728}
729
mtklein63213812016-08-24 09:55:56 -0700730optional("xml") {
731 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000732 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700733
mtklein63213812016-08-24 09:55:56 -0700734 deps = [
735 "//third_party/expat",
736 ]
737 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500738 "src/svg/SkSVGCanvas.cpp",
739 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700740 "src/xml/SkDOM.cpp",
741 "src/xml/SkXMLParser.cpp",
742 "src/xml/SkXMLWriter.cpp",
743 ]
744}
745
mtkleinc04ff472016-06-23 10:29:30 -0700746component("skia") {
747 public_configs = [ ":skia_public" ]
748 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700749
750 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700751 ":arm64",
752 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700753 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700754 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500755 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700756 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700757 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700758 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700759 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700760 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400761 ":heif",
mtklein63213812016-08-24 09:55:56 -0700762 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700763 ":none",
mtklein63213812016-08-24 09:55:56 -0700764 ":pdf",
765 ":png",
scroggof84ad642016-10-31 09:02:57 -0700766 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500767 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700768 ":sse2",
769 ":sse41",
770 ":sse42",
771 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700772 ":webp",
mtklein63213812016-08-24 09:55:56 -0700773 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700774 ]
775
Chinmay Garde43f115c2016-11-16 15:04:12 -0800776 # This file (and all GN files in Skia) are designed to work with an
777 # empty sources assignment filter; we handle all that explicitly.
778 # We clear the filter here for clients who may have set up a global filter.
779 set_sources_assignment_filter([])
780
mtkleinc04ff472016-06-23 10:29:30 -0700781 sources = []
brettwb9447282016-09-01 14:24:39 -0700782 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700783 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500784 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700785 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400786 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500787 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700788 "src/android/SkBitmapRegionCodec.cpp",
789 "src/android/SkBitmapRegionDecoder.cpp",
790 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400791 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700792 "src/codec/SkBmpCodec.cpp",
793 "src/codec/SkBmpMaskCodec.cpp",
794 "src/codec/SkBmpRLECodec.cpp",
795 "src/codec/SkBmpStandardCodec.cpp",
796 "src/codec/SkCodec.cpp",
797 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700798 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700799 "src/codec/SkMaskSwizzler.cpp",
800 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700801 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700802 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700803 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700804 "src/codec/SkSwizzler.cpp",
805 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700806 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700807 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700808 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700809 "src/ports/SkMemory_malloc.cpp",
810 "src/ports/SkOSFile_stdio.cpp",
811 "src/sfnt/SkOTTable_name.cpp",
812 "src/sfnt/SkOTUtils.cpp",
813 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700814 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700815 ]
brettwb9447282016-09-01 14:24:39 -0700816
mtklein7d6fb2c2016-08-25 14:50:44 -0700817 libs = []
818
mtkleinc04ff472016-06-23 10:29:30 -0700819 if (is_win) {
820 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400821 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700822 "src/ports/SkDebug_win.cpp",
823 "src/ports/SkFontHost_win.cpp",
824 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500825 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700826 "src/ports/SkImageEncoder_WIC.cpp",
827 "src/ports/SkImageGeneratorWIC.cpp",
828 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700829 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700830 "src/ports/SkScalerContext_win_dw.cpp",
831 "src/ports/SkTLS_win.cpp",
832 "src/ports/SkTypeface_win_dw.cpp",
833 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400834 libs += [
835 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500836 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400837 "Ole32.lib",
838 "OleAut32.lib",
839 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500840 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400841 ]
mtkleinc04ff472016-06-23 10:29:30 -0700842 } else {
843 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700844 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700845 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700846 "src/ports/SkTLS_pthread.cpp",
847 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400848 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700849 }
850
mtklein7d6fb2c2016-08-25 14:50:44 -0700851 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500852 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500853 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500854 deps += [ "//third_party/cpu-features" ]
855 }
mtklein06c35c02016-09-20 12:28:12 -0700856 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700857 libs += [
858 "EGL",
859 "GLESv2",
860 "log",
861 ]
862 }
863
mtkleinc04ff472016-06-23 10:29:30 -0700864 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700865 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700866 }
867
868 if (is_mac) {
869 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700870 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700871 "src/ports/SkFontHost_mac.cpp",
872 "src/ports/SkImageEncoder_CG.cpp",
873 "src/ports/SkImageGeneratorCG.cpp",
874 ]
mtklein09e61f72016-08-23 13:35:28 -0700875 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400876 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
877 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700878 "ApplicationServices.framework",
879 "OpenGL.framework",
880 ]
mtkleinc04ff472016-06-23 10:29:30 -0700881 }
abarth6fc8ff02016-07-15 15:15:15 -0700882
Mike Klein7d302882016-11-03 14:06:31 -0400883 if (is_ios) {
884 sources += [
885 "src/ports/SkDebug_stdio.cpp",
886 "src/ports/SkFontHost_mac.cpp",
887 "src/ports/SkImageEncoder_CG.cpp",
888 "src/ports/SkImageGeneratorCG.cpp",
889 ]
890 libs += [
891 "CoreFoundation.framework",
892 "CoreGraphics.framework",
893 "CoreText.framework",
894 "ImageIO.framework",
895 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400896
897 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
898 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400899 ]
900 }
901
abarth6fc8ff02016-07-15 15:15:15 -0700902 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700903 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700904 }
mtkleinc04ff472016-06-23 10:29:30 -0700905}
906
mtkleinc095df52016-08-24 12:23:52 -0700907# Targets guarded by skia_enable_tools may use //third_party freely.
908if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500909 # Used by gn_to_bp.py to list our public include dirs.
910 source_set("public") {
911 configs += [ ":skia_public" ]
912 }
913
Mike Kleinc36dedf2016-11-18 09:35:28 -0500914 config("skia.h_config") {
915 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500916 if (skia_use_vulkan) {
917 # So we can get the header which includes vulkan
918 include_dirs += [ "tools/gpu/vk" ]
919 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500920 }
921 action("skia.h") {
922 public_configs = [ ":skia.h_config" ]
923 skia_h = "$target_gen_dir/skia.h"
924 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400925 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000926 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500927 depfile = "$skia_h.deps"
928 outputs = [
929 skia_h,
930 ]
931 }
932
Hal Canary316b7462017-12-13 12:39:19 -0500933 if (skia_embed_resources) {
934 action("binary_resources.cpp") {
935 script = "gn/generate_binary_asset.py"
936 args = [
937 rebase_path("resources"),
938 "gResources",
939 rebase_path("$target_gen_dir/binary_resources.cpp", root_build_dir),
940 ]
941 outputs = [
942 "$target_gen_dir/binary_resources.cpp",
943 ]
944 }
945 }
946
Mike Kleinc36dedf2016-11-18 09:35:28 -0500947 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 executable("fiddle") {
949 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500950 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500951 "tools/fiddle/draw.cpp",
952 "tools/fiddle/fiddle_main.cpp",
953 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400954
955 if (skia_use_egl) {
956 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400957 } else {
958 sources += [ "tools/fiddle/null_context.cpp" ]
959 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400960 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400962 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500963 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500964 ":skia",
965 ":skia.h",
966 ]
967 }
968 }
969
970 if (skia_enable_gpu) {
971 source_set("public_headers_warnings_check") {
972 sources = [
973 "tools/public_headers_warnings_check.cpp",
974 ]
975 configs -= [ "//gn:warnings_except_public_headers" ]
976 deps = [
977 ":skia",
978 ":skia.h",
979 ]
980 }
981 }
982
mtkleinc095df52016-08-24 12:23:52 -0700983 template("test_lib") {
984 config(target_name + "_config") {
985 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700986 if (defined(invoker.public_defines)) {
987 defines = invoker.public_defines
988 }
mtklein25c81d42016-07-27 13:55:26 -0700989 }
mtkleinc095df52016-08-24 12:23:52 -0700990 source_set(target_name) {
991 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
992 public_configs = [
993 ":" + target_name + "_config",
994 ":skia_private",
995 ]
996
997 if (!defined(deps)) {
998 deps = []
999 }
1000 deps += [ ":skia" ]
1001 testonly = true
1002 }
mtklein25c81d42016-07-27 13:55:26 -07001003 }
mtklein25c81d42016-07-27 13:55:26 -07001004
Mike Kleine6682eb2017-01-05 10:54:57 -05001005 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001006 if (is_ios) {
1007 app_name = target_name
1008 gen_path = target_gen_dir
1009
1010 action("${app_name}_generate_info_plist") {
1011 script = "//gn/gen_plist_ios.py"
1012 outputs = [
1013 "$gen_path/${app_name}_Info.plist",
1014 ]
1015 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1016 }
1017
1018 bundle_data("${app_name}_bundle_info_plist") {
1019 public_deps = [
1020 ":${app_name}_generate_info_plist",
1021 ]
1022 sources = [
1023 "$gen_path/${app_name}_Info.plist",
1024 ]
1025 outputs = [
1026 "{{bundle_root_dir}}/Info.plist",
1027 ]
1028 }
1029
Jim Van Verth329c5a62017-11-29 11:42:33 -05001030 bundle_ios_data =
1031 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1032
1033 if (bundle_ios_data) {
1034 has_skps =
1035 "True" == exec_script("//gn/checkdir.py",
1036 [ rebase_path("skps", root_build_dir) ],
1037 "trim string")
1038 bundle_data("${app_name}_bundle_resources") {
1039 sources = [
1040 "resources",
1041 ]
1042 outputs = [
1043 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1044 "{{bundle_resources_dir}}/data/resources",
1045 ]
1046 }
1047
1048 if (has_skps) {
1049 bundle_data("${app_name}_bundle_skps") {
1050 sources = [
1051 "skps",
1052 ]
1053 outputs = [
1054 # Store in same folder as resources
1055 "{{bundle_resources_dir}}/data/skps",
1056 ]
1057 }
1058 }
1059 }
1060
Jim Van Verth443a9132017-11-28 09:45:26 -05001061 executable("${app_name}_generate_executable") {
1062 forward_variables_from(invoker,
1063 "*",
1064 [
1065 "output_name",
1066 "visibility",
1067 "is_shared_library",
1068 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001069 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001070 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001071 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1072 }
1073
1074 bundle_data("${app_name}_bundle_executable") {
1075 public_deps = [
1076 ":${app_name}_generate_executable",
1077 ]
1078 sources = [
1079 "$gen_path/$app_name",
1080 ]
1081 outputs = [
1082 "{{bundle_executable_dir}}/$app_name",
1083 ]
1084 testonly = true
1085 }
1086
1087 create_bundle("$app_name") {
1088 product_type = "com.apple.product-type.application"
1089 testonly = true
1090
1091 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1092 bundle_resources_dir = bundle_root_dir
1093 bundle_executable_dir = bundle_root_dir
1094 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1095
1096 deps = [
1097 ":${app_name}_bundle_executable",
1098 ":${app_name}_bundle_info_plist",
1099 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001100 if (bundle_ios_data) {
1101 deps += [ ":${app_name}_bundle_resources" ]
1102 if (has_skps) {
1103 deps += [ ":${app_name}_bundle_skps" ]
1104 }
1105 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001106
1107 # should only code sign when running on a device, not the simulator
1108 if (target_cpu != "x64") {
1109 code_signing_script = "//gn/codesign_ios.py"
1110 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1111 code_signing_outputs = [
1112 "$bundle_root_dir/_CodeSignature/CodeResources",
1113 "$bundle_root_dir/embedded.mobileprovision",
1114 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001115 code_signing_args = [
1116 rebase_path("$bundle_root_dir", root_build_dir),
1117 skia_ios_identity,
1118 skia_ios_profile,
1119 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001120 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001121 }
1122 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001123 # !is_ios
1124
1125 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1126 shared_library("lib" + target_name) {
1127 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1128 configs += [ ":skia_private" ]
1129 testonly = true
1130 }
1131 } else {
1132 _executable = target_name
1133 executable(_executable) {
1134 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1135 configs += [ ":skia_private" ]
1136 testonly = true
1137 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001138 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001139 if (is_android && skia_android_serial != "" && defined(_executable)) {
1140 action("push_" + target_name) {
1141 script = "gn/push_to_android.py"
1142 deps = [
1143 ":" + _executable,
1144 ]
1145 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1146 outputs = [
1147 _stamp,
1148 ]
1149 args = [
1150 rebase_path("$root_build_dir/$_executable"),
1151 skia_android_serial,
1152 rebase_path(_stamp),
1153 ]
1154 testonly = true
1155 }
Mike Klein7d921032017-01-05 12:20:41 -05001156 }
1157 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001158 }
1159
mtkleinc095df52016-08-24 12:23:52 -07001160 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001161 public_include_dirs = []
1162 if (skia_enable_gpu) {
1163 public_defines = []
1164 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001165
1166 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001167 sources = [
1168 "tools/gpu/GrContextFactory.cpp",
1169 "tools/gpu/GrTest.cpp",
1170 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001171 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001172 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001173 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001174 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1175 "tools/gpu/gl/debug/GrBufferObj.cpp",
1176 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1177 "tools/gpu/gl/debug/GrProgramObj.cpp",
1178 "tools/gpu/gl/debug/GrShaderObj.cpp",
1179 "tools/gpu/gl/debug/GrTextureObj.cpp",
1180 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1181 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001182 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001183 ]
1184 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001185
Kevin Lubick4a24e102017-03-29 11:19:01 -04001186 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001187 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001188 } else if (is_ios) {
1189 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1190 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001191 } else if (is_linux) {
1192 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001193 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001194 } else if (is_mac) {
1195 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001196 } else if (is_win) {
1197 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1198 libs += [
1199 "Gdi32.lib",
1200 "OpenGL32.lib",
1201 ]
mtklein38925aa2016-09-21 10:11:25 -07001202 }
mtklein6ef69992016-09-14 06:12:09 -07001203
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001204 cflags_objcc = [ "-fobjc-arc" ]
1205
Mike Kleinc168a3a2016-11-14 14:53:13 +00001206 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001207 deps += [ "//third_party/angle2" ]
1208 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1209 }
mtkleind68f9b02016-09-23 13:18:41 -07001210 if (skia_use_vulkan) {
1211 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001212 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001213 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001214 if (skia_use_metal) {
1215 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1216 }
mtkleina627b5c2016-09-20 13:36:47 -07001217 }
mtklein25c81d42016-07-27 13:55:26 -07001218 }
mtklein25c81d42016-07-27 13:55:26 -07001219
mtkleinc095df52016-08-24 12:23:52 -07001220 test_lib("flags") {
1221 public_include_dirs = [ "tools/flags" ]
1222 sources = [
1223 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001224 ]
1225 }
1226 test_lib("common_flags") {
1227 public_include_dirs = [ "tools/flags" ]
1228 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001229 "tools/flags/SkCommonFlags.cpp",
1230 "tools/flags/SkCommonFlagsConfig.cpp",
1231 ]
1232 deps = [
mtklein046cb562016-09-16 10:23:12 -07001233 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001234 ":gpu_tool_utils",
1235 ]
1236 }
mtklein25c81d42016-07-27 13:55:26 -07001237
mtkleinc095df52016-08-24 12:23:52 -07001238 test_lib("tool_utils") {
1239 public_include_dirs = [
1240 "tools",
1241 "tools/debugger",
1242 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001243 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001244 ]
1245 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001246 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001247 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001248 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001249 "tools/ProcStats.cpp",
1250 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001251 "tools/SkRandomScalerContext.cpp",
1252 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001253 "tools/UrlDataManager.cpp",
1254 "tools/debugger/SkDebugCanvas.cpp",
1255 "tools/debugger/SkDrawCommand.cpp",
1256 "tools/debugger/SkJsonWriteBuffer.cpp",
1257 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001258 "tools/picture_utils.cpp",
1259 "tools/random_parse_path.cpp",
1260 "tools/sk_tool_utils.cpp",
1261 "tools/sk_tool_utils_font.cpp",
1262 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001263 "tools/trace/SkChromeTracingTracer.cpp",
1264 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001265 "tools/trace/SkDebugfTracer.cpp",
1266 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001267 "tools/trace/SkEventTracingPriv.cpp",
1268 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001269 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001270 libs = []
1271 if (is_ios) {
1272 sources += [ "tools/ios_utils.m" ]
1273 libs += [ "Foundation.framework" ]
1274 }
mtkleinc095df52016-08-24 12:23:52 -07001275 deps = [
mtklein046cb562016-09-16 10:23:12 -07001276 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001277 ":flags",
1278 "//third_party/libpng",
1279 ]
1280 public_deps = [
1281 "//third_party/jsoncpp",
1282 ]
Hal Canarya4935102017-12-08 13:35:47 -05001283 if (skia_embed_resources) {
1284 defines = [ "SK_EMBED_RESOURCES" ]
1285 sources += [ "$target_gen_dir/binary_resources.cpp" ]
1286 deps += [ ":binary_resources.cpp" ]
1287 }
mtkleinc095df52016-08-24 12:23:52 -07001288 }
mtklein25c81d42016-07-27 13:55:26 -07001289
Mike Klein6e744122016-10-27 12:21:40 -04001290 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001291 test_lib("gm") {
1292 public_include_dirs = [ "gm" ]
1293 sources = gm_sources
1294 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001295 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001296 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001297 ":gpu_tool_utils",
1298 ":skia",
1299 ":tool_utils",
1300 ]
1301 }
mtklein25c81d42016-07-27 13:55:26 -07001302
Mike Klein6e744122016-10-27 12:21:40 -04001303 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001304 test_lib("tests") {
1305 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001306 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001307 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001308 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001309 }
mtkleinc095df52016-08-24 12:23:52 -07001310 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001311 ":experimental_sksg",
fmalita6cf896d2016-08-25 08:44:35 -07001312 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001313 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001314 ":skia",
1315 ":tool_utils",
1316 "//third_party/libpng",
1317 "//third_party/zlib",
1318 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001319 public_deps = [
1320 ":gpu_tool_utils", # Test.h #includes headers from this target.
1321 ]
mtkleinc095df52016-08-24 12:23:52 -07001322 }
mtklein2f3416d2016-08-02 16:02:05 -07001323
Mike Klein6e744122016-10-27 12:21:40 -04001324 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001325 test_lib("bench") {
1326 public_include_dirs = [ "bench" ]
1327 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001328 deps = [
1329 ":flags",
1330 ":gm",
1331 ":gpu_tool_utils",
1332 ":skia",
1333 ":tool_utils",
1334 ]
1335 }
mtklein2b6870c2016-07-28 14:17:33 -07001336
Florin Malita54f65c42018-01-16 17:04:30 -05001337 test_lib("experimental_skottie") {
1338 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001339 include_dirs = [ "tools" ]
1340 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001341 "experimental/skottie/Skottie.cpp",
1342 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001343 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001344 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001345 ]
1346 deps = [
1347 ":experimental_sksg",
1348 ":skia",
1349 "//third_party/jsoncpp",
1350 ]
1351 }
1352
mtkleinc095df52016-08-24 12:23:52 -07001353 test_lib("experimental_svg_model") {
1354 public_include_dirs = [ "experimental/svg/model" ]
1355 sources = [
1356 "experimental/svg/model/SkSVGAttribute.cpp",
1357 "experimental/svg/model/SkSVGAttributeParser.cpp",
1358 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001359 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001360 "experimental/svg/model/SkSVGContainer.cpp",
1361 "experimental/svg/model/SkSVGDOM.cpp",
1362 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001363 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001364 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001365 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001366 "experimental/svg/model/SkSVGNode.cpp",
1367 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001368 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001369 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001370 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001371 "experimental/svg/model/SkSVGRect.cpp",
1372 "experimental/svg/model/SkSVGRenderContext.cpp",
1373 "experimental/svg/model/SkSVGSVG.cpp",
1374 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001375 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001376 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001377 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001378 "experimental/svg/model/SkSVGValue.cpp",
1379 ]
1380 deps = [
1381 ":skia",
1382 ]
1383 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001384
Florin Malita4aa44412017-12-19 12:21:02 -05001385 test_lib("experimental_sksg") {
1386 public_include_dirs = [
1387 "experimental/sksg",
1388 "experimental/sksg/effects",
1389 "experimental/sksg/geometry",
1390 "experimental/sksg/paint",
1391 ]
1392 sources = [
1393 "experimental/sksg/SkSGDraw.cpp",
1394 "experimental/sksg/SkSGEffectNode.cpp",
1395 "experimental/sksg/SkSGGeometryNode.cpp",
1396 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001397 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001398 "experimental/sksg/SkSGInvalidationController.cpp",
1399 "experimental/sksg/SkSGNode.cpp",
1400 "experimental/sksg/SkSGPaintNode.cpp",
1401 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001402 "experimental/sksg/SkSGScene.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001403 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001404 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001405 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001406 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001407 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001408 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001409 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001410 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001411 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001412 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001413 ]
1414 deps = [
1415 ":skia",
1416 ]
1417 }
1418
Kevin Lubickebf648e2017-09-21 13:45:16 -04001419 if (target_cpu != "wasm") {
1420 test_lib("views") {
1421 public_include_dirs = [ "include/views" ]
1422 sources = [
1423 "src/views/SkEvent.cpp",
1424 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001425 "src/views/SkTouchGesture.cpp",
1426 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001427 ]
Brian Osman34755e22016-12-05 09:46:02 -05001428 }
Brian Osman16adfa32016-10-18 14:42:44 -04001429 }
1430
Mike Klein38af9432016-11-11 11:39:44 -05001431 if (skia_use_lua) {
1432 test_lib("lua") {
1433 public_include_dirs = []
1434 sources = [
1435 "src/utils/SkLua.cpp",
1436 "src/utils/SkLuaCanvas.cpp",
1437 ]
1438 deps = [
1439 "//third_party/lua",
1440 ]
1441 }
1442
Mike Kleine6682eb2017-01-05 10:54:57 -05001443 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001444 sources = [
1445 "tools/lua/lua_app.cpp",
1446 ]
1447 deps = [
1448 ":lua",
1449 ":skia",
1450 "//third_party/lua",
1451 ]
Mike Klein38af9432016-11-11 11:39:44 -05001452 }
1453
Mike Kleine6682eb2017-01-05 10:54:57 -05001454 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001455 sources = [
1456 "tools/lua/lua_pictures.cpp",
1457 ]
1458 deps = [
1459 ":flags",
1460 ":lua",
1461 ":skia",
1462 ":tool_utils",
1463 "//third_party/lua",
1464 ]
Mike Klein38af9432016-11-11 11:39:44 -05001465 }
1466 }
1467
Cary Clark8032b982017-07-28 11:04:54 -04001468 test_app("bookmaker") {
1469 sources = [
1470 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001471 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001472 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001473 "tools/bookmaker/fiddleParser.cpp",
1474 "tools/bookmaker/includeParser.cpp",
1475 "tools/bookmaker/includeWriter.cpp",
1476 "tools/bookmaker/mdOut.cpp",
1477 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001478 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001479 "tools/bookmaker/spellCheck.cpp",
1480 ]
1481 deps = [
1482 ":flags",
1483 ":skia",
1484 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001485 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001486 ]
1487 }
1488
Kevin Lubickebf648e2017-09-21 13:45:16 -04001489 if (target_cpu != "wasm") {
1490 import("gn/samples.gni")
1491 test_lib("samples") {
1492 public_include_dirs = [ "samplecode" ]
1493 include_dirs = [ "experimental" ]
1494 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001495 # Relocating these files here, so that clients don't try to build them while they're
1496 # still in active development. Clang's thread safety analysis gets tripped up by
1497 # conditional locks.
1498 "src/core/SkThreadedBMPDevice.cpp",
1499 "src/core/SkThreadedBMPDevice.h",
1500 ]
1501 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001502 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001503 ":experimental_svg_model",
1504 ":flags",
1505 ":gm",
1506 ":tool_utils",
1507 ":views",
1508 ":xml",
1509 ]
Mike Klein38af9432016-11-11 11:39:44 -05001510
Kevin Lubickebf648e2017-09-21 13:45:16 -04001511 if (skia_use_lua) {
1512 sources += [ "samplecode/SampleLua.cpp" ]
1513 deps += [
1514 ":lua",
1515 "//third_party/lua",
1516 ]
1517 }
1518 }
1519 test_app("dm") {
1520 sources = [
1521 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001522 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001523 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001524 "dm/DMJsonWriter.cpp",
1525 "dm/DMSrcSink.cpp",
1526 ]
1527 include_dirs = [ "tests" ]
1528 deps = [
1529 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001530 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001531 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001532 ":experimental_svg_model",
1533 ":flags",
1534 ":gm",
1535 ":gpu_tool_utils",
1536 ":skia",
1537 ":tests",
1538 ":tool_utils",
1539 "//third_party/jsoncpp",
1540 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001541 ]
1542 }
Brian Osman16adfa32016-10-18 14:42:44 -04001543 }
1544
Mike Kleina8a51ce2018-01-09 12:34:11 -05001545 if (!is_win) {
1546 test_app("remote_demo") {
1547 sources = [
1548 "tools/remote_demo.cpp",
1549 ]
1550 deps = [
1551 ":skia",
1552 ]
1553 }
1554 }
1555
Mike Klein06432b22017-03-21 13:14:33 -04001556 test_app("ok") {
1557 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001558 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001559 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001560 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001561 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001562 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001563 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001564 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001565 ]
1566 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001567 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001568 ":gm",
1569 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001570 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001571 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001572 ]
1573 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001574 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001575 sources = [
1576 "bench/nanobench.cpp",
1577 ]
1578 deps = [
1579 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001580 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001581 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001582 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001583 ":flags",
1584 ":gm",
1585 ":gpu_tool_utils",
1586 ":skia",
1587 ":tool_utils",
1588 "//third_party/jsoncpp",
1589 ]
mtklein2b6870c2016-07-28 14:17:33 -07001590 }
halcanary19a97202016-08-03 15:08:04 -07001591
Ravi Mistry10d36c52017-01-31 09:49:18 -05001592 test_app("skpinfo") {
1593 sources = [
1594 "tools/skpinfo.cpp",
1595 ]
1596 deps = [
1597 ":flags",
1598 ":skia",
1599 ]
1600 }
1601
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001602 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001603 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001604 sources = [
1605 "tools/skpbench/skpbench.cpp",
1606 ]
1607 deps = [
1608 ":flags",
1609 ":gpu_tool_utils",
1610 ":skia",
1611 ":tool_utils",
1612 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001613 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001614 }
1615
Mike Klein7d302882016-11-03 14:06:31 -04001616 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001617 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001619 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001620 "tools/shape/SkShaper_harfbuzz.cpp",
1621 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001622 ]
1623 deps = [
1624 ":skia",
1625 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001626 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001627 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001628 }
halcanary19a97202016-08-03 15:08:04 -07001629 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001630 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001631 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001632 "tools/shape/SkShaper_primitive.cpp",
1633 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001634 ]
1635 deps = [
1636 ":skia",
1637 ]
halcanary3eee9d92016-09-10 07:01:53 -07001638 }
mtklein046cb562016-09-16 10:23:12 -07001639
Matt Sarett9f1c4032017-05-17 10:06:32 -04001640 test_app("create_flutter_test_images") {
1641 sources = [
1642 "tools/create_flutter_test_images.cpp",
1643 ]
1644 deps = [
1645 ":skia",
1646 ":tool_utils",
1647 ]
1648 }
1649
Ben Wagner219f3622017-07-17 15:32:25 -04001650 test_app("create_test_font") {
1651 sources = [
1652 "tools/create_test_font.cpp",
1653 ]
1654 deps = [
1655 ":skia",
1656 ]
1657 assert_no_deps = [
1658 # tool_utils requires the output of this app.
1659 ":tool_utils",
1660 ]
1661 }
1662
Mike Kleine6682eb2017-01-05 10:54:57 -05001663 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001664 sources = [
1665 "tools/get_images_from_skps.cpp",
1666 ]
1667 deps = [
1668 ":flags",
1669 ":skia",
1670 "//third_party/jsoncpp",
1671 ]
mtklein046cb562016-09-16 10:23:12 -07001672 }
mtkleinecbc5262016-09-22 11:51:24 -07001673
Mike Kleine6682eb2017-01-05 10:54:57 -05001674 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001675 sources = [
1676 "tools/colorspaceinfo.cpp",
1677 ]
1678 deps = [
1679 ":flags",
1680 ":skia",
1681 ":tool_utils",
1682 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001683 }
1684
Kevin Lubickebf648e2017-09-21 13:45:16 -04001685 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001686 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001687 sources = [
1688 "tools/skiaserve/Request.cpp",
1689 "tools/skiaserve/Response.cpp",
1690 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001691 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1692 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1693 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1694 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1695 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1696 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1697 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1698 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1699 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001700 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1701 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001702 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1703 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1704 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1705 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1706 ]
1707 deps = [
1708 ":flags",
1709 ":gpu_tool_utils",
1710 ":skia",
1711 ":tool_utils",
1712 "//third_party/jsoncpp",
1713 "//third_party/libmicrohttpd",
1714 "//third_party/libpng",
1715 ]
Mike Klein7d302882016-11-03 14:06:31 -04001716 }
mtkleinecbc5262016-09-22 11:51:24 -07001717 }
kjlubick14f984b2016-10-03 11:49:45 -07001718
Mike Kleine6682eb2017-01-05 10:54:57 -05001719 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001720 include_dirs = [
1721 "tools",
1722 "tools/debugger",
1723 ]
kjlubick14f984b2016-10-03 11:49:45 -07001724 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001725 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001726 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001727 "fuzz/FuzzGradients.cpp",
1728 "fuzz/FuzzParsePath.cpp",
1729 "fuzz/FuzzPathop.cpp",
1730 "fuzz/FuzzScaleToSides.cpp",
1731 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001732 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1733 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001734 "tools/UrlDataManager.cpp",
1735 "tools/debugger/SkDebugCanvas.cpp",
1736 "tools/debugger/SkDrawCommand.cpp",
1737 "tools/debugger/SkJsonWriteBuffer.cpp",
1738 "tools/debugger/SkObjectParser.cpp",
1739 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001740 ]
1741 deps = [
1742 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001743 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001744 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001745 "//third_party/jsoncpp",
1746 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001747 ]
kjlubick14f984b2016-10-03 11:49:45 -07001748 }
Mike Klein38312422016-10-05 15:41:01 -04001749
Mike Kleine6682eb2017-01-05 10:54:57 -05001750 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001751 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001752 rebase_path("tests/skia_test.cpp"),
1753 rebase_path("tests/Test.cpp"),
1754 ]
caryclark9feb6322016-10-25 08:58:26 -07001755 deps = [
1756 ":flags",
1757 ":gpu_tool_utils",
1758 ":skia",
1759 ":tool_utils",
1760 ]
caryclark9feb6322016-10-25 08:58:26 -07001761 }
1762
Mike Kleine6682eb2017-01-05 10:54:57 -05001763 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001764 sources = [
1765 "tools/DumpRecord.cpp",
1766 "tools/dump_record.cpp",
1767 ]
1768 deps = [
1769 ":flags",
1770 ":skia",
1771 ]
Mike Klein38312422016-10-05 15:41:01 -04001772 }
bungemanfe917272016-10-13 17:36:40 -04001773
Mike Kleine6682eb2017-01-05 10:54:57 -05001774 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001775 sources = [
1776 "tools/skdiff/skdiff.cpp",
1777 "tools/skdiff/skdiff_html.cpp",
1778 "tools/skdiff/skdiff_main.cpp",
1779 "tools/skdiff/skdiff_utils.cpp",
1780 ]
1781 deps = [
1782 ":skia",
1783 ":tool_utils",
1784 ]
bungemanfe917272016-10-13 17:36:40 -04001785 }
halcanarya73d76a2016-10-17 13:19:02 -07001786
Mike Kleine6682eb2017-01-05 10:54:57 -05001787 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001788 sources = [
1789 "tools/skp_parser.cpp",
1790 ]
1791 deps = [
1792 ":skia",
1793 ":tool_utils",
1794 "//third_party/jsoncpp",
1795 ]
halcanarya73d76a2016-10-17 13:19:02 -07001796 }
Brian Osman16adfa32016-10-18 14:42:44 -04001797
Hal Canaryd7b38452017-12-11 17:46:26 -05001798 if (!is_win && skia_enable_gpu) {
1799 test_lib("skqp_lib") {
1800 public_include_dirs = [ "tools/skqp" ]
Hal Canary75427132017-10-11 16:00:31 -04001801 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001802 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001803 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001804 "tools/skqp/gm_knowledge.cpp",
1805 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001806 ]
1807 deps = [
1808 ":gm",
1809 ":gpu_tool_utils",
1810 ":skia",
1811 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001812 ":tool_utils",
1813 ]
1814 }
1815 test_app("skqp") {
1816 sources = [
1817 "tools/skqp/skqp.cpp",
1818 ]
1819 deps = [
1820 ":skia",
1821 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04001822 "//third_party/googletest",
1823 ]
1824 }
1825 }
Hal Canary28f89382017-12-12 09:42:14 -05001826 if (is_android && skia_enable_gpu) {
1827 test_app("skqp_app") {
1828 is_shared_library = true
1829 sources = [
1830 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1831 ]
1832 deps = [
1833 ":skia",
1834 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001835 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001836 ]
1837 libs = [ "android" ]
1838 }
1839 }
Hal Canary75427132017-10-11 16:00:31 -04001840
Hal Canarya9de7602018-01-19 13:08:23 -05001841 test_app("list_gms") {
1842 sources = [
1843 "tools/list_gms.cpp",
1844 ]
1845 deps = [
1846 ":gm",
1847 ":skia",
1848 ]
1849 }
1850 test_app("list_gpu_unit_tests") {
1851 sources = [
1852 "dm/DMGpuTestProcs.cpp",
1853 "tools/list_gpu_unit_tests.cpp",
1854 ]
1855 deps = [
1856 ":skia",
1857 ":tests",
1858 ]
1859 }
1860
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001861 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001862 test_lib("sk_app") {
1863 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001864 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001865 "tools/sk_app/CommandSet.cpp",
1866 "tools/sk_app/GLWindowContext.cpp",
1867 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001868 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001869 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001870
Jim Van Verth4e56a912016-10-21 10:58:52 -04001871 if (is_android) {
1872 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001873 "tools/sk_app/android/GLWindowContext_android.cpp",
1874 "tools/sk_app/android/RasterWindowContext_android.cpp",
1875 "tools/sk_app/android/Window_android.cpp",
1876 "tools/sk_app/android/main_android.cpp",
1877 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001878 ]
Brian Osman462334e2017-02-09 11:22:57 -05001879 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001880 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001881 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001882 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1883 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1884 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001885 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001886 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001887 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001888 libs += [
1889 "GL",
1890 "X11",
1891 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001892 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001893 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001894 "tools/sk_app/win/GLWindowContext_win.cpp",
1895 "tools/sk_app/win/RasterWindowContext_win.cpp",
1896 "tools/sk_app/win/Window_win.cpp",
1897 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001898 ]
Brian Salomon194db172017-08-17 14:37:06 -04001899 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001900 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001901 }
Mike Klein43c25262016-10-20 10:17:47 -04001902 } else if (is_mac) {
1903 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001904 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1905 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1906 "tools/sk_app/mac/Window_mac.cpp",
1907 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001908 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001909 libs += [
1910 "QuartzCore.framework",
1911 "Cocoa.framework",
1912 "Foundation.framework",
1913 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001914 } else if (is_ios) {
1915 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001916 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1917 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1918 "tools/sk_app/ios/Window_ios.cpp",
1919 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001920 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001921 }
1922
1923 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001924 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001925 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001926 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001927 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001928 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001929 libs += [ "X11-xcb" ]
1930 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001931 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001932 }
1933 }
1934
Brian Osman16adfa32016-10-18 14:42:44 -04001935 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001936 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001937 ":skia",
1938 ":tool_utils",
1939 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001940 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001941 if (is_android) {
1942 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001943 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001944 deps += [ "//third_party/libsdl" ]
1945 }
Brian Salomon194db172017-08-17 14:37:06 -04001946 if (skia_use_angle) {
1947 deps += [ "//third_party/angle2" ]
1948 }
Mike Kleina92c3832016-12-08 09:49:39 -05001949 }
Brian Osman16adfa32016-10-18 14:42:44 -04001950 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001951
Brian Osmaneff04b52017-11-21 13:18:02 -05001952 if (skia_enable_gpu) {
1953 test_app("viewer") {
1954 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001955 if (is_ios) {
1956 bundle_ios_data = true
1957 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001958 sources = [
1959 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001960 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001961 "tools/viewer/ImageSlide.cpp",
1962 "tools/viewer/SKPSlide.cpp",
1963 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001964 "tools/viewer/SkottieSlide.cpp",
1965 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001966 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001967 "tools/viewer/Viewer.cpp",
1968 ]
1969 libs = []
1970
1971 include_dirs = []
1972 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001973 ":experimental_skottie",
Brian Osmaneff04b52017-11-21 13:18:02 -05001974 ":flags",
1975 ":gm",
1976 ":gpu_tool_utils",
1977 ":samples",
1978 ":sk_app",
1979 ":skia",
1980 ":tool_utils",
1981 ":views",
1982 "//third_party/imgui",
1983 "//third_party/jsoncpp",
1984 ]
1985 }
1986 }
1987
1988 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1989 test_app("HelloWorld") {
1990 sources = [
1991 "example/HelloWorld.cpp",
1992 ]
1993 libs = []
1994
1995 include_dirs = []
1996 deps = [
1997 ":flags",
1998 ":gpu_tool_utils",
1999 ":sk_app",
2000 ":skia",
2001 ":tool_utils",
2002 ":views",
2003 ]
2004 }
2005 }
2006
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002007 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002008 test_app("SkiaSDLExample") {
2009 sources = [
2010 "example/SkiaSDLExample.cpp",
2011 ]
2012 libs = []
2013 include_dirs = []
2014 deps = [
2015 ":gpu_tool_utils",
2016 ":skia",
2017 "//third_party/libsdl",
2018 ]
2019 }
2020 }
2021
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002022 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2023 action_foreach("generate_mocs") {
2024 script = "gn/call.py"
2025 sources = [
2026 "tools/mdbviz/MainWindow.h",
2027 ]
2028 outputs = [
2029 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2030 ]
2031 args = [
2032 "$skia_qt_path" + "/bin/moc",
2033 "{{source}}",
2034 "-o",
2035 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2036 ]
2037 }
2038 action_foreach("generate_resources") {
2039 script = "gn/call.py"
2040 sources = [
2041 "tools/mdbviz/resources.qrc",
2042 ]
2043 outputs = [
2044 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2045 ]
2046 args = [
2047 "$skia_qt_path" + "/bin/rcc",
2048 "{{source}}",
2049 "-o",
2050 "gen/mdbviz/{{source_name_part}}_res.cpp",
2051 ]
2052 }
2053 test_app("mdbviz") {
2054 if (is_win) {
2055 # on Windows we need to disable some exception handling warnings due to the Qt headers
2056 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2057 }
2058 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002059 "tools/UrlDataManager.cpp",
2060 "tools/debugger/SkDebugCanvas.cpp",
2061 "tools/debugger/SkDrawCommand.cpp",
2062 "tools/debugger/SkJsonWriteBuffer.cpp",
2063 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002064 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002065 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002066 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002067 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002068
2069 # generated files
2070 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2071 "$target_gen_dir/mdbviz/resources_res.cpp",
2072 ]
2073 lib_dirs = [ "$skia_qt_path/lib" ]
2074 libs = [
2075 "Qt5Core.lib",
2076 "Qt5Gui.lib",
2077 "Qt5Widgets.lib",
2078 ]
2079 include_dirs = [
2080 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002081 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002082 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002083 "tools",
2084 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002085 ]
2086 deps = [
2087 ":generate_mocs",
2088 ":generate_resources",
2089 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002090 "//third_party/jsoncpp",
2091 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002092 ]
2093 }
2094 }
2095
Mike Kleine459afd2017-03-03 09:21:30 -05002096 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002097 copy("gdbserver") {
2098 sources = [
2099 "$ndk/$ndk_gdbserver",
2100 ]
2101 outputs = [
2102 "$root_out_dir/gdbserver",
2103 ]
2104 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002105 }
mtklein25c81d42016-07-27 13:55:26 -07002106}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002107
2108if (skia_jumper_clang != "") {
2109 action("regen_jumper") {
2110 script = "src/jumper/build_stages.py"
2111
2112 inputs = [
2113 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002114 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002115 ]
2116
2117 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2118 outputs = [
2119 "$target_out_dir/" +
2120 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2121 "$target_out_dir/" +
2122 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2123 ]
2124
2125 args = [
2126 skia_jumper_clang,
2127 skia_jumper_objdump,
2128 skia_jumper_ccache,
2129 ] + rebase_path(inputs) + rebase_path(outputs)
2130 }
2131}