blob: 95f94c31ecc88a99fb6e0294e9b4e64e92ac3bcc [file] [log] [blame]
benjaminwagner56f6d062016-01-13 10:45:19 -08001################################################################################
2# Skylark macros
3################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -07004
benjaminwagner56f6d062016-01-13 10:45:19 -08005is_bazel = not hasattr(native, "genmpm")
6
7def portable_select(select_dict, bazel_condition, default_condition):
8 """Replaces select() with a Bazel-friendly wrapper.
9
10 Args:
11 select_dict: Dictionary in the same format as select().
12 Returns:
13 If Blaze platform, returns select() using select_dict.
14 If Bazel platform, returns dependencies for condition
15 bazel_condition, or empty list if none specified.
16 """
17 if is_bazel:
18 return select_dict.get(bazel_condition, select_dict[default_condition])
19 else:
20 return select(select_dict)
21
22def skia_select(conditions, results):
23 """Replaces select() for conditions [UNIX, ANDROID, IOS]
24
25 Args:
26 conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS]
27 results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS]
28 Returns:
29 The result matching the platform condition.
30 """
31 if len(conditions) != 3 or len(results) != 3:
32 fail("Must provide exactly 3 conditions and 3 results")
33
34 selector = {}
35 for i in range(3):
36 selector[conditions[i]] = results[i]
37 return portable_select(selector, conditions[2], conditions[0])
38
39def skia_glob(srcs):
40 """Replaces glob() with a version that accepts a struct.
41
42 Args:
43 srcs: struct(include=[], exclude=[])
44 Returns:
45 Equivalent of glob(srcs.include, exclude=srcs.exclude)
46 """
47 if hasattr(srcs, 'include'):
48 if hasattr(srcs, 'exclude'):
49 return native.glob(srcs.include, exclude=srcs.exclude)
50 else:
51 return native.glob(srcs.include)
52 return []
53
54################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -040055## skia_{all,public}_hdrs()
56################################################################################
57def skia_all_hdrs():
58 return native.glob(["src/**/*.h", "include/**/*.h"])
59
60def skia_public_hdrs():
61 return native.glob(["include/**/*.h"],
62 exclude=[
63 "include/private/**/*",
64 "include/views/**/*", # Not used.
65 ])
66
67################################################################################
68## skia_opts_srcs()
69################################################################################
70# Intel
71SKIA_OPTS_SSE2 = "SSE2"
72
73SKIA_OPTS_SSSE3 = "SSSE3"
74
75SKIA_OPTS_SSE41 = "SSE41"
76
77SKIA_OPTS_SSE42 = "SSE42"
78
79SKIA_OPTS_AVX = "AVX"
80
81# Arm
82SKIA_OPTS_NEON = "NEON"
83
84SKIA_OPTS_CRC32 = "CRC32" # arm64
85
86def opts_srcs(opts):
87 if opts == SKIA_OPTS_SSE2:
88 return native.glob([
89 "src/opts/*_SSE2.cpp",
90 "src/opts/*_sse2.cpp", # No matches currently.
91 ])
92 elif opts == SKIA_OPTS_SSSE3:
93 return native.glob([
94 "src/opts/*_SSSE3.cpp",
95 "src/opts/*_ssse3.cpp",
96 ])
97 elif opts == SKIA_OPTS_SSE41:
98 return native.glob([
99 "src/opts/*_sse41.cpp",
100 ])
101 elif opts == SKIA_OPTS_SSE42:
102 return native.glob([
103 "src/opts/*_sse42.cpp",
104 ])
105 elif opts == SKIA_OPTS_AVX:
106 return native.glob([
107 "src/opts/*_avx.cpp",
108 ])
109 elif opts == SKIA_OPTS_NEON:
110 return native.glob([
111 "src/opts/*_neon.cpp",
112 ])
113 elif opts == SKIA_OPTS_CRC32:
114 return native.glob([
115 "src/opts/*_crc32.cpp",
116 ])
117 else:
118 fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
119
120def opts_cflags(opts):
121 if opts == SKIA_OPTS_SSE2:
122 return ["-msse2"]
123 elif opts == SKIA_OPTS_SSSE3:
124 return ["-mssse3"]
125 elif opts == SKIA_OPTS_SSE41:
126 return ["-msse4.1"]
127 elif opts == SKIA_OPTS_SSE42:
128 return ["-msse4.2"]
129 elif opts == SKIA_OPTS_AVX:
130 return ["-mavx"]
131 elif opts == SKIA_OPTS_NEON:
132 return ["-mfpu=neon"]
133 elif opts == SKIA_OPTS_CRC32:
Mike Kleinc29bb572017-10-24 11:40:41 -0400134 # NDK r11's Clang (3.8) doesn't pass along this -march setting correctly to an external
135 # assembler, so we do it manually with -Wa. This is just a bug, fixed in later Clangs.
136 return ["-march=armv8-a+crc", "-Wa,-march=armv8-a+crc"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400137 else:
138 return []
139
140SKIA_CPU_ARM = "ARM"
141
142SKIA_CPU_ARM64 = "ARM64"
143
144SKIA_CPU_X86 = "X86"
145
146SKIA_CPU_OTHER = "OTHER"
147
148def opts_rest_srcs(cpu):
149 srcs = []
150 if cpu == SKIA_CPU_ARM or cpu == SKIA_CPU_ARM64:
151 srcs += native.glob([
152 "src/opts/*_arm.cpp",
153 "src/opts/SkBitmapProcState_opts_none.cpp",
154 ])
155 if cpu == SKIA_CPU_ARM64:
156 # NEON doesn't need special flags to compile on ARM64.
157 srcs += native.glob([
158 "src/opts/*_neon.cpp",
159 ])
160 elif cpu == SKIA_CPU_X86:
161 srcs += native.glob([
162 "src/opts/*_x86.cpp",
163 ])
164 elif cpu == SKIA_CPU_OTHER:
165 srcs += native.glob([
166 "src/opts/*_none.cpp",
167 ])
168 else:
169 fail("opts_rest_srcs parameter 'cpu' must be one of " +
170 "SKIA_CPU_{ARM,ARM64,X86,OTHER}.")
171 return srcs
172
173def skia_opts_deps(cpu):
174 res = [":opts_rest"]
175
176 if cpu == SKIA_CPU_ARM:
177 res += [":opts_neon"]
178
179 if cpu == SKIA_CPU_ARM64:
180 res += [":opts_crc32"]
Mike Kleinc29bb572017-10-24 11:40:41 -0400181
Ben Wagner9eca72b2017-10-17 10:57:34 -0400182 if cpu == SKIA_CPU_X86:
183 res += [
184 ":opts_sse2",
185 ":opts_ssse3",
186 ":opts_sse41",
187 ":opts_sse42",
188 ":opts_avx",
189 ]
190
191 return res
192
193################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800194## BASE_SRCS
195################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -0700196
benjaminwagner39e7aa42015-11-18 13:26:10 -0800197# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800198BASE_SRCS_ALL = struct(
199 include = [
Ben Wagnerdea74282017-03-16 19:15:09 -0400200 "include/private/**/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700201 "src/**/*.h",
202 "src/**/*.cpp",
Ben Wagnerdea74282017-03-16 19:15:09 -0400203 "src/**/*.inc",
Mike Klein0a64e322017-03-29 17:32:50 -0400204 "src/jumper/SkJumper_generated.S",
benjaminwagner787ca872015-08-17 12:58:10 -0700205
mtkleind55d13a2015-08-18 08:51:49 -0700206 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -0700207 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700208 "third_party/etc1/*.h",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400209 "third_party/gif/*.cpp",
210 "third_party/gif/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -0700211 ],
Ben Wagnerdea74282017-03-16 19:15:09 -0400212 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700213 # Exclude platform-dependent files.
iroth76a12252016-01-07 07:11:39 -0800214 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700215 "src/device/xps/*", # Windows-only. Move to ports?
216 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
217 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700218 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700219 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700220 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700221 "src/gpu/gl/iOS/*",
222 "src/gpu/gl/mac/*",
223 "src/gpu/gl/win/*",
224 "src/opts/**/*",
225 "src/ports/**/*",
226 "src/utils/android/**/*",
227 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700228 "src/utils/win/**/*",
229 "src/views/sdl/*",
230 "src/views/win/*",
231 "src/views/unix/*",
232
233 # Exclude multiple definitions.
234 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700235 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700236 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
237 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800238 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700239
240 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700241 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
benjaminwagner921e48b2016-07-15 11:27:27 -0700242 "src/svg/**/*", # Depends on XML.
243 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700244
benjaminwagner39e7aa42015-11-18 13:26:10 -0800245 # Conflicting dependencies among Lua versions. See cl/107087297.
246 "src/utils/SkLua*",
247
benjaminwagner6f6bef82015-10-15 08:09:44 -0700248 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700249 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800250
251 # Currently exclude all vulkan specific files
252 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700253
254 # Defines main.
255 "src/sksl/SkSLMain.cpp",
Ethan Nicholas8d7f4ae2017-09-07 11:07:42 -0400256
257 # Only used to regenerate the lexer
258 "src/sksl/lex/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700259 ],
260)
261
Ben Wagner9eca72b2017-10-17 10:57:34 -0400262def codec_srcs(limited):
263 """Sources for the codecs. Excludes Ico, Webp, Png, and Raw if limited."""
264 exclude = []
265 if limited:
266 exclude += [
267 "src/codec/*Ico*.cpp",
268 "src/codec/*Webp*.cpp",
269 "src/codec/*Png*",
270 "src/codec/*Raw*.cpp",
271 ]
272 return native.glob(["src/codec/*.cpp"], exclude = exclude)
273
benjaminwagner6f6bef82015-10-15 08:09:44 -0700274# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800275BASE_SRCS_UNIX = struct(
276 include = [
iroth5f0de062016-02-17 12:47:27 -0800277 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700278 "src/ports/**/*.cpp",
279 "src/ports/**/*.h",
280 ],
281 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800282 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700283 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800284 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700285 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700286 "src/ports/*mac*",
287 "src/ports/*mozalloc*",
288 "src/ports/*nacl*",
289 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800290 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700291 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700292 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700293 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800294 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800295 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500296 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700297 "src/ports/SkImageGenerator_none.cpp",
298 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700299 ],
300)
301
benjaminwagner86ea33e2015-10-26 10:46:25 -0700302# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800303BASE_SRCS_ANDROID = struct(
304 include = [
iroth5f0de062016-02-17 12:47:27 -0800305 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700306 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700307 "src/ports/**/*.cpp",
308 "src/ports/**/*.h",
309 ],
310 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800311 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800312 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700313 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700314 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700315 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700316 "src/ports/*mac*",
317 "src/ports/*mozalloc*",
318 "src/ports/*nacl*",
319 "src/ports/*win*",
320 "src/ports/SkDebug_stdio.cpp",
321 "src/ports/SkFontMgr_custom_directory_factory.cpp",
322 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700323 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700324 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500325 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700326 "src/ports/SkImageGenerator_none.cpp",
327 "src/ports/SkTLS_none.cpp",
328 ],
329)
330
iroth8b99ef42015-11-02 11:11:21 -0800331# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800332BASE_SRCS_IOS = struct(
333 include = [
iroth5f0de062016-02-17 12:47:27 -0800334 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
335 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800336 "src/ports/**/*.cpp",
337 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800338 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800339 ],
340 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800341 "src/ports/*FontConfig*",
342 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700343 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800344 "src/ports/*android*",
345 "src/ports/*chromium*",
346 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800347 "src/ports/*mozalloc*",
348 "src/ports/*nacl*",
349 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800350 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500351 "src/ports/SkFontMgr_custom_directory.cpp",
352 "src/ports/SkFontMgr_custom_embedded.cpp",
353 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800354 "src/ports/SkFontMgr_custom_directory_factory.cpp",
355 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700356 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800357 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500358 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800359 "src/ports/SkImageGenerator_none.cpp",
360 "src/ports/SkTLS_none.cpp",
361 ],
362)
363
benjaminwagner56f6d062016-01-13 10:45:19 -0800364################################################################################
Ben Wagnerdea74282017-03-16 19:15:09 -0400365## skia_srcs()
benjaminwagner56f6d062016-01-13 10:45:19 -0800366################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -0400367def skia_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400368 """Sources to be compiled into the skia library."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400369 return skia_glob(BASE_SRCS_ALL) + skia_select(
370 os_conditions,
371 [
372 skia_glob(BASE_SRCS_UNIX),
373 skia_glob(BASE_SRCS_ANDROID),
374 skia_glob(BASE_SRCS_IOS),
375 ],
376 )
benjaminwagner39e7aa42015-11-18 13:26:10 -0800377
benjaminwagner56f6d062016-01-13 10:45:19 -0800378################################################################################
379## INCLUDES
380################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800381
benjaminwagner787ca872015-08-17 12:58:10 -0700382# Includes needed by Skia implementation. Not public includes.
383INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800384 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700385 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800386 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700387 "include/codec",
388 "include/config",
389 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700390 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400391 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700392 "include/gpu",
393 "include/images",
394 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700395 "include/pipe",
396 "include/ports",
397 "include/private",
398 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800399 "include/utils/mac",
400 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700401 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700402 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800403 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700404 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700405 "src/gpu",
406 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400407 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700408 "src/lazy",
409 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800410 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700411 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700412 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400413 "src/shaders",
benjaminwagnerc8962512016-09-30 12:06:27 -0700414 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700415 "src/utils",
416 "third_party/etc1",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400417 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800418]
benjaminwagner787ca872015-08-17 12:58:10 -0700419
benjaminwagner56f6d062016-01-13 10:45:19 -0800420################################################################################
421## DM_SRCS
422################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700423
benjaminwagner56f6d062016-01-13 10:45:19 -0800424DM_SRCS_ALL = struct(
425 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700426 "dm/*.cpp",
427 "dm/*.h",
428 "gm/*.c",
429 "gm/*.cpp",
430 "gm/*.h",
431 "tests/*.cpp",
432 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700433 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700434 "tools/CrashHandler.cpp",
435 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700436 "tools/ProcStats.cpp",
437 "tools/ProcStats.h",
438 "tools/Resources.cpp",
439 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700440 "tools/SkJSONCPP.h",
441 "tools/UrlDataManager.cpp",
442 "tools/UrlDataManager.h",
443 "tools/debugger/*.cpp",
444 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700445 "tools/flags/*.cpp",
446 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700447 "tools/gpu/**/*.cpp",
448 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700449 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700450 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800451 "tools/random_parse_path.cpp",
452 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700453 "tools/sk_tool_utils.cpp",
454 "tools/sk_tool_utils.h",
455 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700456 "tools/test_font_monospace.inc",
457 "tools/test_font_sans_serif.inc",
458 "tools/test_font_serif.inc",
459 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700460 "tools/timer/*.cpp",
461 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400462 "tools/trace/*.cpp",
463 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700464 ],
465 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700466 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700467 "tests/skia_test.cpp", # Old main.
468 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner921e48b2016-07-15 11:27:27 -0700469 "tests/SVGDeviceTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700470 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700471 "tools/gpu/gl/egl/*",
472 "tools/gpu/gl/glx/*",
473 "tools/gpu/gl/iOS/*",
474 "tools/gpu/gl/mac/*",
475 "tools/gpu/gl/mesa/*",
476 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700477 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700478 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700479 ],
480)
481
Ben Wagnerdea74282017-03-16 19:15:09 -0400482################################################################################
483## dm_srcs()
484################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700485
Ben Wagner9eca72b2017-10-17 10:57:34 -0400486def dm_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400487 """Sources for the dm binary for the specified os."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400488 return skia_glob(DM_SRCS_ALL) + skia_select(
489 os_conditions,
490 [
491 [],
492 ["tests/FontMgrAndroidParserTest.cpp"],
493 [],
494 ],
495 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800496
497################################################################################
498## DM_INCLUDES
499################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700500
benjaminwagner6f6bef82015-10-15 08:09:44 -0700501DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800502 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700503 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500504 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700505 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500506 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700507 "src/effects",
508 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700509 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700510 "src/pathops",
511 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700512 "src/ports",
Florin Malita5edba452017-05-30 16:39:47 -0400513 "src/shaders",
514 "src/shaders/gradients",
Mike Reedf71828f2017-02-18 09:51:33 -0500515 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700516 "tests",
517 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700518 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700519 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700520 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700521 "tools/timer",
Brian Salomon40d01192017-07-19 13:05:11 -0400522 "tools/trace",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700523]
524
benjaminwagner56f6d062016-01-13 10:45:19 -0800525################################################################################
526## DM_ARGS
527################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700528
Ben Wagner59f9edb2016-11-28 15:30:37 -0500529def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700530 source = ["tests", "gm", "image"]
Ben Wagnere2cbd042017-08-11 09:39:04 -0400531 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
532 config = ["565", "8888", "pdf", "srgb"]
benjaminwagner83906ae2016-05-01 15:02:25 -0700533 # TODO(mtklein): maybe investigate why these fail?
534 match = [
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400535 "~^FontHostStream$$",
536 "~^FontMgr$$",
537 "~^PaintBreakText$$",
538 "~^RecordDraw_TextBounds$$",
benjaminwagner83906ae2016-05-01 15:02:25 -0700539 ]
540 if asan:
Ben Wagner59f9edb2016-11-28 15:30:37 -0500541 # The ASAN we use with Bazel has some strict checks, so omit tests that
542 # trigger them.
Ben Wagner54b22132017-10-17 18:19:37 -0400543 # All of the following are due to
544 # https://bugs.chromium.org/p/skia/issues/detail?id=7052
benjaminwagner83906ae2016-05-01 15:02:25 -0700545 match += [
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400546 "~^clippedcubic2$$",
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400547 "~^PathOpsCubicIntersection$$",
548 "~^PathOpsCubicLineIntersection$$",
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400549 "~^PathOpsOpCubicsThreaded$$",
550 "~^PathOpsOpLoopsThreaded$$",
benjaminwagner56f6d062016-01-13 10:45:19 -0800551 ]
Ben Wagner59f9edb2016-11-28 15:30:37 -0500552 return ["--src"] + source + ["--config"] + config + ["--match"] + match
benjaminwagner56f6d062016-01-13 10:45:19 -0800553
554################################################################################
555## COPTS
556################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800557
Ben Wagner9eca72b2017-10-17 10:57:34 -0400558def base_copts(os_conditions):
559 return skia_select(
560 os_conditions,
561 [
562 # UNIX
563 [
564 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
565 # Internal use of deprecated methods. :(
566 "-Wno-deprecated-declarations",
567 ],
568 # ANDROID
569 [
570 # 'GrResourceCache' declared with greater visibility than the
571 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
572 "-Wno-error=attributes",
573 ],
574 # IOS
575 [],
576 ],
577 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800578
579################################################################################
580## DEFINES
581################################################################################
582
Ben Wagner9eca72b2017-10-17 10:57:34 -0400583def base_defines(os_conditions):
584 return [
585 # Chrome DEFINES.
586 "SK_USE_FREETYPE_EMBOLDEN",
587 # Turn on a few Google3-specific build fixes.
588 "GOOGLE3",
589 # Required for building dm.
590 "GR_TEST_UTILS",
591 # Staging flags for API changes
592 # Should remove after we update golden images
593 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
594 # Experiment to diagnose image diffs in Google3
595 "SK_JUMPER_DISABLE_8BIT",
596 # JPEG is in codec_limited
597 "SK_HAS_JPEG_LIBRARY",
598 ] + skia_select(
599 os_conditions,
600 [
601 # UNIX
602 [
603 "PNG_SKIP_SETJMP_CHECK",
604 "SK_BUILD_FOR_UNIX",
605 "SK_SAMPLES_FOR_X",
606 "SK_PDF_USE_SFNTLY",
607 "SK_CODEC_DECODES_RAW",
608 "SK_HAS_PNG_LIBRARY",
609 "SK_HAS_WEBP_LIBRARY",
610 ],
611 # ANDROID
612 [
613 "SK_BUILD_FOR_ANDROID",
614 "SK_CODEC_DECODES_RAW",
615 "SK_HAS_PNG_LIBRARY",
616 "SK_HAS_WEBP_LIBRARY",
617 ],
618 # IOS
619 [
620 "SK_BUILD_FOR_IOS",
621 "SK_BUILD_NO_OPTS",
622 "SKNX_NO_SIMD",
623 ],
624 ],
625 )
benjaminwagner787ca872015-08-17 12:58:10 -0700626
benjaminwagner56f6d062016-01-13 10:45:19 -0800627################################################################################
628## LINKOPTS
629################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700630
Ben Wagner9eca72b2017-10-17 10:57:34 -0400631def base_linkopts(os_conditions):
632 return [
633 "-ldl",
634 ] + skia_select(
635 os_conditions,
636 [
637 # UNIX
638 [],
639 # ANDROID
640 [
641 "-lEGL",
642 ],
643 # IOS
644 [
645 "-framework CoreFoundation",
646 "-framework CoreGraphics",
647 "-framework CoreText",
648 "-framework ImageIO",
649 "-framework MobileCoreServices",
650 ],
651 ]
652 )