Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: public.bzl

Issue 1584563004: Reland of Move BUILD.public to public.bzl. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.public ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ################################################################################
2 # Skylark macros
3 ################################################################################
4
5 is_bazel = not hasattr(native, "genmpm")
6
7 def 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
22 def 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
39 def 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 ################################################################################
55 ## BASE_SRCS
56 ################################################################################
57
58 # All platform-independent SRCS.
59 BASE_SRCS_ALL = struct(
60 include = [
61 "include/private/*.h",
62 "src/**/*.h",
63 "src/**/*.cpp",
64
65 # Third Party
66 "third_party/etc1/*.cpp",
67 "third_party/etc1/*.h",
68 "third_party/ktx/*.cpp",
69 "third_party/ktx/*.h",
70 ],
71 exclude = [
72 # Exclude platform-dependent files.
73 "src/codec/*",
74 "src/device/xps/*", # Windows-only. Move to ports?
75 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
76 "src/fonts/SkFontMgr_fontconfig.cpp",
77 "src/gpu/gl/android/*",
78 "src/gpu/gl/egl/*",
79 "src/gpu/gl/glx/*",
80 "src/gpu/gl/iOS/*",
81 "src/gpu/gl/mac/*",
82 "src/gpu/gl/win/*",
83 "src/images/*",
84 "src/opts/**/*",
85 "src/ports/**/*",
86 "src/utils/android/**/*",
87 "src/utils/mac/**/*",
88 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
89 "src/utils/win/**/*",
90 "src/views/sdl/*",
91 "src/views/win/*",
92 "src/views/unix/*",
93
94 # Exclude multiple definitions.
95 # TODO(mtklein): Move to opts?
96 "src/doc/SkDocument_PDF_None.cpp", # We use SkDocument_PDF.cpp.
97 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
98 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
99
100 # Exclude files that don't compile with the current DEFINES.
101 "src/gpu/gl/angle/*", # Requires SK_ANGLE define.
102 "src/gpu/gl/command_buffer/*", # unknown type name 'HMODULE'
103 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
104 "src/svg/parser/*", # Missing SkSVG.h.
105
106 # Conflicting dependencies among Lua versions. See cl/107087297.
107 "src/utils/SkLua*",
108
109 # Not used.
110 "src/animator/**/*",
111 "src/views/**/*",
112 "src/xml/SkBML_Verbs.h",
113 "src/xml/SkBML_XMLParser.cpp",
114 "src/xml/SkXMLPullParser.cpp",
115 ],
116 )
117
118 # Platform-dependent SRCS for google3-default platform.
119 BASE_SRCS_UNIX = struct(
120 include = [
121 "src/codec/*",
122 "src/fonts/SkFontMgr_fontconfig.cpp",
123 "src/images/*",
124 "src/opts/**/*.cpp",
125 "src/opts/**/*.h",
126 "src/ports/**/*.cpp",
127 "src/ports/**/*.h",
128 ],
129 exclude = [
130 "src/codec/SkJpegCodec.cpp", # libjpeg_turbo version mismatch.
131 "src/opts/*arm*",
132 "src/opts/*mips*",
133 "src/opts/*NEON*",
134 "src/opts/*neon*",
135 # Included in :opts_ssse3 library.
136 "src/opts/*SSSE3*",
137 "src/opts/*ssse3*",
138 # Included in :opts_sse4 library.
139 "src/opts/*SSE4*",
140 "src/opts/*sse4*",
141 # Included in :opts_avx or :opts_avx2
142 "src/opts/*avx*",
143 "src/opts/SkBitmapProcState_opts_none.cpp",
144 "src/opts/SkBlitMask_opts_none.cpp",
145 "src/opts/SkBlitRow_opts_none.cpp",
146 "src/ports/*android*",
147 "src/ports/*chromium*",
148 "src/ports/*mac*",
149 "src/ports/*mozalloc*",
150 "src/ports/*nacl*",
151 "src/ports/*win*",
152 "src/ports/SkFontConfigInterface_direct_factory.cpp",
153 "src/ports/SkFontMgr_custom_directory_factory.cpp",
154 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
155 "src/ports/SkFontMgr_empty_factory.cpp",
156 "src/ports/SkFontMgr_fontconfig.cpp",
157 "src/ports/SkImageDecoder_CG.cpp",
158 "src/ports/SkFontMgr_fontconfig_factory.cpp",
159 "src/ports/SkImageDecoder_WIC.cpp",
160 "src/ports/SkImageDecoder_empty.cpp",
161 "src/ports/SkImageGenerator_none.cpp",
162 "src/ports/SkTLS_none.cpp",
163 ],
164 )
165
166 # Platform-dependent SRCS for google3-default Android.
167 BASE_SRCS_ANDROID = struct(
168 include = [
169 "src/codec/*",
170 "src/images/*",
171 # TODO(benjaminwagner): Figure out how to compile with EGL.
172 "src/opts/**/*.cpp",
173 "src/opts/**/*.h",
174 "src/ports/**/*.cpp",
175 "src/ports/**/*.h",
176 ],
177 exclude = [
178 "src/codec/SkJpegCodec.cpp", # libjpeg_turbo version mismatch.
179 "src/opts/*mips*",
180 "src/opts/*SSE2*",
181 "src/opts/*SSSE3*",
182 "src/opts/*ssse3*",
183 "src/opts/*SSE4*",
184 "src/opts/*sse4*",
185 "src/opts/*avx*",
186 "src/opts/*x86*",
187 "src/opts/SkBitmapProcState_opts_none.cpp",
188 "src/opts/SkBlitMask_opts_none.cpp",
189 "src/opts/SkBlitRow_opts_none.cpp",
190 "src/ports/*chromium*",
191 "src/ports/*fontconfig*",
192 "src/ports/*FontConfig*",
193 "src/ports/*mac*",
194 "src/ports/*mozalloc*",
195 "src/ports/*nacl*",
196 "src/ports/*win*",
197 "src/ports/SkDebug_stdio.cpp",
198 "src/ports/SkFontConfigInterface_direct_factory.cpp",
199 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
200 "src/ports/SkFontMgr_custom_directory_factory.cpp",
201 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
202 "src/ports/SkFontMgr_empty_factory.cpp",
203 "src/ports/SkImageDecoder_CG.cpp",
204 "src/ports/SkImageDecoder_WIC.cpp",
205 "src/ports/SkImageDecoder_empty.cpp",
206 "src/ports/SkImageGenerator_none.cpp",
207 "src/ports/SkTLS_none.cpp",
208 ],
209 )
210
211 # Platform-dependent SRCS for google3-default iOS.
212 BASE_SRCS_IOS = struct(
213 include = [
214 "src/opts/**/*.cpp",
215 "src/opts/**/*.h",
216 "src/ports/**/*.cpp",
217 "src/ports/**/*.h",
218 ],
219 exclude = [
220 "src/opts/*mips*",
221 "src/opts/*NEON*",
222 "src/opts/*neon*",
223 "src/opts/*SSE2*",
224 "src/opts/*SSSE3*",
225 "src/opts/*ssse3*",
226 "src/opts/*SSE4*",
227 "src/opts/*sse4*",
228 "src/opts/*avx*",
229 "src/opts/*x86*",
230 "src/opts/SkBitmapProcState_opts_none.cpp",
231 "src/opts/SkBlitMask_opts_none.cpp",
232 "src/opts/SkBlitRow_opts_none.cpp",
233 "src/ports/*android*",
234 "src/ports/*chromium*",
235 "src/ports/*fontconfig*",
236 "src/ports/*FontConfig*",
237 "src/ports/*FreeType*",
238 "src/ports/*mozalloc*",
239 "src/ports/*nacl*",
240 "src/ports/*win*",
241 "src/ports/SkDebug_stdio.cpp",
242 "src/ports/SkFontMgr_custom.cpp",
243 "src/ports/SkFontConfigInterface_direct_factory.cpp",
244 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
245 "src/ports/SkFontMgr_custom_directory_factory.cpp",
246 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
247 "src/ports/SkFontMgr_empty_factory.cpp",
248 "src/ports/SkImageDecoder_CG.cpp",
249 "src/ports/SkImageDecoder_WIC.cpp",
250 "src/ports/SkImageDecoder_empty.cpp",
251 "src/ports/SkImageGenerator_none.cpp",
252 "src/ports/SkTLS_none.cpp",
253 ],
254 )
255
256 ################################################################################
257 ## SSSE3/SSE4/AVX/AVX2 SRCS
258 ################################################################################
259
260 SSSE3_SRCS = struct(
261 include = [
262 "src/opts/*SSSE3*.cpp",
263 "src/opts/*ssse3*.cpp",
264 ])
265
266 SSE4_SRCS = struct(
267 include = [
268 "src/opts/*SSE4*.cpp",
269 "src/opts/*sse4*.cpp",
270 ])
271
272 AVX_SRCS = struct(
273 include = [
274 "src/opts/*_avx.cpp",
275 ])
276
277 AVX2_SRCS = struct(
278 include = [
279 "src/opts/*_avx2.cpp",
280 ])
281
282 ################################################################################
283 ## BASE_HDRS
284 ################################################################################
285
286 BASE_HDRS = struct(
287 include = [
288 "include/**/*.h",
289 ],
290 exclude = [
291 "include/private/**/*",
292
293 # Not used.
294 "include/animator/**/*",
295 "include/views/**/*",
296 "include/xml/SkBML_WXMLParser.h",
297 "include/xml/SkBML_XMLParser.h",
298 ])
299
300 ################################################################################
301 ## BASE_DEPS
302 ################################################################################
303
304 BASE_DEPS_ALL = []
305
306 BASE_DEPS_UNIX = [
307 ":opts_ssse3",
308 ":opts_sse4",
309 ":opts_avx",
310 ":opts_avx2",
311 ]
312
313 BASE_DEPS_ANDROID = []
314
315 BASE_DEPS_IOS = []
316
317 ################################################################################
318 ## INCLUDES
319 ################################################################################
320
321 # Includes needed by Skia implementation. Not public includes.
322 INCLUDES = [
323 "include/android",
324 "include/c",
325 "include/codec",
326 "include/config",
327 "include/core",
328 "include/effects",
329 "include/gpu",
330 "include/images",
331 "include/pathops",
332 "include/pipe",
333 "include/ports",
334 "include/private",
335 "include/utils",
336 "include/utils/mac",
337 "include/utils/win",
338 "include/svg",
339 "include/xml",
340 "src/codec",
341 "src/core",
342 "src/gpu",
343 "src/image",
344 "src/lazy",
345 "src/opts",
346 "src/ports",
347 "src/pdf",
348 "src/sfnt",
349 "src/utils",
350 "third_party/etc1",
351 "third_party/ktx",
352 ]
353
354 ################################################################################
355 ## DM_SRCS
356 ################################################################################
357
358 DM_SRCS_ALL = struct(
359 include = [
360 "dm/*.cpp",
361 "dm/*.h",
362 "gm/*.c",
363 "gm/*.cpp",
364 "gm/*.h",
365 "tests/*.cpp",
366 "tests/*.h",
367 "tools/CrashHandler.cpp",
368 "tools/CrashHandler.h",
369 "tools/LazyDecodeBitmap.cpp",
370 "tools/LazyDecodeBitmap.h",
371 "tools/ProcStats.cpp",
372 "tools/ProcStats.h",
373 "tools/Resources.cpp",
374 "tools/Resources.h",
375 "tools/SkBitmapRegionCanvas.cpp",
376 "tools/SkBitmapRegionCanvas.h",
377 "tools/SkBitmapRegionCodec.cpp",
378 "tools/SkBitmapRegionCodec.h",
379 "tools/SkBitmapRegionDecoder.cpp",
380 "tools/SkBitmapRegionDecoder.h",
381 "tools/SkBitmapRegionSampler.cpp",
382 "tools/SkBitmapRegionSampler.h",
383 "tools/flags/*.cpp",
384 "tools/flags/*.h",
385 "tools/sk_tool_utils.cpp",
386 "tools/sk_tool_utils.h",
387 "tools/sk_tool_utils_font.cpp",
388 "tools/timer/*.cpp",
389 "tools/timer/*.h",
390 ],
391 exclude = [
392 "dm/DMSrcSinkAndroid.cpp", # Android-only.
393 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
394 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
395 "tests/skia_test.cpp", # Old main.
396 "tests/SkpSkGrTest.cpp", # Alternate main.
397 "tools/timer/SysTimer_mach.cpp",
398 "tools/timer/SysTimer_windows.cpp",
399 ],
400 )
401
402 DM_SRCS_UNIX = struct()
403
404 DM_SRCS_ANDROID = struct(
405 include = [
406 # Depends on Android HWUI library that is not available in google3.
407 #"dm/DMSrcSinkAndroid.cpp",
408 "tests/FontMgrAndroidParserTest.cpp",
409 ],
410 )
411
412 DM_SRCS_IOS = struct()
413
414 ################################################################################
415 ## DM_INCLUDES
416 ################################################################################
417
418 DM_INCLUDES = [
419 "gm",
420 "src/codec",
421 "src/effects",
422 "src/fonts",
423 "src/pathops",
424 "src/pipe/utils",
425 "src/ports",
426 "src/utils/debugger",
427 "tests",
428 "tools",
429 "tools/flags",
430 "tools/timer",
431 ]
432
433 ################################################################################
434 ## DM_ARGS
435 ################################################################################
436
437 def DM_ARGS(base_dir):
438 return [
439 "--nogpu",
440 "--verbose",
441 # TODO(mtklein): maybe investigate why these fail?
442 "--match ~FontMgr ~Scalar ~Canvas ~Codec_stripes ~Codec_Dimensions ~Code c ~Stream ~skps ~RecordDraw_TextBounds",
443 "--resourcePath %s/resources" % base_dir,
444 "--images %s/resources" % base_dir,
445 ]
446
447 ################################################################################
448 ## COPTS
449 ################################################################################
450
451 COPTS_UNIX = [
452 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
453 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
454 ]
455
456 COPTS_ANDROID = ["-mfpu=neon"]
457
458 COPTS_IOS = []
459
460 COPTS_ALL = []
461
462 ################################################################################
463 ## DEFINES
464 ################################################################################
465
466 DEFINES_UNIX = [
467 "SK_BUILD_FOR_UNIX",
468 "SK_SAMPLES_FOR_X",
469 "SK_SFNTLY_SUBSETTER",
470 ]
471
472 DEFINES_ANDROID = [
473 "SK_BUILD_FOR_ANDROID",
474 # TODO(benjaminwagner): Try to get png library updated?
475 "SK_PNG_NO_INDEX_SUPPORTED",
476 ]
477
478 DEFINES_IOS = [
479 "SK_BUILD_FOR_IOS",
480 "SK_IGNORE_ETC1_SUPPORT",
481 ]
482
483 DEFINES_ALL = [
484 # Chrome DEFINES.
485 "SK_USE_FLOATBITS",
486 "SK_USE_FREETYPE_EMBOLDEN",
487 # Turn on a few Google3-specific build fixes.
488 "GOOGLE3",
489 ]
490
491 ################################################################################
492 ## LINKOPTS
493 ################################################################################
494
495 LINKOPTS_UNIX = []
496
497 LINKOPTS_ANDROID = [
498 "-lEGL",
499 ]
500
501 LINKOPTS_IOS = []
502
503 LINKOPTS_ALL = [
504 "-ldl",
505 ]
506
OLDNEW
« no previous file with comments | « BUILD.public ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698