blob: b4b166fe04157d56023c0e30aaa69c70b36f7376 [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################################################################################
iroth849b1752016-04-11 13:45:51 -070055## PRIVATE_HDRS
56################################################################################
57
benjaminwagner99fb6702016-07-28 15:12:21 -070058PRIVATE_HDRS_INCLUDE_LIST = [
59 "include/private/**/*.h",
60 "src/**/*.inc",
iroth849b1752016-04-11 13:45:51 -070061]
62
63PRIVATE_HDRS = struct(
benjaminwagner99fb6702016-07-28 15:12:21 -070064 include = PRIVATE_HDRS_INCLUDE_LIST,
65)
66
67ALL_HDRS = struct(
68 include = [
69 "src/**/*.h",
70 "include/**/*.h",
71 ],
iroth849b1752016-04-11 13:45:51 -070072)
73
74################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -080075## BASE_SRCS
76################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -070077
benjaminwagner39e7aa42015-11-18 13:26:10 -080078# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -080079BASE_SRCS_ALL = struct(
80 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -070081 "src/**/*.h",
82 "src/**/*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -070083
mtkleind55d13a2015-08-18 08:51:49 -070084 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -070085 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070086 "third_party/etc1/*.h",
Ben Wagnerd0a3b062016-10-24 14:11:12 -040087 "third_party/gif/*.cpp",
88 "third_party/gif/*.h",
Leon Scroggins427da6f2016-12-16 13:51:59 +000089 "third_party/ktx/*.cpp",
90 "third_party/ktx/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070091 ],
benjaminwagner99fb6702016-07-28 15:12:21 -070092 # Note: PRIVATE_HDRS_INCLUDE_LIST is excluded from BASE_SRCS_ALL here
93 # because they are required to appear in srcs for some rules but hdrs for
94 # other rules. See internal cl/119566959.
95 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -070096 # Exclude platform-dependent files.
irothd2ccc772016-01-25 11:24:57 -080097 "src/android/*",
iroth76a12252016-01-07 07:11:39 -080098 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070099 "src/device/xps/*", # Windows-only. Move to ports?
100 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
101 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700102 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700103 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700104 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700105 "src/gpu/gl/iOS/*",
106 "src/gpu/gl/mac/*",
107 "src/gpu/gl/win/*",
iroth76a12252016-01-07 07:11:39 -0800108 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700109 "src/opts/**/*",
110 "src/ports/**/*",
Mike Klein951d4e12017-01-09 13:40:00 -0500111 "src/splicer/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700112 "src/utils/android/**/*",
113 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700114 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
115 "src/utils/win/**/*",
116 "src/views/sdl/*",
117 "src/views/win/*",
118 "src/views/unix/*",
119
120 # Exclude multiple definitions.
121 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700122 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700123 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
124 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800125 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700126
127 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700128 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
benjaminwagner921e48b2016-07-15 11:27:27 -0700129 "src/svg/**/*", # Depends on XML.
130 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700131
benjaminwagner39e7aa42015-11-18 13:26:10 -0800132 # Conflicting dependencies among Lua versions. See cl/107087297.
133 "src/utils/SkLua*",
134
benjaminwagner6f6bef82015-10-15 08:09:44 -0700135 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700136 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800137
138 # Currently exclude all vulkan specific files
139 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700140
141 # Defines main.
142 "src/sksl/SkSLMain.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700143 ],
144)
145
146# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800147BASE_SRCS_UNIX = struct(
148 include = [
irothd2ccc772016-01-25 11:24:57 -0800149 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800150 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800151 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800152 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700153 "src/opts/**/*.cpp",
154 "src/opts/**/*.h",
155 "src/ports/**/*.cpp",
156 "src/ports/**/*.h",
157 ],
158 exclude = [
159 "src/opts/*arm*",
160 "src/opts/*mips*",
161 "src/opts/*NEON*",
162 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700163 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700164 "src/opts/*SSSE3*",
165 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700166 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700167 "src/opts/*SSE4*",
168 "src/opts/*sse4*",
Mike Klein71475052016-09-30 11:34:54 -0400169 # Included in :opts_avx or :opts_hsw
mtkleinf6d8d282015-12-17 10:18:04 -0800170 "src/opts/*avx*",
Mike Klein71475052016-09-30 11:34:54 -0400171 "src/opts/*hsw*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700172 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700173 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700174 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800175 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700176 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800177 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700178 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700179 "src/ports/*mac*",
180 "src/ports/*mozalloc*",
181 "src/ports/*nacl*",
182 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800183 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700184 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700185 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700186 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800187 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800188 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500189 "src/ports/SkGlobalInitialization_none.cpp",
msarettc1d03122016-03-25 08:58:55 -0700190 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700191 "src/ports/SkImageGenerator_none.cpp",
192 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700193 ],
194)
195
benjaminwagner86ea33e2015-10-26 10:46:25 -0700196# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800197BASE_SRCS_ANDROID = struct(
198 include = [
irothd2ccc772016-01-25 11:24:57 -0800199 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800200 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800201 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800202 "src/images/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700203 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700204 "src/opts/**/*.cpp",
205 "src/opts/**/*.h",
206 "src/ports/**/*.cpp",
207 "src/ports/**/*.h",
208 ],
209 exclude = [
210 "src/opts/*mips*",
211 "src/opts/*SSE2*",
212 "src/opts/*SSSE3*",
213 "src/opts/*ssse3*",
214 "src/opts/*SSE4*",
215 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800216 "src/opts/*avx*",
Mike Kleinfb2c6332017-01-26 14:40:53 -0500217 "src/opts/*hsw*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700218 "src/opts/*x86*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700219 "src/opts/SkBlitMask_opts_none.cpp",
220 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800221 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800222 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700223 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700224 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700225 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700226 "src/ports/*mac*",
227 "src/ports/*mozalloc*",
228 "src/ports/*nacl*",
229 "src/ports/*win*",
230 "src/ports/SkDebug_stdio.cpp",
231 "src/ports/SkFontMgr_custom_directory_factory.cpp",
232 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700233 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700234 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500235 "src/ports/SkGlobalInitialization_none.cpp",
msarettc1d03122016-03-25 08:58:55 -0700236 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700237 "src/ports/SkImageGenerator_none.cpp",
238 "src/ports/SkTLS_none.cpp",
239 ],
240)
241
iroth8b99ef42015-11-02 11:11:21 -0800242# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800243BASE_SRCS_IOS = struct(
244 include = [
msarett2775cf52016-02-17 14:14:25 -0800245 "src/android/*",
246 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800247 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
248 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800249 "src/opts/**/*.cpp",
250 "src/opts/**/*.h",
251 "src/ports/**/*.cpp",
252 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800253 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800254 ],
255 exclude = [
msarett2775cf52016-02-17 14:14:25 -0800256 "src/codec/*Ico*.cpp",
257 "src/codec/*Jpeg*.cpp",
258 "src/codec/*Webp*.cpp",
259 "src/codec/*Png*",
260 "src/codec/*Raw*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800261 "src/opts/*mips*",
262 "src/opts/*NEON*",
263 "src/opts/*neon*",
264 "src/opts/*SSE2*",
265 "src/opts/*SSSE3*",
266 "src/opts/*ssse3*",
267 "src/opts/*SSE4*",
268 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800269 "src/opts/*avx*",
Mike Kleinfb2c6332017-01-26 14:40:53 -0500270 "src/opts/*hsw*",
iroth8b99ef42015-11-02 11:11:21 -0800271 "src/opts/*x86*",
irothd2ccc772016-01-25 11:24:57 -0800272 "src/opts/SkBlitMask_opts_arm*.cpp",
273 "src/opts/SkBlitRow_opts_arm*.cpp",
mtklein3f193a92016-03-10 08:52:05 -0800274 "src/ports/*CG*",
275 "src/ports/*FontConfig*",
276 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700277 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800278 "src/ports/*android*",
279 "src/ports/*chromium*",
280 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800281 "src/ports/*mozalloc*",
282 "src/ports/*nacl*",
283 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800284 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500285 "src/ports/SkFontMgr_custom_directory.cpp",
286 "src/ports/SkFontMgr_custom_embedded.cpp",
287 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800288 "src/ports/SkFontMgr_custom_directory_factory.cpp",
289 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700290 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800291 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500292 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800293 "src/ports/SkImageGenerator_none.cpp",
294 "src/ports/SkTLS_none.cpp",
295 ],
296)
297
benjaminwagner56f6d062016-01-13 10:45:19 -0800298################################################################################
Mike Kleinc8deb022016-09-30 12:36:55 -0400299## SSSE3/SSE4/AVX/HSW SRCS
benjaminwagner56f6d062016-01-13 10:45:19 -0800300################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700301
benjaminwagner56f6d062016-01-13 10:45:19 -0800302SSSE3_SRCS = struct(
303 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700304 "src/opts/*SSSE3*.cpp",
305 "src/opts/*ssse3*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800306 ],
307)
mtkleind55d13a2015-08-18 08:51:49 -0700308
benjaminwagner56f6d062016-01-13 10:45:19 -0800309SSE4_SRCS = struct(
310 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700311 "src/opts/*SSE4*.cpp",
312 "src/opts/*sse4*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800313 ],
314)
benjaminwagner787ca872015-08-17 12:58:10 -0700315
benjaminwagner56f6d062016-01-13 10:45:19 -0800316AVX_SRCS = struct(
317 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800318 "src/opts/*_avx.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800319 ],
320)
mtkleinf6d8d282015-12-17 10:18:04 -0800321
Mike Klein78d5a3b2016-09-30 10:48:01 -0400322HSW_SRCS = struct(
323 include = [
324 "src/opts/*_hsw.cpp",
325 ],
326)
327
benjaminwagner56f6d062016-01-13 10:45:19 -0800328################################################################################
329## BASE_HDRS
330################################################################################
331
332BASE_HDRS = struct(
333 include = [
benjaminwagner787ca872015-08-17 12:58:10 -0700334 "include/**/*.h",
335 ],
benjaminwagner99fb6702016-07-28 15:12:21 -0700336 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700337 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700338 "include/views/**/*",
benjaminwagner89061ed2016-01-25 09:29:08 -0800339 ],
340)
benjaminwagner787ca872015-08-17 12:58:10 -0700341
benjaminwagner56f6d062016-01-13 10:45:19 -0800342################################################################################
343## BASE_DEPS
344################################################################################
345
346BASE_DEPS_ALL = []
347
benjaminwagner39e7aa42015-11-18 13:26:10 -0800348BASE_DEPS_UNIX = [
iroth330043c2016-01-12 14:22:24 -0800349 ":opts_ssse3",
benjaminwagner56f6d062016-01-13 10:45:19 -0800350 ":opts_sse4",
351 ":opts_avx",
Mike Kleinc8deb022016-09-30 12:36:55 -0400352 ":opts_hsw",
benjaminwagner39e7aa42015-11-18 13:26:10 -0800353]
354
355BASE_DEPS_ANDROID = []
356
357BASE_DEPS_IOS = []
358
benjaminwagner56f6d062016-01-13 10:45:19 -0800359################################################################################
360## INCLUDES
361################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800362
benjaminwagner787ca872015-08-17 12:58:10 -0700363# Includes needed by Skia implementation. Not public includes.
364INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800365 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700366 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800367 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700368 "include/codec",
369 "include/config",
370 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700371 "include/effects",
372 "include/gpu",
373 "include/images",
374 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700375 "include/pipe",
376 "include/ports",
377 "include/private",
378 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800379 "include/utils/mac",
380 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700381 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700382 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800383 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700384 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700385 "src/gpu",
386 "src/image",
387 "src/lazy",
388 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800389 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700390 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700391 "src/sfnt",
benjaminwagnerc8962512016-09-30 12:06:27 -0700392 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700393 "src/utils",
394 "third_party/etc1",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400395 "third_party/gif",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000396 "third_party/ktx",
benjaminwagner56f6d062016-01-13 10:45:19 -0800397]
benjaminwagner787ca872015-08-17 12:58:10 -0700398
benjaminwagner56f6d062016-01-13 10:45:19 -0800399################################################################################
400## DM_SRCS
401################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700402
benjaminwagner56f6d062016-01-13 10:45:19 -0800403DM_SRCS_ALL = struct(
404 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700405 "dm/*.cpp",
406 "dm/*.h",
407 "gm/*.c",
408 "gm/*.cpp",
409 "gm/*.h",
410 "tests/*.cpp",
411 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700412 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700413 "tools/CrashHandler.cpp",
414 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700415 "tools/ProcStats.cpp",
416 "tools/ProcStats.h",
417 "tools/Resources.cpp",
418 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700419 "tools/SkJSONCPP.h",
420 "tools/UrlDataManager.cpp",
421 "tools/UrlDataManager.h",
422 "tools/debugger/*.cpp",
423 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700424 "tools/flags/*.cpp",
425 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700426 "tools/gpu/**/*.cpp",
427 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700428 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700429 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800430 "tools/random_parse_path.cpp",
431 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700432 "tools/sk_tool_utils.cpp",
433 "tools/sk_tool_utils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700434 "tools/sk_tool_utils_flags.h",
benjaminwagner32885142015-10-24 07:55:31 -0700435 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700436 "tools/test_font_monospace.inc",
437 "tools/test_font_sans_serif.inc",
438 "tools/test_font_serif.inc",
439 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700440 "tools/timer/*.cpp",
441 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700442 ],
443 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700444 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700445 "tests/skia_test.cpp", # Old main.
446 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner921e48b2016-07-15 11:27:27 -0700447 "tests/SVGDeviceTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700448 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700449 "tools/gpu/gl/egl/*",
450 "tools/gpu/gl/glx/*",
451 "tools/gpu/gl/iOS/*",
452 "tools/gpu/gl/mac/*",
453 "tools/gpu/gl/mesa/*",
454 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700455 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700456 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700457 ],
458)
459
benjaminwagner38d68bc2016-04-01 05:00:51 -0700460DM_SRCS_UNIX = struct(
461 include = [
462 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
463 ],
464)
benjaminwagner86ea33e2015-10-26 10:46:25 -0700465
benjaminwagner56f6d062016-01-13 10:45:19 -0800466DM_SRCS_ANDROID = struct(
467 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700468 "tests/FontMgrAndroidParserTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700469 # TODO(benjaminwagner): Figure out how to compile with EGL.
470 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700471 ],
472)
473
benjaminwagner38d68bc2016-04-01 05:00:51 -0700474DM_SRCS_IOS = struct(
475 include = [
476 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
477 ],
478)
benjaminwagner56f6d062016-01-13 10:45:19 -0800479
480################################################################################
481## DM_INCLUDES
482################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700483
benjaminwagner6f6bef82015-10-15 08:09:44 -0700484DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800485 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700486 "gm",
487 "src/codec",
488 "src/effects",
benjaminwagnerbc9a9b42016-02-22 13:30:39 -0800489 "src/effects/gradients",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700490 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700491 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700492 "src/pathops",
493 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700494 "src/ports",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700495 "tests",
496 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700497 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700498 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700499 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700500 "tools/timer",
501]
502
benjaminwagner56f6d062016-01-13 10:45:19 -0800503################################################################################
504## DM_ARGS
505################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700506
Ben Wagner59f9edb2016-11-28 15:30:37 -0500507def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700508 source = ["tests", "gm", "image"]
509 # TODO(benjaminwagner): f16 and serialize-8888 fail.
510 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
511 # TODO(mtklein): maybe investigate why these fail?
512 match = [
513 "~Canvas",
514 "~Codec",
515 "~Codec_Dimensions",
516 "~Codec_stripes",
517 "~FontMgr",
518 "~PaintBreakText",
519 "~RecordDraw_TextBounds",
520 "~Scalar",
521 "~skps",
522 "~Stream",
523 ]
524 if asan:
Ben Wagner59f9edb2016-11-28 15:30:37 -0500525 # The ASAN we use with Bazel has some strict checks, so omit tests that
526 # trigger them.
benjaminwagner83906ae2016-05-01 15:02:25 -0700527 match += [
528 "~clippedcubic2",
529 "~conicpaths",
Ben Wagner59f9edb2016-11-28 15:30:37 -0500530 "~^gradients",
benjaminwagner83906ae2016-05-01 15:02:25 -0700531 "~Math",
532 "~Matrix",
Ben Wagner55b72532017-01-29 21:50:51 -0500533 "~PathBigCubic",
benjaminwagner83906ae2016-05-01 15:02:25 -0700534 "~PathOpsCubic",
benjaminwagnerb5188622016-06-29 10:26:44 -0700535 "~PathOpsFailOp",
caryclark523e76d2016-07-19 12:27:32 -0700536 "~PathOpsOpCubicsThreaded",
benjaminwagner83906ae2016-05-01 15:02:25 -0700537 "~PathOpsOpLoopsThreaded",
538 "~PathOpsSimplify",
539 "~PathOpsTightBoundsQuads",
540 "~Point",
benjaminwagner1d352312016-07-25 06:32:13 -0700541 "~sk_linear_to_srgb",
Ben Wagner59f9edb2016-11-28 15:30:37 -0500542 "~small_color_stop",
benjaminwagner56f6d062016-01-13 10:45:19 -0800543 ]
Ben Wagner59f9edb2016-11-28 15:30:37 -0500544 return ["--src"] + source + ["--config"] + config + ["--match"] + match
benjaminwagner56f6d062016-01-13 10:45:19 -0800545
546################################################################################
547## COPTS
548################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800549
benjaminwagner86ea33e2015-10-26 10:46:25 -0700550COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700551 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700552 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700553]
554
benjaminwagner56f6d062016-01-13 10:45:19 -0800555COPTS_ANDROID = ["-mfpu=neon"]
556
557COPTS_IOS = []
558
559COPTS_ALL = []
560
561################################################################################
562## DEFINES
563################################################################################
564
565DEFINES_UNIX = [
scroggo7732c0c2016-06-22 07:25:16 -0700566 "PNG_SKIP_SETJMP_CHECK",
benjaminwagner56f6d062016-01-13 10:45:19 -0800567 "SK_BUILD_FOR_UNIX",
568 "SK_SAMPLES_FOR_X",
halcanary650e20d2016-08-25 09:07:02 -0700569 "SK_PDF_USE_SFNTLY",
benjaminwagner186e0b92016-02-11 16:00:24 -0800570 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700571 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700572 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700573 "SK_HAS_WEBP_LIBRARY",
benjaminwagner56f6d062016-01-13 10:45:19 -0800574]
benjaminwagner86ea33e2015-10-26 10:46:25 -0700575
576DEFINES_ANDROID = [
577 "SK_BUILD_FOR_ANDROID",
benjaminwagner186e0b92016-02-11 16:00:24 -0800578 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700579 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700580 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700581 "SK_HAS_WEBP_LIBRARY",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700582]
583
iroth8b99ef42015-11-02 11:11:21 -0800584DEFINES_IOS = [
585 "SK_BUILD_FOR_IOS",
sdefresnee3fa8112016-06-01 07:08:56 -0700586 "SK_BUILD_NO_OPTS",
iroth8b99ef42015-11-02 11:11:21 -0800587 "SK_IGNORE_ETC1_SUPPORT",
irothd2ccc772016-01-25 11:24:57 -0800588 "SKNX_NO_SIMD",
iroth8b99ef42015-11-02 11:11:21 -0800589]
590
benjaminwagner86ea33e2015-10-26 10:46:25 -0700591DEFINES_ALL = [
benjaminwagner787ca872015-08-17 12:58:10 -0700592 # Chrome DEFINES.
593 "SK_USE_FLOATBITS",
594 "SK_USE_FREETYPE_EMBOLDEN",
595 # Turn on a few Google3-specific build fixes.
596 "GOOGLE3",
reedd053ce92016-03-22 10:17:23 -0700597 # Staging flags for API changes
Yuqian Li8622b722016-11-14 15:42:58 -0500598 # Temporarily Disable analytic AA for Google3
599 "SK_NO_ANALYTIC_AA",
Hal Canary1b3387b2016-12-12 13:48:12 -0500600 "SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF",
Mike Reed3711e112016-12-20 08:17:36 -0500601 "SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES",
benjaminwagner787ca872015-08-17 12:58:10 -0700602]
603
benjaminwagner56f6d062016-01-13 10:45:19 -0800604################################################################################
605## LINKOPTS
606################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700607
benjaminwagner56f6d062016-01-13 10:45:19 -0800608LINKOPTS_UNIX = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700609
benjaminwagner56f6d062016-01-13 10:45:19 -0800610LINKOPTS_ANDROID = [
611 "-lEGL",
612]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700613
benjaminwagner56f6d062016-01-13 10:45:19 -0800614LINKOPTS_IOS = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700615
benjaminwagner56f6d062016-01-13 10:45:19 -0800616LINKOPTS_ALL = [
617 "-ldl",
618]