blob: f4b9ef9b00dc807cc197b10879ff6aced5998629 [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",
benjaminwagner787ca872015-08-17 12:58:10 -070089 ],
benjaminwagner99fb6702016-07-28 15:12:21 -070090 # Note: PRIVATE_HDRS_INCLUDE_LIST is excluded from BASE_SRCS_ALL here
91 # because they are required to appear in srcs for some rules but hdrs for
92 # other rules. See internal cl/119566959.
93 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -070094 # Exclude platform-dependent files.
irothd2ccc772016-01-25 11:24:57 -080095 "src/android/*",
iroth76a12252016-01-07 07:11:39 -080096 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070097 "src/device/xps/*", # Windows-only. Move to ports?
98 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
99 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700100 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700101 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700102 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700103 "src/gpu/gl/iOS/*",
104 "src/gpu/gl/mac/*",
105 "src/gpu/gl/win/*",
iroth76a12252016-01-07 07:11:39 -0800106 "src/images/*",
Mike Kleine1caee12017-02-15 13:31:12 -0500107 "src/jumper/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700108 "src/opts/**/*",
109 "src/ports/**/*",
110 "src/utils/android/**/*",
111 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700112 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
113 "src/utils/win/**/*",
114 "src/views/sdl/*",
115 "src/views/win/*",
116 "src/views/unix/*",
117
118 # Exclude multiple definitions.
119 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700120 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700121 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
122 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800123 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700124
125 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700126 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
benjaminwagner921e48b2016-07-15 11:27:27 -0700127 "src/svg/**/*", # Depends on XML.
128 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700129
benjaminwagner39e7aa42015-11-18 13:26:10 -0800130 # Conflicting dependencies among Lua versions. See cl/107087297.
131 "src/utils/SkLua*",
132
benjaminwagner6f6bef82015-10-15 08:09:44 -0700133 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700134 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800135
136 # Currently exclude all vulkan specific files
137 "src/gpu/vk/*",
benjaminwagnerc8962512016-09-30 12:06:27 -0700138
139 # Defines main.
140 "src/sksl/SkSLMain.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700141 ],
142)
143
144# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800145BASE_SRCS_UNIX = struct(
146 include = [
irothd2ccc772016-01-25 11:24:57 -0800147 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800148 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800149 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800150 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700151 "src/opts/**/*.cpp",
152 "src/opts/**/*.h",
153 "src/ports/**/*.cpp",
154 "src/ports/**/*.h",
155 ],
156 exclude = [
157 "src/opts/*arm*",
158 "src/opts/*mips*",
159 "src/opts/*NEON*",
160 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700161 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700162 "src/opts/*SSSE3*",
163 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700164 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700165 "src/opts/*SSE4*",
166 "src/opts/*sse4*",
Mike Klein71475052016-09-30 11:34:54 -0400167 # Included in :opts_avx or :opts_hsw
mtkleinf6d8d282015-12-17 10:18:04 -0800168 "src/opts/*avx*",
Mike Klein71475052016-09-30 11:34:54 -0400169 "src/opts/*hsw*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700170 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700171 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700172 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800173 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700174 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800175 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700176 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700177 "src/ports/*mac*",
178 "src/ports/*mozalloc*",
179 "src/ports/*nacl*",
180 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800181 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700182 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700183 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700184 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800185 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800186 "src/ports/SkFontMgr_fontconfig_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500187 "src/ports/SkGlobalInitialization_none.cpp",
msarettc1d03122016-03-25 08:58:55 -0700188 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700189 "src/ports/SkImageGenerator_none.cpp",
190 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700191 ],
192)
193
benjaminwagner86ea33e2015-10-26 10:46:25 -0700194# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800195BASE_SRCS_ANDROID = struct(
196 include = [
irothd2ccc772016-01-25 11:24:57 -0800197 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800198 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800199 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800200 "src/images/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700201 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700202 "src/opts/**/*.cpp",
203 "src/opts/**/*.h",
204 "src/ports/**/*.cpp",
205 "src/ports/**/*.h",
206 ],
207 exclude = [
208 "src/opts/*mips*",
209 "src/opts/*SSE2*",
210 "src/opts/*SSSE3*",
211 "src/opts/*ssse3*",
212 "src/opts/*SSE4*",
213 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800214 "src/opts/*avx*",
Mike Kleinfb2c6332017-01-26 14:40:53 -0500215 "src/opts/*hsw*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700216 "src/opts/*x86*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700217 "src/opts/SkBlitMask_opts_none.cpp",
218 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800219 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800220 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700221 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700222 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700223 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700224 "src/ports/*mac*",
225 "src/ports/*mozalloc*",
226 "src/ports/*nacl*",
227 "src/ports/*win*",
228 "src/ports/SkDebug_stdio.cpp",
229 "src/ports/SkFontMgr_custom_directory_factory.cpp",
230 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700231 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700232 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500233 "src/ports/SkGlobalInitialization_none.cpp",
msarettc1d03122016-03-25 08:58:55 -0700234 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700235 "src/ports/SkImageGenerator_none.cpp",
236 "src/ports/SkTLS_none.cpp",
237 ],
238)
239
iroth8b99ef42015-11-02 11:11:21 -0800240# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800241BASE_SRCS_IOS = struct(
242 include = [
msarett2775cf52016-02-17 14:14:25 -0800243 "src/android/*",
244 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800245 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
246 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800247 "src/opts/**/*.cpp",
248 "src/opts/**/*.h",
249 "src/ports/**/*.cpp",
250 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800251 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800252 ],
253 exclude = [
msarett2775cf52016-02-17 14:14:25 -0800254 "src/codec/*Ico*.cpp",
msarett2775cf52016-02-17 14:14:25 -0800255 "src/codec/*Webp*.cpp",
256 "src/codec/*Png*",
257 "src/codec/*Raw*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800258 "src/opts/*mips*",
259 "src/opts/*NEON*",
260 "src/opts/*neon*",
261 "src/opts/*SSE2*",
262 "src/opts/*SSSE3*",
263 "src/opts/*ssse3*",
264 "src/opts/*SSE4*",
265 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800266 "src/opts/*avx*",
Mike Kleinfb2c6332017-01-26 14:40:53 -0500267 "src/opts/*hsw*",
iroth8b99ef42015-11-02 11:11:21 -0800268 "src/opts/*x86*",
irothd2ccc772016-01-25 11:24:57 -0800269 "src/opts/SkBlitMask_opts_arm*.cpp",
270 "src/opts/SkBlitRow_opts_arm*.cpp",
mtklein3f193a92016-03-10 08:52:05 -0800271 "src/ports/*CG*",
272 "src/ports/*FontConfig*",
273 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700274 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800275 "src/ports/*android*",
276 "src/ports/*chromium*",
277 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800278 "src/ports/*mozalloc*",
279 "src/ports/*nacl*",
280 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800281 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500282 "src/ports/SkFontMgr_custom_directory.cpp",
283 "src/ports/SkFontMgr_custom_embedded.cpp",
284 "src/ports/SkFontMgr_custom_empty.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800285 "src/ports/SkFontMgr_custom_directory_factory.cpp",
286 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700287 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800288 "src/ports/SkFontMgr_empty_factory.cpp",
Mike Klein4b698cb2017-02-09 15:28:53 -0500289 "src/ports/SkGlobalInitialization_none.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800290 "src/ports/SkImageGenerator_none.cpp",
291 "src/ports/SkTLS_none.cpp",
292 ],
293)
294
benjaminwagner56f6d062016-01-13 10:45:19 -0800295################################################################################
Mike Kleinc8deb022016-09-30 12:36:55 -0400296## SSSE3/SSE4/AVX/HSW SRCS
benjaminwagner56f6d062016-01-13 10:45:19 -0800297################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700298
benjaminwagner56f6d062016-01-13 10:45:19 -0800299SSSE3_SRCS = struct(
300 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700301 "src/opts/*SSSE3*.cpp",
302 "src/opts/*ssse3*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800303 ],
304)
mtkleind55d13a2015-08-18 08:51:49 -0700305
benjaminwagner56f6d062016-01-13 10:45:19 -0800306SSE4_SRCS = struct(
307 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700308 "src/opts/*SSE4*.cpp",
309 "src/opts/*sse4*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800310 ],
311)
benjaminwagner787ca872015-08-17 12:58:10 -0700312
benjaminwagner56f6d062016-01-13 10:45:19 -0800313AVX_SRCS = struct(
314 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800315 "src/opts/*_avx.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800316 ],
317)
mtkleinf6d8d282015-12-17 10:18:04 -0800318
Mike Klein78d5a3b2016-09-30 10:48:01 -0400319HSW_SRCS = struct(
320 include = [
321 "src/opts/*_hsw.cpp",
322 ],
323)
324
benjaminwagner56f6d062016-01-13 10:45:19 -0800325################################################################################
326## BASE_HDRS
327################################################################################
328
329BASE_HDRS = struct(
330 include = [
benjaminwagner787ca872015-08-17 12:58:10 -0700331 "include/**/*.h",
332 ],
benjaminwagner99fb6702016-07-28 15:12:21 -0700333 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700334 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700335 "include/views/**/*",
benjaminwagner89061ed2016-01-25 09:29:08 -0800336 ],
337)
benjaminwagner787ca872015-08-17 12:58:10 -0700338
benjaminwagner56f6d062016-01-13 10:45:19 -0800339################################################################################
340## BASE_DEPS
341################################################################################
342
343BASE_DEPS_ALL = []
344
benjaminwagner39e7aa42015-11-18 13:26:10 -0800345BASE_DEPS_UNIX = [
iroth330043c2016-01-12 14:22:24 -0800346 ":opts_ssse3",
benjaminwagner56f6d062016-01-13 10:45:19 -0800347 ":opts_sse4",
348 ":opts_avx",
Mike Kleinc8deb022016-09-30 12:36:55 -0400349 ":opts_hsw",
benjaminwagner39e7aa42015-11-18 13:26:10 -0800350]
351
352BASE_DEPS_ANDROID = []
353
354BASE_DEPS_IOS = []
355
benjaminwagner56f6d062016-01-13 10:45:19 -0800356################################################################################
357## INCLUDES
358################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800359
benjaminwagner787ca872015-08-17 12:58:10 -0700360# Includes needed by Skia implementation. Not public includes.
361INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800362 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700363 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800364 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700365 "include/codec",
366 "include/config",
367 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700368 "include/effects",
369 "include/gpu",
370 "include/images",
371 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700372 "include/pipe",
373 "include/ports",
374 "include/private",
375 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800376 "include/utils/mac",
377 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700378 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700379 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800380 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700381 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700382 "src/gpu",
383 "src/image",
384 "src/lazy",
385 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800386 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700387 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700388 "src/sfnt",
benjaminwagnerc8962512016-09-30 12:06:27 -0700389 "src/sksl",
benjaminwagner787ca872015-08-17 12:58:10 -0700390 "src/utils",
391 "third_party/etc1",
Ben Wagnerd0a3b062016-10-24 14:11:12 -0400392 "third_party/gif",
benjaminwagner56f6d062016-01-13 10:45:19 -0800393]
benjaminwagner787ca872015-08-17 12:58:10 -0700394
benjaminwagner56f6d062016-01-13 10:45:19 -0800395################################################################################
396## DM_SRCS
397################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700398
benjaminwagner56f6d062016-01-13 10:45:19 -0800399DM_SRCS_ALL = struct(
400 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700401 "dm/*.cpp",
402 "dm/*.h",
403 "gm/*.c",
404 "gm/*.cpp",
405 "gm/*.h",
406 "tests/*.cpp",
407 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700408 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700409 "tools/CrashHandler.cpp",
410 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700411 "tools/ProcStats.cpp",
412 "tools/ProcStats.h",
413 "tools/Resources.cpp",
414 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700415 "tools/SkJSONCPP.h",
416 "tools/UrlDataManager.cpp",
417 "tools/UrlDataManager.h",
418 "tools/debugger/*.cpp",
419 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700420 "tools/flags/*.cpp",
421 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700422 "tools/gpu/**/*.cpp",
423 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700424 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700425 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800426 "tools/random_parse_path.cpp",
427 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700428 "tools/sk_tool_utils.cpp",
429 "tools/sk_tool_utils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700430 "tools/sk_tool_utils_flags.h",
benjaminwagner32885142015-10-24 07:55:31 -0700431 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700432 "tools/test_font_monospace.inc",
433 "tools/test_font_sans_serif.inc",
434 "tools/test_font_serif.inc",
435 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700436 "tools/timer/*.cpp",
437 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700438 ],
439 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700440 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700441 "tests/skia_test.cpp", # Old main.
442 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner921e48b2016-07-15 11:27:27 -0700443 "tests/SVGDeviceTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700444 "tools/gpu/gl/angle/*",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700445 "tools/gpu/gl/egl/*",
446 "tools/gpu/gl/glx/*",
447 "tools/gpu/gl/iOS/*",
448 "tools/gpu/gl/mac/*",
449 "tools/gpu/gl/mesa/*",
450 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700451 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700452 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700453 ],
454)
455
benjaminwagner38d68bc2016-04-01 05:00:51 -0700456DM_SRCS_UNIX = struct(
457 include = [
458 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
459 ],
460)
benjaminwagner86ea33e2015-10-26 10:46:25 -0700461
benjaminwagner56f6d062016-01-13 10:45:19 -0800462DM_SRCS_ANDROID = struct(
463 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700464 "tests/FontMgrAndroidParserTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700465 # TODO(benjaminwagner): Figure out how to compile with EGL.
466 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700467 ],
468)
469
benjaminwagner38d68bc2016-04-01 05:00:51 -0700470DM_SRCS_IOS = struct(
471 include = [
472 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
473 ],
474)
benjaminwagner56f6d062016-01-13 10:45:19 -0800475
476################################################################################
477## DM_INCLUDES
478################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700479
benjaminwagner6f6bef82015-10-15 08:09:44 -0700480DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800481 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700482 "gm",
Mike Reed7f302c42017-02-18 14:12:08 -0500483 "experimental/svg/model",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700484 "src/codec",
Mike Reedaab8ce42017-02-18 12:57:09 -0500485 "src/core",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700486 "src/effects",
benjaminwagnerbc9a9b42016-02-22 13:30:39 -0800487 "src/effects/gradients",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700488 "src/fonts",
Hal Canarydb683012016-11-23 08:55:18 -0700489 "src/images",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700490 "src/pathops",
491 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700492 "src/ports",
Mike Reedf71828f2017-02-18 09:51:33 -0500493 "src/xml",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700494 "tests",
495 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700496 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700497 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700498 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700499 "tools/timer",
500]
501
benjaminwagner56f6d062016-01-13 10:45:19 -0800502################################################################################
503## DM_ARGS
504################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700505
Ben Wagner59f9edb2016-11-28 15:30:37 -0500506def DM_ARGS(asan):
benjaminwagner83906ae2016-05-01 15:02:25 -0700507 source = ["tests", "gm", "image"]
508 # TODO(benjaminwagner): f16 and serialize-8888 fail.
509 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
510 # TODO(mtklein): maybe investigate why these fail?
511 match = [
512 "~Canvas",
513 "~Codec",
514 "~Codec_Dimensions",
515 "~Codec_stripes",
516 "~FontMgr",
517 "~PaintBreakText",
518 "~RecordDraw_TextBounds",
519 "~Scalar",
520 "~skps",
521 "~Stream",
522 ]
523 if asan:
Ben Wagner59f9edb2016-11-28 15:30:37 -0500524 # The ASAN we use with Bazel has some strict checks, so omit tests that
525 # trigger them.
benjaminwagner83906ae2016-05-01 15:02:25 -0700526 match += [
527 "~clippedcubic2",
528 "~conicpaths",
Ben Wagner59f9edb2016-11-28 15:30:37 -0500529 "~^gradients",
benjaminwagner83906ae2016-05-01 15:02:25 -0700530 "~Math",
531 "~Matrix",
Ben Wagner55b72532017-01-29 21:50:51 -0500532 "~PathBigCubic",
benjaminwagner83906ae2016-05-01 15:02:25 -0700533 "~PathOpsCubic",
benjaminwagnerb5188622016-06-29 10:26:44 -0700534 "~PathOpsFailOp",
caryclark523e76d2016-07-19 12:27:32 -0700535 "~PathOpsOpCubicsThreaded",
benjaminwagner83906ae2016-05-01 15:02:25 -0700536 "~PathOpsOpLoopsThreaded",
537 "~PathOpsSimplify",
538 "~PathOpsTightBoundsQuads",
539 "~Point",
benjaminwagner1d352312016-07-25 06:32:13 -0700540 "~sk_linear_to_srgb",
Ben Wagner59f9edb2016-11-28 15:30:37 -0500541 "~small_color_stop",
benjaminwagner56f6d062016-01-13 10:45:19 -0800542 ]
Ben Wagner59f9edb2016-11-28 15:30:37 -0500543 return ["--src"] + source + ["--config"] + config + ["--match"] + match
benjaminwagner56f6d062016-01-13 10:45:19 -0800544
545################################################################################
546## COPTS
547################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800548
benjaminwagner86ea33e2015-10-26 10:46:25 -0700549COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700550 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700551 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700552]
553
benjaminwagner56f6d062016-01-13 10:45:19 -0800554COPTS_ANDROID = ["-mfpu=neon"]
555
556COPTS_IOS = []
557
558COPTS_ALL = []
559
560################################################################################
561## DEFINES
562################################################################################
563
564DEFINES_UNIX = [
scroggo7732c0c2016-06-22 07:25:16 -0700565 "PNG_SKIP_SETJMP_CHECK",
benjaminwagner56f6d062016-01-13 10:45:19 -0800566 "SK_BUILD_FOR_UNIX",
567 "SK_SAMPLES_FOR_X",
halcanary650e20d2016-08-25 09:07:02 -0700568 "SK_PDF_USE_SFNTLY",
benjaminwagner186e0b92016-02-11 16:00:24 -0800569 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700570 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700571 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700572 "SK_HAS_WEBP_LIBRARY",
benjaminwagner56f6d062016-01-13 10:45:19 -0800573]
benjaminwagner86ea33e2015-10-26 10:46:25 -0700574
575DEFINES_ANDROID = [
576 "SK_BUILD_FOR_ANDROID",
benjaminwagner186e0b92016-02-11 16:00:24 -0800577 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700578 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700579 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700580 "SK_HAS_WEBP_LIBRARY",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700581]
582
iroth8b99ef42015-11-02 11:11:21 -0800583DEFINES_IOS = [
584 "SK_BUILD_FOR_IOS",
sdefresnee3fa8112016-06-01 07:08:56 -0700585 "SK_BUILD_NO_OPTS",
Matt Sarett2d4fc272017-02-10 09:42:54 -0500586 "SK_HAS_JPEG_LIBRARY",
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]