blob: d039497558dd31fbeb7edcf233811a9c84e17f89 [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():
Ben Wagnerb7e80112018-01-24 18:18:12 -050058 return native.glob([
59 "src/**/*.h",
60 "include/**/*.h",
61 "third_party/**/*.h",
62 ])
Ben Wagner9eca72b2017-10-17 10:57:34 -040063
64def skia_public_hdrs():
65 return native.glob(["include/**/*.h"],
66 exclude=[
67 "include/private/**/*",
68 "include/views/**/*", # Not used.
69 ])
70
71################################################################################
72## skia_opts_srcs()
73################################################################################
74# Intel
75SKIA_OPTS_SSE2 = "SSE2"
76
77SKIA_OPTS_SSSE3 = "SSSE3"
78
79SKIA_OPTS_SSE41 = "SSE41"
80
81SKIA_OPTS_SSE42 = "SSE42"
82
83SKIA_OPTS_AVX = "AVX"
84
85# Arm
86SKIA_OPTS_NEON = "NEON"
87
88SKIA_OPTS_CRC32 = "CRC32" # arm64
89
90def opts_srcs(opts):
91 if opts == SKIA_OPTS_SSE2:
92 return native.glob([
93 "src/opts/*_SSE2.cpp",
94 "src/opts/*_sse2.cpp", # No matches currently.
95 ])
96 elif opts == SKIA_OPTS_SSSE3:
97 return native.glob([
98 "src/opts/*_SSSE3.cpp",
99 "src/opts/*_ssse3.cpp",
100 ])
101 elif opts == SKIA_OPTS_SSE41:
102 return native.glob([
103 "src/opts/*_sse41.cpp",
104 ])
105 elif opts == SKIA_OPTS_SSE42:
106 return native.glob([
107 "src/opts/*_sse42.cpp",
108 ])
109 elif opts == SKIA_OPTS_AVX:
110 return native.glob([
111 "src/opts/*_avx.cpp",
112 ])
113 elif opts == SKIA_OPTS_NEON:
114 return native.glob([
115 "src/opts/*_neon.cpp",
116 ])
117 elif opts == SKIA_OPTS_CRC32:
118 return native.glob([
119 "src/opts/*_crc32.cpp",
120 ])
121 else:
122 fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
123
124def opts_cflags(opts):
125 if opts == SKIA_OPTS_SSE2:
126 return ["-msse2"]
127 elif opts == SKIA_OPTS_SSSE3:
128 return ["-mssse3"]
129 elif opts == SKIA_OPTS_SSE41:
130 return ["-msse4.1"]
131 elif opts == SKIA_OPTS_SSE42:
132 return ["-msse4.2"]
133 elif opts == SKIA_OPTS_AVX:
134 return ["-mavx"]
135 elif opts == SKIA_OPTS_NEON:
136 return ["-mfpu=neon"]
137 elif opts == SKIA_OPTS_CRC32:
Mike Kleinc29bb572017-10-24 11:40:41 -0400138 # NDK r11's Clang (3.8) doesn't pass along this -march setting correctly to an external
139 # assembler, so we do it manually with -Wa. This is just a bug, fixed in later Clangs.
140 return ["-march=armv8-a+crc", "-Wa,-march=armv8-a+crc"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400141 else:
142 return []
143
144SKIA_CPU_ARM = "ARM"
145
146SKIA_CPU_ARM64 = "ARM64"
147
148SKIA_CPU_X86 = "X86"
149
150SKIA_CPU_OTHER = "OTHER"
151
152def opts_rest_srcs(cpu):
153 srcs = []
154 if cpu == SKIA_CPU_ARM or cpu == SKIA_CPU_ARM64:
155 srcs += native.glob([
156 "src/opts/*_arm.cpp",
157 "src/opts/SkBitmapProcState_opts_none.cpp",
158 ])
159 if cpu == SKIA_CPU_ARM64:
160 # NEON doesn't need special flags to compile on ARM64.
161 srcs += native.glob([
162 "src/opts/*_neon.cpp",
163 ])
164 elif cpu == SKIA_CPU_X86:
165 srcs += native.glob([
166 "src/opts/*_x86.cpp",
167 ])
168 elif cpu == SKIA_CPU_OTHER:
169 srcs += native.glob([
170 "src/opts/*_none.cpp",
171 ])
172 else:
173 fail("opts_rest_srcs parameter 'cpu' must be one of " +
174 "SKIA_CPU_{ARM,ARM64,X86,OTHER}.")
175 return srcs
176
177def skia_opts_deps(cpu):
178 res = [":opts_rest"]
179
180 if cpu == SKIA_CPU_ARM:
181 res += [":opts_neon"]
182
183 if cpu == SKIA_CPU_ARM64:
184 res += [":opts_crc32"]
Mike Kleinc29bb572017-10-24 11:40:41 -0400185
Ben Wagner9eca72b2017-10-17 10:57:34 -0400186 if cpu == SKIA_CPU_X86:
187 res += [
188 ":opts_sse2",
189 ":opts_ssse3",
190 ":opts_sse41",
191 ":opts_sse42",
192 ":opts_avx",
193 ]
194
195 return res
196
197################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800198## BASE_SRCS
199################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -0700200
benjaminwagner39e7aa42015-11-18 13:26:10 -0800201# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800202BASE_SRCS_ALL = struct(
203 include = [
Ben Wagnerdea74282017-03-16 19:15:09 -0400204 "include/private/**/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700205 "src/**/*.h",
206 "src/**/*.cpp",
Ben Wagnerdea74282017-03-16 19:15:09 -0400207 "src/**/*.inc",
Mike Klein0a64e322017-03-29 17:32:50 -0400208 "src/jumper/SkJumper_generated.S",
benjaminwagner787ca872015-08-17 12:58:10 -0700209
mtkleind55d13a2015-08-18 08:51:49 -0700210 # Third Party
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400211 "third_party/gif/*.cpp",
212 "third_party/gif/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -0700213 ],
Ben Wagnerdea74282017-03-16 19:15:09 -0400214 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700215 # Exclude platform-dependent files.
iroth76a12252016-01-07 07:11:39 -0800216 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700217 "src/device/xps/*", # Windows-only. Move to ports?
218 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
219 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700220 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700221 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700222 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700223 "src/gpu/gl/iOS/*",
224 "src/gpu/gl/mac/*",
225 "src/gpu/gl/win/*",
226 "src/opts/**/*",
227 "src/ports/**/*",
228 "src/utils/android/**/*",
229 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700230 "src/utils/win/**/*",
231 "src/views/sdl/*",
232 "src/views/win/*",
233 "src/views/unix/*",
234
235 # Exclude multiple definitions.
236 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700237 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500238 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700239
240 # Exclude files that don't compile with the current DEFINES.
benjaminwagner921e48b2016-07-15 11:27:27 -0700241 "src/svg/**/*", # Depends on XML.
242 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700243
benjaminwagner39e7aa42015-11-18 13:26:10 -0800244 # Conflicting dependencies among Lua versions. See cl/107087297.
245 "src/utils/SkLua*",
246
benjaminwagner6f6bef82015-10-15 08:09:44 -0700247 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700248 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800249
250 # Currently exclude all vulkan specific files
251 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700252
253 # Defines main.
254 "src/sksl/SkSLMain.cpp",
Ethan Nicholas8d7f4ae2017-09-07 11:07:42 -0400255
256 # Only used to regenerate the lexer
257 "src/sksl/lex/*",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500258
259 # Atlas text
260 "src/atlastext/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700261 ],
262)
263
Ben Wagner9eca72b2017-10-17 10:57:34 -0400264def codec_srcs(limited):
265 """Sources for the codecs. Excludes Ico, Webp, Png, and Raw if limited."""
266 exclude = []
267 if limited:
268 exclude += [
269 "src/codec/*Ico*.cpp",
270 "src/codec/*Webp*.cpp",
271 "src/codec/*Png*",
272 "src/codec/*Raw*.cpp",
273 ]
274 return native.glob(["src/codec/*.cpp"], exclude = exclude)
275
benjaminwagner6f6bef82015-10-15 08:09:44 -0700276# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800277BASE_SRCS_UNIX = struct(
278 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500279 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700280 "src/ports/**/*.cpp",
281 "src/ports/**/*.h",
282 ],
283 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800284 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700285 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800286 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700287 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700288 "src/ports/*mac*",
289 "src/ports/*mozalloc*",
290 "src/ports/*nacl*",
291 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800292 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700293 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700294 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700295 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800296 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800297 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500298 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700299 "src/ports/SkImageGenerator_none.cpp",
300 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700301 ],
302)
303
benjaminwagner86ea33e2015-10-26 10:46:25 -0700304# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800305BASE_SRCS_ANDROID = struct(
306 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500307 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700308 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700309 "src/ports/**/*.cpp",
310 "src/ports/**/*.h",
311 ],
312 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800313 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800314 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700315 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700316 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700317 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700318 "src/ports/*mac*",
319 "src/ports/*mozalloc*",
320 "src/ports/*nacl*",
321 "src/ports/*win*",
322 "src/ports/SkDebug_stdio.cpp",
323 "src/ports/SkFontMgr_custom_directory_factory.cpp",
324 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700325 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700326 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500327 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700328 "src/ports/SkImageGenerator_none.cpp",
329 "src/ports/SkTLS_none.cpp",
330 ],
331)
332
iroth8b99ef42015-11-02 11:11:21 -0800333# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800334BASE_SRCS_IOS = struct(
335 include = [
Brian Salomon3d6801e2017-12-11 10:06:31 -0500336 "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800337 "src/ports/**/*.cpp",
338 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800339 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800340 ],
341 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800342 "src/ports/*FontConfig*",
343 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700344 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800345 "src/ports/*android*",
346 "src/ports/*chromium*",
347 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800348 "src/ports/*mozalloc*",
349 "src/ports/*nacl*",
350 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800351 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500352 "src/ports/SkFontMgr_custom_directory.cpp",
353 "src/ports/SkFontMgr_custom_embedded.cpp",
354 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800355 "src/ports/SkFontMgr_custom_directory_factory.cpp",
356 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700357 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800358 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500359 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800360 "src/ports/SkImageGenerator_none.cpp",
361 "src/ports/SkTLS_none.cpp",
362 ],
363)
364
benjaminwagner56f6d062016-01-13 10:45:19 -0800365################################################################################
Ben Wagnerdea74282017-03-16 19:15:09 -0400366## skia_srcs()
benjaminwagner56f6d062016-01-13 10:45:19 -0800367################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -0400368def skia_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400369 """Sources to be compiled into the skia library."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400370 return skia_glob(BASE_SRCS_ALL) + skia_select(
371 os_conditions,
372 [
373 skia_glob(BASE_SRCS_UNIX),
374 skia_glob(BASE_SRCS_ANDROID),
375 skia_glob(BASE_SRCS_IOS),
376 ],
377 )
benjaminwagner39e7aa42015-11-18 13:26:10 -0800378
benjaminwagner56f6d062016-01-13 10:45:19 -0800379################################################################################
380## INCLUDES
381################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800382
benjaminwagner787ca872015-08-17 12:58:10 -0700383# Includes needed by Skia implementation. Not public includes.
384INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800385 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700386 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800387 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700388 "include/codec",
389 "include/config",
390 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700391 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400392 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700393 "include/gpu",
394 "include/images",
395 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700396 "include/pipe",
397 "include/ports",
398 "include/private",
399 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800400 "include/utils/mac",
401 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700402 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700403 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800404 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700405 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700406 "src/gpu",
407 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400408 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700409 "src/lazy",
410 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800411 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700412 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700413 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400414 "src/shaders",
benjaminwagnerc8962512016-09-30 12:06:27 -0700415 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700416 "src/utils",
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",
Mike Klein10d66cc2017-11-10 11:33:43 -0500441 "tools/SkRandomScalerContext.cpp",
442 "tools/SkRandomScalerContext.h",
443 "tools/SkTestScalerContext.cpp",
444 "tools/SkTestScalerContext.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700445 "tools/UrlDataManager.cpp",
446 "tools/UrlDataManager.h",
447 "tools/debugger/*.cpp",
448 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700449 "tools/flags/*.cpp",
450 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700451 "tools/gpu/**/*.cpp",
452 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700453 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700454 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800455 "tools/random_parse_path.cpp",
456 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700457 "tools/sk_tool_utils.cpp",
458 "tools/sk_tool_utils.h",
459 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700460 "tools/test_font_monospace.inc",
461 "tools/test_font_sans_serif.inc",
462 "tools/test_font_serif.inc",
463 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700464 "tools/timer/*.cpp",
465 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400466 "tools/trace/*.cpp",
467 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700468 ],
469 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700470 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700471 "tests/skia_test.cpp", # Old main.
472 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner921e48b2016-07-15 11:27:27 -0700473 "tests/SVGDeviceTest.cpp",
Brian Salomonf9ec4702017-11-19 14:46:36 -0500474 "tools/gpu/atlastext/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700475 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700476 "tools/gpu/gl/egl/*",
477 "tools/gpu/gl/glx/*",
478 "tools/gpu/gl/iOS/*",
479 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700480 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700481 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700482 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700483 ],
484)
485
Ben Wagnerdea74282017-03-16 19:15:09 -0400486################################################################################
487## dm_srcs()
488################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700489
Ben Wagner9eca72b2017-10-17 10:57:34 -0400490def dm_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400491 """Sources for the dm binary for the specified os."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400492 return skia_glob(DM_SRCS_ALL) + skia_select(
493 os_conditions,
494 [
495 [],
496 ["tests/FontMgrAndroidParserTest.cpp"],
497 [],
498 ],
499 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800500
501################################################################################
502## DM_INCLUDES
503################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700504
benjaminwagner6f6bef82015-10-15 08:09:44 -0700505DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800506 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700507 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500508 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700509 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500510 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700511 "src/effects",
512 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700513 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700514 "src/pathops",
515 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700516 "src/ports",
Florin Malita5edba452017-05-30 16:39:47 -0400517 "src/shaders",
518 "src/shaders/gradients",
Mike Reedf71828f2017-02-18 09:51:33 -0500519 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700520 "tests",
521 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700522 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700523 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700524 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700525 "tools/timer",
Brian Salomon40d01192017-07-19 13:05:11 -0400526 "tools/trace",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700527]
528
benjaminwagner56f6d062016-01-13 10:45:19 -0800529################################################################################
530## DM_ARGS
531################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700532
Ben Wagner59f9edb2016-11-28 15:30:37 -0500533def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700534 source = ["tests", "gm", "image"]
Ben Wagnere2cbd042017-08-11 09:39:04 -0400535 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
536 config = ["565", "8888", "pdf", "srgb"]
benjaminwagner83906ae2016-05-01 15:02:25 -0700537 # TODO(mtklein): maybe investigate why these fail?
538 match = [
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400539 "~^FontHostStream$$",
540 "~^FontMgr$$",
541 "~^PaintBreakText$$",
542 "~^RecordDraw_TextBounds$$",
benjaminwagner83906ae2016-05-01 15:02:25 -0700543 ]
Ben Wagner59f9edb2016-11-28 15:30:37 -0500544 return ["--src"] + source + ["--config"] + config + ["--match"] + match
benjaminwagner56f6d062016-01-13 10:45:19 -0800545
546################################################################################
547## COPTS
548################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800549
Ben Wagner9eca72b2017-10-17 10:57:34 -0400550def base_copts(os_conditions):
551 return skia_select(
552 os_conditions,
553 [
554 # UNIX
555 [
556 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
557 # Internal use of deprecated methods. :(
558 "-Wno-deprecated-declarations",
559 ],
560 # ANDROID
561 [
562 # 'GrResourceCache' declared with greater visibility than the
563 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
564 "-Wno-error=attributes",
565 ],
566 # IOS
567 [],
568 ],
569 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800570
571################################################################################
572## DEFINES
573################################################################################
574
Ben Wagner9eca72b2017-10-17 10:57:34 -0400575def base_defines(os_conditions):
576 return [
577 # Chrome DEFINES.
578 "SK_USE_FREETYPE_EMBOLDEN",
579 # Turn on a few Google3-specific build fixes.
Mike Klein6613cc52017-12-19 09:09:33 -0500580 "SK_BUILD_FOR_GOOGLE3",
Ben Wagner9eca72b2017-10-17 10:57:34 -0400581 # Required for building dm.
582 "GR_TEST_UTILS",
583 # Staging flags for API changes
584 # Should remove after we update golden images
585 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
586 # Experiment to diagnose image diffs in Google3
587 "SK_JUMPER_DISABLE_8BIT",
588 # JPEG is in codec_limited
589 "SK_HAS_JPEG_LIBRARY",
590 ] + skia_select(
591 os_conditions,
592 [
593 # UNIX
594 [
595 "PNG_SKIP_SETJMP_CHECK",
596 "SK_BUILD_FOR_UNIX",
597 "SK_SAMPLES_FOR_X",
598 "SK_PDF_USE_SFNTLY",
599 "SK_CODEC_DECODES_RAW",
600 "SK_HAS_PNG_LIBRARY",
601 "SK_HAS_WEBP_LIBRARY",
602 ],
603 # ANDROID
604 [
605 "SK_BUILD_FOR_ANDROID",
606 "SK_CODEC_DECODES_RAW",
607 "SK_HAS_PNG_LIBRARY",
608 "SK_HAS_WEBP_LIBRARY",
609 ],
610 # IOS
611 [
612 "SK_BUILD_FOR_IOS",
613 "SK_BUILD_NO_OPTS",
614 "SKNX_NO_SIMD",
615 ],
616 ],
617 )
benjaminwagner787ca872015-08-17 12:58:10 -0700618
benjaminwagner56f6d062016-01-13 10:45:19 -0800619################################################################################
620## LINKOPTS
621################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700622
Ben Wagner9eca72b2017-10-17 10:57:34 -0400623def base_linkopts(os_conditions):
624 return [
625 "-ldl",
626 ] + skia_select(
627 os_conditions,
628 [
629 # UNIX
630 [],
631 # ANDROID
632 [
633 "-lEGL",
634 ],
635 # IOS
636 [
637 "-framework CoreFoundation",
638 "-framework CoreGraphics",
639 "-framework CoreText",
640 "-framework ImageIO",
641 "-framework MobileCoreServices",
642 ],
643 ]
644 )