blob: aeb3df274ecada19d08f48fb9327ef63c88a558b [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
Mike Klein33d077d2018-02-27 13:43:53 -050085SKIA_OPTS_HSW = "HSW"
86
Ben Wagner9eca72b2017-10-17 10:57:34 -040087# Arm
88SKIA_OPTS_NEON = "NEON"
89
90SKIA_OPTS_CRC32 = "CRC32" # arm64
91
92def opts_srcs(opts):
93 if opts == SKIA_OPTS_SSE2:
94 return native.glob([
95 "src/opts/*_SSE2.cpp",
96 "src/opts/*_sse2.cpp", # No matches currently.
97 ])
98 elif opts == SKIA_OPTS_SSSE3:
99 return native.glob([
100 "src/opts/*_SSSE3.cpp",
101 "src/opts/*_ssse3.cpp",
102 ])
103 elif opts == SKIA_OPTS_SSE41:
104 return native.glob([
105 "src/opts/*_sse41.cpp",
106 ])
107 elif opts == SKIA_OPTS_SSE42:
108 return native.glob([
109 "src/opts/*_sse42.cpp",
110 ])
111 elif opts == SKIA_OPTS_AVX:
112 return native.glob([
113 "src/opts/*_avx.cpp",
114 ])
Mike Klein33d077d2018-02-27 13:43:53 -0500115 elif opts == SKIA_OPTS_HSW:
116 return native.glob([
117 "src/opts/*_hsw.cpp",
118 ])
Ben Wagner9eca72b2017-10-17 10:57:34 -0400119 elif opts == SKIA_OPTS_NEON:
120 return native.glob([
121 "src/opts/*_neon.cpp",
122 ])
123 elif opts == SKIA_OPTS_CRC32:
124 return native.glob([
125 "src/opts/*_crc32.cpp",
126 ])
127 else:
128 fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
129
130def opts_cflags(opts):
131 if opts == SKIA_OPTS_SSE2:
132 return ["-msse2"]
133 elif opts == SKIA_OPTS_SSSE3:
134 return ["-mssse3"]
135 elif opts == SKIA_OPTS_SSE41:
136 return ["-msse4.1"]
137 elif opts == SKIA_OPTS_SSE42:
138 return ["-msse4.2"]
139 elif opts == SKIA_OPTS_AVX:
140 return ["-mavx"]
Mike Klein33d077d2018-02-27 13:43:53 -0500141 elif opts == SKIA_OPTS_HSW:
142 return ["-mavx2", "-mf16c", "-mfma"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400143 elif opts == SKIA_OPTS_NEON:
144 return ["-mfpu=neon"]
145 elif opts == SKIA_OPTS_CRC32:
Mike Kleinc29bb572017-10-24 11:40:41 -0400146 # NDK r11's Clang (3.8) doesn't pass along this -march setting correctly to an external
147 # assembler, so we do it manually with -Wa. This is just a bug, fixed in later Clangs.
148 return ["-march=armv8-a+crc", "-Wa,-march=armv8-a+crc"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400149 else:
150 return []
151
152SKIA_CPU_ARM = "ARM"
153
154SKIA_CPU_ARM64 = "ARM64"
155
156SKIA_CPU_X86 = "X86"
157
158SKIA_CPU_OTHER = "OTHER"
159
160def opts_rest_srcs(cpu):
161 srcs = []
162 if cpu == SKIA_CPU_ARM or cpu == SKIA_CPU_ARM64:
163 srcs += native.glob([
164 "src/opts/*_arm.cpp",
165 "src/opts/SkBitmapProcState_opts_none.cpp",
166 ])
167 if cpu == SKIA_CPU_ARM64:
168 # NEON doesn't need special flags to compile on ARM64.
169 srcs += native.glob([
170 "src/opts/*_neon.cpp",
171 ])
172 elif cpu == SKIA_CPU_X86:
173 srcs += native.glob([
174 "src/opts/*_x86.cpp",
175 ])
176 elif cpu == SKIA_CPU_OTHER:
177 srcs += native.glob([
178 "src/opts/*_none.cpp",
179 ])
180 else:
181 fail("opts_rest_srcs parameter 'cpu' must be one of " +
182 "SKIA_CPU_{ARM,ARM64,X86,OTHER}.")
183 return srcs
184
185def skia_opts_deps(cpu):
186 res = [":opts_rest"]
187
188 if cpu == SKIA_CPU_ARM:
189 res += [":opts_neon"]
190
191 if cpu == SKIA_CPU_ARM64:
192 res += [":opts_crc32"]
Mike Kleinc29bb572017-10-24 11:40:41 -0400193
Ben Wagner9eca72b2017-10-17 10:57:34 -0400194 if cpu == SKIA_CPU_X86:
195 res += [
196 ":opts_sse2",
197 ":opts_ssse3",
198 ":opts_sse41",
199 ":opts_sse42",
200 ":opts_avx",
Mike Klein33d077d2018-02-27 13:43:53 -0500201 ":opts_hsw",
Ben Wagner9eca72b2017-10-17 10:57:34 -0400202 ]
203
204 return res
205
206################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800207## BASE_SRCS
208################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -0700209
benjaminwagner39e7aa42015-11-18 13:26:10 -0800210# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800211BASE_SRCS_ALL = struct(
212 include = [
Ben Wagnerdea74282017-03-16 19:15:09 -0400213 "include/private/**/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700214 "src/**/*.h",
215 "src/**/*.cpp",
Ben Wagnerdea74282017-03-16 19:15:09 -0400216 "src/**/*.inc",
Mike Klein0a64e322017-03-29 17:32:50 -0400217 "src/jumper/SkJumper_generated.S",
benjaminwagner787ca872015-08-17 12:58:10 -0700218
mtkleind55d13a2015-08-18 08:51:49 -0700219 # Third Party
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400220 "third_party/gif/*.cpp",
221 "third_party/gif/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -0700222 ],
Ben Wagnerdea74282017-03-16 19:15:09 -0400223 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700224 # Exclude platform-dependent files.
iroth76a12252016-01-07 07:11:39 -0800225 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700226 "src/device/xps/*", # Windows-only. Move to ports?
227 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
228 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700229 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700230 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700231 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700232 "src/gpu/gl/iOS/*",
233 "src/gpu/gl/mac/*",
234 "src/gpu/gl/win/*",
235 "src/opts/**/*",
236 "src/ports/**/*",
237 "src/utils/android/**/*",
238 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700239 "src/utils/win/**/*",
240 "src/views/sdl/*",
241 "src/views/win/*",
242 "src/views/unix/*",
243
244 # Exclude multiple definitions.
245 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700246 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500247 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700248
249 # Exclude files that don't compile with the current DEFINES.
benjaminwagner921e48b2016-07-15 11:27:27 -0700250 "src/svg/**/*", # Depends on XML.
251 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700252
benjaminwagner39e7aa42015-11-18 13:26:10 -0800253 # Conflicting dependencies among Lua versions. See cl/107087297.
254 "src/utils/SkLua*",
255
benjaminwagner6f6bef82015-10-15 08:09:44 -0700256 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700257 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800258
259 # Currently exclude all vulkan specific files
260 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700261
262 # Defines main.
263 "src/sksl/SkSLMain.cpp",
Ethan Nicholas8d7f4ae2017-09-07 11:07:42 -0400264
265 # Only used to regenerate the lexer
266 "src/sksl/lex/*",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500267
268 # Atlas text
269 "src/atlastext/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700270 ],
271)
272
Ben Wagner9eca72b2017-10-17 10:57:34 -0400273def codec_srcs(limited):
274 """Sources for the codecs. Excludes Ico, Webp, Png, and Raw if limited."""
275 exclude = []
276 if limited:
277 exclude += [
278 "src/codec/*Ico*.cpp",
279 "src/codec/*Webp*.cpp",
280 "src/codec/*Png*",
281 "src/codec/*Raw*.cpp",
282 ]
283 return native.glob(["src/codec/*.cpp"], exclude = exclude)
284
benjaminwagner6f6bef82015-10-15 08:09:44 -0700285# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800286BASE_SRCS_UNIX = struct(
287 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500288 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700289 "src/ports/**/*.cpp",
290 "src/ports/**/*.h",
291 ],
292 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800293 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700294 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800295 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700296 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700297 "src/ports/*mac*",
298 "src/ports/*mozalloc*",
299 "src/ports/*nacl*",
300 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800301 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700302 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700303 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700304 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800305 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800306 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500307 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700308 "src/ports/SkImageGenerator_none.cpp",
309 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700310 ],
311)
312
benjaminwagner86ea33e2015-10-26 10:46:25 -0700313# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800314BASE_SRCS_ANDROID = struct(
315 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500316 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700317 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700318 "src/ports/**/*.cpp",
319 "src/ports/**/*.h",
320 ],
321 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800322 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800323 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700324 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700325 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700326 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700327 "src/ports/*mac*",
328 "src/ports/*mozalloc*",
329 "src/ports/*nacl*",
330 "src/ports/*win*",
331 "src/ports/SkDebug_stdio.cpp",
332 "src/ports/SkFontMgr_custom_directory_factory.cpp",
333 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700334 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700335 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500336 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700337 "src/ports/SkImageGenerator_none.cpp",
338 "src/ports/SkTLS_none.cpp",
339 ],
340)
341
iroth8b99ef42015-11-02 11:11:21 -0800342# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800343BASE_SRCS_IOS = struct(
344 include = [
Brian Salomon3d6801e2017-12-11 10:06:31 -0500345 "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800346 "src/ports/**/*.cpp",
347 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800348 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800349 ],
350 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800351 "src/ports/*FontConfig*",
352 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700353 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800354 "src/ports/*android*",
355 "src/ports/*chromium*",
356 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800357 "src/ports/*mozalloc*",
358 "src/ports/*nacl*",
359 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800360 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500361 "src/ports/SkFontMgr_custom_directory.cpp",
362 "src/ports/SkFontMgr_custom_embedded.cpp",
363 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800364 "src/ports/SkFontMgr_custom_directory_factory.cpp",
365 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700366 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800367 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500368 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800369 "src/ports/SkImageGenerator_none.cpp",
370 "src/ports/SkTLS_none.cpp",
371 ],
372)
373
benjaminwagner56f6d062016-01-13 10:45:19 -0800374################################################################################
Ben Wagnerdea74282017-03-16 19:15:09 -0400375## skia_srcs()
benjaminwagner56f6d062016-01-13 10:45:19 -0800376################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -0400377def skia_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400378 """Sources to be compiled into the skia library."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400379 return skia_glob(BASE_SRCS_ALL) + skia_select(
380 os_conditions,
381 [
382 skia_glob(BASE_SRCS_UNIX),
383 skia_glob(BASE_SRCS_ANDROID),
384 skia_glob(BASE_SRCS_IOS),
385 ],
386 )
benjaminwagner39e7aa42015-11-18 13:26:10 -0800387
benjaminwagner56f6d062016-01-13 10:45:19 -0800388################################################################################
389## INCLUDES
390################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800391
benjaminwagner787ca872015-08-17 12:58:10 -0700392# Includes needed by Skia implementation. Not public includes.
393INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800394 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700395 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800396 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700397 "include/codec",
398 "include/config",
399 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700400 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400401 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700402 "include/gpu",
403 "include/images",
404 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700405 "include/pipe",
406 "include/ports",
407 "include/private",
408 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800409 "include/utils/mac",
410 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700411 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700412 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800413 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700414 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700415 "src/gpu",
416 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400417 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700418 "src/lazy",
419 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800420 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700421 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700422 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400423 "src/shaders",
benjaminwagnerc8962512016-09-30 12:06:27 -0700424 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700425 "src/utils",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400426 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800427]
benjaminwagner787ca872015-08-17 12:58:10 -0700428
benjaminwagner56f6d062016-01-13 10:45:19 -0800429################################################################################
430## DM_SRCS
431################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700432
benjaminwagner56f6d062016-01-13 10:45:19 -0800433DM_SRCS_ALL = struct(
434 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700435 "dm/*.cpp",
436 "dm/*.h",
437 "gm/*.c",
438 "gm/*.cpp",
439 "gm/*.h",
440 "tests/*.cpp",
441 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700442 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700443 "tools/CrashHandler.cpp",
444 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700445 "tools/ProcStats.cpp",
446 "tools/ProcStats.h",
447 "tools/Resources.cpp",
448 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700449 "tools/SkJSONCPP.h",
450 "tools/UrlDataManager.cpp",
451 "tools/UrlDataManager.h",
452 "tools/debugger/*.cpp",
453 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700454 "tools/flags/*.cpp",
455 "tools/flags/*.h",
Ben Wagner483c7722018-02-20 17:06:07 -0500456 "tools/fonts/SkRandomScalerContext.cpp",
457 "tools/fonts/SkRandomScalerContext.h",
458 "tools/fonts/SkTestFontMgr.cpp",
459 "tools/fonts/SkTestFontMgr.h",
460 "tools/fonts/SkTestScalerContext.cpp",
461 "tools/fonts/SkTestScalerContext.h",
462 "tools/fonts/sk_tool_utils_font.cpp",
463 "tools/fonts/test_font_monospace.inc",
464 "tools/fonts/test_font_sans_serif.inc",
465 "tools/fonts/test_font_serif.inc",
466 "tools/fonts/test_font_index.inc",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700467 "tools/gpu/**/*.cpp",
468 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700469 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700470 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800471 "tools/random_parse_path.cpp",
472 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700473 "tools/sk_tool_utils.cpp",
474 "tools/sk_tool_utils.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700475 "tools/timer/*.cpp",
476 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400477 "tools/trace/*.cpp",
478 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700479 ],
480 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700481 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700482 "tests/skia_test.cpp", # Old main.
benjaminwagner921e48b2016-07-15 11:27:27 -0700483 "tests/SVGDeviceTest.cpp",
Brian Salomonf9ec4702017-11-19 14:46:36 -0500484 "tools/gpu/atlastext/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700485 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700486 "tools/gpu/gl/egl/*",
487 "tools/gpu/gl/glx/*",
488 "tools/gpu/gl/iOS/*",
489 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700490 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700491 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700492 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700493 ],
494)
495
Ben Wagnerdea74282017-03-16 19:15:09 -0400496################################################################################
497## dm_srcs()
498################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700499
Ben Wagner9eca72b2017-10-17 10:57:34 -0400500def dm_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400501 """Sources for the dm binary for the specified os."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400502 return skia_glob(DM_SRCS_ALL) + skia_select(
503 os_conditions,
504 [
505 [],
506 ["tests/FontMgrAndroidParserTest.cpp"],
507 [],
508 ],
509 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800510
511################################################################################
512## DM_INCLUDES
513################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700514
benjaminwagner6f6bef82015-10-15 08:09:44 -0700515DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800516 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700517 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500518 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700519 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500520 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700521 "src/effects",
522 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700523 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700524 "src/pathops",
525 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700526 "src/ports",
Florin Malita5edba452017-05-30 16:39:47 -0400527 "src/shaders",
528 "src/shaders/gradients",
Mike Reedf71828f2017-02-18 09:51:33 -0500529 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700530 "tests",
531 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700532 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700533 "tools/flags",
Ben Wagner483c7722018-02-20 17:06:07 -0500534 "tools/fonts",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700535 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700536 "tools/timer",
Brian Salomon40d01192017-07-19 13:05:11 -0400537 "tools/trace",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700538]
539
benjaminwagner56f6d062016-01-13 10:45:19 -0800540################################################################################
541## DM_ARGS
542################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700543
Ben Wagner59f9edb2016-11-28 15:30:37 -0500544def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700545 source = ["tests", "gm", "image"]
Ben Wagnere2cbd042017-08-11 09:39:04 -0400546 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
547 config = ["565", "8888", "pdf", "srgb"]
benjaminwagner83906ae2016-05-01 15:02:25 -0700548 # TODO(mtklein): maybe investigate why these fail?
549 match = [
Ben Wagner56e9d4a2017-09-12 19:33:38 -0400550 "~^FontHostStream$$",
551 "~^FontMgr$$",
552 "~^PaintBreakText$$",
553 "~^RecordDraw_TextBounds$$",
benjaminwagner83906ae2016-05-01 15:02:25 -0700554 ]
Ben Wagner59f9edb2016-11-28 15:30:37 -0500555 return ["--src"] + source + ["--config"] + config + ["--match"] + match
benjaminwagner56f6d062016-01-13 10:45:19 -0800556
557################################################################################
558## COPTS
559################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800560
Ben Wagner9eca72b2017-10-17 10:57:34 -0400561def base_copts(os_conditions):
562 return skia_select(
563 os_conditions,
564 [
565 # UNIX
566 [
567 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
568 # Internal use of deprecated methods. :(
569 "-Wno-deprecated-declarations",
570 ],
571 # ANDROID
572 [
573 # 'GrResourceCache' declared with greater visibility than the
574 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
575 "-Wno-error=attributes",
576 ],
577 # IOS
578 [],
579 ],
580 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800581
582################################################################################
583## DEFINES
584################################################################################
585
Ben Wagner9eca72b2017-10-17 10:57:34 -0400586def base_defines(os_conditions):
587 return [
588 # Chrome DEFINES.
589 "SK_USE_FREETYPE_EMBOLDEN",
590 # Turn on a few Google3-specific build fixes.
Mike Klein6613cc52017-12-19 09:09:33 -0500591 "SK_BUILD_FOR_GOOGLE3",
Ben Wagner9eca72b2017-10-17 10:57:34 -0400592 # Required for building dm.
593 "GR_TEST_UTILS",
594 # Staging flags for API changes
595 # Should remove after we update golden images
596 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
597 # Experiment to diagnose image diffs in Google3
598 "SK_JUMPER_DISABLE_8BIT",
599 # JPEG is in codec_limited
600 "SK_HAS_JPEG_LIBRARY",
601 ] + skia_select(
602 os_conditions,
603 [
604 # UNIX
605 [
606 "PNG_SKIP_SETJMP_CHECK",
607 "SK_BUILD_FOR_UNIX",
608 "SK_SAMPLES_FOR_X",
609 "SK_PDF_USE_SFNTLY",
610 "SK_CODEC_DECODES_RAW",
611 "SK_HAS_PNG_LIBRARY",
612 "SK_HAS_WEBP_LIBRARY",
613 ],
614 # ANDROID
615 [
616 "SK_BUILD_FOR_ANDROID",
617 "SK_CODEC_DECODES_RAW",
618 "SK_HAS_PNG_LIBRARY",
619 "SK_HAS_WEBP_LIBRARY",
620 ],
621 # IOS
622 [
623 "SK_BUILD_FOR_IOS",
624 "SK_BUILD_NO_OPTS",
625 "SKNX_NO_SIMD",
626 ],
627 ],
628 )
benjaminwagner787ca872015-08-17 12:58:10 -0700629
benjaminwagner56f6d062016-01-13 10:45:19 -0800630################################################################################
631## LINKOPTS
632################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700633
Ben Wagner9eca72b2017-10-17 10:57:34 -0400634def base_linkopts(os_conditions):
635 return [
636 "-ldl",
637 ] + skia_select(
638 os_conditions,
639 [
640 # UNIX
641 [],
642 # ANDROID
643 [
644 "-lEGL",
645 ],
646 # IOS
647 [
648 "-framework CoreFoundation",
649 "-framework CoreGraphics",
650 "-framework CoreText",
651 "-framework ImageIO",
652 "-framework MobileCoreServices",
653 ],
654 ]
655 )