blob: 5b32518263adfe50357d8a8af8a8a85212423b99 [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 -08005def skia_select(conditions, results):
Mike Kleinbec7f102020-06-02 08:12:02 -05006 """select() for conditions provided externally.
7
8 Instead of {"conditionA": resultA, "conditionB": resultB},
9 this takes two arrays, ["conditionA", "conditionB"] and [resultA, resultB].
10
11 This allows the exact targets of the conditions to be provided externally while
12 the results can live here, hiding the structure of those conditions in Google3.
13
14 Maybe this is too much paranoia?
benjaminwagner56f6d062016-01-13 10:45:19 -080015
Ben Wagnerb303a422018-07-31 10:31:06 -040016 Args:
Mike Kleinbec7f102020-06-02 08:12:02 -050017 conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS, CONDITION_WASM, ...]
18 results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS, RESULT_WASM, ....]
Ben Wagnerb303a422018-07-31 10:31:06 -040019 Returns:
Mike Kleinbec7f102020-06-02 08:12:02 -050020 The result matching the active condition.
Ben Wagnerb303a422018-07-31 10:31:06 -040021 """
Ben Wagnerb303a422018-07-31 10:31:06 -040022 selector = {}
Mike Kleinbec7f102020-06-02 08:12:02 -050023 for i in range(len(conditions)):
Ben Wagnerb303a422018-07-31 10:31:06 -040024 selector[conditions[i]] = results[i]
Mike Kleinbec7f102020-06-02 08:12:02 -050025 return select(selector)
benjaminwagner56f6d062016-01-13 10:45:19 -080026
27def skia_glob(srcs):
Ben Wagnerb303a422018-07-31 10:31:06 -040028 """Replaces glob() with a version that accepts a struct.
benjaminwagner56f6d062016-01-13 10:45:19 -080029
Ben Wagnerb303a422018-07-31 10:31:06 -040030 Args:
31 srcs: struct(include=[], exclude=[])
32 Returns:
33 Equivalent of glob(srcs.include, exclude=srcs.exclude)
34 """
35 if hasattr(srcs, "include"):
36 if hasattr(srcs, "exclude"):
37 return native.glob(srcs.include, exclude = srcs.exclude)
38 else:
39 return native.glob(srcs.include)
40 return []
benjaminwagner56f6d062016-01-13 10:45:19 -080041
42################################################################################
Ben Wagner9eca72b2017-10-17 10:57:34 -040043## skia_{all,public}_hdrs()
44################################################################################
45def skia_all_hdrs():
Ben Wagnerb303a422018-07-31 10:31:06 -040046 return native.glob([
47 "src/**/*.h",
48 "include/**/*.h",
49 "third_party/**/*.h",
50 ])
Ben Wagner9eca72b2017-10-17 10:57:34 -040051
52def skia_public_hdrs():
Ben Wagnerb303a422018-07-31 10:31:06 -040053 return native.glob(
54 ["include/**/*.h"],
55 exclude = [
56 "include/private/**/*",
Ben Wagnerb303a422018-07-31 10:31:06 -040057 ],
58 )
Ben Wagner9eca72b2017-10-17 10:57:34 -040059
60################################################################################
61## skia_opts_srcs()
62################################################################################
63# Intel
64SKIA_OPTS_SSE2 = "SSE2"
65
66SKIA_OPTS_SSSE3 = "SSSE3"
67
68SKIA_OPTS_SSE41 = "SSE41"
69
70SKIA_OPTS_SSE42 = "SSE42"
71
72SKIA_OPTS_AVX = "AVX"
73
Mike Klein33d077d2018-02-27 13:43:53 -050074SKIA_OPTS_HSW = "HSW"
75
Ben Wagner9eca72b2017-10-17 10:57:34 -040076# Arm
77SKIA_OPTS_NEON = "NEON"
78
79SKIA_OPTS_CRC32 = "CRC32" # arm64
80
81def opts_srcs(opts):
Ben Wagnerb303a422018-07-31 10:31:06 -040082 if opts == SKIA_OPTS_SSE2:
83 return native.glob([
84 "src/opts/*_SSE2.cpp",
85 "src/opts/*_sse2.cpp", # No matches currently.
86 ])
87 elif opts == SKIA_OPTS_SSSE3:
88 return native.glob([
89 "src/opts/*_SSSE3.cpp",
90 "src/opts/*_ssse3.cpp",
91 ])
92 elif opts == SKIA_OPTS_SSE41:
93 return native.glob([
94 "src/opts/*_sse41.cpp",
95 ])
96 elif opts == SKIA_OPTS_SSE42:
97 return native.glob([
98 "src/opts/*_sse42.cpp",
99 ])
100 elif opts == SKIA_OPTS_AVX:
101 return native.glob([
102 "src/opts/*_avx.cpp",
103 ])
104 elif opts == SKIA_OPTS_HSW:
105 return native.glob([
106 "src/opts/*_hsw.cpp",
107 ])
108 elif opts == SKIA_OPTS_NEON:
109 return native.glob([
110 "src/opts/*_neon.cpp",
111 ])
112 elif opts == SKIA_OPTS_CRC32:
113 return native.glob([
114 "src/opts/*_crc32.cpp",
115 ])
116 else:
117 fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
Ben Wagner9eca72b2017-10-17 10:57:34 -0400118
119def opts_cflags(opts):
Ben Wagnerb303a422018-07-31 10:31:06 -0400120 if opts == SKIA_OPTS_SSE2:
121 return ["-msse2"]
122 elif opts == SKIA_OPTS_SSSE3:
123 return ["-mssse3"]
124 elif opts == SKIA_OPTS_SSE41:
125 return ["-msse4.1"]
126 elif opts == SKIA_OPTS_SSE42:
127 return ["-msse4.2"]
128 elif opts == SKIA_OPTS_AVX:
129 return ["-mavx"]
130 elif opts == SKIA_OPTS_HSW:
131 return ["-mavx2", "-mf16c", "-mfma"]
132 elif opts == SKIA_OPTS_NEON:
133 return ["-mfpu=neon"]
134 elif opts == SKIA_OPTS_CRC32:
135 # NDK r11's Clang (3.8) doesn't pass along this -march setting correctly to an external
136 # assembler, so we do it manually with -Wa. This is just a bug, fixed in later Clangs.
137 return ["-march=armv8-a+crc", "-Wa,-march=armv8-a+crc"]
138 else:
139 return []
Ben Wagner9eca72b2017-10-17 10:57:34 -0400140
141SKIA_CPU_ARM = "ARM"
142
143SKIA_CPU_ARM64 = "ARM64"
144
145SKIA_CPU_X86 = "X86"
146
147SKIA_CPU_OTHER = "OTHER"
148
149def opts_rest_srcs(cpu):
Ben Wagnerb303a422018-07-31 10:31:06 -0400150 srcs = []
151 if cpu == SKIA_CPU_ARM or cpu == SKIA_CPU_ARM64:
152 srcs += native.glob([
153 "src/opts/*_arm.cpp",
154 "src/opts/SkBitmapProcState_opts_none.cpp",
155 ])
156 if cpu == SKIA_CPU_ARM64:
157 # NEON doesn't need special flags to compile on ARM64.
158 srcs += native.glob([
159 "src/opts/*_neon.cpp",
160 ])
161 elif cpu == SKIA_CPU_X86:
162 srcs += native.glob([
163 "src/opts/*_x86.cpp",
164 ])
165 elif cpu == SKIA_CPU_OTHER:
166 srcs += native.glob([
167 "src/opts/*_none.cpp",
168 ])
169 else:
170 fail("opts_rest_srcs parameter 'cpu' must be one of " +
171 "SKIA_CPU_{ARM,ARM64,X86,OTHER}.")
172 return srcs
Ben Wagner9eca72b2017-10-17 10:57:34 -0400173
174def skia_opts_deps(cpu):
Ben Wagnerb303a422018-07-31 10:31:06 -0400175 res = [":opts_rest"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400176
Ben Wagnerb303a422018-07-31 10:31:06 -0400177 if cpu == SKIA_CPU_ARM:
178 res += [":opts_neon"]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400179
Ben Wagnerb303a422018-07-31 10:31:06 -0400180 if cpu == SKIA_CPU_ARM64:
181 res += [":opts_crc32"]
Mike Kleinc29bb572017-10-24 11:40:41 -0400182
Ben Wagnerb303a422018-07-31 10:31:06 -0400183 if cpu == SKIA_CPU_X86:
184 res += [
185 ":opts_sse2",
186 ":opts_ssse3",
187 ":opts_sse41",
188 ":opts_sse42",
189 ":opts_avx",
190 ":opts_hsw",
191 ]
Ben Wagner9eca72b2017-10-17 10:57:34 -0400192
Ben Wagnerb303a422018-07-31 10:31:06 -0400193 return res
Ben Wagner9eca72b2017-10-17 10:57:34 -0400194
195################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800196## BASE_SRCS
197################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -0700198
benjaminwagner39e7aa42015-11-18 13:26:10 -0800199# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800200BASE_SRCS_ALL = struct(
201 include = [
Ben Wagnerdea74282017-03-16 19:15:09 -0400202 "include/private/**/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700203 "src/**/*.h",
204 "src/**/*.cpp",
Ben Wagnerdea74282017-03-16 19:15:09 -0400205 "src/**/*.inc",
benjaminwagner787ca872015-08-17 12:58:10 -0700206 ],
Ben Wagnerdea74282017-03-16 19:15:09 -0400207 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700208 # Exclude platform-dependent files.
Mike Klein9509e042019-05-15 21:57:48 +0000209 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700210 "src/device/xps/*", # Windows-only. Move to ports?
211 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
212 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700213 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700214 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700215 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700216 "src/gpu/gl/iOS/*",
217 "src/gpu/gl/mac/*",
218 "src/gpu/gl/win/*",
219 "src/opts/**/*",
220 "src/ports/**/*",
221 "src/utils/android/**/*",
222 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700223 "src/utils/win/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700224
225 # Exclude multiple definitions.
Kevin Lubickc9210672018-10-15 11:36:55 -0400226 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
227 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700228
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400229 # Exclude files that don't compile everywhere.
230 "src/svg/**/*", # Depends on xml, SkJpegCodec, and SkPngCodec.
231 "src/xml/**/*", # Avoid dragging in expat when not needed.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700232
Guruji Panda9ae40202020-07-10 09:17:47 -0700233 # Exclude all GL specific files
234 "src/gpu/gl/*",
235 "src/gpu/gl/builders/*",
236
Kevin Lubick2eabdf52020-08-20 12:31:21 -0400237 # Exclude all WebGL specific files
238 "src/gpu/gl/webgl/*",
239
egdaniel32119f12016-02-22 10:07:54 -0800240 # Currently exclude all vulkan specific files
241 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700242
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500243 # Currently exclude all Direct3D specific files
244 "src/gpu/d3d/*",
245
Stephen White985741a2019-07-18 11:43:45 -0400246 # Currently exclude all Dawn-specific files
247 "src/gpu/dawn/*",
248
benjaminwagnerc8962512016-09-30 12:06:27 -0700249 # Defines main.
250 "src/sksl/SkSLMain.cpp",
Ethan Nicholas8d7f4ae2017-09-07 11:07:42 -0400251
252 # Only used to regenerate the lexer
253 "src/sksl/lex/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700254 ],
255)
256
Hal Canaryce4693f2019-11-20 21:43:54 +0000257def codec_srcs(limited):
258 """Sources for the codecs. Excludes Raw, and Ico, Webp, and Png if limited."""
Ben Wagnerec8c6602018-10-26 12:31:36 -0400259
Hal Canaryb5c217b2019-11-20 10:16:10 -0500260 exclude = ["src/codec/*Raw*.cpp"]
Hal Canaryce4693f2019-11-20 21:43:54 +0000261 if limited:
262 exclude += [
263 "src/codec/*Ico*.cpp",
264 "src/codec/*Webp*.cpp",
265 "src/codec/*Png*",
266 ]
Hal Canaryb5c217b2019-11-20 10:16:10 -0500267 return native.glob(["src/codec/*.cpp"], exclude = exclude)
Ben Wagner9eca72b2017-10-17 10:57:34 -0400268
Mike Klein7f95c292019-03-27 11:16:25 -0500269GL_SRCS_UNIX = struct(
benjaminwagner56f6d062016-01-13 10:45:19 -0800270 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500271 "src/gpu/gl/*.cpp",
272 "src/gpu/gl/*.h",
273 "src/gpu/gl/builders/*.cpp",
274 "src/gpu/gl/builders/*.h",
Mike Klein7f95c292019-03-27 11:16:25 -0500275 ],
276 exclude = [],
277)
278PORTS_SRCS_UNIX = struct(
279 include = [
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*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400292 "src/ports/*NDK*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800293 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700294 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700295 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700296 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800297 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800298 "src/ports/SkFontMgr_fuchsia.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700299 "src/ports/SkImageGenerator_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700300 ],
301)
302
Mike Klein7f95c292019-03-27 11:16:25 -0500303GL_SRCS_ANDROID = struct(
benjaminwagner56f6d062016-01-13 10:45:19 -0800304 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500305 "src/gpu/gl/*.cpp",
306 "src/gpu/gl/*.h",
307 "src/gpu/gl/builders/*.cpp",
308 "src/gpu/gl/builders/*.h",
Ben Wagner773151f2018-08-17 09:28:53 -0400309 "src/gpu/gl/android/*.cpp",
Mike Klein7f95c292019-03-27 11:16:25 -0500310 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700311 exclude = [
312 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
313 ],
Mike Klein7f95c292019-03-27 11:16:25 -0500314)
315PORTS_SRCS_ANDROID = struct(
316 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700317 "src/ports/**/*.cpp",
318 "src/ports/**/*.h",
319 ],
320 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800321 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800322 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700323 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700324 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700325 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700326 "src/ports/*mac*",
327 "src/ports/*mozalloc*",
328 "src/ports/*nacl*",
329 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400330 "src/ports/*NDK*", # TODO (scroggo): enable NDK decoding/encoding in Google3
benjaminwagner86ea33e2015-10-26 10:46:25 -0700331 "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",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800336 "src/ports/SkFontMgr_fuchsia.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700337 "src/ports/SkImageGenerator_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700338 ],
339)
340
Jorge Betancourtbb69f092022-01-21 13:48:50 -0500341PORTS_SRCS_ANDROID_NO_FONT = struct(
342 include = [
343 "src/ports/**/*.cpp",
344 "src/ports/**/*.h",
345 ],
346 exclude = [
347 "src/ports/*CG*",
348 "src/ports/*FontConfig*",
349 "src/ports/*WIC*",
350 "src/ports/*chromium*",
351 "src/ports/*fontconfig*",
352 "src/ports/*mac*",
353 "src/ports/*mozalloc*",
354 "src/ports/*nacl*",
355 "src/ports/*win*",
356 "src/ports/*NDK*",
357 "src/ports/SkDebug_stdio.cpp",
358 "src/ports/SkFontMgr_a*",
359 "src/ports/SkFontHost_Free*",
360 "src/ports/SkFontMgr_custom*",
361 "src/ports/SkFontMgr_fuchsia.cpp",
362 "src/ports/SkImageGenerator_none.cpp",
363 ],
364)
365
Mike Klein7f95c292019-03-27 11:16:25 -0500366GL_SRCS_IOS = struct(
benjaminwagner56f6d062016-01-13 10:45:19 -0800367 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500368 "src/gpu/gl/*.cpp",
369 "src/gpu/gl/*.h",
370 "src/gpu/gl/builders/*.cpp",
371 "src/gpu/gl/builders/*.h",
Brian Salomon3d6801e2017-12-11 10:06:31 -0500372 "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
Mike Klein7f95c292019-03-27 11:16:25 -0500373 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700374 exclude = [
375 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
376 ],
Mike Klein7f95c292019-03-27 11:16:25 -0500377)
378PORTS_SRCS_IOS = struct(
379 include = [
iroth8b99ef42015-11-02 11:11:21 -0800380 "src/ports/**/*.cpp",
381 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800382 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800383 ],
384 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800385 "src/ports/*FontConfig*",
386 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700387 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800388 "src/ports/*android*",
389 "src/ports/*chromium*",
390 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800391 "src/ports/*mozalloc*",
392 "src/ports/*nacl*",
393 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400394 "src/ports/*NDK*",
iroth8b99ef42015-11-02 11:11:21 -0800395 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500396 "src/ports/SkFontMgr_custom_directory.cpp",
397 "src/ports/SkFontMgr_custom_embedded.cpp",
398 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800399 "src/ports/SkFontMgr_custom_directory_factory.cpp",
400 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700401 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800402 "src/ports/SkFontMgr_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800403 "src/ports/SkFontMgr_fuchsia.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800404 "src/ports/SkImageGenerator_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800405 ],
406)
407
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500408GL_SRCS_WASM = struct(
409 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500410 "src/gpu/gl/*.cpp",
411 "src/gpu/gl/*.h",
412 "src/gpu/gl/builders/*.cpp",
413 "src/gpu/gl/builders/*.h",
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500414 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500415 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
416 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700417 exclude = [
418 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
419 ],
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500420)
421PORTS_SRCS_WASM = struct(
422 include = [
423 "src/ports/**/*.cpp",
424 "src/ports/**/*.h",
425 ],
426 exclude = [
427 # commented lines below left in because they indicate specifically what is
428 # included here and not in other PORTS_SRCS lists.
429 "src/ports/*FontConfig*",
Nathaniel Nifong3d6d4162020-09-18 15:29:12 -0400430 #"src/ports/*FreeType*",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500431 "src/ports/*WIC*",
432 "src/ports/*CG*",
433 "src/ports/*android*",
434 "src/ports/*chromium*",
435 "src/ports/*fontconfig*",
436 "src/ports/*mac*",
437 "src/ports/*mozalloc*",
438 "src/ports/*nacl*",
439 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400440 "src/ports/*NDK*",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500441 #"src/ports/SkDebug_stdio.cpp",
Nathaniel Nifong3d6d4162020-09-18 15:29:12 -0400442 #"src/ports/SkFontMgr_custom.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500443 "src/ports/SkFontMgr_custom_directory.cpp",
444 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Kevin Lubick4e0e8d42020-12-23 07:58:58 -0500445 "src/ports/SkFontMgr_custom_embedded.cpp",
446 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500447 "src/ports/SkFontMgr_custom_empty.cpp",
448 "src/ports/SkFontMgr_custom_empty_factory.cpp",
449 # "src/ports/SkFontMgr_empty_factory.cpp",
450 "src/ports/SkFontMgr_fontconfig_factory.cpp",
451 "src/ports/SkFontMgr_fuchsia.cpp",
452 "src/ports/SkImageGenerator_none.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500453 ],
454)
455
Mike Klein54c0d062020-06-02 09:13:01 -0500456GL_SRCS_FUCHSIA = struct(
457 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500458 "src/gpu/vk/*.cpp",
459 "src/gpu/vk/*.h",
Mike Klein54c0d062020-06-02 09:13:01 -0500460 ],
461 exclude = [],
462)
463PORTS_SRCS_FUCHSIA = struct(
464 include = [
465 "src/ports/**/*.cpp",
466 "src/ports/**/*.h",
467 ],
468 exclude = [
469 "src/ports/*FontConfig*",
470 #"src/ports/*FreeType*",
471 "src/ports/*WIC*",
472 "src/ports/*CG*",
473 "src/ports/*android*",
474 "src/ports/*chromium*",
475 "src/ports/*fontconfig*",
476 "src/ports/*mac*",
477 "src/ports/*mozalloc*",
478 "src/ports/*nacl*",
479 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400480 "src/ports/*NDK*",
Mike Klein54c0d062020-06-02 09:13:01 -0500481 #"src/ports/SkDebug_stdio.cpp",
482 #"src/ports/SkFontMgr_custom.cpp",
483 "src/ports/SkFontMgr_custom_directory.cpp",
484 "src/ports/SkFontMgr_custom_directory_factory.cpp",
485 "src/ports/SkFontMgr_custom_embedded.cpp",
486 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
487 "src/ports/SkFontMgr_custom_empty.cpp",
488 "src/ports/SkFontMgr_custom_empty_factory.cpp",
489 #"src/ports/SkFontMgr_empty_factory.cpp",
490 "src/ports/SkFontMgr_fontconfig_factory.cpp",
491 #"src/ports/SkFontMgr_fuchsia.cpp",
492 "src/ports/SkImageGenerator_none.cpp",
493 ],
494)
495
Andy Weissbe1829f2020-07-01 11:08:16 -0700496GL_SRCS_MACOS = struct(
497 include = [
Kevin Lubickbe253592021-11-24 10:34:21 -0500498 "src/gpu/gl/*.cpp",
499 "src/gpu/gl/*.h",
500 "src/gpu/gl/builders/*.cpp",
501 "src/gpu/gl/builders/*.h",
Andy Weissbe1829f2020-07-01 11:08:16 -0700502 "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp",
503 ],
Andy Weiss25a1d4f2020-07-13 10:27:35 -0700504 exclude = [
505 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
506 ],
Andy Weissbe1829f2020-07-01 11:08:16 -0700507)
508PORTS_SRCS_MACOS = PORTS_SRCS_IOS
509
Mike Klein7f95c292019-03-27 11:16:25 -0500510def base_srcs():
511 return skia_glob(BASE_SRCS_ALL)
512
513def ports_srcs(os_conditions):
Mike Klein299ea7b2019-03-27 13:53:08 -0500514 return skia_select(
515 os_conditions,
Ben Wagnerb303a422018-07-31 10:31:06 -0400516 [
Mike Klein7f95c292019-03-27 11:16:25 -0500517 skia_glob(PORTS_SRCS_UNIX),
518 skia_glob(PORTS_SRCS_ANDROID),
519 skia_glob(PORTS_SRCS_IOS),
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500520 skia_glob(PORTS_SRCS_WASM),
Mike Klein54c0d062020-06-02 09:13:01 -0500521 skia_glob(PORTS_SRCS_FUCHSIA),
Andy Weissbe1829f2020-07-01 11:08:16 -0700522 skia_glob(PORTS_SRCS_MACOS),
Jorge Betancourtbb69f092022-01-21 13:48:50 -0500523 skia_glob(PORTS_SRCS_ANDROID_NO_FONT),
Mike Klein299ea7b2019-03-27 13:53:08 -0500524 ],
525 )
Mike Klein7f95c292019-03-27 11:16:25 -0500526
527def gl_srcs(os_conditions):
Mike Klein299ea7b2019-03-27 13:53:08 -0500528 return skia_select(
529 os_conditions,
Mike Klein7f95c292019-03-27 11:16:25 -0500530 [
531 skia_glob(GL_SRCS_UNIX),
532 skia_glob(GL_SRCS_ANDROID),
533 skia_glob(GL_SRCS_IOS),
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500534 skia_glob(GL_SRCS_WASM),
Mike Klein54c0d062020-06-02 09:13:01 -0500535 skia_glob(GL_SRCS_FUCHSIA),
Andy Weissbe1829f2020-07-01 11:08:16 -0700536 skia_glob(GL_SRCS_MACOS),
Jorge Betancourtbb69f092022-01-21 13:48:50 -0500537 skia_glob(GL_SRCS_ANDROID),
Mike Klein299ea7b2019-03-27 13:53:08 -0500538 ],
539 )
Mike Klein7f95c292019-03-27 11:16:25 -0500540
541def skia_srcs(os_conditions):
542 return base_srcs() + ports_srcs(os_conditions) + gl_srcs(os_conditions)
543
Hal Canary6ad6c502019-12-11 14:09:16 -0500544def metal_objc_srcs():
545 return native.glob(
546 [
547 "include/**/*.h",
548 "src/**/*.h",
549 "src/gpu/mtl/**/*.mm",
550 "third_party/**/*.h",
Ben Wagner8718be92019-12-11 20:11:30 -0500551 ],
Hal Canary6ad6c502019-12-11 14:09:16 -0500552 ) + [
553 "src/image/SkSurface_GpuMtl.mm",
554 ]
555
benjaminwagner56f6d062016-01-13 10:45:19 -0800556################################################################################
557## INCLUDES
558################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800559
benjaminwagner787ca872015-08-17 12:58:10 -0700560# Includes needed by Skia implementation. Not public includes.
561INCLUDES = [
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500562 ".",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800563 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700564 "include/c",
565 "include/codec",
566 "include/config",
567 "include/core",
Ben Wagnercc62b5d2018-09-20 16:26:31 -0400568 "include/docs",
benjaminwagner787ca872015-08-17 12:58:10 -0700569 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400570 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700571 "include/gpu",
benjaminwagner787ca872015-08-17 12:58:10 -0700572 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700573 "include/ports",
574 "include/private",
Brian Osmanea236bf2019-04-29 10:28:22 -0400575 "include/third_party/skcms",
benjaminwagner787ca872015-08-17 12:58:10 -0700576 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800577 "include/utils/mac",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800578 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700579 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700580 "src/gpu",
581 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400582 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700583 "src/lazy",
584 "src/opts",
585 "src/pdf",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400586 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700587 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400588 "src/shaders",
Michael Ludwig4f94ef62018-09-12 15:22:16 -0400589 "src/shaders/gradients",
benjaminwagnerc8962512016-09-30 12:06:27 -0700590 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700591 "src/utils",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400592 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800593]
benjaminwagner787ca872015-08-17 12:58:10 -0700594
benjaminwagner56f6d062016-01-13 10:45:19 -0800595################################################################################
596## DM_SRCS
597################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700598
benjaminwagner56f6d062016-01-13 10:45:19 -0800599DM_SRCS_ALL = struct(
600 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700601 "dm/*.cpp",
602 "dm/*.h",
Mike Klein60900b52018-09-21 11:19:45 -0400603 "experimental/pipe/*.cpp",
604 "experimental/pipe/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700605 "gm/*.cpp",
606 "gm/*.h",
Tyler Denniston45f94f82020-02-04 16:09:08 -0500607 "gm/verifiers/*.cpp",
608 "gm/verifiers/*.h",
Florin Malitab3418102020-10-15 18:10:29 -0400609 # TODO(fmalita): SVG sources should not be included here
610 "modules/svg/include/*.h",
611 "modules/svg/src/*.cpp",
Nathaniel Nifong0426c382019-06-21 11:09:19 -0400612 "src/utils/SkMultiPictureDocument.cpp",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400613 "src/xml/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700614 "tests/*.cpp",
615 "tests/*.h",
Jim Van Verth8a9a3712019-05-31 10:49:12 -0400616 "tools/AutoreleasePool.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400617 "tools/BinaryAsset.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700618 "tools/CrashHandler.cpp",
619 "tools/CrashHandler.h",
Robert Phillipse61ba842018-05-30 08:27:26 -0400620 "tools/DDLPromiseImageHelper.cpp",
621 "tools/DDLPromiseImageHelper.h",
622 "tools/DDLTileHelper.cpp",
623 "tools/DDLTileHelper.h",
Mike Kleinb61e25b2019-03-27 10:51:28 -0500624 "tools/HashAndEncode.cpp",
625 "tools/HashAndEncode.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700626 "tools/ProcStats.cpp",
627 "tools/ProcStats.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400628 "tools/Registry.h",
629 "tools/ResourceFactory.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700630 "tools/Resources.cpp",
631 "tools/Resources.h",
John Stiles0e99fbe2021-07-14 21:53:12 -0400632 "tools/RuntimeBlendUtils.cpp",
633 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400634 "tools/SkMetaData.cpp",
635 "tools/SkMetaData.h",
636 "tools/SkSharingProc.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -0400637 "tools/ToolUtils.cpp",
638 "tools/ToolUtils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700639 "tools/UrlDataManager.cpp",
640 "tools/UrlDataManager.h",
641 "tools/debugger/*.cpp",
642 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700643 "tools/flags/*.cpp",
644 "tools/flags/*.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -0500645 "tools/fonts/RandomScalerContext.cpp",
646 "tools/fonts/RandomScalerContext.h",
647 "tools/fonts/TestFontMgr.cpp",
648 "tools/fonts/TestFontMgr.h",
649 "tools/fonts/TestSVGTypeface.cpp",
650 "tools/fonts/TestSVGTypeface.h",
651 "tools/fonts/TestTypeface.cpp",
652 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -0500653 "tools/fonts/ToolUtilsFont.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -0400654 "tools/fonts/test_font_index.inc",
Ben Wagner483c7722018-02-20 17:06:07 -0500655 "tools/fonts/test_font_monospace.inc",
656 "tools/fonts/test_font_sans_serif.inc",
657 "tools/fonts/test_font_serif.inc",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700658 "tools/gpu/**/*.cpp",
659 "tools/gpu/**/*.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400660 "tools/ios_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800661 "tools/random_parse_path.cpp",
662 "tools/random_parse_path.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700663 "tools/timer/*.cpp",
664 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400665 "tools/trace/*.cpp",
666 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700667 ],
668 exclude = [
Mike Kleindb537602018-06-01 11:01:11 -0400669 "gm/cgms.cpp",
Mike Kleinc4abade2019-08-09 10:11:35 -0400670 "gm/fiddle.cpp",
Mike Reed7bf160e2019-05-17 16:50:51 -0400671 "gm/video_decoder.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700672 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
Ben Wagner37a06c02018-06-22 21:11:00 +0000673 "tests/FontMgrFontConfigTest.cpp", # FontConfig-only.
Ben Wagnera3e5e552021-02-22 15:37:33 +0000674 "tests/TypefaceMacTest.cpp", # CoreText-only.
Julia Lavrovaf0ade8a2019-11-08 12:58:57 -0500675 "tests/SkParagraphTest.cpp", # Skipping tests for now.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700676 "tests/skia_test.cpp", # Old main.
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500677 "tools/gpu/d3d/*",
Stephen White985741a2019-07-18 11:43:45 -0400678 "tools/gpu/dawn/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700679 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700680 "tools/gpu/gl/egl/*",
681 "tools/gpu/gl/glx/*",
682 "tools/gpu/gl/iOS/*",
683 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700684 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700685 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700686 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700687 ],
688)
689
Ben Wagnerdea74282017-03-16 19:15:09 -0400690################################################################################
691## dm_srcs()
692################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700693
Ben Wagner9eca72b2017-10-17 10:57:34 -0400694def dm_srcs(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400695 """Sources for the dm binary for the specified os."""
696 return skia_glob(DM_SRCS_ALL) + skia_select(
697 os_conditions,
698 [
Ben Wagnera3e5e552021-02-22 15:37:33 +0000699 ["tests/FontMgrFontConfigTest.cpp"], # Unix
700 ["tests/FontMgrAndroidParserTest.cpp"], # Android
701 ["tests/TypefaceMacTest.cpp"], # iOS
Mike Klein54c0d062020-06-02 09:13:01 -0500702 [], # WASM
703 [], # Fuchsia
Ben Wagnera3e5e552021-02-22 15:37:33 +0000704 ["tests/TypefaceMacTest.cpp"], # macOS
Ben Wagnerb303a422018-07-31 10:31:06 -0400705 ],
706 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800707
708################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800709## DM_ARGS
710################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700711
Ben Wagner59f9edb2016-11-28 15:30:37 -0500712def DM_ARGS(asan):
Mike Kleindd650c42018-11-08 14:26:02 -0500713 source = ["gm", "image", "lottie"]
Ben Wagnerb303a422018-07-31 10:31:06 -0400714
715 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
716 config = ["565", "8888", "pdf"]
717 match = ["~Codec_78329453"]
718 return (["--src"] + source + ["--config"] + config + ["--nonativeFonts"] +
719 ["--match"] + match)
benjaminwagner56f6d062016-01-13 10:45:19 -0800720
721################################################################################
722## COPTS
723################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800724
Ben Wagner9eca72b2017-10-17 10:57:34 -0400725def base_copts(os_conditions):
Mike Klein54c0d062020-06-02 09:13:01 -0500726 return ["-Wno-implicit-fallthrough"] + skia_select(
Ben Wagnerb303a422018-07-31 10:31:06 -0400727 os_conditions,
728 [
729 # UNIX
730 [
Ben Wagnerb303a422018-07-31 10:31:06 -0400731 # Internal use of deprecated methods. :(
732 "-Wno-deprecated-declarations",
733 # TODO(kjlubick)
734 "-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
735 ],
736 # ANDROID
737 [
738 # 'GrResourceCache' declared with greater visibility than the
739 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
740 "-Wno-error=attributes",
741 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500742 [], # iOS
743 [], # wasm
744 [], # Fuchsia
Andy Weissbe1829f2020-07-01 11:08:16 -0700745 [], # macOS
Ben Wagnerb303a422018-07-31 10:31:06 -0400746 ],
747 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800748
749################################################################################
750## DEFINES
751################################################################################
752
Ben Wagner9eca72b2017-10-17 10:57:34 -0400753def base_defines(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400754 return [
755 # Chrome DEFINES.
756 "SK_USE_FREETYPE_EMBOLDEN",
757 # Turn on a few Google3-specific build fixes.
758 "SK_BUILD_FOR_GOOGLE3",
759 # Required for building dm.
760 "GR_TEST_UTILS",
761 # Staging flags for API changes
Julia Lavrovad20a1092021-01-21 17:06:44 -0500762 "SK_PARAGRAPH_GRAPHEME_EDGES",
Ben Wagnerb303a422018-07-31 10:31:06 -0400763 # Should remove after we update golden images
764 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
765 # Experiment to diagnose image diffs in Google3
Mike Klein0ade68c2018-10-24 06:52:35 -0400766 "SK_DISABLE_LOWP_RASTER_PIPELINE",
Ben Wagnerb303a422018-07-31 10:31:06 -0400767 # JPEG is in codec_limited
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400768 "SK_CODEC_DECODES_JPEG",
769 "SK_ENCODE_JPEG",
Leon Scroggins1340dbd2020-11-09 14:18:12 -0500770 "SK_HAS_ANDROID_CODEC",
Ben Wagnerb303a422018-07-31 10:31:06 -0400771 ] + skia_select(
772 os_conditions,
773 [
774 # UNIX
775 [
776 "PNG_SKIP_SETJMP_CHECK",
777 "SK_BUILD_FOR_UNIX",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400778 "SK_CODEC_DECODES_PNG",
779 "SK_CODEC_DECODES_WEBP",
780 "SK_ENCODE_PNG",
781 "SK_ENCODE_WEBP",
Mike Kleinf0a53692019-04-24 11:42:40 -0500782 "SK_R32_SHIFT=16",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400783 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400784 ],
785 # ANDROID
786 [
787 "SK_BUILD_FOR_ANDROID",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400788 "SK_CODEC_DECODES_PNG",
789 "SK_CODEC_DECODES_WEBP",
790 "SK_ENCODE_PNG",
791 "SK_ENCODE_WEBP",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400792 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400793 ],
794 # IOS
795 [
796 "SK_BUILD_FOR_IOS",
Mike Kleindbbf7532020-03-06 12:04:33 -0600797 "SK_NO_COMMAND_BUFFER", # Test tools that use thread_local.
Brian Salomon17dc63f2020-07-30 13:54:53 -0400798 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400799 ],
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500800 # WASM
801 [
802 "SK_DISABLE_LEGACY_SHADERCONTEXT",
803 "SK_DISABLE_TRACING",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400804 "SK_GL",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500805 "SK_SUPPORT_GPU=1",
806 "SK_DISABLE_AAA",
807 "SK_DISABLE_EFFECT_DESERIALIZATION",
808 "SK_FORCE_8_BYTE_ALIGNMENT",
809 "SKNX_NO_SIMD",
810 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500811 # FUCHSIA
812 [
813 "SK_BUILD_FOR_UNIX",
814 "SK_CODEC_DECODES_PNG",
815 "SK_CODEC_DECODES_WEBP",
816 "SK_ENCODE_PNG",
817 "SK_ENCODE_WEBP",
818 "SK_R32_SHIFT=16",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400819 "SK_VULKAN",
Mike Klein54c0d062020-06-02 09:13:01 -0500820 ],
Andy Weissbe1829f2020-07-01 11:08:16 -0700821 # MACOS
822 [
823 "SK_BUILD_FOR_MAC",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400824 "SK_GL",
Andy Weissbe1829f2020-07-01 11:08:16 -0700825 ],
Ben Wagnerb303a422018-07-31 10:31:06 -0400826 ],
827 )
benjaminwagner787ca872015-08-17 12:58:10 -0700828
benjaminwagner56f6d062016-01-13 10:45:19 -0800829################################################################################
830## LINKOPTS
831################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700832
Ben Wagner9eca72b2017-10-17 10:57:34 -0400833def base_linkopts(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400834 return [
835 "-ldl",
836 ] + skia_select(
837 os_conditions,
838 [
Mike Klein54c0d062020-06-02 09:13:01 -0500839 [], # Unix
Ben Wagnerb303a422018-07-31 10:31:06 -0400840 # ANDROID
841 [
842 "-lEGL",
Ben Wagner773151f2018-08-17 09:28:53 -0400843 "-lGLESv2",
Ben Wagnerb303a422018-07-31 10:31:06 -0400844 ],
845 # IOS
846 [
847 "-framework CoreFoundation",
848 "-framework CoreGraphics",
849 "-framework CoreText",
850 "-framework ImageIO",
851 "-framework MobileCoreServices",
852 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500853 [], # wasm
854 [], # Fuchsia
Andy Weissbe1829f2020-07-01 11:08:16 -0700855 # MACOS
856 [
857 "-framework CoreFoundation",
858 "-framework CoreGraphics",
859 "-framework CoreText",
860 "-framework ImageIO",
861 "-framework ApplicationServices",
862 ],
Ben Wagnerb303a422018-07-31 10:31:06 -0400863 ],
864 )
Florin Malitadcc9d062018-11-08 14:25:19 -0500865
866################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400867## sksg_lib
Florin Malitadcc9d062018-11-08 14:25:19 -0500868################################################################################
869
Florin Malitae4e95512019-05-03 14:03:50 -0400870def sksg_lib_hdrs():
871 return native.glob(["modules/sksg/include/*.h"])
872
873def sksg_lib_srcs():
Florin Malitaccacfa02019-07-10 13:38:48 -0400874 return native.glob([
875 "modules/sksg/src/*.cpp",
876 "modules/sksg/src/*.h",
877 ])
Florin Malitae4e95512019-05-03 14:03:50 -0400878
879################################################################################
Julia Lavrova5ec1b8f2019-06-10 11:10:17 -0400880## skparagraph_lib
881################################################################################
882
883def skparagraph_lib_hdrs():
884 return native.glob(["modules/skparagraph/include/*.h"])
885
886def skparagraph_lib_srcs():
887 return native.glob(["modules/skparagraph/src/*.cpp"])
888
889################################################################################
Mike Reeddaf19452019-06-11 17:20:33 -0400890## experimental xform
891################################################################################
892
893def exp_xform_lib_hdrs():
894 return native.glob(["experimental/xform/*.h"])
895
896def exp_xform_lib_srcs():
897 return native.glob(["experimental/xform/*.cpp"])
898
899################################################################################
Hal Canary484384b2019-12-17 10:50:26 -0500900## skresources_lib
901################################################################################
902
903def skresources_lib_hdrs():
904 return ["modules/skresources/include/SkResources.h"]
905
906def skresources_lib_srcs():
907 return ["modules/skresources/src/SkResources.cpp"]
908
909################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400910## skottie_lib
911################################################################################
912
913def skottie_lib_hdrs():
Florin Malita1b1b6572019-05-03 15:16:30 -0400914 return native.glob(["modules/skottie/include/*.h"])
Florin Malitae4e95512019-05-03 14:03:50 -0400915
916def skottie_lib_srcs():
917 return native.glob(
918 [
919 "modules/skottie/src/*.cpp",
920 "modules/skottie/src/*.h",
Florin Malita141ac682020-03-17 11:20:10 -0400921 "modules/skottie/src/animator/*.cpp",
922 "modules/skottie/src/animator/*.h",
Florin Malitae47d8af2019-06-14 12:20:10 -0400923 "modules/skottie/src/effects/*.cpp",
924 "modules/skottie/src/effects/*.h",
Florin Malita45dc1f02019-07-01 13:57:43 -0400925 "modules/skottie/src/layers/*.cpp",
926 "modules/skottie/src/layers/*.h",
Florin Malitacbf31d02020-01-22 14:22:21 -0500927 "modules/skottie/src/layers/shapelayer/*.cpp",
928 "modules/skottie/src/layers/shapelayer/*.h",
Florin Malitaca449d52019-05-08 10:04:09 -0400929 "modules/skottie/src/text/*.cpp",
930 "modules/skottie/src/text/*.h",
Florin Malitae4e95512019-05-03 14:03:50 -0400931 ],
932 exclude = [
933 "modules/skottie/src/SkottieTest.cpp",
934 "modules/skottie/src/SkottieTool.cpp",
935 ],
936 )
937
938################################################################################
Florin Malita044e8bc2020-06-23 10:26:56 -0400939## skottie_utils
940################################################################################
941
942SKOTTIE_UTILS_HDRS = [
943 "modules/skottie/utils/SkottieUtils.h",
944]
945
946SKOTTIE_UTILS_SRCS = [
947 "modules/skottie/utils/SkottieUtils.cpp",
948]
949
Florin Malita044e8bc2020-06-23 10:26:56 -0400950################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400951## skottie_shaper
952################################################################################
953
954SKOTTIE_SHAPER_HDRS = [
Florin Malitaca449d52019-05-08 10:04:09 -0400955 "modules/skottie/src/text/SkottieShaper.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500956]
957
Florin Malitae4e95512019-05-03 14:03:50 -0400958SKOTTIE_SHAPER_SRCS = [
Florin Malitaca449d52019-05-08 10:04:09 -0400959 "modules/skottie/src/text/SkottieShaper.cpp",
Florin Malitae4e95512019-05-03 14:03:50 -0400960]
961
962################################################################################
963## skottie_tool
964################################################################################
965
Florin Malitadcc9d062018-11-08 14:25:19 -0500966SKOTTIE_TOOL_SRCS = [
967 "modules/skottie/src/SkottieTool.cpp",
Brian Osman849f4d62019-11-26 08:58:26 -0500968 "modules/skresources/src/SkResources.cpp",
969 "modules/skresources/include/SkResources.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500970 # TODO(benjaminwagner): Add "flags" target.
Mike Klein88544fb2019-03-20 10:50:33 -0500971 "tools/flags/CommandLineFlags.cpp",
972 "tools/flags/CommandLineFlags.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500973]
Florin Malita6d415bc2019-01-17 16:42:15 -0500974
975################################################################################
976## SkShaper
977################################################################################
978
Florin Malita40f3db42021-07-27 14:02:28 -0400979# Stubs, pending SkUnicode fission
Florin Malitaf884b122021-08-04 17:06:19 -0400980SKUNICODE_ICU_BUILTIN_SRCS = [
981 "modules/skunicode/include/SkUnicode.h",
982 "modules/skunicode/src/SkUnicode_icu.cpp",
983 "modules/skunicode/src/SkUnicode_icu.h",
984 "modules/skunicode/src/SkUnicode_icu_builtin.cpp",
985]
986
987SKUNICODE_ICU_RUNTIME_SRCS = [
988 "modules/skunicode/include/SkUnicode.h",
989 "modules/skunicode/src/SkUnicode_icu.cpp",
990 "modules/skunicode/src/SkUnicode_icu.h",
991 "modules/skunicode/src/SkUnicode_icu_runtime.cpp",
992]
Florin Malita40f3db42021-07-27 14:02:28 -0400993
Florin Malita226ba982019-01-21 11:55:51 -0500994SKSHAPER_HARFBUZZ_SRCS = [
Florin Malita6d415bc2019-01-17 16:42:15 -0500995 "modules/skshaper/include/SkShaper.h",
996 "modules/skshaper/src/SkShaper.cpp",
997 "modules/skshaper/src/SkShaper_harfbuzz.cpp",
Hal Canary30c9eda2019-02-22 15:23:45 -0500998 "modules/skshaper/src/SkShaper_primitive.cpp",
Florin Malita6d415bc2019-01-17 16:42:15 -0500999]
Florin Malita226ba982019-01-21 11:55:51 -05001000
1001SKSHAPER_PRIMITIVE_SRCS = [
1002 "modules/skshaper/include/SkShaper.h",
1003 "modules/skshaper/src/SkShaper.cpp",
1004 "modules/skshaper/src/SkShaper_primitive.cpp",
1005]
Hal Canaryb56b5542019-12-19 09:48:28 -05001006
1007################################################################################
1008## skottie_ios_lib
1009################################################################################
1010
1011SKOTTIE_IOS_LIB_SRCS = [
Hal Canary118df7c2019-12-18 16:26:19 -05001012 "tools/skottie_ios_app/SkiaContext.mm",
1013 "tools/skottie_ios_app/SkiaUIContext.mm",
1014 "tools/skottie_ios_app/SkiaViewController.mm",
1015 "tools/skottie_ios_app/SkottieViewController.mm",
Hal Canaryb56b5542019-12-19 09:48:28 -05001016]
1017
1018SKOTTIE_IOS_LIB_HDRS = [
Hal Canary118df7c2019-12-18 16:26:19 -05001019 "tools/skottie_ios_app/SkiaContext.h",
1020 "tools/skottie_ios_app/SkiaViewController.h",
1021 "tools/skottie_ios_app/SkottieViewController.h",
Hal Canaryb56b5542019-12-19 09:48:28 -05001022]
Hal Canary76cc2c52020-01-07 12:39:13 -05001023
1024SKOTTIE_IOS_LIB_SDK_FRAMEWORKS = [
1025 "Foundation",
1026 "UIKit",
1027]
Florin Malita0f02d0b2020-10-12 10:31:12 -04001028
1029################################################################################
1030## svg_lib
1031################################################################################
1032
1033def svg_lib_hdrs():
Florin Malitaa5e8f6b2020-10-16 10:53:27 -04001034 return native.glob(["modules/svg/include/*.h"])
Florin Malita0f02d0b2020-10-12 10:31:12 -04001035
1036def svg_lib_srcs():
Florin Malitab3418102020-10-15 18:10:29 -04001037 return native.glob(["modules/svg/src/*.cpp"])
Florin Malita3bfeab72020-10-12 11:26:56 -04001038
1039################################################################################
1040## svg_tool
1041################################################################################
1042
1043SVG_TOOL_SRCS = [
Florin Malitab3418102020-10-15 18:10:29 -04001044 "modules/svg/utils/SvgTool.cpp",
Florin Malita3bfeab72020-10-12 11:26:56 -04001045 # TODO(benjaminwagner): Add "flags" target.
1046 "tools/flags/CommandLineFlags.cpp",
1047 "tools/flags/CommandLineFlags.h",
1048]