blob: 9ffdabf780e202ca51785e2151488326aac3056c [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 Klein38af9432016-11-11 11:39:44 -050028 skia_use_lua = false
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
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050035 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050036 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040037 skia_enable_flutter_defines = false
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040043 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040044 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040045 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070046 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040047
48 skia_jumper_clang = ""
49 skia_jumper_objdump = ""
50 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070051}
Brian Salomon23d73ea2016-10-27 13:31:37 -040052declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040053 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040054 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050055 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040056
Mike Klein4d598a32016-10-31 13:44:49 -040057 if (is_android) {
58 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070059 } else if (is_fuchsia) {
60 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040061 } else {
62 skia_use_vulkan = skia_vulkan_sdk != ""
63 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040064}
Greg Danielec6ae522017-04-25 13:38:26 -040065declare_args() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000066 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040067 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000068 # 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 -040069 if (is_fuchsia) {
70 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
71 } else if (is_linux || is_win) {
72 skia_vulkan_headers = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040073 }
Greg Danielec6ae522017-04-25 13:38:26 -040074 }
75}
Brian Salomon789e25e2016-09-30 13:41:03 -040076
Adam Barth54ef74a2017-10-13 10:59:38 -070077if (defined(skia_settings)) {
78 import(skia_settings)
79}
80
mtklein38925aa2016-09-21 10:11:25 -070081# Our tools require static linking (they use non-exported symbols).
82skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070083
mtkleina45be612016-08-29 15:22:10 -070084fontmgr_android_enabled = skia_use_expat && skia_use_freetype
85
mtklein1211e0c2016-07-26 13:55:45 -070086skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070087 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070088 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070089 "include/codec",
90 "include/config",
91 "include/core",
92 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040093 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070094 "include/gpu",
95 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050096 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/pathops",
98 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070099 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/utils",
101 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700102]
103
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000104if (skia_use_vulkan) {
105 skia_public_includes += [ "include/gpu/vk" ]
106}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107if (skia_enable_atlas_text) {
108 skia_public_includes += [ "include/atlastext" ]
109}
Greg Daniele5ddff52017-07-05 16:49:36 -0400110if (skia_use_metal) {
111 skia_public_includes += [ "include/gpu/mtl" ]
112}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113
mtkleinc04ff472016-06-23 10:29:30 -0700114# Skia public API, generally provided by :skia.
115config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700116 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -0400117 if (skia_vulkan_headers != "") {
118 include_dirs += [ skia_vulkan_headers ]
119 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400120 defines = []
121 if (is_component_build) {
122 defines += [ "SKIA_DLL" ]
123 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400124 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700125 defines += [ "SK_SAMPLES_FOR_X" ]
126 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400127 if (skia_enable_flutter_defines) {
128 defines += flutter_defines
129 }
mtklein06c35c02016-09-20 12:28:12 -0700130 if (!skia_enable_gpu) {
131 defines += [ "SK_SUPPORT_GPU=0" ]
132 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500133 if (skia_enable_atlas_text) {
134 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
135 }
mtkleinc04ff472016-06-23 10:29:30 -0700136}
137
138# Skia internal APIs, used by Skia itself and a few test tools.
139config("skia_private") {
140 visibility = [ ":*" ]
141
142 include_dirs = [
143 "include/private",
144 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700145 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700146 "src/core",
147 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700148 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/image",
150 "src/images",
151 "src/lazy",
152 "src/opts",
153 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700154 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/ports",
156 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400157 "src/shaders",
158 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700159 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700161 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500162 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700163 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700164 ]
mtklein150d1132016-08-01 06:56:40 -0700165
Mike Reeda9e241d2017-05-03 10:52:00 -0400166 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700167 if (is_android) {
168 defines += [
169 "SK_GAMMA_EXPONENT=1.4",
170 "SK_GAMMA_CONTRAST=0.0",
171 ]
172 }
mtklein88a7ac02016-09-14 11:16:49 -0700173 if (is_official_build || is_android) {
174 # TODO(bsalomon): it'd be nice to make Android normal.
175 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
176 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400177 libs = []
178 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500179 if (skia_enable_gpu) {
180 include_dirs += [ "src/gpu" ]
181 }
Brian Osman34755e22016-12-05 09:46:02 -0500182 if (skia_use_angle) {
183 defines += [ "SK_ANGLE" ]
184 }
Brian Osman3f375d02016-12-28 11:19:22 -0500185 if (skia_enable_discrete_gpu) {
186 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
187 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400188 if (!is_official_build) {
189 defines += [ "GR_TEST_UTILS=1" ]
190 }
mtkleinc04ff472016-06-23 10:29:30 -0700191}
192
193# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
194config("skia_library") {
195 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700196 defines = [ "SKIA_IMPLEMENTATION=1" ]
197}
198
199skia_library_configs = [
200 ":skia_public",
201 ":skia_private",
202 ":skia_library",
203]
204
mtklein9b8583d2016-08-24 17:32:30 -0700205# Use for CPU-specific Skia code that needs particular compiler flags.
206template("opts") {
207 if (invoker.enabled) {
208 source_set(target_name) {
209 forward_variables_from(invoker, "*")
210 configs += skia_library_configs
211 }
212 } else {
213 # If not enabled, a phony empty target that swallows all otherwise unused variables.
214 source_set(target_name) {
215 forward_variables_from(invoker,
216 "*",
217 [
218 "sources",
219 "cflags",
220 ])
221 }
222 }
anmittala7eaf2e2016-08-17 13:57:26 -0700223}
224
mtklein422310d2016-08-16 18:28:43 -0700225is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700226
mtklein7d6fb2c2016-08-25 14:50:44 -0700227opts("none") {
228 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700230 cflags = []
231}
232
mtklein7d6fb2c2016-08-25 14:50:44 -0700233opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700234 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700236 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700237}
238
239opts("arm64") {
240 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700242 cflags = []
243}
244
245opts("crc32") {
246 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700248 cflags = [ "-march=armv8-a+crc" ]
249}
250
mtklein9b8583d2016-08-24 17:32:30 -0700251opts("sse2") {
252 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400254 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400255 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
256 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400257 cflags = [ "-msse2" ]
258 }
mtklein9b8583d2016-08-24 17:32:30 -0700259}
mtkleinc04ff472016-06-23 10:29:30 -0700260
mtklein9b8583d2016-08-24 17:32:30 -0700261opts("ssse3") {
262 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.ssse3_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_SSSE3" ]
266 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400267 cflags = [ "-mssse3" ]
268 }
mtklein9b8583d2016-08-24 17:32:30 -0700269}
mtkleinc04ff472016-06-23 10:29:30 -0700270
mtklein9b8583d2016-08-24 17:32:30 -0700271opts("sse41") {
272 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700273 sources = skia_opts.sse41_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_SSE41" ]
276 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400277 cflags = [ "-msse4.1" ]
278 }
mtklein9b8583d2016-08-24 17:32:30 -0700279}
mtklein4e976072016-08-08 09:06:27 -0700280
mtklein9b8583d2016-08-24 17:32:30 -0700281opts("sse42") {
282 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700283 sources = skia_opts.sse42_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_SSE42" ]
286 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400287 cflags = [ "-msse4.2" ]
288 }
mtklein9b8583d2016-08-24 17:32:30 -0700289}
290
291opts("avx") {
292 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700293 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400294 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000295 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400296 } else {
297 cflags = [ "-mavx" ]
298 }
mtkleinc04ff472016-06-23 10:29:30 -0700299}
300
mtkleinc095df52016-08-24 12:23:52 -0700301# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700302template("optional") {
303 if (invoker.enabled) {
304 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700305 if (defined(invoker.public_defines)) {
306 defines = invoker.public_defines
307 }
mtklein457b42a2016-08-23 13:56:37 -0700308 }
309 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700310 forward_variables_from(invoker,
311 "*",
312 [
313 "public_defines",
314 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700315 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700316 ])
mtklein457b42a2016-08-23 13:56:37 -0700317 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700318 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700319 if (defined(invoker.configs_to_remove)) {
320 configs -= invoker.configs_to_remove
321 }
mtklein457b42a2016-08-23 13:56:37 -0700322 }
323 } else {
mtklein457b42a2016-08-23 13:56:37 -0700324 source_set(target_name) {
325 forward_variables_from(invoker,
326 "*",
327 [
328 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700329 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700330 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700331 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700332 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700333 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700334 ])
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.sources_when_disabled)) {
336 sources = invoker.sources_when_disabled
337 }
338 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700339 }
mtkleineb3c4252016-08-23 07:38:09 -0700340 }
mtklein457b42a2016-08-23 13:56:37 -0700341}
mtklein457b42a2016-08-23 13:56:37 -0700342
Mike Kleina04bb452017-02-09 12:24:07 -0500343optional("effects") {
344 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400345 deps = [
346 ":compile_processors",
347 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500348 sources =
349 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
350 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
351}
352
mtkleina45be612016-08-29 15:22:10 -0700353optional("fontmgr_android") {
354 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700355
356 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500357 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700358 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700359 ]
360 sources = [
361 "src/ports/SkFontMgr_android.cpp",
362 "src/ports/SkFontMgr_android_factory.cpp",
363 "src/ports/SkFontMgr_android_parser.cpp",
364 ]
365}
366
mtkleind2e39db2016-09-07 07:52:55 -0700367optional("fontmgr_custom") {
368 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700372 ]
373 sources = [
374 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500375 "src/ports/SkFontMgr_custom.h",
376 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700377 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500378 "src/ports/SkFontMgr_custom_embedded.cpp",
379 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700380 ]
381}
382
mtklein3cc22182016-08-29 13:26:14 -0700383optional("fontmgr_fontconfig") {
384 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700388 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700389 ]
390 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700391 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700392 "src/ports/SkFontConfigInterface_direct.cpp",
393 "src/ports/SkFontConfigInterface_direct_factory.cpp",
394 "src/ports/SkFontMgr_FontConfigInterface.cpp",
395 "src/ports/SkFontMgr_fontconfig.cpp",
396 "src/ports/SkFontMgr_fontconfig_factory.cpp",
397 ]
398}
399
mtkleincdedd0e2016-09-12 15:15:44 -0700400optional("fontmgr_fuchsia") {
401 enabled = is_fuchsia && skia_use_freetype
402
403 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500404 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700405 ]
406 sources = [
407 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 "src/ports/SkFontMgr_custom_empty_factory.cpp",
410 ]
411}
412
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700413if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400414 executable("sksllex") {
415 sources = [
416 "src/sksl/lex/Main.cpp",
417 "src/sksl/lex/NFA.cpp",
418 "src/sksl/lex/RegexNode.cpp",
419 "src/sksl/lex/RegexParser.cpp",
420 ]
421 include_dirs = [ "src/sksl/lex" ]
422 }
423
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700424 action("run_sksllex") {
425 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400426 deps = [
427 ":sksllex(//gn/toolchain:$host_toolchain)",
428 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700429 sources = [
430 "src/sksl/lex/layout.lex",
431 "src/sksl/lex/sksl.lex",
432 ]
433
434 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
435 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
436 outputs = [
437 "$target_out_dir/" +
438 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
439 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
440 # confused due to the same file being named by two different paths
441 ]
442 sksllex_path = "$root_out_dir/"
443 sksllex_path += "sksllex"
444 if (host_os == "win") {
445 sksllex_path += ".exe"
446 }
447 args = [
448 rebase_path(sksllex_path),
449 rebase_path("bin/clang-format"),
450 rebase_path("src"),
451 ]
452 }
453} else {
454 group("run_sksllex") {
455 }
456}
457
458if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400459 executable("skslc") {
460 defines = [ "SKSL_STANDALONE" ]
461 sources = [
462 "src/sksl/SkSLMain.cpp",
463 ]
464 sources += skia_sksl_sources
465 include_dirs = [
466 "src/gpu",
467 "src/sksl",
468 ]
469 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500470 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400471 "//third_party/spirv-tools",
472 ]
473 }
474
475 skia_gpu_processor_outputs = []
476 foreach(src, skia_gpu_processor_sources) {
477 dir = get_path_info(src, "dir")
478 name = get_path_info(src, "name")
479
480 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
481 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
482 skia_gpu_processor_outputs += [
483 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
484 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
485 # confused due to the same file being named by two different paths
486 ]
487 }
488
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500489 action("create_sksl_enums") {
490 script = "gn/create_sksl_enums.py"
491 sources = [
492 "include/private/GrSharedEnums.h",
493 ]
494 outputs = [
495 "$target_out_dir/" +
496 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
497 ]
498 args = [
499 rebase_path(sources[0]),
500 rebase_path(outputs[0]),
501 ]
502 }
503
Ethan Nicholas762466e2017-06-29 10:03:38 -0400504 action("compile_processors") {
505 script = "gn/compile_processors.py"
506 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 ":skslc(//gn/toolchain:$host_toolchain)",
509 ]
510 sources = skia_gpu_processor_sources
511 outputs = skia_gpu_processor_outputs
512 skslc_path = "$root_out_dir/"
513 if (host_toolchain != default_toolchain_name) {
514 skslc_path += "$host_toolchain/"
515 }
516 skslc_path += "skslc"
517 if (host_os == "win") {
518 skslc_path += ".exe"
519 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400520 args = [
521 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400522 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400523 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400524 args += rebase_path(skia_gpu_processor_sources)
525 }
526} else {
527 skia_gpu_processor_outputs = []
528 group("compile_processors") {
529 }
530}
531
mtklein06c35c02016-09-20 12:28:12 -0700532optional("gpu") {
533 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400534 deps = [
535 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700536 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400537 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700538 public_defines = []
539
Mike Klein29b3e582017-02-09 11:57:32 -0500540 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
542 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700543
544 # These paths need to be absolute to match the ones produced by shared_sources.gni.
545 sources -= get_path_info([
546 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
547 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
548 ],
549 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400550 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700551 if (is_android) {
552 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400553
554 # this lib is required to link against AHardwareBuffer
555 if (defined(ndk_api) && ndk_api >= 26) {
556 libs += [ "android" ]
557 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400558 } else if (skia_use_egl) {
559 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
560 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700561 } else if (is_linux) {
562 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500563 libs += [
564 "GL",
565 "GLU",
566 ]
mtklein06c35c02016-09-20 12:28:12 -0700567 } else if (is_mac) {
568 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800569 } else if (is_ios) {
570 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400571 } else if (is_win) {
572 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
573 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700574 } else {
575 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
576 }
mtkleine9fb3d52016-09-20 15:11:46 -0700577
578 if (skia_use_vulkan) {
579 public_defines += [ "SK_VULKAN" ]
580 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700581 if (skia_enable_vulkan_debug_layers) {
582 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
583 }
mtkleine9fb3d52016-09-20 15:11:46 -0700584 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400585 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400586 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400587 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
588 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400589
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400590 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400591 if (skia_use_metal) {
592 public_defines += [ "SK_METAL" ]
593 sources += skia_metal_sources
594 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400595 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400596 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500597
598 if (skia_enable_atlas_text) {
599 sources += skia_atlas_text_sources
600 }
mtklein06c35c02016-09-20 12:28:12 -0700601}
602
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400603optional("heif") {
604 enabled = skia_use_libheif
605 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
606
607 deps = []
608
609 sources = [
610 "src/codec/SkHeifCodec.cpp",
611 ]
612}
613
mtklein63213812016-08-24 09:55:56 -0700614optional("jpeg") {
615 enabled = skia_use_libjpeg_turbo
616 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
617
mtklein63213812016-08-24 09:55:56 -0700618 deps = [
619 "//third_party/libjpeg-turbo:libjpeg",
620 ]
621 sources = [
622 "src/codec/SkJpegCodec.cpp",
623 "src/codec/SkJpegDecoderMgr.cpp",
624 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700625 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400626 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700627 ]
628}
629
630optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500631 enabled = skia_use_zlib && skia_enable_pdf
632 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700633
mtklein63213812016-08-24 09:55:56 -0700634 deps = [
635 "//third_party/zlib",
636 ]
brettwb9447282016-09-01 14:24:39 -0700637 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700638 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700639
640 if (skia_use_sfntly) {
641 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500642 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700643 }
644}
645
646optional("png") {
647 enabled = skia_use_libpng
648 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
649
mtklein63213812016-08-24 09:55:56 -0700650 deps = [
651 "//third_party/libpng",
652 ]
653 sources = [
654 "src/codec/SkIcoCodec.cpp",
655 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400656 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700657 ]
658}
659
scroggof84ad642016-10-31 09:02:57 -0700660optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400661 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700662 public_defines = [ "SK_CODEC_DECODES_RAW" ]
663
664 deps = [
665 "//third_party/dng_sdk",
666 "//third_party/libjpeg-turbo:libjpeg",
667 "//third_party/piex",
668 ]
669
670 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
671 # Skia.
672 configs_to_remove = [ "//gn:no_exceptions" ]
673
674 sources = [
675 "src/codec/SkRawAdapterCodec.cpp",
676 "src/codec/SkRawCodec.cpp",
677 ]
678}
679
mtklein3cc22182016-08-29 13:26:14 -0700680optional("typeface_freetype") {
681 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700682
683 deps = [
684 "//third_party/freetype2",
685 ]
686 sources = [
687 "src/ports/SkFontHost_FreeType.cpp",
688 "src/ports/SkFontHost_FreeType_common.cpp",
689 ]
690}
691
mtklein457b42a2016-08-23 13:56:37 -0700692optional("webp") {
693 enabled = skia_use_libwebp
694 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
695
mtklein457b42a2016-08-23 13:56:37 -0700696 deps = [
697 "//third_party/libwebp",
698 ]
699 sources = [
700 "src/codec/SkWebpAdapterCodec.cpp",
701 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400702 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700703 ]
mtkleineb3c4252016-08-23 07:38:09 -0700704}
705
mtklein63213812016-08-24 09:55:56 -0700706optional("xml") {
707 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000708 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700709
mtklein63213812016-08-24 09:55:56 -0700710 deps = [
711 "//third_party/expat",
712 ]
713 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500714 "src/svg/SkSVGCanvas.cpp",
715 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700716 "src/xml/SkDOM.cpp",
717 "src/xml/SkXMLParser.cpp",
718 "src/xml/SkXMLWriter.cpp",
719 ]
720}
721
mtkleinc04ff472016-06-23 10:29:30 -0700722component("skia") {
723 public_configs = [ ":skia_public" ]
724 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700725
726 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700727 ":arm64",
728 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700729 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700730 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500731 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700732 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700733 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700734 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700735 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700736 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400737 ":heif",
mtklein63213812016-08-24 09:55:56 -0700738 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700739 ":none",
mtklein63213812016-08-24 09:55:56 -0700740 ":pdf",
741 ":png",
scroggof84ad642016-10-31 09:02:57 -0700742 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700743 ":sse2",
744 ":sse41",
745 ":sse42",
746 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700747 ":webp",
mtklein63213812016-08-24 09:55:56 -0700748 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700749 ]
750
Chinmay Garde43f115c2016-11-16 15:04:12 -0800751 # This file (and all GN files in Skia) are designed to work with an
752 # empty sources assignment filter; we handle all that explicitly.
753 # We clear the filter here for clients who may have set up a global filter.
754 set_sources_assignment_filter([])
755
mtkleinc04ff472016-06-23 10:29:30 -0700756 sources = []
brettwb9447282016-09-01 14:24:39 -0700757 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700758 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500759 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700760 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400761 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700762 "src/android/SkBitmapRegionCodec.cpp",
763 "src/android/SkBitmapRegionDecoder.cpp",
764 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400765 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700766 "src/codec/SkBmpCodec.cpp",
767 "src/codec/SkBmpMaskCodec.cpp",
768 "src/codec/SkBmpRLECodec.cpp",
769 "src/codec/SkBmpStandardCodec.cpp",
770 "src/codec/SkCodec.cpp",
771 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700772 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700773 "src/codec/SkMaskSwizzler.cpp",
774 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700775 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700776 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700777 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700778 "src/codec/SkSwizzler.cpp",
779 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700780 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700781 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700782 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700783 "src/ports/SkMemory_malloc.cpp",
784 "src/ports/SkOSFile_stdio.cpp",
785 "src/sfnt/SkOTTable_name.cpp",
786 "src/sfnt/SkOTUtils.cpp",
787 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700788 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700789 ]
brettwb9447282016-09-01 14:24:39 -0700790
mtklein7d6fb2c2016-08-25 14:50:44 -0700791 libs = []
792
mtkleinc04ff472016-06-23 10:29:30 -0700793 if (is_win) {
794 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400795 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700796 "src/ports/SkDebug_win.cpp",
797 "src/ports/SkFontHost_win.cpp",
798 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500799 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700800 "src/ports/SkImageEncoder_WIC.cpp",
801 "src/ports/SkImageGeneratorWIC.cpp",
802 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700803 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700804 "src/ports/SkScalerContext_win_dw.cpp",
805 "src/ports/SkTLS_win.cpp",
806 "src/ports/SkTypeface_win_dw.cpp",
807 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400808 libs += [
809 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500810 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400811 "Ole32.lib",
812 "OleAut32.lib",
813 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500814 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400815 ]
mtkleinc04ff472016-06-23 10:29:30 -0700816 } else {
817 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700818 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700819 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/ports/SkTLS_pthread.cpp",
821 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400822 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700823 }
824
mtklein7d6fb2c2016-08-25 14:50:44 -0700825 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500826 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500827 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500828 deps += [ "//third_party/cpu-features" ]
829 }
mtklein06c35c02016-09-20 12:28:12 -0700830 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700831 libs += [
832 "EGL",
833 "GLESv2",
834 "log",
835 ]
836 }
837
mtkleinc04ff472016-06-23 10:29:30 -0700838 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700839 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700840 }
841
842 if (is_mac) {
843 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700844 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700845 "src/ports/SkFontHost_mac.cpp",
846 "src/ports/SkImageEncoder_CG.cpp",
847 "src/ports/SkImageGeneratorCG.cpp",
848 ]
mtklein09e61f72016-08-23 13:35:28 -0700849 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400850 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
851 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700852 "ApplicationServices.framework",
853 "OpenGL.framework",
854 ]
mtkleinc04ff472016-06-23 10:29:30 -0700855 }
abarth6fc8ff02016-07-15 15:15:15 -0700856
Mike Klein7d302882016-11-03 14:06:31 -0400857 if (is_ios) {
858 sources += [
859 "src/ports/SkDebug_stdio.cpp",
860 "src/ports/SkFontHost_mac.cpp",
861 "src/ports/SkImageEncoder_CG.cpp",
862 "src/ports/SkImageGeneratorCG.cpp",
863 ]
864 libs += [
865 "CoreFoundation.framework",
866 "CoreGraphics.framework",
867 "CoreText.framework",
868 "ImageIO.framework",
869 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400870
871 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
872 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400873 ]
874 }
875
abarth6fc8ff02016-07-15 15:15:15 -0700876 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700877 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700878 }
mtkleinc04ff472016-06-23 10:29:30 -0700879}
880
mtkleinc095df52016-08-24 12:23:52 -0700881# Targets guarded by skia_enable_tools may use //third_party freely.
882if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500883 # Used by gn_to_bp.py to list our public include dirs.
884 source_set("public") {
885 configs += [ ":skia_public" ]
886 }
887
Mike Kleinc36dedf2016-11-18 09:35:28 -0500888 config("skia.h_config") {
889 include_dirs = [ "$target_gen_dir" ]
890 }
891 action("skia.h") {
892 public_configs = [ ":skia.h_config" ]
893 skia_h = "$target_gen_dir/skia.h"
894 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400895 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000896 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500897 depfile = "$skia_h.deps"
898 outputs = [
899 skia_h,
900 ]
901 }
902
903 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500904 executable("fiddle") {
905 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500906 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500907 "tools/fiddle/draw.cpp",
908 "tools/fiddle/fiddle_main.cpp",
909 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400910
911 if (skia_use_egl) {
912 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400913 } else {
914 sources += [ "tools/fiddle/null_context.cpp" ]
915 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400916 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500917 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400918 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500919 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500920 ":skia",
921 ":skia.h",
922 ]
923 }
924 }
925
926 if (skia_enable_gpu) {
927 source_set("public_headers_warnings_check") {
928 sources = [
929 "tools/public_headers_warnings_check.cpp",
930 ]
931 configs -= [ "//gn:warnings_except_public_headers" ]
932 deps = [
933 ":skia",
934 ":skia.h",
935 ]
936 }
937 }
938
mtkleinc095df52016-08-24 12:23:52 -0700939 template("test_lib") {
940 config(target_name + "_config") {
941 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700942 if (defined(invoker.public_defines)) {
943 defines = invoker.public_defines
944 }
mtklein25c81d42016-07-27 13:55:26 -0700945 }
mtkleinc095df52016-08-24 12:23:52 -0700946 source_set(target_name) {
947 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
948 public_configs = [
949 ":" + target_name + "_config",
950 ":skia_private",
951 ]
952
953 if (!defined(deps)) {
954 deps = []
955 }
956 deps += [ ":skia" ]
957 testonly = true
958 }
mtklein25c81d42016-07-27 13:55:26 -0700959 }
mtklein25c81d42016-07-27 13:55:26 -0700960
Mike Kleine6682eb2017-01-05 10:54:57 -0500961 template("test_app") {
962 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
963 shared_library("lib" + target_name) {
964 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400965 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500966 testonly = true
967 }
968 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500969 _executable = target_name
970 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500971 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400972 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500973 testonly = true
974 }
975 }
Mike Klein7d921032017-01-05 12:20:41 -0500976 if (is_android && skia_android_serial != "" && defined(_executable)) {
977 action("push_" + target_name) {
978 script = "gn/push_to_android.py"
979 deps = [
980 ":" + _executable,
981 ]
982 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
983 outputs = [
984 _stamp,
985 ]
986 args = [
987 rebase_path("$root_build_dir/$_executable"),
988 skia_android_serial,
989 rebase_path(_stamp),
990 ]
991 testonly = true
992 }
993 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500994 }
995
mtkleinc095df52016-08-24 12:23:52 -0700996 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700997 public_include_dirs = []
998 if (skia_enable_gpu) {
999 public_defines = []
1000 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001001
1002 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001003 sources = [
1004 "tools/gpu/GrContextFactory.cpp",
1005 "tools/gpu/GrTest.cpp",
1006 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001007 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001008 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001009 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001010 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1011 "tools/gpu/gl/debug/GrBufferObj.cpp",
1012 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1013 "tools/gpu/gl/debug/GrProgramObj.cpp",
1014 "tools/gpu/gl/debug/GrShaderObj.cpp",
1015 "tools/gpu/gl/debug/GrTextureObj.cpp",
1016 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1017 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001018 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001019 ]
1020 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001021
Kevin Lubick4a24e102017-03-29 11:19:01 -04001022 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001023 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001024 } else if (is_ios) {
1025 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1026 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001027 } else if (is_linux) {
1028 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001029 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001030 } else if (is_mac) {
1031 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001032 } else if (is_win) {
1033 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1034 libs += [
1035 "Gdi32.lib",
1036 "OpenGL32.lib",
1037 ]
mtklein38925aa2016-09-21 10:11:25 -07001038 }
mtklein6ef69992016-09-14 06:12:09 -07001039
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001040 cflags_objcc = [ "-fobjc-arc" ]
1041
Mike Kleinc168a3a2016-11-14 14:53:13 +00001042 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001043 deps += [ "//third_party/angle2" ]
1044 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1045 }
mtkleind68f9b02016-09-23 13:18:41 -07001046 if (skia_use_vulkan) {
1047 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001048 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001049 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001050 if (skia_use_metal) {
1051 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1052 }
mtkleina627b5c2016-09-20 13:36:47 -07001053 }
mtklein25c81d42016-07-27 13:55:26 -07001054 }
mtklein25c81d42016-07-27 13:55:26 -07001055
mtkleinc095df52016-08-24 12:23:52 -07001056 test_lib("flags") {
1057 public_include_dirs = [ "tools/flags" ]
1058 sources = [
1059 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001060 ]
1061 }
1062 test_lib("common_flags") {
1063 public_include_dirs = [ "tools/flags" ]
1064 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001065 "tools/flags/SkCommonFlags.cpp",
1066 "tools/flags/SkCommonFlagsConfig.cpp",
1067 ]
1068 deps = [
mtklein046cb562016-09-16 10:23:12 -07001069 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001070 ":gpu_tool_utils",
1071 ]
1072 }
mtklein25c81d42016-07-27 13:55:26 -07001073
mtkleinc095df52016-08-24 12:23:52 -07001074 test_lib("tool_utils") {
1075 public_include_dirs = [
1076 "tools",
1077 "tools/debugger",
1078 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001079 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001080 ]
1081 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001082 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001083 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001084 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001085 "tools/ProcStats.cpp",
1086 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001087 "tools/SkRandomScalerContext.cpp",
1088 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001089 "tools/ThermalManager.cpp",
1090 "tools/UrlDataManager.cpp",
1091 "tools/debugger/SkDebugCanvas.cpp",
1092 "tools/debugger/SkDrawCommand.cpp",
1093 "tools/debugger/SkJsonWriteBuffer.cpp",
1094 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001095 "tools/picture_utils.cpp",
1096 "tools/random_parse_path.cpp",
1097 "tools/sk_tool_utils.cpp",
1098 "tools/sk_tool_utils_font.cpp",
1099 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001100 "tools/trace/SkChromeTracingTracer.cpp",
1101 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001102 "tools/trace/SkDebugfTracer.cpp",
1103 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001104 "tools/trace/SkEventTracingPriv.cpp",
1105 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001106 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001107 libs = []
1108 if (is_ios) {
1109 sources += [ "tools/ios_utils.m" ]
1110 libs += [ "Foundation.framework" ]
1111 }
mtkleinc095df52016-08-24 12:23:52 -07001112 deps = [
mtklein046cb562016-09-16 10:23:12 -07001113 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001114 ":flags",
1115 "//third_party/libpng",
1116 ]
1117 public_deps = [
1118 "//third_party/jsoncpp",
1119 ]
1120 }
mtklein25c81d42016-07-27 13:55:26 -07001121
Mike Klein6e744122016-10-27 12:21:40 -04001122 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001123 test_lib("gm") {
1124 public_include_dirs = [ "gm" ]
1125 sources = gm_sources
1126 deps = [
scroggo19b91532016-10-24 09:03:26 -07001127 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001128 ":gpu_tool_utils",
1129 ":skia",
1130 ":tool_utils",
1131 ]
1132 }
mtklein25c81d42016-07-27 13:55:26 -07001133
Mike Klein6e744122016-10-27 12:21:40 -04001134 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001135 test_lib("tests") {
1136 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001137 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001138 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001139 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001140 }
mtkleinc095df52016-08-24 12:23:52 -07001141 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001142 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001143 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001144 ":skia",
1145 ":tool_utils",
1146 "//third_party/libpng",
1147 "//third_party/zlib",
1148 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001149 public_deps = [
1150 ":gpu_tool_utils", # Test.h #includes headers from this target.
1151 ]
mtkleinc095df52016-08-24 12:23:52 -07001152 }
mtklein2f3416d2016-08-02 16:02:05 -07001153
Mike Klein6e744122016-10-27 12:21:40 -04001154 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001155 test_lib("bench") {
1156 public_include_dirs = [ "bench" ]
1157 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001158 deps = [
1159 ":flags",
1160 ":gm",
1161 ":gpu_tool_utils",
1162 ":skia",
1163 ":tool_utils",
1164 ]
1165 }
mtklein2b6870c2016-07-28 14:17:33 -07001166
mtkleinc095df52016-08-24 12:23:52 -07001167 test_lib("experimental_svg_model") {
1168 public_include_dirs = [ "experimental/svg/model" ]
1169 sources = [
1170 "experimental/svg/model/SkSVGAttribute.cpp",
1171 "experimental/svg/model/SkSVGAttributeParser.cpp",
1172 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001173 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001174 "experimental/svg/model/SkSVGContainer.cpp",
1175 "experimental/svg/model/SkSVGDOM.cpp",
1176 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001177 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001178 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001179 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001180 "experimental/svg/model/SkSVGNode.cpp",
1181 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001182 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001183 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001184 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001185 "experimental/svg/model/SkSVGRect.cpp",
1186 "experimental/svg/model/SkSVGRenderContext.cpp",
1187 "experimental/svg/model/SkSVGSVG.cpp",
1188 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001189 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001190 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001191 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001192 "experimental/svg/model/SkSVGValue.cpp",
1193 ]
1194 deps = [
1195 ":skia",
1196 ]
1197 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001198
Kevin Lubickebf648e2017-09-21 13:45:16 -04001199 if (target_cpu != "wasm") {
1200 test_lib("views") {
1201 public_include_dirs = [ "include/views" ]
1202 sources = [
1203 "src/views/SkEvent.cpp",
1204 "src/views/SkEventSink.cpp",
1205 "src/views/SkOSMenu.cpp",
1206 "src/views/SkTagList.cpp",
1207 "src/views/SkTouchGesture.cpp",
1208 "src/views/SkView.cpp",
1209 "src/views/SkViewPriv.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001210 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001211 libs = []
1212 deps = []
1213 if (!is_android) {
1214 sources += [ "src/views/SkWindow.cpp" ]
1215 }
1216 if (is_linux) {
1217 public_include_dirs += [ "src/views/unix" ]
1218 sources += [
1219 "src/views/unix/SkOSWindow_Unix.cpp",
1220 "src/views/unix/keysym2ucs.c",
1221 ]
1222 libs += [
1223 "GL",
1224 "X11",
1225 ]
1226 } else if (is_mac) {
1227 sources += [
1228 "src/views/mac/SkEventNotifier.mm",
1229 "src/views/mac/SkNSView.mm",
1230 "src/views/mac/SkOSWindow_Mac.mm",
1231 "src/views/mac/SkTextFieldCell.m",
1232 ]
1233 libs += [
1234 "QuartzCore.framework",
1235 "Cocoa.framework",
1236 "Foundation.framework",
1237 ]
1238 } else if (is_win) {
1239 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1240 } else if (is_ios) {
1241 sources += [ "src/views/mac/SkEventNotifier.mm" ]
1242 }
1243 if (skia_use_angle) {
1244 deps += [ "//third_party/angle2" ]
1245 }
Brian Osman34755e22016-12-05 09:46:02 -05001246 }
Brian Osman16adfa32016-10-18 14:42:44 -04001247 }
1248
Mike Klein38af9432016-11-11 11:39:44 -05001249 if (skia_use_lua) {
1250 test_lib("lua") {
1251 public_include_dirs = []
1252 sources = [
1253 "src/utils/SkLua.cpp",
1254 "src/utils/SkLuaCanvas.cpp",
1255 ]
1256 deps = [
1257 "//third_party/lua",
1258 ]
1259 }
1260
Mike Kleine6682eb2017-01-05 10:54:57 -05001261 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001262 sources = [
1263 "tools/lua/lua_app.cpp",
1264 ]
1265 deps = [
1266 ":lua",
1267 ":skia",
1268 "//third_party/lua",
1269 ]
Mike Klein38af9432016-11-11 11:39:44 -05001270 }
1271
Mike Kleine6682eb2017-01-05 10:54:57 -05001272 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001273 sources = [
1274 "tools/lua/lua_pictures.cpp",
1275 ]
1276 deps = [
1277 ":flags",
1278 ":lua",
1279 ":skia",
1280 ":tool_utils",
1281 "//third_party/lua",
1282 ]
Mike Klein38af9432016-11-11 11:39:44 -05001283 }
1284 }
1285
Cary Clark8032b982017-07-28 11:04:54 -04001286 test_app("bookmaker") {
1287 sources = [
1288 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001289 "tools/bookmaker/cataloger.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001290 "tools/bookmaker/fiddleParser.cpp",
1291 "tools/bookmaker/includeParser.cpp",
1292 "tools/bookmaker/includeWriter.cpp",
1293 "tools/bookmaker/mdOut.cpp",
1294 "tools/bookmaker/parserCommon.cpp",
1295 "tools/bookmaker/spellCheck.cpp",
1296 ]
1297 deps = [
1298 ":flags",
1299 ":skia",
1300 ":tool_utils",
1301 ]
1302 }
1303
Kevin Lubickebf648e2017-09-21 13:45:16 -04001304 if (target_cpu != "wasm") {
1305 import("gn/samples.gni")
1306 test_lib("samples") {
1307 public_include_dirs = [ "samplecode" ]
1308 include_dirs = [ "experimental" ]
1309 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001310 # Relocating these files here, so that clients don't try to build them while they're
1311 # still in active development. Clang's thread safety analysis gets tripped up by
1312 # conditional locks.
1313 "src/core/SkThreadedBMPDevice.cpp",
1314 "src/core/SkThreadedBMPDevice.h",
1315 ]
1316 deps = [
1317 ":experimental_svg_model",
1318 ":flags",
1319 ":gm",
1320 ":tool_utils",
1321 ":views",
1322 ":xml",
1323 ]
Mike Klein38af9432016-11-11 11:39:44 -05001324
Kevin Lubickebf648e2017-09-21 13:45:16 -04001325 if (skia_use_lua) {
1326 sources += [ "samplecode/SampleLua.cpp" ]
1327 deps += [
1328 ":lua",
1329 "//third_party/lua",
1330 ]
1331 }
1332 }
1333 test_app("dm") {
1334 sources = [
1335 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001336 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001337 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001338 "dm/DMJsonWriter.cpp",
1339 "dm/DMSrcSink.cpp",
1340 ]
1341 include_dirs = [ "tests" ]
1342 deps = [
1343 ":common_flags",
1344 ":experimental_svg_model",
1345 ":flags",
1346 ":gm",
1347 ":gpu_tool_utils",
1348 ":skia",
1349 ":tests",
1350 ":tool_utils",
1351 "//third_party/jsoncpp",
1352 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001353 ]
1354 }
Brian Osman16adfa32016-10-18 14:42:44 -04001355 }
1356
Mike Klein06432b22017-03-21 13:14:33 -04001357 test_app("ok") {
1358 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001359 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001360 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001361 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001362 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001363 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001364 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001365 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001366 ]
1367 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001368 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001369 ":gm",
1370 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001371 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001372 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001373 ]
1374 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001375 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001376 sources = [
1377 "bench/nanobench.cpp",
1378 ]
1379 deps = [
1380 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001381 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001382 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001383 ":flags",
1384 ":gm",
1385 ":gpu_tool_utils",
1386 ":skia",
1387 ":tool_utils",
1388 "//third_party/jsoncpp",
1389 ]
mtklein2b6870c2016-07-28 14:17:33 -07001390 }
halcanary19a97202016-08-03 15:08:04 -07001391
Ravi Mistry10d36c52017-01-31 09:49:18 -05001392 test_app("skpinfo") {
1393 sources = [
1394 "tools/skpinfo.cpp",
1395 ]
1396 deps = [
1397 ":flags",
1398 ":skia",
1399 ]
1400 }
1401
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001402 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001403 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001404 sources = [
1405 "tools/skpbench/skpbench.cpp",
1406 ]
1407 deps = [
1408 ":flags",
1409 ":gpu_tool_utils",
1410 ":skia",
1411 ":tool_utils",
1412 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001413 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001414 }
1415
Mike Klein7d302882016-11-03 14:06:31 -04001416 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001417 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001418 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001419 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001420 "tools/shape/SkShaper_harfbuzz.cpp",
1421 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001422 ]
1423 deps = [
1424 ":skia",
1425 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001426 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001427 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001428 }
halcanary19a97202016-08-03 15:08:04 -07001429 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001430 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001431 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001432 "tools/shape/SkShaper_primitive.cpp",
1433 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001434 ]
1435 deps = [
1436 ":skia",
1437 ]
halcanary3eee9d92016-09-10 07:01:53 -07001438 }
mtklein046cb562016-09-16 10:23:12 -07001439
Matt Sarett9f1c4032017-05-17 10:06:32 -04001440 test_app("create_flutter_test_images") {
1441 sources = [
1442 "tools/create_flutter_test_images.cpp",
1443 ]
1444 deps = [
1445 ":skia",
1446 ":tool_utils",
1447 ]
1448 }
1449
Ben Wagner219f3622017-07-17 15:32:25 -04001450 test_app("create_test_font") {
1451 sources = [
1452 "tools/create_test_font.cpp",
1453 ]
1454 deps = [
1455 ":skia",
1456 ]
1457 assert_no_deps = [
1458 # tool_utils requires the output of this app.
1459 ":tool_utils",
1460 ]
1461 }
1462
Mike Kleine6682eb2017-01-05 10:54:57 -05001463 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001464 sources = [
1465 "tools/get_images_from_skps.cpp",
1466 ]
1467 deps = [
1468 ":flags",
1469 ":skia",
1470 "//third_party/jsoncpp",
1471 ]
mtklein046cb562016-09-16 10:23:12 -07001472 }
mtkleinecbc5262016-09-22 11:51:24 -07001473
Mike Kleine6682eb2017-01-05 10:54:57 -05001474 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001475 sources = [
1476 "tools/colorspaceinfo.cpp",
1477 ]
1478 deps = [
1479 ":flags",
1480 ":skia",
1481 ":tool_utils",
1482 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001483 }
1484
Kevin Lubickebf648e2017-09-21 13:45:16 -04001485 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001486 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001487 sources = [
1488 "tools/skiaserve/Request.cpp",
1489 "tools/skiaserve/Response.cpp",
1490 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001491 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1492 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1493 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1494 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1495 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1496 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1497 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1498 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1499 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001500 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1501 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001502 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1503 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1504 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1505 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1506 ]
1507 deps = [
1508 ":flags",
1509 ":gpu_tool_utils",
1510 ":skia",
1511 ":tool_utils",
1512 "//third_party/jsoncpp",
1513 "//third_party/libmicrohttpd",
1514 "//third_party/libpng",
1515 ]
Mike Klein7d302882016-11-03 14:06:31 -04001516 }
mtkleinecbc5262016-09-22 11:51:24 -07001517 }
kjlubick14f984b2016-10-03 11:49:45 -07001518
Mike Kleine6682eb2017-01-05 10:54:57 -05001519 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001520 sources = [
1521 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001522 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001523 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001524 "fuzz/FuzzGradients.cpp",
1525 "fuzz/FuzzParsePath.cpp",
1526 "fuzz/FuzzPathop.cpp",
1527 "fuzz/FuzzScaleToSides.cpp",
1528 "fuzz/fuzz.cpp",
1529 ]
1530 deps = [
1531 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001532 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001533 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001534 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001535 ]
kjlubick14f984b2016-10-03 11:49:45 -07001536 }
Mike Klein38312422016-10-05 15:41:01 -04001537
Mike Kleine6682eb2017-01-05 10:54:57 -05001538 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001539 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001540 rebase_path("tests/skia_test.cpp"),
1541 rebase_path("tests/Test.cpp"),
1542 ]
caryclark9feb6322016-10-25 08:58:26 -07001543 deps = [
1544 ":flags",
1545 ":gpu_tool_utils",
1546 ":skia",
1547 ":tool_utils",
1548 ]
caryclark9feb6322016-10-25 08:58:26 -07001549 }
1550
Mike Kleine6682eb2017-01-05 10:54:57 -05001551 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001552 sources = [
1553 "tools/DumpRecord.cpp",
1554 "tools/dump_record.cpp",
1555 ]
1556 deps = [
1557 ":flags",
1558 ":skia",
1559 ]
Mike Klein38312422016-10-05 15:41:01 -04001560 }
bungemanfe917272016-10-13 17:36:40 -04001561
Mike Kleine6682eb2017-01-05 10:54:57 -05001562 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001563 sources = [
1564 "tools/skdiff/skdiff.cpp",
1565 "tools/skdiff/skdiff_html.cpp",
1566 "tools/skdiff/skdiff_main.cpp",
1567 "tools/skdiff/skdiff_utils.cpp",
1568 ]
1569 deps = [
1570 ":skia",
1571 ":tool_utils",
1572 ]
bungemanfe917272016-10-13 17:36:40 -04001573 }
halcanarya73d76a2016-10-17 13:19:02 -07001574
Mike Kleine6682eb2017-01-05 10:54:57 -05001575 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001576 sources = [
1577 "tools/skp_parser.cpp",
1578 ]
1579 deps = [
1580 ":skia",
1581 ":tool_utils",
1582 "//third_party/jsoncpp",
1583 ]
halcanarya73d76a2016-10-17 13:19:02 -07001584 }
Brian Osman16adfa32016-10-18 14:42:44 -04001585
Hal Canary75427132017-10-11 16:00:31 -04001586 if (!is_win) {
1587 test_app("gpucts") {
1588 sources = [
1589 "dm/DMGpuTestProcs.cpp",
1590 "tools/gpucts/gm_knowledge.c",
1591 "tools/gpucts/gm_runner.cpp",
1592 "tools/gpucts/gpucts.cpp",
1593 ]
1594 deps = [
1595 ":gm",
1596 ":gpu_tool_utils",
1597 ":skia",
1598 ":tests",
1599 "//third_party/googletest",
1600 ]
1601 }
1602 }
1603
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001604 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001605 test_lib("sk_app") {
1606 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001607 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001608 "tools/sk_app/CommandSet.cpp",
1609 "tools/sk_app/GLWindowContext.cpp",
1610 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001611 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001612 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001613
Jim Van Verth4e56a912016-10-21 10:58:52 -04001614 if (is_android) {
1615 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001616 "tools/sk_app/android/GLWindowContext_android.cpp",
1617 "tools/sk_app/android/RasterWindowContext_android.cpp",
1618 "tools/sk_app/android/Window_android.cpp",
1619 "tools/sk_app/android/main_android.cpp",
1620 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001621 ]
Brian Osman462334e2017-02-09 11:22:57 -05001622 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001623 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001624 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001625 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1626 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1627 "tools/sk_app/unix/Window_unix.cpp",
1628 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001629 ]
1630 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001631 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001632 "tools/sk_app/win/GLWindowContext_win.cpp",
1633 "tools/sk_app/win/RasterWindowContext_win.cpp",
1634 "tools/sk_app/win/Window_win.cpp",
1635 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001636 ]
Brian Salomon194db172017-08-17 14:37:06 -04001637 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001638 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001639 }
Mike Klein43c25262016-10-20 10:17:47 -04001640 } else if (is_mac) {
1641 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001642 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1643 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1644 "tools/sk_app/mac/Window_mac.cpp",
1645 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001646 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001647 } else if (is_ios) {
1648 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001649 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1650 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1651 "tools/sk_app/ios/Window_ios.cpp",
1652 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001653 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001654 }
1655
1656 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001657 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001658 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001659 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001660 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001661 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001662 libs += [ "X11-xcb" ]
1663 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001664 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001665 }
1666 }
1667
Brian Osman16adfa32016-10-18 14:42:44 -04001668 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001669 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001670 ":skia",
1671 ":tool_utils",
1672 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001673 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001674 if (is_android) {
1675 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001676 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001677 deps += [ "//third_party/libsdl" ]
1678 }
Brian Salomon194db172017-08-17 14:37:06 -04001679 if (skia_use_angle) {
1680 deps += [ "//third_party/angle2" ]
1681 }
Mike Kleina92c3832016-12-08 09:49:39 -05001682 }
Brian Osman16adfa32016-10-18 14:42:44 -04001683 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001684
Brian Osmaneff04b52017-11-21 13:18:02 -05001685 if (skia_enable_gpu) {
1686 test_app("viewer") {
1687 is_shared_library = is_android
1688 sources = [
1689 "tools/viewer/GMSlide.cpp",
1690 "tools/viewer/ImageSlide.cpp",
1691 "tools/viewer/SKPSlide.cpp",
1692 "tools/viewer/SampleSlide.cpp",
1693 "tools/viewer/Viewer.cpp",
1694 ]
1695 libs = []
1696
1697 include_dirs = []
1698 deps = [
1699 ":flags",
1700 ":gm",
1701 ":gpu_tool_utils",
1702 ":samples",
1703 ":sk_app",
1704 ":skia",
1705 ":tool_utils",
1706 ":views",
1707 "//third_party/imgui",
1708 "//third_party/jsoncpp",
1709 ]
1710 }
1711 }
1712
1713 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1714 test_app("HelloWorld") {
1715 sources = [
1716 "example/HelloWorld.cpp",
1717 ]
1718 libs = []
1719
1720 include_dirs = []
1721 deps = [
1722 ":flags",
1723 ":gpu_tool_utils",
1724 ":sk_app",
1725 ":skia",
1726 ":tool_utils",
1727 ":views",
1728 ]
1729 }
1730 }
1731
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001732 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001733 test_app("SkiaSDLExample") {
1734 sources = [
1735 "example/SkiaSDLExample.cpp",
1736 ]
1737 libs = []
1738 include_dirs = []
1739 deps = [
1740 ":gpu_tool_utils",
1741 ":skia",
1742 "//third_party/libsdl",
1743 ]
1744 }
1745 }
1746
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001747 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1748 action_foreach("generate_mocs") {
1749 script = "gn/call.py"
1750 sources = [
1751 "tools/mdbviz/MainWindow.h",
1752 ]
1753 outputs = [
1754 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1755 ]
1756 args = [
1757 "$skia_qt_path" + "/bin/moc",
1758 "{{source}}",
1759 "-o",
1760 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1761 ]
1762 }
1763 action_foreach("generate_resources") {
1764 script = "gn/call.py"
1765 sources = [
1766 "tools/mdbviz/resources.qrc",
1767 ]
1768 outputs = [
1769 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1770 ]
1771 args = [
1772 "$skia_qt_path" + "/bin/rcc",
1773 "{{source}}",
1774 "-o",
1775 "gen/mdbviz/{{source_name_part}}_res.cpp",
1776 ]
1777 }
1778 test_app("mdbviz") {
1779 if (is_win) {
1780 # on Windows we need to disable some exception handling warnings due to the Qt headers
1781 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1782 }
1783 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001784 "tools/UrlDataManager.cpp",
1785 "tools/debugger/SkDebugCanvas.cpp",
1786 "tools/debugger/SkDrawCommand.cpp",
1787 "tools/debugger/SkJsonWriteBuffer.cpp",
1788 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001789 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001790 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001791 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001792 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001793
1794 # generated files
1795 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1796 "$target_gen_dir/mdbviz/resources_res.cpp",
1797 ]
1798 lib_dirs = [ "$skia_qt_path/lib" ]
1799 libs = [
1800 "Qt5Core.lib",
1801 "Qt5Gui.lib",
1802 "Qt5Widgets.lib",
1803 ]
1804 include_dirs = [
1805 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001806 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001807 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001808 "tools",
1809 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001810 ]
1811 deps = [
1812 ":generate_mocs",
1813 ":generate_resources",
1814 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001815 "//third_party/jsoncpp",
1816 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001817 ]
1818 }
1819 }
1820
Mike Kleine459afd2017-03-03 09:21:30 -05001821 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001822 copy("gdbserver") {
1823 sources = [
1824 "$ndk/$ndk_gdbserver",
1825 ]
1826 outputs = [
1827 "$root_out_dir/gdbserver",
1828 ]
1829 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001830 }
mtklein25c81d42016-07-27 13:55:26 -07001831}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001832
1833if (skia_jumper_clang != "") {
1834 action("regen_jumper") {
1835 script = "src/jumper/build_stages.py"
1836
1837 inputs = [
1838 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001839 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001840 ]
1841
1842 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1843 outputs = [
1844 "$target_out_dir/" +
1845 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1846 "$target_out_dir/" +
1847 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1848 ]
1849
1850 args = [
1851 skia_jumper_clang,
1852 skia_jumper_objdump,
1853 skia_jumper_ccache,
1854 ] + rebase_path(inputs) + rebase_path(outputs)
1855 }
1856}