blob: 4af4014c9c163afe909897a1a970fe5ed6b6bd41 [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
Hal Canarya4935102017-12-08 13:35:47 -050033 skia_embed_resources = false
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
mtklein06c35c02016-09-20 12:28:12 -070039 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050040 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040041 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050042 skia_enable_tools = is_skia_dev_build
43 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050044 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040045 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040046 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040047 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070048 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040049
50 skia_jumper_clang = ""
51 skia_jumper_objdump = ""
52 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070053}
Brian Salomon23d73ea2016-10-27 13:31:37 -040054declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040055 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040056 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050057 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040058
Mike Klein4d598a32016-10-31 13:44:49 -040059 if (is_android) {
60 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070061 } else if (is_fuchsia) {
62 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040063 } else {
64 skia_use_vulkan = skia_vulkan_sdk != ""
65 }
Jim Van Verth4e502972017-12-07 15:16:10 -050066
67 if (is_ios) {
68 skia_ios_identity = ".*Google.*"
69 skia_ios_profile = "Google Development"
70 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040071}
Greg Danielec6ae522017-04-25 13:38:26 -040072declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050073 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040074 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000075 # 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 -040076 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050077 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040078 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050079 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040080 }
Greg Danielec6ae522017-04-25 13:38:26 -040081 }
82}
Brian Salomon789e25e2016-09-30 13:41:03 -040083
Adam Barth54ef74a2017-10-13 10:59:38 -070084if (defined(skia_settings)) {
85 import(skia_settings)
86}
87
mtklein38925aa2016-09-21 10:11:25 -070088# Our tools require static linking (they use non-exported symbols).
89skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070090
mtkleina45be612016-08-29 15:22:10 -070091fontmgr_android_enabled = skia_use_expat && skia_use_freetype
92
mtklein1211e0c2016-07-26 13:55:45 -070093skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070094 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070095 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070096 "include/codec",
97 "include/config",
98 "include/core",
99 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400100 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/gpu",
102 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500103 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700104 "include/pathops",
105 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700106 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700107 "include/utils",
108 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700109]
110
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000111if (skia_use_vulkan) {
112 skia_public_includes += [ "include/gpu/vk" ]
113}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500114if (skia_enable_atlas_text) {
115 skia_public_includes += [ "include/atlastext" ]
116}
Greg Daniele5ddff52017-07-05 16:49:36 -0400117if (skia_use_metal) {
118 skia_public_includes += [ "include/gpu/mtl" ]
119}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000120
mtkleinc04ff472016-06-23 10:29:30 -0700121# Skia public API, generally provided by :skia.
122config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700123 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500124 if (skia_tools_vulkan_header_dir != "") {
125 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400126 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400127 defines = []
128 if (is_component_build) {
129 defines += [ "SKIA_DLL" ]
130 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400131 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700132 defines += [ "SK_SAMPLES_FOR_X" ]
133 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400134 if (skia_enable_flutter_defines) {
135 defines += flutter_defines
136 }
mtklein06c35c02016-09-20 12:28:12 -0700137 if (!skia_enable_gpu) {
138 defines += [ "SK_SUPPORT_GPU=0" ]
139 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500140 if (skia_enable_atlas_text) {
141 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
142 }
mtkleinc04ff472016-06-23 10:29:30 -0700143}
144
145# Skia internal APIs, used by Skia itself and a few test tools.
146config("skia_private") {
147 visibility = [ ":*" ]
148
149 include_dirs = [
150 "include/private",
151 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700152 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/core",
154 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700155 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/image",
157 "src/images",
158 "src/lazy",
159 "src/opts",
160 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700161 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700162 "src/ports",
163 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400164 "src/shaders",
165 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700166 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700167 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700168 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500169 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700170 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700171 ]
mtklein150d1132016-08-01 06:56:40 -0700172
Mike Reeda9e241d2017-05-03 10:52:00 -0400173 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700174 if (is_android) {
175 defines += [
176 "SK_GAMMA_EXPONENT=1.4",
177 "SK_GAMMA_CONTRAST=0.0",
178 ]
179 }
mtklein88a7ac02016-09-14 11:16:49 -0700180 if (is_official_build || is_android) {
181 # TODO(bsalomon): it'd be nice to make Android normal.
182 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
183 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400184 libs = []
185 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500186 if (skia_enable_gpu) {
187 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500188 if (is_skia_dev_build && skia_use_vulkan) {
189 include_dirs += [ "tools/gpu/vk" ]
190 }
Brian Salomon03e05842017-02-23 12:23:47 -0500191 }
Brian Osman34755e22016-12-05 09:46:02 -0500192 if (skia_use_angle) {
193 defines += [ "SK_ANGLE" ]
194 }
Brian Osman3f375d02016-12-28 11:19:22 -0500195 if (skia_enable_discrete_gpu) {
196 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
197 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400198 if (!is_official_build) {
199 defines += [ "GR_TEST_UTILS=1" ]
200 }
mtkleinc04ff472016-06-23 10:29:30 -0700201}
202
203# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
204config("skia_library") {
205 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700206 defines = [ "SKIA_IMPLEMENTATION=1" ]
207}
208
209skia_library_configs = [
210 ":skia_public",
211 ":skia_private",
212 ":skia_library",
213]
214
mtklein9b8583d2016-08-24 17:32:30 -0700215# Use for CPU-specific Skia code that needs particular compiler flags.
216template("opts") {
217 if (invoker.enabled) {
218 source_set(target_name) {
219 forward_variables_from(invoker, "*")
220 configs += skia_library_configs
221 }
222 } else {
223 # If not enabled, a phony empty target that swallows all otherwise unused variables.
224 source_set(target_name) {
225 forward_variables_from(invoker,
226 "*",
227 [
228 "sources",
229 "cflags",
230 ])
231 }
232 }
anmittala7eaf2e2016-08-17 13:57:26 -0700233}
234
mtklein422310d2016-08-16 18:28:43 -0700235is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700236
mtklein7d6fb2c2016-08-25 14:50:44 -0700237opts("none") {
238 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700240 cflags = []
241}
242
mtklein7d6fb2c2016-08-25 14:50:44 -0700243opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700244 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700246 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700247}
248
249opts("arm64") {
250 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700252 cflags = []
253}
254
255opts("crc32") {
256 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700258 cflags = [ "-march=armv8-a+crc" ]
259}
260
mtklein9b8583d2016-08-24 17:32:30 -0700261opts("sse2") {
262 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400264 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400265 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
266 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400267 cflags = [ "-msse2" ]
268 }
mtklein9b8583d2016-08-24 17:32:30 -0700269}
mtkleinc04ff472016-06-23 10:29:30 -0700270
mtklein9b8583d2016-08-24 17:32:30 -0700271opts("ssse3") {
272 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700273 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400274 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400275 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
276 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400277 cflags = [ "-mssse3" ]
278 }
mtklein9b8583d2016-08-24 17:32:30 -0700279}
mtkleinc04ff472016-06-23 10:29:30 -0700280
mtklein9b8583d2016-08-24 17:32:30 -0700281opts("sse41") {
282 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700283 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400284 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400285 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
286 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400287 cflags = [ "-msse4.1" ]
288 }
mtklein9b8583d2016-08-24 17:32:30 -0700289}
mtklein4e976072016-08-08 09:06:27 -0700290
mtklein9b8583d2016-08-24 17:32:30 -0700291opts("sse42") {
292 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700293 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400294 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400295 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
296 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400297 cflags = [ "-msse4.2" ]
298 }
mtklein9b8583d2016-08-24 17:32:30 -0700299}
300
301opts("avx") {
302 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700303 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400304 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000305 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400306 } else {
307 cflags = [ "-mavx" ]
308 }
mtkleinc04ff472016-06-23 10:29:30 -0700309}
310
mtkleinc095df52016-08-24 12:23:52 -0700311# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700312template("optional") {
313 if (invoker.enabled) {
314 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700315 if (defined(invoker.public_defines)) {
316 defines = invoker.public_defines
317 }
mtklein457b42a2016-08-23 13:56:37 -0700318 }
319 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700320 forward_variables_from(invoker,
321 "*",
322 [
323 "public_defines",
324 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700325 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700326 ])
mtklein457b42a2016-08-23 13:56:37 -0700327 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700328 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700329 if (defined(invoker.configs_to_remove)) {
330 configs -= invoker.configs_to_remove
331 }
mtklein457b42a2016-08-23 13:56:37 -0700332 }
333 } else {
mtklein457b42a2016-08-23 13:56:37 -0700334 source_set(target_name) {
335 forward_variables_from(invoker,
336 "*",
337 [
338 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700339 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700340 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700341 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700342 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700343 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700344 ])
mtkleincd01b032016-08-31 04:58:19 -0700345 if (defined(invoker.sources_when_disabled)) {
346 sources = invoker.sources_when_disabled
347 }
348 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700349 }
mtkleineb3c4252016-08-23 07:38:09 -0700350 }
mtklein457b42a2016-08-23 13:56:37 -0700351}
mtklein457b42a2016-08-23 13:56:37 -0700352
Mike Kleina04bb452017-02-09 12:24:07 -0500353optional("effects") {
354 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400355 deps = [
356 ":compile_processors",
357 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500358 sources =
359 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
360 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
361}
362
mtkleina45be612016-08-29 15:22:10 -0700363optional("fontmgr_android") {
364 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700365
366 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500367 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700368 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700369 ]
370 sources = [
371 "src/ports/SkFontMgr_android.cpp",
372 "src/ports/SkFontMgr_android_factory.cpp",
373 "src/ports/SkFontMgr_android_parser.cpp",
374 ]
375}
376
mtkleind2e39db2016-09-07 07:52:55 -0700377optional("fontmgr_custom") {
378 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700382 ]
383 sources = [
384 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500385 "src/ports/SkFontMgr_custom.h",
386 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700387 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500388 "src/ports/SkFontMgr_custom_embedded.cpp",
389 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700390 ]
391}
392
mtklein3cc22182016-08-29 13:26:14 -0700393optional("fontmgr_fontconfig") {
394 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700395
396 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500397 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700398 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700399 ]
400 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700401 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700402 "src/ports/SkFontConfigInterface_direct.cpp",
403 "src/ports/SkFontConfigInterface_direct_factory.cpp",
404 "src/ports/SkFontMgr_FontConfigInterface.cpp",
405 "src/ports/SkFontMgr_fontconfig.cpp",
406 "src/ports/SkFontMgr_fontconfig_factory.cpp",
407 ]
408}
409
mtkleincdedd0e2016-09-12 15:15:44 -0700410optional("fontmgr_fuchsia") {
411 enabled = is_fuchsia && skia_use_freetype
412
413 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500414 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700415 ]
416 sources = [
417 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500418 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700419 "src/ports/SkFontMgr_custom_empty_factory.cpp",
420 ]
421}
422
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700423if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400424 executable("sksllex") {
425 sources = [
426 "src/sksl/lex/Main.cpp",
427 "src/sksl/lex/NFA.cpp",
428 "src/sksl/lex/RegexNode.cpp",
429 "src/sksl/lex/RegexParser.cpp",
430 ]
431 include_dirs = [ "src/sksl/lex" ]
432 }
433
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700434 action("run_sksllex") {
435 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400436 deps = [
437 ":sksllex(//gn/toolchain:$host_toolchain)",
438 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700439 sources = [
440 "src/sksl/lex/layout.lex",
441 "src/sksl/lex/sksl.lex",
442 ]
443
444 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
445 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
446 outputs = [
447 "$target_out_dir/" +
448 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
449 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
450 # confused due to the same file being named by two different paths
451 ]
452 sksllex_path = "$root_out_dir/"
453 sksllex_path += "sksllex"
454 if (host_os == "win") {
455 sksllex_path += ".exe"
456 }
457 args = [
458 rebase_path(sksllex_path),
459 rebase_path("bin/clang-format"),
460 rebase_path("src"),
461 ]
462 }
463} else {
464 group("run_sksllex") {
465 }
466}
467
468if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400469 executable("skslc") {
470 defines = [ "SKSL_STANDALONE" ]
471 sources = [
472 "src/sksl/SkSLMain.cpp",
473 ]
474 sources += skia_sksl_sources
475 include_dirs = [
476 "src/gpu",
477 "src/sksl",
478 ]
479 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500480 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400481 "//third_party/spirv-tools",
482 ]
483 }
484
485 skia_gpu_processor_outputs = []
486 foreach(src, skia_gpu_processor_sources) {
487 dir = get_path_info(src, "dir")
488 name = get_path_info(src, "name")
489
490 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
491 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
492 skia_gpu_processor_outputs += [
493 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
494 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
495 # confused due to the same file being named by two different paths
496 ]
497 }
498
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500499 action("create_sksl_enums") {
500 script = "gn/create_sksl_enums.py"
501 sources = [
502 "include/private/GrSharedEnums.h",
503 ]
504 outputs = [
505 "$target_out_dir/" +
506 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
507 ]
508 args = [
509 rebase_path(sources[0]),
510 rebase_path(outputs[0]),
511 ]
512 }
513
Ethan Nicholas762466e2017-06-29 10:03:38 -0400514 action("compile_processors") {
515 script = "gn/compile_processors.py"
516 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500517 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400518 ":skslc(//gn/toolchain:$host_toolchain)",
519 ]
520 sources = skia_gpu_processor_sources
521 outputs = skia_gpu_processor_outputs
522 skslc_path = "$root_out_dir/"
523 if (host_toolchain != default_toolchain_name) {
524 skslc_path += "$host_toolchain/"
525 }
526 skslc_path += "skslc"
527 if (host_os == "win") {
528 skslc_path += ".exe"
529 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400530 args = [
531 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400532 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400533 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400534 args += rebase_path(skia_gpu_processor_sources)
535 }
536} else {
537 skia_gpu_processor_outputs = []
538 group("compile_processors") {
539 }
540}
541
mtklein06c35c02016-09-20 12:28:12 -0700542optional("gpu") {
543 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400544 deps = [
545 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700546 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400547 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700548 public_defines = []
549
Brian Salomon3d6801e2017-12-11 10:06:31 -0500550 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700551
552 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500553 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700554 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400555 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700556 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500557 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400558
559 # this lib is required to link against AHardwareBuffer
560 if (defined(ndk_api) && ndk_api >= 26) {
561 libs += [ "android" ]
562 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400563 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500564 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400565 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700566 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500567 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500568 libs += [
569 "GL",
570 "GLU",
571 ]
mtklein06c35c02016-09-20 12:28:12 -0700572 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500573 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800574 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500575 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400576 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500577 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400578 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700579 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500580 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700581 }
mtkleine9fb3d52016-09-20 15:11:46 -0700582
583 if (skia_use_vulkan) {
584 public_defines += [ "SK_VULKAN" ]
585 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700586 if (skia_enable_vulkan_debug_layers) {
587 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
588 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500589 if (skia_vulkan_header != "") {
590 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
591 } else {
592 if (is_skia_dev_build) {
593 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
594 }
595 }
mtkleine9fb3d52016-09-20 15:11:46 -0700596 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400597 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400598 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400599 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
600 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400601
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400602 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400603 if (skia_use_metal) {
604 public_defines += [ "SK_METAL" ]
605 sources += skia_metal_sources
606 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400607 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400608 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500609
610 if (skia_enable_atlas_text) {
611 sources += skia_atlas_text_sources
612 }
mtklein06c35c02016-09-20 12:28:12 -0700613}
614
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400615optional("heif") {
616 enabled = skia_use_libheif
617 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
618
619 deps = []
620
621 sources = [
622 "src/codec/SkHeifCodec.cpp",
623 ]
624}
625
mtklein63213812016-08-24 09:55:56 -0700626optional("jpeg") {
627 enabled = skia_use_libjpeg_turbo
628 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
629
mtklein63213812016-08-24 09:55:56 -0700630 deps = [
631 "//third_party/libjpeg-turbo:libjpeg",
632 ]
633 sources = [
634 "src/codec/SkJpegCodec.cpp",
635 "src/codec/SkJpegDecoderMgr.cpp",
636 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700637 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400638 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700639 ]
640}
641
642optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500643 enabled = skia_use_zlib && skia_enable_pdf
644 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700645
mtklein63213812016-08-24 09:55:56 -0700646 deps = [
647 "//third_party/zlib",
648 ]
brettwb9447282016-09-01 14:24:39 -0700649 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700650 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700651
652 if (skia_use_sfntly) {
653 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500654 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700655 }
656}
657
658optional("png") {
659 enabled = skia_use_libpng
660 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
661
mtklein63213812016-08-24 09:55:56 -0700662 deps = [
663 "//third_party/libpng",
664 ]
665 sources = [
666 "src/codec/SkIcoCodec.cpp",
667 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400668 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700669 ]
670}
671
scroggof84ad642016-10-31 09:02:57 -0700672optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400673 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700674 public_defines = [ "SK_CODEC_DECODES_RAW" ]
675
676 deps = [
677 "//third_party/dng_sdk",
678 "//third_party/libjpeg-turbo:libjpeg",
679 "//third_party/piex",
680 ]
681
682 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
683 # Skia.
684 configs_to_remove = [ "//gn:no_exceptions" ]
685
686 sources = [
687 "src/codec/SkRawAdapterCodec.cpp",
688 "src/codec/SkRawCodec.cpp",
689 ]
690}
691
mtklein3cc22182016-08-29 13:26:14 -0700692optional("typeface_freetype") {
693 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700694
695 deps = [
696 "//third_party/freetype2",
697 ]
698 sources = [
699 "src/ports/SkFontHost_FreeType.cpp",
700 "src/ports/SkFontHost_FreeType_common.cpp",
701 ]
702}
703
mtklein457b42a2016-08-23 13:56:37 -0700704optional("webp") {
705 enabled = skia_use_libwebp
706 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
707
mtklein457b42a2016-08-23 13:56:37 -0700708 deps = [
709 "//third_party/libwebp",
710 ]
711 sources = [
712 "src/codec/SkWebpAdapterCodec.cpp",
713 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400714 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700715 ]
mtkleineb3c4252016-08-23 07:38:09 -0700716}
717
mtklein63213812016-08-24 09:55:56 -0700718optional("xml") {
719 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000720 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700721
mtklein63213812016-08-24 09:55:56 -0700722 deps = [
723 "//third_party/expat",
724 ]
725 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500726 "src/svg/SkSVGCanvas.cpp",
727 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700728 "src/xml/SkDOM.cpp",
729 "src/xml/SkXMLParser.cpp",
730 "src/xml/SkXMLWriter.cpp",
731 ]
732}
733
mtkleinc04ff472016-06-23 10:29:30 -0700734component("skia") {
735 public_configs = [ ":skia_public" ]
736 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700737
738 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700739 ":arm64",
740 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700741 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700742 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500743 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700744 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700745 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700746 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700747 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700748 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400749 ":heif",
mtklein63213812016-08-24 09:55:56 -0700750 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700751 ":none",
mtklein63213812016-08-24 09:55:56 -0700752 ":pdf",
753 ":png",
scroggof84ad642016-10-31 09:02:57 -0700754 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700755 ":sse2",
756 ":sse41",
757 ":sse42",
758 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700759 ":webp",
mtklein63213812016-08-24 09:55:56 -0700760 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700761 ]
762
Chinmay Garde43f115c2016-11-16 15:04:12 -0800763 # This file (and all GN files in Skia) are designed to work with an
764 # empty sources assignment filter; we handle all that explicitly.
765 # We clear the filter here for clients who may have set up a global filter.
766 set_sources_assignment_filter([])
767
mtkleinc04ff472016-06-23 10:29:30 -0700768 sources = []
brettwb9447282016-09-01 14:24:39 -0700769 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700770 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500771 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700772 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400773 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500774 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700775 "src/android/SkBitmapRegionCodec.cpp",
776 "src/android/SkBitmapRegionDecoder.cpp",
777 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400778 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700779 "src/codec/SkBmpCodec.cpp",
780 "src/codec/SkBmpMaskCodec.cpp",
781 "src/codec/SkBmpRLECodec.cpp",
782 "src/codec/SkBmpStandardCodec.cpp",
783 "src/codec/SkCodec.cpp",
784 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700785 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700786 "src/codec/SkMaskSwizzler.cpp",
787 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700788 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700789 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700790 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700791 "src/codec/SkSwizzler.cpp",
792 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700793 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700794 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700795 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700796 "src/ports/SkMemory_malloc.cpp",
797 "src/ports/SkOSFile_stdio.cpp",
798 "src/sfnt/SkOTTable_name.cpp",
799 "src/sfnt/SkOTUtils.cpp",
800 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700801 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700802 ]
brettwb9447282016-09-01 14:24:39 -0700803
mtklein7d6fb2c2016-08-25 14:50:44 -0700804 libs = []
805
mtkleinc04ff472016-06-23 10:29:30 -0700806 if (is_win) {
807 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400808 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700809 "src/ports/SkDebug_win.cpp",
810 "src/ports/SkFontHost_win.cpp",
811 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500812 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700813 "src/ports/SkImageEncoder_WIC.cpp",
814 "src/ports/SkImageGeneratorWIC.cpp",
815 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700816 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700817 "src/ports/SkScalerContext_win_dw.cpp",
818 "src/ports/SkTLS_win.cpp",
819 "src/ports/SkTypeface_win_dw.cpp",
820 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400821 libs += [
822 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500823 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400824 "Ole32.lib",
825 "OleAut32.lib",
826 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500827 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400828 ]
mtkleinc04ff472016-06-23 10:29:30 -0700829 } else {
830 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700831 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700832 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700833 "src/ports/SkTLS_pthread.cpp",
834 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400835 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700836 }
837
mtklein7d6fb2c2016-08-25 14:50:44 -0700838 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500839 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500840 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500841 deps += [ "//third_party/cpu-features" ]
842 }
mtklein06c35c02016-09-20 12:28:12 -0700843 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700844 libs += [
845 "EGL",
846 "GLESv2",
847 "log",
848 ]
849 }
850
mtkleinc04ff472016-06-23 10:29:30 -0700851 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700852 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700853 }
854
855 if (is_mac) {
856 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700857 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700858 "src/ports/SkFontHost_mac.cpp",
859 "src/ports/SkImageEncoder_CG.cpp",
860 "src/ports/SkImageGeneratorCG.cpp",
861 ]
mtklein09e61f72016-08-23 13:35:28 -0700862 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400863 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
864 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700865 "ApplicationServices.framework",
866 "OpenGL.framework",
867 ]
mtkleinc04ff472016-06-23 10:29:30 -0700868 }
abarth6fc8ff02016-07-15 15:15:15 -0700869
Mike Klein7d302882016-11-03 14:06:31 -0400870 if (is_ios) {
871 sources += [
872 "src/ports/SkDebug_stdio.cpp",
873 "src/ports/SkFontHost_mac.cpp",
874 "src/ports/SkImageEncoder_CG.cpp",
875 "src/ports/SkImageGeneratorCG.cpp",
876 ]
877 libs += [
878 "CoreFoundation.framework",
879 "CoreGraphics.framework",
880 "CoreText.framework",
881 "ImageIO.framework",
882 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400883
884 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
885 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400886 ]
887 }
888
abarth6fc8ff02016-07-15 15:15:15 -0700889 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700890 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700891 }
mtkleinc04ff472016-06-23 10:29:30 -0700892}
893
mtkleinc095df52016-08-24 12:23:52 -0700894# Targets guarded by skia_enable_tools may use //third_party freely.
895if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500896 # Used by gn_to_bp.py to list our public include dirs.
897 source_set("public") {
898 configs += [ ":skia_public" ]
899 }
900
Mike Kleinc36dedf2016-11-18 09:35:28 -0500901 config("skia.h_config") {
902 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500903 if (skia_use_vulkan) {
904 # So we can get the header which includes vulkan
905 include_dirs += [ "tools/gpu/vk" ]
906 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500907 }
908 action("skia.h") {
909 public_configs = [ ":skia.h_config" ]
910 skia_h = "$target_gen_dir/skia.h"
911 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400912 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000913 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500914 depfile = "$skia_h.deps"
915 outputs = [
916 skia_h,
917 ]
918 }
919
Hal Canary316b7462017-12-13 12:39:19 -0500920 if (skia_embed_resources) {
921 action("binary_resources.cpp") {
922 script = "gn/generate_binary_asset.py"
923 args = [
924 rebase_path("resources"),
925 "gResources",
926 rebase_path("$target_gen_dir/binary_resources.cpp", root_build_dir),
927 ]
928 outputs = [
929 "$target_gen_dir/binary_resources.cpp",
930 ]
931 }
932 }
933
Mike Kleinc36dedf2016-11-18 09:35:28 -0500934 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500935 executable("fiddle") {
936 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500937 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500938 "tools/fiddle/draw.cpp",
939 "tools/fiddle/fiddle_main.cpp",
940 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400941
942 if (skia_use_egl) {
943 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400944 } else {
945 sources += [ "tools/fiddle/null_context.cpp" ]
946 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400947 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400949 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500950 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500951 ":skia",
952 ":skia.h",
953 ]
954 }
955 }
956
957 if (skia_enable_gpu) {
958 source_set("public_headers_warnings_check") {
959 sources = [
960 "tools/public_headers_warnings_check.cpp",
961 ]
962 configs -= [ "//gn:warnings_except_public_headers" ]
963 deps = [
964 ":skia",
965 ":skia.h",
966 ]
967 }
968 }
969
mtkleinc095df52016-08-24 12:23:52 -0700970 template("test_lib") {
971 config(target_name + "_config") {
972 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700973 if (defined(invoker.public_defines)) {
974 defines = invoker.public_defines
975 }
mtklein25c81d42016-07-27 13:55:26 -0700976 }
mtkleinc095df52016-08-24 12:23:52 -0700977 source_set(target_name) {
978 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
979 public_configs = [
980 ":" + target_name + "_config",
981 ":skia_private",
982 ]
983
984 if (!defined(deps)) {
985 deps = []
986 }
987 deps += [ ":skia" ]
988 testonly = true
989 }
mtklein25c81d42016-07-27 13:55:26 -0700990 }
mtklein25c81d42016-07-27 13:55:26 -0700991
Mike Kleine6682eb2017-01-05 10:54:57 -0500992 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -0500993 if (is_ios) {
994 app_name = target_name
995 gen_path = target_gen_dir
996
997 action("${app_name}_generate_info_plist") {
998 script = "//gn/gen_plist_ios.py"
999 outputs = [
1000 "$gen_path/${app_name}_Info.plist",
1001 ]
1002 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1003 }
1004
1005 bundle_data("${app_name}_bundle_info_plist") {
1006 public_deps = [
1007 ":${app_name}_generate_info_plist",
1008 ]
1009 sources = [
1010 "$gen_path/${app_name}_Info.plist",
1011 ]
1012 outputs = [
1013 "{{bundle_root_dir}}/Info.plist",
1014 ]
1015 }
1016
Jim Van Verth329c5a62017-11-29 11:42:33 -05001017 bundle_ios_data =
1018 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1019
1020 if (bundle_ios_data) {
1021 has_skps =
1022 "True" == exec_script("//gn/checkdir.py",
1023 [ rebase_path("skps", root_build_dir) ],
1024 "trim string")
1025 bundle_data("${app_name}_bundle_resources") {
1026 sources = [
1027 "resources",
1028 ]
1029 outputs = [
1030 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1031 "{{bundle_resources_dir}}/data/resources",
1032 ]
1033 }
1034
1035 if (has_skps) {
1036 bundle_data("${app_name}_bundle_skps") {
1037 sources = [
1038 "skps",
1039 ]
1040 outputs = [
1041 # Store in same folder as resources
1042 "{{bundle_resources_dir}}/data/skps",
1043 ]
1044 }
1045 }
1046 }
1047
Jim Van Verth443a9132017-11-28 09:45:26 -05001048 executable("${app_name}_generate_executable") {
1049 forward_variables_from(invoker,
1050 "*",
1051 [
1052 "output_name",
1053 "visibility",
1054 "is_shared_library",
1055 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001056 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001057 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001058 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1059 }
1060
1061 bundle_data("${app_name}_bundle_executable") {
1062 public_deps = [
1063 ":${app_name}_generate_executable",
1064 ]
1065 sources = [
1066 "$gen_path/$app_name",
1067 ]
1068 outputs = [
1069 "{{bundle_executable_dir}}/$app_name",
1070 ]
1071 testonly = true
1072 }
1073
1074 create_bundle("$app_name") {
1075 product_type = "com.apple.product-type.application"
1076 testonly = true
1077
1078 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1079 bundle_resources_dir = bundle_root_dir
1080 bundle_executable_dir = bundle_root_dir
1081 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1082
1083 deps = [
1084 ":${app_name}_bundle_executable",
1085 ":${app_name}_bundle_info_plist",
1086 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001087 if (bundle_ios_data) {
1088 deps += [ ":${app_name}_bundle_resources" ]
1089 if (has_skps) {
1090 deps += [ ":${app_name}_bundle_skps" ]
1091 }
1092 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001093
1094 # should only code sign when running on a device, not the simulator
1095 if (target_cpu != "x64") {
1096 code_signing_script = "//gn/codesign_ios.py"
1097 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1098 code_signing_outputs = [
1099 "$bundle_root_dir/_CodeSignature/CodeResources",
1100 "$bundle_root_dir/embedded.mobileprovision",
1101 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001102 code_signing_args = [
1103 rebase_path("$bundle_root_dir", root_build_dir),
1104 skia_ios_identity,
1105 skia_ios_profile,
1106 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001107 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001108 }
1109 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001110 # !is_ios
1111
1112 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1113 shared_library("lib" + target_name) {
1114 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1115 configs += [ ":skia_private" ]
1116 testonly = true
1117 }
1118 } else {
1119 _executable = target_name
1120 executable(_executable) {
1121 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1122 configs += [ ":skia_private" ]
1123 testonly = true
1124 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001125 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001126 if (is_android && skia_android_serial != "" && defined(_executable)) {
1127 action("push_" + target_name) {
1128 script = "gn/push_to_android.py"
1129 deps = [
1130 ":" + _executable,
1131 ]
1132 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1133 outputs = [
1134 _stamp,
1135 ]
1136 args = [
1137 rebase_path("$root_build_dir/$_executable"),
1138 skia_android_serial,
1139 rebase_path(_stamp),
1140 ]
1141 testonly = true
1142 }
Mike Klein7d921032017-01-05 12:20:41 -05001143 }
1144 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001145 }
1146
mtkleinc095df52016-08-24 12:23:52 -07001147 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001148 public_include_dirs = []
1149 if (skia_enable_gpu) {
1150 public_defines = []
1151 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001152
1153 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001154 sources = [
1155 "tools/gpu/GrContextFactory.cpp",
1156 "tools/gpu/GrTest.cpp",
1157 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001158 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001159 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001160 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001161 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1162 "tools/gpu/gl/debug/GrBufferObj.cpp",
1163 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1164 "tools/gpu/gl/debug/GrProgramObj.cpp",
1165 "tools/gpu/gl/debug/GrShaderObj.cpp",
1166 "tools/gpu/gl/debug/GrTextureObj.cpp",
1167 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1168 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001169 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001170 ]
1171 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001172
Kevin Lubick4a24e102017-03-29 11:19:01 -04001173 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001174 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001175 } else if (is_ios) {
1176 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1177 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001178 } else if (is_linux) {
1179 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001180 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001181 } else if (is_mac) {
1182 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001183 } else if (is_win) {
1184 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1185 libs += [
1186 "Gdi32.lib",
1187 "OpenGL32.lib",
1188 ]
mtklein38925aa2016-09-21 10:11:25 -07001189 }
mtklein6ef69992016-09-14 06:12:09 -07001190
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001191 cflags_objcc = [ "-fobjc-arc" ]
1192
Mike Kleinc168a3a2016-11-14 14:53:13 +00001193 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001194 deps += [ "//third_party/angle2" ]
1195 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1196 }
mtkleind68f9b02016-09-23 13:18:41 -07001197 if (skia_use_vulkan) {
1198 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001199 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001200 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001201 if (skia_use_metal) {
1202 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1203 }
mtkleina627b5c2016-09-20 13:36:47 -07001204 }
mtklein25c81d42016-07-27 13:55:26 -07001205 }
mtklein25c81d42016-07-27 13:55:26 -07001206
mtkleinc095df52016-08-24 12:23:52 -07001207 test_lib("flags") {
1208 public_include_dirs = [ "tools/flags" ]
1209 sources = [
1210 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001211 ]
1212 }
1213 test_lib("common_flags") {
1214 public_include_dirs = [ "tools/flags" ]
1215 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001216 "tools/flags/SkCommonFlags.cpp",
1217 "tools/flags/SkCommonFlagsConfig.cpp",
1218 ]
1219 deps = [
mtklein046cb562016-09-16 10:23:12 -07001220 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001221 ":gpu_tool_utils",
1222 ]
1223 }
mtklein25c81d42016-07-27 13:55:26 -07001224
mtkleinc095df52016-08-24 12:23:52 -07001225 test_lib("tool_utils") {
1226 public_include_dirs = [
1227 "tools",
1228 "tools/debugger",
1229 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001230 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001231 ]
1232 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001233 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001234 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001235 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001236 "tools/ProcStats.cpp",
1237 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001238 "tools/SkRandomScalerContext.cpp",
1239 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001240 "tools/UrlDataManager.cpp",
1241 "tools/debugger/SkDebugCanvas.cpp",
1242 "tools/debugger/SkDrawCommand.cpp",
1243 "tools/debugger/SkJsonWriteBuffer.cpp",
1244 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001245 "tools/picture_utils.cpp",
1246 "tools/random_parse_path.cpp",
1247 "tools/sk_tool_utils.cpp",
1248 "tools/sk_tool_utils_font.cpp",
1249 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001250 "tools/trace/SkChromeTracingTracer.cpp",
1251 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001252 "tools/trace/SkDebugfTracer.cpp",
1253 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001254 "tools/trace/SkEventTracingPriv.cpp",
1255 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001256 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001257 libs = []
1258 if (is_ios) {
1259 sources += [ "tools/ios_utils.m" ]
1260 libs += [ "Foundation.framework" ]
1261 }
mtkleinc095df52016-08-24 12:23:52 -07001262 deps = [
mtklein046cb562016-09-16 10:23:12 -07001263 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001264 ":flags",
1265 "//third_party/libpng",
1266 ]
1267 public_deps = [
1268 "//third_party/jsoncpp",
1269 ]
Hal Canarya4935102017-12-08 13:35:47 -05001270 if (skia_embed_resources) {
1271 defines = [ "SK_EMBED_RESOURCES" ]
1272 sources += [ "$target_gen_dir/binary_resources.cpp" ]
1273 deps += [ ":binary_resources.cpp" ]
1274 }
mtkleinc095df52016-08-24 12:23:52 -07001275 }
mtklein25c81d42016-07-27 13:55:26 -07001276
Mike Klein6e744122016-10-27 12:21:40 -04001277 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001278 test_lib("gm") {
1279 public_include_dirs = [ "gm" ]
1280 sources = gm_sources
1281 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001282 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001283 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001284 ":gpu_tool_utils",
1285 ":skia",
1286 ":tool_utils",
1287 ]
1288 }
mtklein25c81d42016-07-27 13:55:26 -07001289
Mike Klein6e744122016-10-27 12:21:40 -04001290 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001291 test_lib("tests") {
1292 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001293 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001294 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001295 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001296 }
mtkleinc095df52016-08-24 12:23:52 -07001297 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001298 ":experimental_sksg",
fmalita6cf896d2016-08-25 08:44:35 -07001299 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001300 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001301 ":skia",
1302 ":tool_utils",
1303 "//third_party/libpng",
1304 "//third_party/zlib",
1305 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001306 public_deps = [
1307 ":gpu_tool_utils", # Test.h #includes headers from this target.
1308 ]
mtkleinc095df52016-08-24 12:23:52 -07001309 }
mtklein2f3416d2016-08-02 16:02:05 -07001310
Mike Klein6e744122016-10-27 12:21:40 -04001311 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001312 test_lib("bench") {
1313 public_include_dirs = [ "bench" ]
1314 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001315 deps = [
1316 ":flags",
1317 ":gm",
1318 ":gpu_tool_utils",
1319 ":skia",
1320 ":tool_utils",
1321 ]
1322 }
mtklein2b6870c2016-07-28 14:17:33 -07001323
Florin Malita54f65c42018-01-16 17:04:30 -05001324 test_lib("experimental_skottie") {
1325 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001326 include_dirs = [ "tools" ]
1327 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001328 "experimental/skottie/Skottie.cpp",
1329 "experimental/skottie/SkottieAnimator.cpp",
1330 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001331 ]
1332 deps = [
1333 ":experimental_sksg",
1334 ":skia",
1335 "//third_party/jsoncpp",
1336 ]
1337 }
1338
mtkleinc095df52016-08-24 12:23:52 -07001339 test_lib("experimental_svg_model") {
1340 public_include_dirs = [ "experimental/svg/model" ]
1341 sources = [
1342 "experimental/svg/model/SkSVGAttribute.cpp",
1343 "experimental/svg/model/SkSVGAttributeParser.cpp",
1344 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001345 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001346 "experimental/svg/model/SkSVGContainer.cpp",
1347 "experimental/svg/model/SkSVGDOM.cpp",
1348 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001349 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001350 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001351 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001352 "experimental/svg/model/SkSVGNode.cpp",
1353 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001354 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001355 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001356 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001357 "experimental/svg/model/SkSVGRect.cpp",
1358 "experimental/svg/model/SkSVGRenderContext.cpp",
1359 "experimental/svg/model/SkSVGSVG.cpp",
1360 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001361 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001362 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001363 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001364 "experimental/svg/model/SkSVGValue.cpp",
1365 ]
1366 deps = [
1367 ":skia",
1368 ]
1369 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001370
Florin Malita4aa44412017-12-19 12:21:02 -05001371 test_lib("experimental_sksg") {
1372 public_include_dirs = [
1373 "experimental/sksg",
1374 "experimental/sksg/effects",
1375 "experimental/sksg/geometry",
1376 "experimental/sksg/paint",
1377 ]
1378 sources = [
1379 "experimental/sksg/SkSGDraw.cpp",
1380 "experimental/sksg/SkSGEffectNode.cpp",
1381 "experimental/sksg/SkSGGeometryNode.cpp",
1382 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001383 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001384 "experimental/sksg/SkSGInvalidationController.cpp",
1385 "experimental/sksg/SkSGNode.cpp",
1386 "experimental/sksg/SkSGPaintNode.cpp",
1387 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001388 "experimental/sksg/SkSGScene.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001389 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001390 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001391 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001392 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001393 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001394 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001395 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001396 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001397 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001398 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001399 ]
1400 deps = [
1401 ":skia",
1402 ]
1403 }
1404
Kevin Lubickebf648e2017-09-21 13:45:16 -04001405 if (target_cpu != "wasm") {
1406 test_lib("views") {
1407 public_include_dirs = [ "include/views" ]
1408 sources = [
1409 "src/views/SkEvent.cpp",
1410 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001411 "src/views/SkTouchGesture.cpp",
1412 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001413 ]
Brian Osman34755e22016-12-05 09:46:02 -05001414 }
Brian Osman16adfa32016-10-18 14:42:44 -04001415 }
1416
Mike Klein38af9432016-11-11 11:39:44 -05001417 if (skia_use_lua) {
1418 test_lib("lua") {
1419 public_include_dirs = []
1420 sources = [
1421 "src/utils/SkLua.cpp",
1422 "src/utils/SkLuaCanvas.cpp",
1423 ]
1424 deps = [
1425 "//third_party/lua",
1426 ]
1427 }
1428
Mike Kleine6682eb2017-01-05 10:54:57 -05001429 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001430 sources = [
1431 "tools/lua/lua_app.cpp",
1432 ]
1433 deps = [
1434 ":lua",
1435 ":skia",
1436 "//third_party/lua",
1437 ]
Mike Klein38af9432016-11-11 11:39:44 -05001438 }
1439
Mike Kleine6682eb2017-01-05 10:54:57 -05001440 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001441 sources = [
1442 "tools/lua/lua_pictures.cpp",
1443 ]
1444 deps = [
1445 ":flags",
1446 ":lua",
1447 ":skia",
1448 ":tool_utils",
1449 "//third_party/lua",
1450 ]
Mike Klein38af9432016-11-11 11:39:44 -05001451 }
1452 }
1453
Cary Clark8032b982017-07-28 11:04:54 -04001454 test_app("bookmaker") {
1455 sources = [
1456 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001457 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001458 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001459 "tools/bookmaker/fiddleParser.cpp",
1460 "tools/bookmaker/includeParser.cpp",
1461 "tools/bookmaker/includeWriter.cpp",
1462 "tools/bookmaker/mdOut.cpp",
1463 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001464 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001465 "tools/bookmaker/spellCheck.cpp",
1466 ]
1467 deps = [
1468 ":flags",
1469 ":skia",
1470 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001471 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001472 ]
1473 }
1474
Kevin Lubickebf648e2017-09-21 13:45:16 -04001475 if (target_cpu != "wasm") {
1476 import("gn/samples.gni")
1477 test_lib("samples") {
1478 public_include_dirs = [ "samplecode" ]
1479 include_dirs = [ "experimental" ]
1480 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001481 # Relocating these files here, so that clients don't try to build them while they're
1482 # still in active development. Clang's thread safety analysis gets tripped up by
1483 # conditional locks.
1484 "src/core/SkThreadedBMPDevice.cpp",
1485 "src/core/SkThreadedBMPDevice.h",
1486 ]
1487 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001488 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001489 ":experimental_svg_model",
1490 ":flags",
1491 ":gm",
1492 ":tool_utils",
1493 ":views",
1494 ":xml",
1495 ]
Mike Klein38af9432016-11-11 11:39:44 -05001496
Kevin Lubickebf648e2017-09-21 13:45:16 -04001497 if (skia_use_lua) {
1498 sources += [ "samplecode/SampleLua.cpp" ]
1499 deps += [
1500 ":lua",
1501 "//third_party/lua",
1502 ]
1503 }
1504 }
1505 test_app("dm") {
1506 sources = [
1507 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001508 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001509 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001510 "dm/DMJsonWriter.cpp",
1511 "dm/DMSrcSink.cpp",
1512 ]
1513 include_dirs = [ "tests" ]
1514 deps = [
1515 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001516 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001517 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001518 ":experimental_svg_model",
1519 ":flags",
1520 ":gm",
1521 ":gpu_tool_utils",
1522 ":skia",
1523 ":tests",
1524 ":tool_utils",
1525 "//third_party/jsoncpp",
1526 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001527 ]
1528 }
Brian Osman16adfa32016-10-18 14:42:44 -04001529 }
1530
Mike Kleina8a51ce2018-01-09 12:34:11 -05001531 if (!is_win) {
1532 test_app("remote_demo") {
1533 sources = [
1534 "tools/remote_demo.cpp",
1535 ]
1536 deps = [
1537 ":skia",
1538 ]
1539 }
1540 }
1541
Mike Klein06432b22017-03-21 13:14:33 -04001542 test_app("ok") {
1543 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001544 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001545 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001546 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001547 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001548 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001549 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001550 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001551 ]
1552 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001553 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001554 ":gm",
1555 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001556 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001557 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001558 ]
1559 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001560 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001561 sources = [
1562 "bench/nanobench.cpp",
1563 ]
1564 deps = [
1565 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001566 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001567 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001568 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001569 ":flags",
1570 ":gm",
1571 ":gpu_tool_utils",
1572 ":skia",
1573 ":tool_utils",
1574 "//third_party/jsoncpp",
1575 ]
mtklein2b6870c2016-07-28 14:17:33 -07001576 }
halcanary19a97202016-08-03 15:08:04 -07001577
Ravi Mistry10d36c52017-01-31 09:49:18 -05001578 test_app("skpinfo") {
1579 sources = [
1580 "tools/skpinfo.cpp",
1581 ]
1582 deps = [
1583 ":flags",
1584 ":skia",
1585 ]
1586 }
1587
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001588 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001589 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001590 sources = [
1591 "tools/skpbench/skpbench.cpp",
1592 ]
1593 deps = [
1594 ":flags",
1595 ":gpu_tool_utils",
1596 ":skia",
1597 ":tool_utils",
1598 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001599 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001600 }
1601
Mike Klein7d302882016-11-03 14:06:31 -04001602 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001603 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001604 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001605 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001606 "tools/shape/SkShaper_harfbuzz.cpp",
1607 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001608 ]
1609 deps = [
1610 ":skia",
1611 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001612 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001613 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001614 }
halcanary19a97202016-08-03 15:08:04 -07001615 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001616 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001617 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001618 "tools/shape/SkShaper_primitive.cpp",
1619 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001620 ]
1621 deps = [
1622 ":skia",
1623 ]
halcanary3eee9d92016-09-10 07:01:53 -07001624 }
mtklein046cb562016-09-16 10:23:12 -07001625
Matt Sarett9f1c4032017-05-17 10:06:32 -04001626 test_app("create_flutter_test_images") {
1627 sources = [
1628 "tools/create_flutter_test_images.cpp",
1629 ]
1630 deps = [
1631 ":skia",
1632 ":tool_utils",
1633 ]
1634 }
1635
Ben Wagner219f3622017-07-17 15:32:25 -04001636 test_app("create_test_font") {
1637 sources = [
1638 "tools/create_test_font.cpp",
1639 ]
1640 deps = [
1641 ":skia",
1642 ]
1643 assert_no_deps = [
1644 # tool_utils requires the output of this app.
1645 ":tool_utils",
1646 ]
1647 }
1648
Mike Kleine6682eb2017-01-05 10:54:57 -05001649 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001650 sources = [
1651 "tools/get_images_from_skps.cpp",
1652 ]
1653 deps = [
1654 ":flags",
1655 ":skia",
1656 "//third_party/jsoncpp",
1657 ]
mtklein046cb562016-09-16 10:23:12 -07001658 }
mtkleinecbc5262016-09-22 11:51:24 -07001659
Mike Kleine6682eb2017-01-05 10:54:57 -05001660 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001661 sources = [
1662 "tools/colorspaceinfo.cpp",
1663 ]
1664 deps = [
1665 ":flags",
1666 ":skia",
1667 ":tool_utils",
1668 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001669 }
1670
Kevin Lubickebf648e2017-09-21 13:45:16 -04001671 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001672 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001673 sources = [
1674 "tools/skiaserve/Request.cpp",
1675 "tools/skiaserve/Response.cpp",
1676 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001677 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1678 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1679 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1680 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1681 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1682 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1683 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1684 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1685 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001686 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1687 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001688 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1689 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1690 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1691 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1692 ]
1693 deps = [
1694 ":flags",
1695 ":gpu_tool_utils",
1696 ":skia",
1697 ":tool_utils",
1698 "//third_party/jsoncpp",
1699 "//third_party/libmicrohttpd",
1700 "//third_party/libpng",
1701 ]
Mike Klein7d302882016-11-03 14:06:31 -04001702 }
mtkleinecbc5262016-09-22 11:51:24 -07001703 }
kjlubick14f984b2016-10-03 11:49:45 -07001704
Mike Kleine6682eb2017-01-05 10:54:57 -05001705 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001706 include_dirs = [
1707 "tools",
1708 "tools/debugger",
1709 ]
kjlubick14f984b2016-10-03 11:49:45 -07001710 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001711 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001712 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001713 "fuzz/FuzzGradients.cpp",
1714 "fuzz/FuzzParsePath.cpp",
1715 "fuzz/FuzzPathop.cpp",
1716 "fuzz/FuzzScaleToSides.cpp",
1717 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001718 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1719 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001720 "tools/UrlDataManager.cpp",
1721 "tools/debugger/SkDebugCanvas.cpp",
1722 "tools/debugger/SkDrawCommand.cpp",
1723 "tools/debugger/SkJsonWriteBuffer.cpp",
1724 "tools/debugger/SkObjectParser.cpp",
1725 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001726 ]
1727 deps = [
1728 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001729 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001730 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001731 "//third_party/jsoncpp",
1732 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001733 ]
kjlubick14f984b2016-10-03 11:49:45 -07001734 }
Mike Klein38312422016-10-05 15:41:01 -04001735
Mike Kleine6682eb2017-01-05 10:54:57 -05001736 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001737 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001738 rebase_path("tests/skia_test.cpp"),
1739 rebase_path("tests/Test.cpp"),
1740 ]
caryclark9feb6322016-10-25 08:58:26 -07001741 deps = [
1742 ":flags",
1743 ":gpu_tool_utils",
1744 ":skia",
1745 ":tool_utils",
1746 ]
caryclark9feb6322016-10-25 08:58:26 -07001747 }
1748
Mike Kleine6682eb2017-01-05 10:54:57 -05001749 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001750 sources = [
1751 "tools/DumpRecord.cpp",
1752 "tools/dump_record.cpp",
1753 ]
1754 deps = [
1755 ":flags",
1756 ":skia",
1757 ]
Mike Klein38312422016-10-05 15:41:01 -04001758 }
bungemanfe917272016-10-13 17:36:40 -04001759
Mike Kleine6682eb2017-01-05 10:54:57 -05001760 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001761 sources = [
1762 "tools/skdiff/skdiff.cpp",
1763 "tools/skdiff/skdiff_html.cpp",
1764 "tools/skdiff/skdiff_main.cpp",
1765 "tools/skdiff/skdiff_utils.cpp",
1766 ]
1767 deps = [
1768 ":skia",
1769 ":tool_utils",
1770 ]
bungemanfe917272016-10-13 17:36:40 -04001771 }
halcanarya73d76a2016-10-17 13:19:02 -07001772
Mike Kleine6682eb2017-01-05 10:54:57 -05001773 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001774 sources = [
1775 "tools/skp_parser.cpp",
1776 ]
1777 deps = [
1778 ":skia",
1779 ":tool_utils",
1780 "//third_party/jsoncpp",
1781 ]
halcanarya73d76a2016-10-17 13:19:02 -07001782 }
Brian Osman16adfa32016-10-18 14:42:44 -04001783
Hal Canaryd7b38452017-12-11 17:46:26 -05001784 if (!is_win && skia_enable_gpu) {
1785 test_lib("skqp_lib") {
1786 public_include_dirs = [ "tools/skqp" ]
Hal Canary75427132017-10-11 16:00:31 -04001787 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001788 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001789 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001790 "tools/skqp/gm_knowledge.cpp",
1791 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001792 ]
1793 deps = [
1794 ":gm",
1795 ":gpu_tool_utils",
1796 ":skia",
1797 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001798 ":tool_utils",
1799 ]
1800 }
1801 test_app("skqp") {
1802 sources = [
1803 "tools/skqp/skqp.cpp",
1804 ]
1805 deps = [
1806 ":skia",
1807 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04001808 "//third_party/googletest",
1809 ]
1810 }
1811 }
Hal Canary28f89382017-12-12 09:42:14 -05001812 if (is_android && skia_enable_gpu) {
1813 test_app("skqp_app") {
1814 is_shared_library = true
1815 sources = [
1816 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1817 ]
1818 deps = [
1819 ":skia",
1820 ":skqp_lib",
1821 ]
1822 libs = [ "android" ]
1823 }
1824 }
Hal Canary75427132017-10-11 16:00:31 -04001825
Hal Canarya9de7602018-01-19 13:08:23 -05001826 test_app("list_gms") {
1827 sources = [
1828 "tools/list_gms.cpp",
1829 ]
1830 deps = [
1831 ":gm",
1832 ":skia",
1833 ]
1834 }
1835 test_app("list_gpu_unit_tests") {
1836 sources = [
1837 "dm/DMGpuTestProcs.cpp",
1838 "tools/list_gpu_unit_tests.cpp",
1839 ]
1840 deps = [
1841 ":skia",
1842 ":tests",
1843 ]
1844 }
1845
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001846 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001847 test_lib("sk_app") {
1848 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001849 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001850 "tools/sk_app/CommandSet.cpp",
1851 "tools/sk_app/GLWindowContext.cpp",
1852 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001853 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001854 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001855
Jim Van Verth4e56a912016-10-21 10:58:52 -04001856 if (is_android) {
1857 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001858 "tools/sk_app/android/GLWindowContext_android.cpp",
1859 "tools/sk_app/android/RasterWindowContext_android.cpp",
1860 "tools/sk_app/android/Window_android.cpp",
1861 "tools/sk_app/android/main_android.cpp",
1862 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001863 ]
Brian Osman462334e2017-02-09 11:22:57 -05001864 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001865 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001866 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001867 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1868 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1869 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001870 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001871 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001872 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001873 libs += [
1874 "GL",
1875 "X11",
1876 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001877 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001878 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001879 "tools/sk_app/win/GLWindowContext_win.cpp",
1880 "tools/sk_app/win/RasterWindowContext_win.cpp",
1881 "tools/sk_app/win/Window_win.cpp",
1882 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001883 ]
Brian Salomon194db172017-08-17 14:37:06 -04001884 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001886 }
Mike Klein43c25262016-10-20 10:17:47 -04001887 } else if (is_mac) {
1888 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001889 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1890 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1891 "tools/sk_app/mac/Window_mac.cpp",
1892 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001893 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001894 libs += [
1895 "QuartzCore.framework",
1896 "Cocoa.framework",
1897 "Foundation.framework",
1898 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001899 } else if (is_ios) {
1900 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001901 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1902 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1903 "tools/sk_app/ios/Window_ios.cpp",
1904 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001905 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001906 }
1907
1908 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001909 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001910 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001911 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001912 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001913 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001914 libs += [ "X11-xcb" ]
1915 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001916 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001917 }
1918 }
1919
Brian Osman16adfa32016-10-18 14:42:44 -04001920 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001921 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001922 ":skia",
1923 ":tool_utils",
1924 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001925 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001926 if (is_android) {
1927 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001928 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001929 deps += [ "//third_party/libsdl" ]
1930 }
Brian Salomon194db172017-08-17 14:37:06 -04001931 if (skia_use_angle) {
1932 deps += [ "//third_party/angle2" ]
1933 }
Mike Kleina92c3832016-12-08 09:49:39 -05001934 }
Brian Osman16adfa32016-10-18 14:42:44 -04001935 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001936
Brian Osmaneff04b52017-11-21 13:18:02 -05001937 if (skia_enable_gpu) {
1938 test_app("viewer") {
1939 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001940 if (is_ios) {
1941 bundle_ios_data = true
1942 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001943 sources = [
1944 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001945 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001946 "tools/viewer/ImageSlide.cpp",
1947 "tools/viewer/SKPSlide.cpp",
1948 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001949 "tools/viewer/SkottieSlide.cpp",
1950 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001951 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001952 "tools/viewer/Viewer.cpp",
1953 ]
1954 libs = []
1955
1956 include_dirs = []
1957 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001958 ":experimental_skottie",
Brian Osmaneff04b52017-11-21 13:18:02 -05001959 ":flags",
1960 ":gm",
1961 ":gpu_tool_utils",
1962 ":samples",
1963 ":sk_app",
1964 ":skia",
1965 ":tool_utils",
1966 ":views",
1967 "//third_party/imgui",
1968 "//third_party/jsoncpp",
1969 ]
1970 }
1971 }
1972
1973 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1974 test_app("HelloWorld") {
1975 sources = [
1976 "example/HelloWorld.cpp",
1977 ]
1978 libs = []
1979
1980 include_dirs = []
1981 deps = [
1982 ":flags",
1983 ":gpu_tool_utils",
1984 ":sk_app",
1985 ":skia",
1986 ":tool_utils",
1987 ":views",
1988 ]
1989 }
1990 }
1991
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001992 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001993 test_app("SkiaSDLExample") {
1994 sources = [
1995 "example/SkiaSDLExample.cpp",
1996 ]
1997 libs = []
1998 include_dirs = []
1999 deps = [
2000 ":gpu_tool_utils",
2001 ":skia",
2002 "//third_party/libsdl",
2003 ]
2004 }
2005 }
2006
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002007 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2008 action_foreach("generate_mocs") {
2009 script = "gn/call.py"
2010 sources = [
2011 "tools/mdbviz/MainWindow.h",
2012 ]
2013 outputs = [
2014 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2015 ]
2016 args = [
2017 "$skia_qt_path" + "/bin/moc",
2018 "{{source}}",
2019 "-o",
2020 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2021 ]
2022 }
2023 action_foreach("generate_resources") {
2024 script = "gn/call.py"
2025 sources = [
2026 "tools/mdbviz/resources.qrc",
2027 ]
2028 outputs = [
2029 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2030 ]
2031 args = [
2032 "$skia_qt_path" + "/bin/rcc",
2033 "{{source}}",
2034 "-o",
2035 "gen/mdbviz/{{source_name_part}}_res.cpp",
2036 ]
2037 }
2038 test_app("mdbviz") {
2039 if (is_win) {
2040 # on Windows we need to disable some exception handling warnings due to the Qt headers
2041 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2042 }
2043 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002044 "tools/UrlDataManager.cpp",
2045 "tools/debugger/SkDebugCanvas.cpp",
2046 "tools/debugger/SkDrawCommand.cpp",
2047 "tools/debugger/SkJsonWriteBuffer.cpp",
2048 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002049 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002050 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002051 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002052 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002053
2054 # generated files
2055 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2056 "$target_gen_dir/mdbviz/resources_res.cpp",
2057 ]
2058 lib_dirs = [ "$skia_qt_path/lib" ]
2059 libs = [
2060 "Qt5Core.lib",
2061 "Qt5Gui.lib",
2062 "Qt5Widgets.lib",
2063 ]
2064 include_dirs = [
2065 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002066 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002067 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002068 "tools",
2069 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002070 ]
2071 deps = [
2072 ":generate_mocs",
2073 ":generate_resources",
2074 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002075 "//third_party/jsoncpp",
2076 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002077 ]
2078 }
2079 }
2080
Mike Kleine459afd2017-03-03 09:21:30 -05002081 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002082 copy("gdbserver") {
2083 sources = [
2084 "$ndk/$ndk_gdbserver",
2085 ]
2086 outputs = [
2087 "$root_out_dir/gdbserver",
2088 ]
2089 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002090 }
mtklein25c81d42016-07-27 13:55:26 -07002091}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002092
2093if (skia_jumper_clang != "") {
2094 action("regen_jumper") {
2095 script = "src/jumper/build_stages.py"
2096
2097 inputs = [
2098 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002099 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002100 ]
2101
2102 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2103 outputs = [
2104 "$target_out_dir/" +
2105 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2106 "$target_out_dir/" +
2107 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2108 ]
2109
2110 args = [
2111 skia_jumper_clang,
2112 skia_jumper_objdump,
2113 skia_jumper_ccache,
2114 ] + rebase_path(inputs) + rebase_path(outputs)
2115 }
2116}