blob: c9b789c2adb3ec6c65e3899e938862810729a22e [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/*.cpp",
437 "gm/*.h",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400438 "src/xml/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700439 "tests/*.cpp",
440 "tests/*.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400441 "tools/ios_utils.h",
442 "tools/BinaryAsset.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700443 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700444 "tools/CrashHandler.cpp",
445 "tools/CrashHandler.h",
Robert Phillipse61ba842018-05-30 08:27:26 -0400446 "tools/DDLPromiseImageHelper.cpp",
447 "tools/DDLPromiseImageHelper.h",
448 "tools/DDLTileHelper.cpp",
449 "tools/DDLTileHelper.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700450 "tools/ProcStats.cpp",
451 "tools/ProcStats.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400452 "tools/Registry.h",
453 "tools/ResourceFactory.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700454 "tools/Resources.cpp",
455 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700456 "tools/SkJSONCPP.h",
457 "tools/UrlDataManager.cpp",
458 "tools/UrlDataManager.h",
459 "tools/debugger/*.cpp",
460 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700461 "tools/flags/*.cpp",
462 "tools/flags/*.h",
Ben Wagner483c7722018-02-20 17:06:07 -0500463 "tools/fonts/SkRandomScalerContext.cpp",
464 "tools/fonts/SkRandomScalerContext.h",
465 "tools/fonts/SkTestFontMgr.cpp",
466 "tools/fonts/SkTestFontMgr.h",
Ben Wagner97182cc2018-02-15 10:20:04 -0500467 "tools/fonts/SkTestSVGTypeface.cpp",
468 "tools/fonts/SkTestSVGTypeface.h",
469 "tools/fonts/SkTestTypeface.cpp",
470 "tools/fonts/SkTestTypeface.h",
Ben Wagner483c7722018-02-20 17:06:07 -0500471 "tools/fonts/sk_tool_utils_font.cpp",
472 "tools/fonts/test_font_monospace.inc",
473 "tools/fonts/test_font_sans_serif.inc",
474 "tools/fonts/test_font_serif.inc",
475 "tools/fonts/test_font_index.inc",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700476 "tools/gpu/**/*.cpp",
477 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700478 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700479 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800480 "tools/random_parse_path.cpp",
481 "tools/random_parse_path.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400482 "tools/sk_pixel_iter.h",
benjaminwagner32885142015-10-24 07:55:31 -0700483 "tools/sk_tool_utils.cpp",
484 "tools/sk_tool_utils.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700485 "tools/timer/*.cpp",
486 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400487 "tools/trace/*.cpp",
488 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700489 ],
490 exclude = [
Mike Kleindb537602018-06-01 11:01:11 -0400491 "gm/cgms.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700492 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700493 "tests/skia_test.cpp", # Old main.
Brian Salomonf9ec4702017-11-19 14:46:36 -0500494 "tools/gpu/atlastext/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700495 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700496 "tools/gpu/gl/egl/*",
497 "tools/gpu/gl/glx/*",
498 "tools/gpu/gl/iOS/*",
499 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700500 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700501 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700502 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700503 ],
504)
505
Ben Wagnerdea74282017-03-16 19:15:09 -0400506################################################################################
507## dm_srcs()
508################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700509
Ben Wagner9eca72b2017-10-17 10:57:34 -0400510def dm_srcs(os_conditions):
Ben Wagnerdea74282017-03-16 19:15:09 -0400511 """Sources for the dm binary for the specified os."""
Ben Wagner9eca72b2017-10-17 10:57:34 -0400512 return skia_glob(DM_SRCS_ALL) + skia_select(
513 os_conditions,
514 [
515 [],
516 ["tests/FontMgrAndroidParserTest.cpp"],
517 [],
518 ],
519 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800520
521################################################################################
522## DM_INCLUDES
523################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700524
benjaminwagner6f6bef82015-10-15 08:09:44 -0700525DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800526 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700527 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500528 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700529 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500530 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700531 "src/effects",
532 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700533 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700534 "src/pathops",
535 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700536 "src/ports",
Florin Malita5edba452017-05-30 16:39:47 -0400537 "src/shaders",
538 "src/shaders/gradients",
Mike Reedf71828f2017-02-18 09:51:33 -0500539 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700540 "tests",
541 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700542 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700543 "tools/flags",
Ben Wagner483c7722018-02-20 17:06:07 -0500544 "tools/fonts",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700545 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700546 "tools/timer",
Brian Salomon40d01192017-07-19 13:05:11 -0400547 "tools/trace",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700548]
549
benjaminwagner56f6d062016-01-13 10:45:19 -0800550################################################################################
551## DM_ARGS
552################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700553
Ben Wagner59f9edb2016-11-28 15:30:37 -0500554def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700555 source = ["tests", "gm", "image"]
Ben Wagnere2cbd042017-08-11 09:39:04 -0400556 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
557 config = ["565", "8888", "pdf", "srgb"]
Ben Wagneraa567ab2018-03-07 10:36:27 -0500558 return ["--src"] + source + ["--config"] + config + ["--nonativeFonts"]
benjaminwagner56f6d062016-01-13 10:45:19 -0800559
560################################################################################
561## COPTS
562################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800563
Ben Wagner9eca72b2017-10-17 10:57:34 -0400564def base_copts(os_conditions):
565 return skia_select(
566 os_conditions,
567 [
568 # UNIX
569 [
570 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
571 # Internal use of deprecated methods. :(
572 "-Wno-deprecated-declarations",
Mike Klein1b6eb992018-04-16 15:28:37 -0400573 # TODO(kjlubick)
574 "-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
Ben Wagner9eca72b2017-10-17 10:57:34 -0400575 ],
576 # ANDROID
577 [
578 # 'GrResourceCache' declared with greater visibility than the
579 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
580 "-Wno-error=attributes",
581 ],
582 # IOS
583 [],
584 ],
585 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800586
587################################################################################
588## DEFINES
589################################################################################
590
Ben Wagner9eca72b2017-10-17 10:57:34 -0400591def base_defines(os_conditions):
592 return [
593 # Chrome DEFINES.
594 "SK_USE_FREETYPE_EMBOLDEN",
595 # Turn on a few Google3-specific build fixes.
Mike Klein6613cc52017-12-19 09:09:33 -0500596 "SK_BUILD_FOR_GOOGLE3",
Ben Wagner9eca72b2017-10-17 10:57:34 -0400597 # Required for building dm.
598 "GR_TEST_UTILS",
599 # Staging flags for API changes
600 # Should remove after we update golden images
601 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
602 # Experiment to diagnose image diffs in Google3
603 "SK_JUMPER_DISABLE_8BIT",
604 # JPEG is in codec_limited
605 "SK_HAS_JPEG_LIBRARY",
606 ] + skia_select(
607 os_conditions,
608 [
609 # UNIX
610 [
611 "PNG_SKIP_SETJMP_CHECK",
612 "SK_BUILD_FOR_UNIX",
613 "SK_SAMPLES_FOR_X",
614 "SK_PDF_USE_SFNTLY",
615 "SK_CODEC_DECODES_RAW",
616 "SK_HAS_PNG_LIBRARY",
617 "SK_HAS_WEBP_LIBRARY",
618 ],
619 # ANDROID
620 [
621 "SK_BUILD_FOR_ANDROID",
622 "SK_CODEC_DECODES_RAW",
623 "SK_HAS_PNG_LIBRARY",
624 "SK_HAS_WEBP_LIBRARY",
625 ],
626 # IOS
627 [
628 "SK_BUILD_FOR_IOS",
629 "SK_BUILD_NO_OPTS",
630 "SKNX_NO_SIMD",
631 ],
632 ],
633 )
benjaminwagner787ca872015-08-17 12:58:10 -0700634
benjaminwagner56f6d062016-01-13 10:45:19 -0800635################################################################################
636## LINKOPTS
637################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700638
Ben Wagner9eca72b2017-10-17 10:57:34 -0400639def base_linkopts(os_conditions):
640 return [
641 "-ldl",
642 ] + skia_select(
643 os_conditions,
644 [
645 # UNIX
646 [],
647 # ANDROID
648 [
649 "-lEGL",
650 ],
651 # IOS
652 [
653 "-framework CoreFoundation",
654 "-framework CoreGraphics",
655 "-framework CoreText",
656 "-framework ImageIO",
657 "-framework MobileCoreServices",
658 ],
659 ]
660 )