blob: 0b2c35573a7666b571c6182693b8aa58e9bd55c3 [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
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400249 # Exclude files that don't compile everywhere.
250 "src/svg/**/*", # Depends on xml, SkJpegCodec, and SkPngCodec.
251 "src/xml/**/*", # Avoid dragging in expat when not needed.
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/*",
Mike Klein83ee4632018-03-27 13:22:50 -0400270
271 # Not time for skcms in Google3 yet.
272 "src/core/SkColorSpaceXform_skcms.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700273 ],
274)
275
Ben Wagner9eca72b2017-10-17 10:57:34 -0400276def codec_srcs(limited):
277 """Sources for the codecs. Excludes Ico, Webp, Png, and Raw if limited."""
278 exclude = []
279 if limited:
280 exclude += [
281 "src/codec/*Ico*.cpp",
282 "src/codec/*Webp*.cpp",
283 "src/codec/*Png*",
284 "src/codec/*Raw*.cpp",
285 ]
286 return native.glob(["src/codec/*.cpp"], exclude = exclude)
287
benjaminwagner6f6bef82015-10-15 08:09:44 -0700288# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800289BASE_SRCS_UNIX = struct(
290 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500291 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700292 "src/ports/**/*.cpp",
293 "src/ports/**/*.h",
294 ],
295 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800296 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700297 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800298 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700299 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700300 "src/ports/*mac*",
301 "src/ports/*mozalloc*",
302 "src/ports/*nacl*",
303 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800304 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700305 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700306 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700307 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800308 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800309 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500310 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700311 "src/ports/SkImageGenerator_none.cpp",
312 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700313 ],
314)
315
benjaminwagner86ea33e2015-10-26 10:46:25 -0700316# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800317BASE_SRCS_ANDROID = struct(
318 include = [
Brian Salomonb3ce76e2017-12-11 15:21:39 -0500319 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700320 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700321 "src/ports/**/*.cpp",
322 "src/ports/**/*.h",
323 ],
324 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800325 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800326 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700327 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700328 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700329 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700330 "src/ports/*mac*",
331 "src/ports/*mozalloc*",
332 "src/ports/*nacl*",
333 "src/ports/*win*",
334 "src/ports/SkDebug_stdio.cpp",
335 "src/ports/SkFontMgr_custom_directory_factory.cpp",
336 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700337 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700338 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500339 "src/ports/SkGlobalInitialization_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700340 "src/ports/SkImageGenerator_none.cpp",
341 "src/ports/SkTLS_none.cpp",
342 ],
343)
344
iroth8b99ef42015-11-02 11:11:21 -0800345# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800346BASE_SRCS_IOS = struct(
347 include = [
Brian Salomon3d6801e2017-12-11 10:06:31 -0500348 "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800349 "src/ports/**/*.cpp",
350 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800351 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800352 ],
353 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800354 "src/ports/*FontConfig*",
355 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700356 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800357 "src/ports/*android*",
358 "src/ports/*chromium*",
359 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800360 "src/ports/*mozalloc*",
361 "src/ports/*nacl*",
362 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800363 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500364 "src/ports/SkFontMgr_custom_directory.cpp",
365 "src/ports/SkFontMgr_custom_embedded.cpp",
366 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800367 "src/ports/SkFontMgr_custom_directory_factory.cpp",
368 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700369 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800370 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500371 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800372 "src/ports/SkImageGenerator_none.cpp",
373 "src/ports/SkTLS_none.cpp",
374 ],
375)
376
benjaminwagner56f6d062016-01-13 10:45:19 -0800377################################################################################
Ben Wagnerdea74282017-03-16 19:15:09 -0400378## skia_srcs()
benjaminwagner56f6d062016-01-13 10:45:19 -0800379################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -0400380def skia_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400381 """Sources to be compiled into the skia library."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400382 return skia_glob(BASE_SRCS_ALL) + skia_select(
383 os_conditions,
384 [
385 skia_glob(BASE_SRCS_UNIX),
386 skia_glob(BASE_SRCS_ANDROID),
387 skia_glob(BASE_SRCS_IOS),
388 ],
389 )
benjaminwagner39e7aa42015-11-18 13:26:10 -0800390
benjaminwagner56f6d062016-01-13 10:45:19 -0800391################################################################################
392## INCLUDES
393################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800394
benjaminwagner787ca872015-08-17 12:58:10 -0700395# Includes needed by Skia implementation. Not public includes.
396INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800397 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700398 "include/c",
399 "include/codec",
400 "include/config",
401 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700402 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400403 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700404 "include/gpu",
benjaminwagner787ca872015-08-17 12:58:10 -0700405 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700406 "include/ports",
407 "include/private",
408 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800409 "include/utils/mac",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800410 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700411 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700412 "src/gpu",
413 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400414 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700415 "src/lazy",
416 "src/opts",
417 "src/pdf",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400418 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700419 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400420 "src/shaders",
benjaminwagnerc8962512016-09-30 12:06:27 -0700421 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700422 "src/utils",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400423 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800424]
benjaminwagner787ca872015-08-17 12:58:10 -0700425
benjaminwagner56f6d062016-01-13 10:45:19 -0800426################################################################################
427## DM_SRCS
428################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700429
benjaminwagner56f6d062016-01-13 10:45:19 -0800430DM_SRCS_ALL = struct(
431 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700432 "dm/*.cpp",
433 "dm/*.h",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400434 "experimental/svg/model/*.cpp",
435 "experimental/svg/model/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700436 "gm/*.c",
437 "gm/*.cpp",
438 "gm/*.h",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400439 "src/xml/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700440 "tests/*.cpp",
441 "tests/*.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400442 "tools/ios_utils.h",
443 "tools/BinaryAsset.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700444 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700445 "tools/CrashHandler.cpp",
446 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700447 "tools/ProcStats.cpp",
448 "tools/ProcStats.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400449 "tools/Registry.h",
450 "tools/ResourceFactory.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700451 "tools/Resources.cpp",
452 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700453 "tools/SkJSONCPP.h",
454 "tools/UrlDataManager.cpp",
455 "tools/UrlDataManager.h",
456 "tools/debugger/*.cpp",
457 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700458 "tools/flags/*.cpp",
459 "tools/flags/*.h",
Ben Wagner483c7722018-02-20 17:06:07 -0500460 "tools/fonts/SkRandomScalerContext.cpp",
461 "tools/fonts/SkRandomScalerContext.h",
462 "tools/fonts/SkTestFontMgr.cpp",
463 "tools/fonts/SkTestFontMgr.h",
Ben Wagner97182cc2018-02-15 10:20:04 -0500464 "tools/fonts/SkTestSVGTypeface.cpp",
465 "tools/fonts/SkTestSVGTypeface.h",
466 "tools/fonts/SkTestTypeface.cpp",
467 "tools/fonts/SkTestTypeface.h",
Ben Wagner483c7722018-02-20 17:06:07 -0500468 "tools/fonts/sk_tool_utils_font.cpp",
469 "tools/fonts/test_font_monospace.inc",
470 "tools/fonts/test_font_sans_serif.inc",
471 "tools/fonts/test_font_serif.inc",
472 "tools/fonts/test_font_index.inc",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700473 "tools/gpu/**/*.cpp",
474 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700475 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700476 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800477 "tools/random_parse_path.cpp",
478 "tools/random_parse_path.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400479 "tools/sk_pixel_iter.h",
benjaminwagner32885142015-10-24 07:55:31 -0700480 "tools/sk_tool_utils.cpp",
481 "tools/sk_tool_utils.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700482 "tools/timer/*.cpp",
483 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400484 "tools/trace/*.cpp",
485 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700486 ],
487 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700488 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700489 "tests/skia_test.cpp", # Old main.
Brian Salomonf9ec4702017-11-19 14:46:36 -0500490 "tools/gpu/atlastext/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700491 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700492 "tools/gpu/gl/egl/*",
493 "tools/gpu/gl/glx/*",
494 "tools/gpu/gl/iOS/*",
495 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700496 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700497 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700498 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700499 ],
500)
501
Ben Wagnerdea74282017-03-16 19:15:09 -0400502################################################################################
503## dm_srcs()
504################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700505
Ben Wagner9eca72b2017-10-17 10:57:34 -0400506def dm_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400507 """Sources for the dm binary for the specified os."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400508 return skia_glob(DM_SRCS_ALL) + skia_select(
509 os_conditions,
510 [
511 [],
512 ["tests/FontMgrAndroidParserTest.cpp"],
513 [],
514 ],
515 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800516
517################################################################################
518## DM_INCLUDES
519################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700520
benjaminwagner6f6bef82015-10-15 08:09:44 -0700521DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800522 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700523 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500524 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700525 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500526 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700527 "src/effects",
528 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700529 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700530 "src/pathops",
531 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700532 "src/ports",
Florin Malita5edba452017-05-30 16:39:47 -0400533 "src/shaders",
534 "src/shaders/gradients",
Mike Reedf71828f2017-02-18 09:51:33 -0500535 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700536 "tests",
537 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700538 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700539 "tools/flags",
Ben Wagner483c7722018-02-20 17:06:07 -0500540 "tools/fonts",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700541 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700542 "tools/timer",
Brian Salomon40d01192017-07-19 13:05:11 -0400543 "tools/trace",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700544]
545
benjaminwagner56f6d062016-01-13 10:45:19 -0800546################################################################################
547## DM_ARGS
548################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700549
Ben Wagner59f9edb2016-11-28 15:30:37 -0500550def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700551 source = ["tests", "gm", "image"]
Ben Wagnere2cbd042017-08-11 09:39:04 -0400552 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
553 config = ["565", "8888", "pdf", "srgb"]
Ben Wagneraa567ab2018-03-07 10:36:27 -0500554 return ["--src"] + source + ["--config"] + config + ["--nonativeFonts"]
benjaminwagner56f6d062016-01-13 10:45:19 -0800555
556################################################################################
557## COPTS
558################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800559
Ben Wagner9eca72b2017-10-17 10:57:34 -0400560def base_copts(os_conditions):
561 return skia_select(
562 os_conditions,
563 [
564 # UNIX
565 [
566 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
567 # Internal use of deprecated methods. :(
568 "-Wno-deprecated-declarations",
Mike Klein1b6eb992018-04-16 15:28:37 -0400569 # TODO(kjlubick)
570 "-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
Ben Wagner9eca72b2017-10-17 10:57:34 -0400571 ],
572 # ANDROID
573 [
574 # 'GrResourceCache' declared with greater visibility than the
575 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
576 "-Wno-error=attributes",
577 ],
578 # IOS
579 [],
580 ],
581 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800582
583################################################################################
584## DEFINES
585################################################################################
586
Ben Wagner9eca72b2017-10-17 10:57:34 -0400587def base_defines(os_conditions):
588 return [
589 # Chrome DEFINES.
590 "SK_USE_FREETYPE_EMBOLDEN",
591 # Turn on a few Google3-specific build fixes.
Mike Klein6613cc52017-12-19 09:09:33 -0500592 "SK_BUILD_FOR_GOOGLE3",
Ben Wagner9eca72b2017-10-17 10:57:34 -0400593 # Required for building dm.
594 "GR_TEST_UTILS",
595 # Staging flags for API changes
596 # Should remove after we update golden images
597 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
598 # Experiment to diagnose image diffs in Google3
599 "SK_JUMPER_DISABLE_8BIT",
600 # JPEG is in codec_limited
601 "SK_HAS_JPEG_LIBRARY",
602 ] + skia_select(
603 os_conditions,
604 [
605 # UNIX
606 [
607 "PNG_SKIP_SETJMP_CHECK",
608 "SK_BUILD_FOR_UNIX",
609 "SK_SAMPLES_FOR_X",
610 "SK_PDF_USE_SFNTLY",
611 "SK_CODEC_DECODES_RAW",
612 "SK_HAS_PNG_LIBRARY",
613 "SK_HAS_WEBP_LIBRARY",
614 ],
615 # ANDROID
616 [
617 "SK_BUILD_FOR_ANDROID",
618 "SK_CODEC_DECODES_RAW",
619 "SK_HAS_PNG_LIBRARY",
620 "SK_HAS_WEBP_LIBRARY",
621 ],
622 # IOS
623 [
624 "SK_BUILD_FOR_IOS",
625 "SK_BUILD_NO_OPTS",
626 "SKNX_NO_SIMD",
627 ],
628 ],
629 )
benjaminwagner787ca872015-08-17 12:58:10 -0700630
benjaminwagner56f6d062016-01-13 10:45:19 -0800631################################################################################
632## LINKOPTS
633################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700634
Ben Wagner9eca72b2017-10-17 10:57:34 -0400635def base_linkopts(os_conditions):
636 return [
637 "-ldl",
638 ] + skia_select(
639 os_conditions,
640 [
641 # UNIX
642 [],
643 # ANDROID
644 [
645 "-lEGL",
646 ],
647 # IOS
648 [
649 "-framework CoreFoundation",
650 "-framework CoreGraphics",
651 "-framework CoreText",
652 "-framework ImageIO",
653 "-framework MobileCoreServices",
654 ],
655 ]
656 )