blob: 5d94ab35323dbf4417ba2c40e5d7572a8bb538b8 [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/GrPathRendering_none.cpp",
Kevin Lubick93faa672018-10-10 15:54:53 -0400227 "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp",
Kevin Lubickc9210672018-10-15 11:36:55 -0400228 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
229 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700230
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400231 # Exclude files that don't compile everywhere.
232 "src/svg/**/*", # Depends on xml, SkJpegCodec, and SkPngCodec.
233 "src/xml/**/*", # Avoid dragging in expat when not needed.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700234
Guruji Panda9ae40202020-07-10 09:17:47 -0700235 # Exclude all GL specific files
236 "src/gpu/gl/*",
237 "src/gpu/gl/builders/*",
238
Kevin Lubick2eabdf52020-08-20 12:31:21 -0400239 # Exclude all WebGL specific files
240 "src/gpu/gl/webgl/*",
241
egdaniel32119f12016-02-22 10:07:54 -0800242 # Currently exclude all vulkan specific files
243 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700244
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500245 # Currently exclude all Direct3D specific files
246 "src/gpu/d3d/*",
247
Stephen White985741a2019-07-18 11:43:45 -0400248 # Currently exclude all Dawn-specific files
249 "src/gpu/dawn/*",
250
benjaminwagnerc8962512016-09-30 12:06:27 -0700251 # Defines main.
252 "src/sksl/SkSLMain.cpp",
Ethan Nicholas8d7f4ae2017-09-07 11:07:42 -0400253
254 # Only used to regenerate the lexer
255 "src/sksl/lex/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700256 ],
257)
258
Hal Canaryce4693f2019-11-20 21:43:54 +0000259def codec_srcs(limited):
260 """Sources for the codecs. Excludes Raw, and Ico, Webp, and Png if limited."""
Ben Wagnerec8c6602018-10-26 12:31:36 -0400261
Hal Canaryb5c217b2019-11-20 10:16:10 -0500262 exclude = ["src/codec/*Raw*.cpp"]
Hal Canaryce4693f2019-11-20 21:43:54 +0000263 if limited:
264 exclude += [
265 "src/codec/*Ico*.cpp",
266 "src/codec/*Webp*.cpp",
267 "src/codec/*Png*",
268 ]
Hal Canaryb5c217b2019-11-20 10:16:10 -0500269 return native.glob(["src/codec/*.cpp"], exclude = exclude)
Ben Wagner9eca72b2017-10-17 10:57:34 -0400270
Mike Klein7f95c292019-03-27 11:16:25 -0500271GL_SRCS_UNIX = struct(
benjaminwagner56f6d062016-01-13 10:45:19 -0800272 include = [
Guruji Panda9ae40202020-07-10 09:17:47 -0700273 "src/gpu/gl/*",
274 "src/gpu/gl/builders/*",
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 = [
Guruji Panda9ae40202020-07-10 09:17:47 -0700305 "src/gpu/gl/*",
306 "src/gpu/gl/builders/*",
Ben Wagner773151f2018-08-17 09:28:53 -0400307 "src/gpu/gl/android/*.cpp",
Mike Klein7f95c292019-03-27 11:16:25 -0500308 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700309 exclude = [
310 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
311 ],
Mike Klein7f95c292019-03-27 11:16:25 -0500312)
313PORTS_SRCS_ANDROID = struct(
314 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700315 "src/ports/**/*.cpp",
316 "src/ports/**/*.h",
317 ],
318 exclude = [
msarett6b4985c2016-03-10 07:15:59 -0800319 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800320 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700321 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700322 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700323 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700324 "src/ports/*mac*",
325 "src/ports/*mozalloc*",
326 "src/ports/*nacl*",
327 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400328 "src/ports/*NDK*", # TODO (scroggo): enable NDK decoding/encoding in Google3
benjaminwagner86ea33e2015-10-26 10:46:25 -0700329 "src/ports/SkDebug_stdio.cpp",
330 "src/ports/SkFontMgr_custom_directory_factory.cpp",
331 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700332 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700333 "src/ports/SkFontMgr_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800334 "src/ports/SkFontMgr_fuchsia.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700335 "src/ports/SkImageGenerator_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700336 ],
337)
338
Mike Klein7f95c292019-03-27 11:16:25 -0500339GL_SRCS_IOS = struct(
benjaminwagner56f6d062016-01-13 10:45:19 -0800340 include = [
Guruji Panda9ae40202020-07-10 09:17:47 -0700341 "src/gpu/gl/*",
342 "src/gpu/gl/builders/*",
Brian Salomon3d6801e2017-12-11 10:06:31 -0500343 "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
Mike Klein7f95c292019-03-27 11:16:25 -0500344 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700345 exclude = [
346 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
347 ],
Mike Klein7f95c292019-03-27 11:16:25 -0500348)
349PORTS_SRCS_IOS = struct(
350 include = [
iroth8b99ef42015-11-02 11:11:21 -0800351 "src/ports/**/*.cpp",
352 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800353 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800354 ],
355 exclude = [
mtklein3f193a92016-03-10 08:52:05 -0800356 "src/ports/*FontConfig*",
357 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700358 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800359 "src/ports/*android*",
360 "src/ports/*chromium*",
361 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800362 "src/ports/*mozalloc*",
363 "src/ports/*nacl*",
364 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400365 "src/ports/*NDK*",
iroth8b99ef42015-11-02 11:11:21 -0800366 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500367 "src/ports/SkFontMgr_custom_directory.cpp",
368 "src/ports/SkFontMgr_custom_embedded.cpp",
369 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800370 "src/ports/SkFontMgr_custom_directory_factory.cpp",
371 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700372 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800373 "src/ports/SkFontMgr_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800374 "src/ports/SkFontMgr_fuchsia.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800375 "src/ports/SkImageGenerator_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800376 ],
377)
378
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500379GL_SRCS_WASM = struct(
380 include = [
Guruji Panda9ae40202020-07-10 09:17:47 -0700381 "src/gpu/gl/*",
382 "src/gpu/gl/builders/*",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500383 "src/gpu/gl/GrGLMakeNativeInterface_egl.cpp",
384 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
385 ],
Guruji Panda9ae40202020-07-10 09:17:47 -0700386 exclude = [
387 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
388 ],
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500389)
390PORTS_SRCS_WASM = struct(
391 include = [
392 "src/ports/**/*.cpp",
393 "src/ports/**/*.h",
394 ],
395 exclude = [
396 # commented lines below left in because they indicate specifically what is
397 # included here and not in other PORTS_SRCS lists.
398 "src/ports/*FontConfig*",
Nathaniel Nifong3d6d4162020-09-18 15:29:12 -0400399 #"src/ports/*FreeType*",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500400 "src/ports/*WIC*",
401 "src/ports/*CG*",
402 "src/ports/*android*",
403 "src/ports/*chromium*",
404 "src/ports/*fontconfig*",
405 "src/ports/*mac*",
406 "src/ports/*mozalloc*",
407 "src/ports/*nacl*",
408 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400409 "src/ports/*NDK*",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500410 #"src/ports/SkDebug_stdio.cpp",
Nathaniel Nifong3d6d4162020-09-18 15:29:12 -0400411 #"src/ports/SkFontMgr_custom.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500412 "src/ports/SkFontMgr_custom_directory.cpp",
413 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Nathaniel Nifong3d6d4162020-09-18 15:29:12 -0400414 #"src/ports/SkFontMgr_custom_embedded.cpp",
415 #"src/ports/SkFontMgr_custom_embedded_factory.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500416 "src/ports/SkFontMgr_custom_empty.cpp",
417 "src/ports/SkFontMgr_custom_empty_factory.cpp",
418 # "src/ports/SkFontMgr_empty_factory.cpp",
419 "src/ports/SkFontMgr_fontconfig_factory.cpp",
420 "src/ports/SkFontMgr_fuchsia.cpp",
421 "src/ports/SkImageGenerator_none.cpp",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500422 ],
423)
424
Mike Klein54c0d062020-06-02 09:13:01 -0500425GL_SRCS_FUCHSIA = struct(
426 include = [
Guruji Panda9ae40202020-07-10 09:17:47 -0700427 "src/gpu/vk/*",
Mike Klein54c0d062020-06-02 09:13:01 -0500428 ],
429 exclude = [],
430)
431PORTS_SRCS_FUCHSIA = struct(
432 include = [
433 "src/ports/**/*.cpp",
434 "src/ports/**/*.h",
435 ],
436 exclude = [
437 "src/ports/*FontConfig*",
438 #"src/ports/*FreeType*",
439 "src/ports/*WIC*",
440 "src/ports/*CG*",
441 "src/ports/*android*",
442 "src/ports/*chromium*",
443 "src/ports/*fontconfig*",
444 "src/ports/*mac*",
445 "src/ports/*mozalloc*",
446 "src/ports/*nacl*",
447 "src/ports/*win*",
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400448 "src/ports/*NDK*",
Mike Klein54c0d062020-06-02 09:13:01 -0500449 #"src/ports/SkDebug_stdio.cpp",
450 #"src/ports/SkFontMgr_custom.cpp",
451 "src/ports/SkFontMgr_custom_directory.cpp",
452 "src/ports/SkFontMgr_custom_directory_factory.cpp",
453 "src/ports/SkFontMgr_custom_embedded.cpp",
454 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
455 "src/ports/SkFontMgr_custom_empty.cpp",
456 "src/ports/SkFontMgr_custom_empty_factory.cpp",
457 #"src/ports/SkFontMgr_empty_factory.cpp",
458 "src/ports/SkFontMgr_fontconfig_factory.cpp",
459 #"src/ports/SkFontMgr_fuchsia.cpp",
460 "src/ports/SkImageGenerator_none.cpp",
461 ],
462)
463
Andy Weissbe1829f2020-07-01 11:08:16 -0700464GL_SRCS_MACOS = struct(
465 include = [
Andy Weiss25a1d4f2020-07-13 10:27:35 -0700466 "src/gpu/gl/*",
467 "src/gpu/gl/builders/*",
Andy Weissbe1829f2020-07-01 11:08:16 -0700468 "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp",
469 ],
Andy Weiss25a1d4f2020-07-13 10:27:35 -0700470 exclude = [
471 "src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
472 ],
Andy Weissbe1829f2020-07-01 11:08:16 -0700473)
474PORTS_SRCS_MACOS = PORTS_SRCS_IOS
475
Mike Klein7f95c292019-03-27 11:16:25 -0500476def base_srcs():
477 return skia_glob(BASE_SRCS_ALL)
478
479def ports_srcs(os_conditions):
Mike Klein299ea7b2019-03-27 13:53:08 -0500480 return skia_select(
481 os_conditions,
Ben Wagnerb303a422018-07-31 10:31:06 -0400482 [
Mike Klein7f95c292019-03-27 11:16:25 -0500483 skia_glob(PORTS_SRCS_UNIX),
484 skia_glob(PORTS_SRCS_ANDROID),
485 skia_glob(PORTS_SRCS_IOS),
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500486 skia_glob(PORTS_SRCS_WASM),
Mike Klein54c0d062020-06-02 09:13:01 -0500487 skia_glob(PORTS_SRCS_FUCHSIA),
Andy Weissbe1829f2020-07-01 11:08:16 -0700488 skia_glob(PORTS_SRCS_MACOS),
Mike Klein299ea7b2019-03-27 13:53:08 -0500489 ],
490 )
Mike Klein7f95c292019-03-27 11:16:25 -0500491
492def gl_srcs(os_conditions):
Mike Klein299ea7b2019-03-27 13:53:08 -0500493 return skia_select(
494 os_conditions,
Mike Klein7f95c292019-03-27 11:16:25 -0500495 [
496 skia_glob(GL_SRCS_UNIX),
497 skia_glob(GL_SRCS_ANDROID),
498 skia_glob(GL_SRCS_IOS),
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500499 skia_glob(GL_SRCS_WASM),
Mike Klein54c0d062020-06-02 09:13:01 -0500500 skia_glob(GL_SRCS_FUCHSIA),
Andy Weissbe1829f2020-07-01 11:08:16 -0700501 skia_glob(GL_SRCS_MACOS),
Mike Klein299ea7b2019-03-27 13:53:08 -0500502 ],
503 )
Mike Klein7f95c292019-03-27 11:16:25 -0500504
505def skia_srcs(os_conditions):
506 return base_srcs() + ports_srcs(os_conditions) + gl_srcs(os_conditions)
507
Hal Canary6ad6c502019-12-11 14:09:16 -0500508def metal_objc_srcs():
509 return native.glob(
510 [
511 "include/**/*.h",
512 "src/**/*.h",
513 "src/gpu/mtl/**/*.mm",
514 "third_party/**/*.h",
Ben Wagner8718be92019-12-11 20:11:30 -0500515 ],
Hal Canary6ad6c502019-12-11 14:09:16 -0500516 ) + [
517 "src/image/SkSurface_GpuMtl.mm",
518 ]
519
benjaminwagner56f6d062016-01-13 10:45:19 -0800520################################################################################
521## INCLUDES
522################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800523
benjaminwagner787ca872015-08-17 12:58:10 -0700524# Includes needed by Skia implementation. Not public includes.
525INCLUDES = [
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500526 ".",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800527 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700528 "include/c",
529 "include/codec",
530 "include/config",
531 "include/core",
Ben Wagnercc62b5d2018-09-20 16:26:31 -0400532 "include/docs",
benjaminwagner787ca872015-08-17 12:58:10 -0700533 "include/effects",
Matt Sarettd7093c22017-05-09 15:28:32 -0400534 "include/encode",
benjaminwagner787ca872015-08-17 12:58:10 -0700535 "include/gpu",
benjaminwagner787ca872015-08-17 12:58:10 -0700536 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700537 "include/ports",
538 "include/private",
Brian Osmanea236bf2019-04-29 10:28:22 -0400539 "include/third_party/skcms",
benjaminwagner787ca872015-08-17 12:58:10 -0700540 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800541 "include/utils/mac",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800542 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700543 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700544 "src/gpu",
545 "src/image",
Mike Klein135a1b12017-08-15 13:13:59 -0400546 "src/images",
benjaminwagner787ca872015-08-17 12:58:10 -0700547 "src/lazy",
548 "src/opts",
549 "src/pdf",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400550 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700551 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400552 "src/shaders",
Michael Ludwig4f94ef62018-09-12 15:22:16 -0400553 "src/shaders/gradients",
benjaminwagnerc8962512016-09-30 12:06:27 -0700554 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700555 "src/utils",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400556 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800557]
benjaminwagner787ca872015-08-17 12:58:10 -0700558
benjaminwagner56f6d062016-01-13 10:45:19 -0800559################################################################################
560## DM_SRCS
561################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700562
benjaminwagner56f6d062016-01-13 10:45:19 -0800563DM_SRCS_ALL = struct(
564 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700565 "dm/*.cpp",
566 "dm/*.h",
Mike Klein60900b52018-09-21 11:19:45 -0400567 "experimental/pipe/*.cpp",
568 "experimental/pipe/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700569 "gm/*.cpp",
570 "gm/*.h",
Tyler Denniston45f94f82020-02-04 16:09:08 -0500571 "gm/verifiers/*.cpp",
572 "gm/verifiers/*.h",
Florin Malitab3418102020-10-15 18:10:29 -0400573 # TODO(fmalita): SVG sources should not be included here
574 "modules/svg/include/*.h",
575 "modules/svg/src/*.cpp",
Nathaniel Nifong0426c382019-06-21 11:09:19 -0400576 "src/utils/SkMultiPictureDocument.cpp",
Ben Wagner4ccf49c2018-03-26 15:46:40 -0400577 "src/xml/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700578 "tests/*.cpp",
579 "tests/*.h",
Jim Van Verth8a9a3712019-05-31 10:49:12 -0400580 "tools/AutoreleasePool.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700581 "tools/BigPathBench.inc",
Hal Canarye574f1e2019-07-15 14:01:37 -0400582 "tools/BinaryAsset.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700583 "tools/CrashHandler.cpp",
584 "tools/CrashHandler.h",
Robert Phillipse61ba842018-05-30 08:27:26 -0400585 "tools/DDLPromiseImageHelper.cpp",
586 "tools/DDLPromiseImageHelper.h",
587 "tools/DDLTileHelper.cpp",
588 "tools/DDLTileHelper.h",
Mike Kleinb61e25b2019-03-27 10:51:28 -0500589 "tools/HashAndEncode.cpp",
590 "tools/HashAndEncode.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700591 "tools/ProcStats.cpp",
592 "tools/ProcStats.h",
Ben Wagnerfb4487b2018-03-26 17:48:09 -0400593 "tools/Registry.h",
594 "tools/ResourceFactory.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700595 "tools/Resources.cpp",
596 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400597 "tools/SkMetaData.cpp",
598 "tools/SkMetaData.h",
599 "tools/SkSharingProc.cpp",
Mike Kleina4bb0202019-06-04 13:40:15 -0500600 "tools/SkVMBuilders.cpp",
601 "tools/SkVMBuilders.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400602 "tools/ToolUtils.cpp",
603 "tools/ToolUtils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700604 "tools/UrlDataManager.cpp",
605 "tools/UrlDataManager.h",
606 "tools/debugger/*.cpp",
607 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700608 "tools/flags/*.cpp",
609 "tools/flags/*.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -0500610 "tools/fonts/RandomScalerContext.cpp",
611 "tools/fonts/RandomScalerContext.h",
612 "tools/fonts/TestFontMgr.cpp",
613 "tools/fonts/TestFontMgr.h",
614 "tools/fonts/TestSVGTypeface.cpp",
615 "tools/fonts/TestSVGTypeface.h",
616 "tools/fonts/TestTypeface.cpp",
617 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -0500618 "tools/fonts/ToolUtilsFont.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -0400619 "tools/fonts/test_font_index.inc",
Ben Wagner483c7722018-02-20 17:06:07 -0500620 "tools/fonts/test_font_monospace.inc",
621 "tools/fonts/test_font_sans_serif.inc",
622 "tools/fonts/test_font_serif.inc",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700623 "tools/gpu/**/*.cpp",
624 "tools/gpu/**/*.h",
Hal Canarye574f1e2019-07-15 14:01:37 -0400625 "tools/ios_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800626 "tools/random_parse_path.cpp",
627 "tools/random_parse_path.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700628 "tools/timer/*.cpp",
629 "tools/timer/*.h",
Brian Salomon40d01192017-07-19 13:05:11 -0400630 "tools/trace/*.cpp",
631 "tools/trace/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700632 ],
633 exclude = [
Mike Kleindb537602018-06-01 11:01:11 -0400634 "gm/cgms.cpp",
Mike Kleinc4abade2019-08-09 10:11:35 -0400635 "gm/fiddle.cpp",
Mike Reed7bf160e2019-05-17 16:50:51 -0400636 "gm/video_decoder.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700637 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
Ben Wagner37a06c02018-06-22 21:11:00 +0000638 "tests/FontMgrFontConfigTest.cpp", # FontConfig-only.
Julia Lavrovaf0ade8a2019-11-08 12:58:57 -0500639 "tests/SkParagraphTest.cpp", # Skipping tests for now.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700640 "tests/skia_test.cpp", # Old main.
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500641 "tools/gpu/d3d/*",
Stephen White985741a2019-07-18 11:43:45 -0400642 "tools/gpu/dawn/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700643 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700644 "tools/gpu/gl/egl/*",
645 "tools/gpu/gl/glx/*",
646 "tools/gpu/gl/iOS/*",
647 "tools/gpu/gl/mac/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700648 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700649 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700650 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700651 ],
652)
653
Ben Wagnerdea74282017-03-16 19:15:09 -0400654################################################################################
655## dm_srcs()
656################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700657
Ben Wagner9eca72b2017-10-17 10:57:34 -0400658def dm_srcs(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400659 """Sources for the dm binary for the specified os."""
660 return skia_glob(DM_SRCS_ALL) + skia_select(
661 os_conditions,
662 [
Ben Wagnerc5ee4992019-03-25 15:58:31 -0400663 ["tests/FontMgrFontConfigTest.cpp"],
Ben Wagnerb303a422018-07-31 10:31:06 -0400664 ["tests/FontMgrAndroidParserTest.cpp"],
Mike Klein54c0d062020-06-02 09:13:01 -0500665 [], # iOS
666 [], # WASM
667 [], # Fuchsia
Andy Weissbe1829f2020-07-01 11:08:16 -0700668 [], # macOS
Ben Wagnerb303a422018-07-31 10:31:06 -0400669 ],
670 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800671
672################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -0800673## DM_ARGS
674################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700675
Ben Wagner59f9edb2016-11-28 15:30:37 -0500676def DM_ARGS(asan):
Mike Kleindd650c42018-11-08 14:26:02 -0500677 source = ["gm", "image", "lottie"]
Ben Wagnerb303a422018-07-31 10:31:06 -0400678
679 # TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
680 config = ["565", "8888", "pdf"]
681 match = ["~Codec_78329453"]
682 return (["--src"] + source + ["--config"] + config + ["--nonativeFonts"] +
683 ["--match"] + match)
benjaminwagner56f6d062016-01-13 10:45:19 -0800684
685################################################################################
686## COPTS
687################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800688
Ben Wagner9eca72b2017-10-17 10:57:34 -0400689def base_copts(os_conditions):
Mike Klein54c0d062020-06-02 09:13:01 -0500690 return ["-Wno-implicit-fallthrough"] + skia_select(
Ben Wagnerb303a422018-07-31 10:31:06 -0400691 os_conditions,
692 [
693 # UNIX
694 [
Ben Wagnerb303a422018-07-31 10:31:06 -0400695 # Internal use of deprecated methods. :(
696 "-Wno-deprecated-declarations",
697 # TODO(kjlubick)
698 "-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
699 ],
700 # ANDROID
701 [
702 # 'GrResourceCache' declared with greater visibility than the
703 # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
704 "-Wno-error=attributes",
705 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500706 [], # iOS
707 [], # wasm
708 [], # Fuchsia
Andy Weissbe1829f2020-07-01 11:08:16 -0700709 [], # macOS
Ben Wagnerb303a422018-07-31 10:31:06 -0400710 ],
711 )
benjaminwagner56f6d062016-01-13 10:45:19 -0800712
713################################################################################
714## DEFINES
715################################################################################
716
Ben Wagner9eca72b2017-10-17 10:57:34 -0400717def base_defines(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400718 return [
719 # Chrome DEFINES.
720 "SK_USE_FREETYPE_EMBOLDEN",
721 # Turn on a few Google3-specific build fixes.
722 "SK_BUILD_FOR_GOOGLE3",
723 # Required for building dm.
724 "GR_TEST_UTILS",
Robert Phillips6db27c22019-05-01 10:43:56 -0400725 # Google3 probably doesn't want this feature yet
726 "SK_DISABLE_REDUCE_OPLIST_SPLITTING",
Ben Wagnerb303a422018-07-31 10:31:06 -0400727 # Staging flags for API changes
728 # Should remove after we update golden images
729 "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
730 # Experiment to diagnose image diffs in Google3
Mike Klein0ade68c2018-10-24 06:52:35 -0400731 "SK_DISABLE_LOWP_RASTER_PIPELINE",
Ben Wagnerb303a422018-07-31 10:31:06 -0400732 # JPEG is in codec_limited
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400733 "SK_CODEC_DECODES_JPEG",
734 "SK_ENCODE_JPEG",
Leon Scroggins1340dbd2020-11-09 14:18:12 -0500735 "SK_HAS_ANDROID_CODEC",
Ben Wagnerb303a422018-07-31 10:31:06 -0400736 ] + skia_select(
737 os_conditions,
738 [
739 # UNIX
740 [
741 "PNG_SKIP_SETJMP_CHECK",
742 "SK_BUILD_FOR_UNIX",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400743 "SK_CODEC_DECODES_PNG",
744 "SK_CODEC_DECODES_WEBP",
745 "SK_ENCODE_PNG",
746 "SK_ENCODE_WEBP",
Mike Kleinf0a53692019-04-24 11:42:40 -0500747 "SK_R32_SHIFT=16",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400748 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400749 ],
750 # ANDROID
751 [
752 "SK_BUILD_FOR_ANDROID",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400753 "SK_CODEC_DECODES_PNG",
754 "SK_CODEC_DECODES_WEBP",
755 "SK_ENCODE_PNG",
756 "SK_ENCODE_WEBP",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400757 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400758 ],
759 # IOS
760 [
761 "SK_BUILD_FOR_IOS",
762 "SK_BUILD_NO_OPTS",
763 "SKNX_NO_SIMD",
Mike Kleindbbf7532020-03-06 12:04:33 -0600764 "SK_NO_COMMAND_BUFFER", # Test tools that use thread_local.
Brian Salomon17dc63f2020-07-30 13:54:53 -0400765 "SK_GL",
Ben Wagnerb303a422018-07-31 10:31:06 -0400766 ],
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500767 # WASM
768 [
769 "SK_DISABLE_LEGACY_SHADERCONTEXT",
770 "SK_DISABLE_TRACING",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400771 "SK_GL",
Nathaniel Nifongc6ce3d42020-03-02 12:10:02 -0500772 "SK_SUPPORT_GPU=1",
773 "SK_DISABLE_AAA",
774 "SK_DISABLE_EFFECT_DESERIALIZATION",
775 "SK_FORCE_8_BYTE_ALIGNMENT",
776 "SKNX_NO_SIMD",
777 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500778 # FUCHSIA
779 [
780 "SK_BUILD_FOR_UNIX",
781 "SK_CODEC_DECODES_PNG",
782 "SK_CODEC_DECODES_WEBP",
783 "SK_ENCODE_PNG",
784 "SK_ENCODE_WEBP",
785 "SK_R32_SHIFT=16",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400786 "SK_VULKAN",
Mike Klein54c0d062020-06-02 09:13:01 -0500787 ],
Andy Weissbe1829f2020-07-01 11:08:16 -0700788 # MACOS
789 [
790 "SK_BUILD_FOR_MAC",
Andy Weiss64381942020-07-01 11:59:28 -0700791 "SK_BUILD_NO_OPTS",
Brian Salomon17dc63f2020-07-30 13:54:53 -0400792 "SK_GL",
Andy Weissbe1829f2020-07-01 11:08:16 -0700793 ],
Ben Wagnerb303a422018-07-31 10:31:06 -0400794 ],
795 )
benjaminwagner787ca872015-08-17 12:58:10 -0700796
benjaminwagner56f6d062016-01-13 10:45:19 -0800797################################################################################
798## LINKOPTS
799################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700800
Ben Wagner9eca72b2017-10-17 10:57:34 -0400801def base_linkopts(os_conditions):
Ben Wagnerb303a422018-07-31 10:31:06 -0400802 return [
803 "-ldl",
804 ] + skia_select(
805 os_conditions,
806 [
Mike Klein54c0d062020-06-02 09:13:01 -0500807 [], # Unix
Ben Wagnerb303a422018-07-31 10:31:06 -0400808 # ANDROID
809 [
810 "-lEGL",
Ben Wagner773151f2018-08-17 09:28:53 -0400811 "-lGLESv2",
Ben Wagnerb303a422018-07-31 10:31:06 -0400812 ],
813 # IOS
814 [
815 "-framework CoreFoundation",
816 "-framework CoreGraphics",
817 "-framework CoreText",
818 "-framework ImageIO",
819 "-framework MobileCoreServices",
820 ],
Mike Klein54c0d062020-06-02 09:13:01 -0500821 [], # wasm
822 [], # Fuchsia
Andy Weissbe1829f2020-07-01 11:08:16 -0700823 # MACOS
824 [
825 "-framework CoreFoundation",
826 "-framework CoreGraphics",
827 "-framework CoreText",
828 "-framework ImageIO",
829 "-framework ApplicationServices",
830 ],
Ben Wagnerb303a422018-07-31 10:31:06 -0400831 ],
832 )
Florin Malitadcc9d062018-11-08 14:25:19 -0500833
834################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400835## sksg_lib
Florin Malitadcc9d062018-11-08 14:25:19 -0500836################################################################################
837
Florin Malitae4e95512019-05-03 14:03:50 -0400838def sksg_lib_hdrs():
839 return native.glob(["modules/sksg/include/*.h"])
840
841def sksg_lib_srcs():
Florin Malitaccacfa02019-07-10 13:38:48 -0400842 return native.glob([
843 "modules/sksg/src/*.cpp",
844 "modules/sksg/src/*.h",
845 ])
Florin Malitae4e95512019-05-03 14:03:50 -0400846
847################################################################################
Julia Lavrova5ec1b8f2019-06-10 11:10:17 -0400848## skparagraph_lib
849################################################################################
850
851def skparagraph_lib_hdrs():
852 return native.glob(["modules/skparagraph/include/*.h"])
853
854def skparagraph_lib_srcs():
855 return native.glob(["modules/skparagraph/src/*.cpp"])
856
857################################################################################
Mike Reeddaf19452019-06-11 17:20:33 -0400858## experimental xform
859################################################################################
860
861def exp_xform_lib_hdrs():
862 return native.glob(["experimental/xform/*.h"])
863
864def exp_xform_lib_srcs():
865 return native.glob(["experimental/xform/*.cpp"])
866
867################################################################################
Hal Canary484384b2019-12-17 10:50:26 -0500868## skresources_lib
869################################################################################
870
871def skresources_lib_hdrs():
872 return ["modules/skresources/include/SkResources.h"]
873
874def skresources_lib_srcs():
875 return ["modules/skresources/src/SkResources.cpp"]
876
877################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400878## skottie_lib
879################################################################################
880
881def skottie_lib_hdrs():
Florin Malita1b1b6572019-05-03 15:16:30 -0400882 return native.glob(["modules/skottie/include/*.h"])
Florin Malitae4e95512019-05-03 14:03:50 -0400883
884def skottie_lib_srcs():
885 return native.glob(
886 [
887 "modules/skottie/src/*.cpp",
888 "modules/skottie/src/*.h",
Florin Malita141ac682020-03-17 11:20:10 -0400889 "modules/skottie/src/animator/*.cpp",
890 "modules/skottie/src/animator/*.h",
Florin Malitae47d8af2019-06-14 12:20:10 -0400891 "modules/skottie/src/effects/*.cpp",
892 "modules/skottie/src/effects/*.h",
Florin Malita45dc1f02019-07-01 13:57:43 -0400893 "modules/skottie/src/layers/*.cpp",
894 "modules/skottie/src/layers/*.h",
Florin Malitacbf31d02020-01-22 14:22:21 -0500895 "modules/skottie/src/layers/shapelayer/*.cpp",
896 "modules/skottie/src/layers/shapelayer/*.h",
Florin Malitaca449d52019-05-08 10:04:09 -0400897 "modules/skottie/src/text/*.cpp",
898 "modules/skottie/src/text/*.h",
Florin Malitae4e95512019-05-03 14:03:50 -0400899 ],
900 exclude = [
901 "modules/skottie/src/SkottieTest.cpp",
902 "modules/skottie/src/SkottieTool.cpp",
903 ],
904 )
905
906################################################################################
Florin Malita044e8bc2020-06-23 10:26:56 -0400907## skottie_utils
908################################################################################
909
910SKOTTIE_UTILS_HDRS = [
911 "modules/skottie/utils/SkottieUtils.h",
912]
913
914SKOTTIE_UTILS_SRCS = [
915 "modules/skottie/utils/SkottieUtils.cpp",
916]
917
Florin Malita044e8bc2020-06-23 10:26:56 -0400918################################################################################
Florin Malitae4e95512019-05-03 14:03:50 -0400919## skottie_shaper
920################################################################################
921
922SKOTTIE_SHAPER_HDRS = [
Florin Malitaca449d52019-05-08 10:04:09 -0400923 "modules/skottie/src/text/SkottieShaper.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500924]
925
Florin Malitae4e95512019-05-03 14:03:50 -0400926SKOTTIE_SHAPER_SRCS = [
Florin Malitaca449d52019-05-08 10:04:09 -0400927 "modules/skottie/src/text/SkottieShaper.cpp",
Florin Malitae4e95512019-05-03 14:03:50 -0400928]
929
930################################################################################
931## skottie_tool
932################################################################################
933
Florin Malitadcc9d062018-11-08 14:25:19 -0500934SKOTTIE_TOOL_SRCS = [
935 "modules/skottie/src/SkottieTool.cpp",
Brian Osman849f4d62019-11-26 08:58:26 -0500936 "modules/skresources/src/SkResources.cpp",
937 "modules/skresources/include/SkResources.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500938 # TODO(benjaminwagner): Add "flags" target.
Mike Klein88544fb2019-03-20 10:50:33 -0500939 "tools/flags/CommandLineFlags.cpp",
940 "tools/flags/CommandLineFlags.h",
Florin Malitadcc9d062018-11-08 14:25:19 -0500941]
Florin Malita6d415bc2019-01-17 16:42:15 -0500942
943################################################################################
944## SkShaper
945################################################################################
946
Florin Malita226ba982019-01-21 11:55:51 -0500947SKSHAPER_HARFBUZZ_SRCS = [
Florin Malita6d415bc2019-01-17 16:42:15 -0500948 "modules/skshaper/include/SkShaper.h",
949 "modules/skshaper/src/SkShaper.cpp",
950 "modules/skshaper/src/SkShaper_harfbuzz.cpp",
Hal Canary30c9eda2019-02-22 15:23:45 -0500951 "modules/skshaper/src/SkShaper_primitive.cpp",
Julia Lavrova90787fe2020-07-20 17:32:03 +0000952 "modules/skshaper/src/SkUnicode.h",
953 "modules/skshaper/src/SkUnicode_icu.cpp",
Florin Malita6d415bc2019-01-17 16:42:15 -0500954]
Florin Malita226ba982019-01-21 11:55:51 -0500955
956SKSHAPER_PRIMITIVE_SRCS = [
957 "modules/skshaper/include/SkShaper.h",
958 "modules/skshaper/src/SkShaper.cpp",
959 "modules/skshaper/src/SkShaper_primitive.cpp",
960]
Hal Canaryb56b5542019-12-19 09:48:28 -0500961
962################################################################################
963## skottie_ios_lib
964################################################################################
965
966SKOTTIE_IOS_LIB_SRCS = [
Hal Canary118df7c2019-12-18 16:26:19 -0500967 "tools/skottie_ios_app/SkiaContext.mm",
968 "tools/skottie_ios_app/SkiaUIContext.mm",
969 "tools/skottie_ios_app/SkiaViewController.mm",
970 "tools/skottie_ios_app/SkottieViewController.mm",
Hal Canaryb56b5542019-12-19 09:48:28 -0500971]
972
973SKOTTIE_IOS_LIB_HDRS = [
Hal Canary118df7c2019-12-18 16:26:19 -0500974 "tools/skottie_ios_app/SkiaContext.h",
975 "tools/skottie_ios_app/SkiaViewController.h",
976 "tools/skottie_ios_app/SkottieViewController.h",
Hal Canaryb56b5542019-12-19 09:48:28 -0500977]
Hal Canary76cc2c52020-01-07 12:39:13 -0500978
979SKOTTIE_IOS_LIB_SDK_FRAMEWORKS = [
980 "Foundation",
981 "UIKit",
982]
Florin Malita0f02d0b2020-10-12 10:31:12 -0400983
984################################################################################
985## svg_lib
986################################################################################
987
988def svg_lib_hdrs():
Florin Malitaa5e8f6b2020-10-16 10:53:27 -0400989 return native.glob(["modules/svg/include/*.h"])
Florin Malita0f02d0b2020-10-12 10:31:12 -0400990
991def svg_lib_srcs():
Florin Malitab3418102020-10-15 18:10:29 -0400992 return native.glob(["modules/svg/src/*.cpp"])
Florin Malita3bfeab72020-10-12 11:26:56 -0400993
994################################################################################
995## svg_tool
996################################################################################
997
998SVG_TOOL_SRCS = [
Florin Malitab3418102020-10-15 18:10:29 -0400999 "modules/svg/utils/SvgTool.cpp",
Florin Malita3bfeab72020-10-12 11:26:56 -04001000 # TODO(benjaminwagner): Add "flags" target.
1001 "tools/flags/CommandLineFlags.cpp",
1002 "tools/flags/CommandLineFlags.h",
1003]