This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
public.bzl
1058 lines (955 loc) · 31.2 KB
/
public.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
################################################################################
# Skylark macros
################################################################################
def skia_select(conditions, results):
"""select() for conditions provided externally.
Instead of {"conditionA": resultA, "conditionB": resultB},
this takes two arrays, ["conditionA", "conditionB"] and [resultA, resultB].
This allows the exact targets of the conditions to be provided externally while
the results can live here, hiding the structure of those conditions in Google3.
Maybe this is too much paranoia?
Args:
conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS, CONDITION_WASM, ...]
results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS, RESULT_WASM, ....]
Returns:
The result matching the active condition.
"""
selector = {}
for i in range(len(conditions)):
selector[conditions[i]] = results[i]
return select(selector)
def skia_glob(srcs):
"""Replaces glob() with a version that accepts a struct.
Args:
srcs: struct(include=[], exclude=[])
Returns:
Equivalent of glob(srcs.include, exclude=srcs.exclude)
"""
if hasattr(srcs, "include"):
if hasattr(srcs, "exclude"):
return native.glob(srcs.include, exclude = srcs.exclude)
else:
return native.glob(srcs.include)
return []
################################################################################
## skia_{all,public}_hdrs()
################################################################################
def skia_all_hdrs():
return native.glob([
"src/**/*.h",
"include/**/*.h",
"third_party/**/*.h",
])
def skia_public_hdrs():
return native.glob(
["include/**/*.h"],
exclude = [
"include/private/**/*",
],
)
################################################################################
## skia_opts_srcs()
################################################################################
# Intel
SKIA_OPTS_SSE2 = "SSE2"
SKIA_OPTS_SSSE3 = "SSSE3"
SKIA_OPTS_SSE41 = "SSE41"
SKIA_OPTS_SSE42 = "SSE42"
SKIA_OPTS_AVX = "AVX"
SKIA_OPTS_HSW = "HSW"
# Arm
SKIA_OPTS_NEON = "NEON"
SKIA_OPTS_CRC32 = "CRC32" # arm64
def opts_srcs(opts):
if opts == SKIA_OPTS_SSE2:
return native.glob([
"src/opts/*_SSE2.cpp",
"src/opts/*_sse2.cpp", # No matches currently.
])
elif opts == SKIA_OPTS_SSSE3:
return native.glob([
"src/opts/*_SSSE3.cpp",
"src/opts/*_ssse3.cpp",
])
elif opts == SKIA_OPTS_SSE41:
return native.glob([
"src/opts/*_sse41.cpp",
])
elif opts == SKIA_OPTS_SSE42:
return native.glob([
"src/opts/*_sse42.cpp",
])
elif opts == SKIA_OPTS_AVX:
return native.glob([
"src/opts/*_avx.cpp",
])
elif opts == SKIA_OPTS_HSW:
return native.glob([
"src/opts/*_hsw.cpp",
])
elif opts == SKIA_OPTS_NEON:
return native.glob([
"src/opts/*_neon.cpp",
])
elif opts == SKIA_OPTS_CRC32:
return native.glob([
"src/opts/*_crc32.cpp",
])
else:
fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
def opts_cflags(opts):
if opts == SKIA_OPTS_SSE2:
return ["-msse2"]
elif opts == SKIA_OPTS_SSSE3:
return ["-mssse3"]
elif opts == SKIA_OPTS_SSE41:
return ["-msse4.1"]
elif opts == SKIA_OPTS_SSE42:
return ["-msse4.2"]
elif opts == SKIA_OPTS_AVX:
return ["-mavx"]
elif opts == SKIA_OPTS_HSW:
return ["-mavx2", "-mf16c", "-mfma"]
elif opts == SKIA_OPTS_NEON:
return ["-mfpu=neon"]
elif opts == SKIA_OPTS_CRC32:
# NDK r11's Clang (3.8) doesn't pass along this -march setting correctly to an external
# assembler, so we do it manually with -Wa. This is just a bug, fixed in later Clangs.
return ["-march=armv8-a+crc", "-Wa,-march=armv8-a+crc"]
else:
return []
SKIA_CPU_ARM = "ARM"
SKIA_CPU_ARM64 = "ARM64"
SKIA_CPU_X86 = "X86"
SKIA_CPU_OTHER = "OTHER"
def opts_rest_srcs(cpu):
srcs = []
if cpu == SKIA_CPU_ARM or cpu == SKIA_CPU_ARM64:
srcs += native.glob([
"src/opts/*_arm.cpp",
"src/opts/SkBitmapProcState_opts_none.cpp",
])
if cpu == SKIA_CPU_ARM64:
# NEON doesn't need special flags to compile on ARM64.
srcs += native.glob([
"src/opts/*_neon.cpp",
])
elif cpu == SKIA_CPU_X86:
srcs += native.glob([
"src/opts/*_x86.cpp",
])
elif cpu == SKIA_CPU_OTHER:
srcs += native.glob([
"src/opts/*_none.cpp",
])
else:
fail("opts_rest_srcs parameter 'cpu' must be one of " +
"SKIA_CPU_{ARM,ARM64,X86,OTHER}.")
return srcs
def skia_opts_deps(cpu):
res = [":opts_rest"]
if cpu == SKIA_CPU_ARM:
res += [":opts_neon"]
if cpu == SKIA_CPU_ARM64:
res += [":opts_crc32"]
if cpu == SKIA_CPU_X86:
res += [
":opts_sse2",
":opts_ssse3",
":opts_sse41",
":opts_sse42",
":opts_avx",
":opts_hsw",
]
return res
################################################################################
## BASE_SRCS
################################################################################
# All platform-independent SRCS.
BASE_SRCS_ALL = struct(
include = [
"include/private/**/*.h",
"src/**/*.h",
"src/**/*.cpp",
"src/**/*.inc",
],
exclude = [
# Exclude platform-dependent files.
"src/codec/*",
"src/device/xps/*", # Windows-only. Move to ports?
"src/doc/*_XPS.cpp", # Windows-only. Move to ports?
"src/gpu/gl/android/*",
"src/gpu/gl/egl/*",
"src/gpu/gl/glfw/*",
"src/gpu/gl/glx/*",
"src/gpu/gl/iOS/*",
"src/gpu/gl/mac/*",
"src/gpu/gl/win/*",
"src/opts/**/*",
"src/ports/**/*",
"src/utils/android/**/*",
"src/utils/mac/**/*",
"src/utils/win/**/*",
# Exclude multiple definitions.
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
"src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
# Exclude files that don't compile everywhere.
"src/svg/**/*", # Depends on xml, SkJpegCodec, and SkPngCodec.
"src/xml/**/*", # Avoid dragging in expat when not needed.
# Exclude all GL specific files
"src/gpu/gl/*",
"src/gpu/gl/builders/*",
# Exclude all WebGL specific files
"src/gpu/gl/webgl/*",
# Currently exclude all vulkan specific files
"src/gpu/vk/*",
# Currently exclude all Direct3D specific files
"src/gpu/d3d/*",
# Currently exclude all Dawn-specific files
"src/gpu/dawn/*",
# Defines main.
"src/sksl/SkSLMain.cpp",
# Only used to regenerate the lexer
"src/sksl/lex/*",
],
)
def codec_srcs(limited):
"""Sources for the codecs. Excludes Raw, and Ico, Webp, and Png if limited."""
exclude = ["src/codec/*Raw*.cpp"]
if limited:
exclude += [
"src/codec/*Ico*.cpp",
"src/codec/*Webp*.cpp",
"src/codec/*Png*",
]
return native.glob(["src/codec/*.cpp"], exclude = exclude)
GL_SRCS_UNIX = struct(
include = [
"src/gpu/gl/*.cpp",
"src/gpu/gl/*.h",
"src/gpu/gl/builders/*.cpp",
"src/gpu/gl/builders/*.h",
],
exclude = [],
)
PORTS_SRCS_UNIX = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
],
exclude = [
"src/ports/*CG*",
"src/ports/*WIC*",
"src/ports/*android*",
"src/ports/*chromium*",
"src/ports/*mac*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fontconfig_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
GL_SRCS_ANDROID = struct(
include = [
"src/gpu/gl/*.cpp",
"src/gpu/gl/*.h",
"src/gpu/gl/builders/*.cpp",
"src/gpu/gl/builders/*.h",
"src/gpu/gl/android/*.cpp",
],
exclude = [
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
],
)
PORTS_SRCS_ANDROID = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
],
exclude = [
"src/ports/*CG*",
"src/ports/*FontConfig*",
"src/ports/*WIC*",
"src/ports/*chromium*",
"src/ports/*fontconfig*",
"src/ports/*mac*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*", # TODO (scroggo): enable NDK decoding/encoding in Google3
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
PORTS_SRCS_ANDROID_NO_FONT = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
],
exclude = [
"src/ports/*CG*",
"src/ports/*FontConfig*",
"src/ports/*WIC*",
"src/ports/*chromium*",
"src/ports/*fontconfig*",
"src/ports/*mac*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*",
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkFontMgr_a*",
"src/ports/SkFontHost_Free*",
"src/ports/SkFontMgr_custom*",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
GL_SRCS_IOS = struct(
include = [
"src/gpu/gl/*.cpp",
"src/gpu/gl/*.h",
"src/gpu/gl/builders/*.cpp",
"src/gpu/gl/builders/*.h",
"src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp",
],
exclude = [
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
],
)
PORTS_SRCS_IOS = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
"src/utils/mac/*.cpp",
],
exclude = [
"src/ports/*FontConfig*",
"src/ports/*FreeType*",
"src/ports/*WIC*",
"src/ports/*android*",
"src/ports/*chromium*",
"src/ports/*fontconfig*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*",
"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom_directory.cpp",
"src/ports/SkFontMgr_custom_embedded.cpp",
"src/ports/SkFontMgr_custom_empty.cpp",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
GL_SRCS_WASM = struct(
include = [
"src/gpu/gl/*.cpp",
"src/gpu/gl/*.h",
"src/gpu/gl/builders/*.cpp",
"src/gpu/gl/builders/*.h",
"src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
"src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
],
exclude = [
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
],
)
PORTS_SRCS_WASM = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
],
exclude = [
# commented lines below left in because they indicate specifically what is
# included here and not in other PORTS_SRCS lists.
"src/ports/*FontConfig*",
#"src/ports/*FreeType*",
"src/ports/*WIC*",
"src/ports/*CG*",
"src/ports/*android*",
"src/ports/*chromium*",
"src/ports/*fontconfig*",
"src/ports/*mac*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*",
#"src/ports/SkDebug_stdio.cpp",
#"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom_directory.cpp",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded.cpp",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
# "src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fontconfig_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
GL_SRCS_FUCHSIA = struct(
include = [
"src/gpu/vk/*.cpp",
"src/gpu/vk/*.h",
],
exclude = [],
)
PORTS_SRCS_FUCHSIA = struct(
include = [
"src/ports/**/*.cpp",
"src/ports/**/*.h",
],
exclude = [
"src/ports/*FontConfig*",
#"src/ports/*FreeType*",
"src/ports/*WIC*",
"src/ports/*CG*",
"src/ports/*android*",
"src/ports/*chromium*",
"src/ports/*fontconfig*",
"src/ports/*mac*",
"src/ports/*mozalloc*",
"src/ports/*nacl*",
"src/ports/*win*",
"src/ports/*NDK*",
#"src/ports/SkDebug_stdio.cpp",
#"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom_directory.cpp",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded.cpp",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
#"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fontconfig_factory.cpp",
#"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
],
)
GL_SRCS_MACOS = struct(
include = [
"src/gpu/gl/*.cpp",
"src/gpu/gl/*.h",
"src/gpu/gl/builders/*.cpp",
"src/gpu/gl/builders/*.h",
"src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp",
],
exclude = [
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
],
)
PORTS_SRCS_MACOS = PORTS_SRCS_IOS
def base_srcs():
return skia_glob(BASE_SRCS_ALL)
def ports_srcs(os_conditions):
return skia_select(
os_conditions,
[
skia_glob(PORTS_SRCS_UNIX),
skia_glob(PORTS_SRCS_ANDROID),
skia_glob(PORTS_SRCS_IOS),
skia_glob(PORTS_SRCS_WASM),
skia_glob(PORTS_SRCS_FUCHSIA),
skia_glob(PORTS_SRCS_MACOS),
skia_glob(PORTS_SRCS_ANDROID_NO_FONT),
],
)
def gl_srcs(os_conditions):
return skia_select(
os_conditions,
[
skia_glob(GL_SRCS_UNIX),
skia_glob(GL_SRCS_ANDROID),
skia_glob(GL_SRCS_IOS),
skia_glob(GL_SRCS_WASM),
skia_glob(GL_SRCS_FUCHSIA),
skia_glob(GL_SRCS_MACOS),
skia_glob(GL_SRCS_ANDROID),
],
)
def skia_srcs(os_conditions):
return base_srcs() + ports_srcs(os_conditions) + gl_srcs(os_conditions)
def metal_objc_srcs():
return native.glob(
[
"include/**/*.h",
"src/**/*.h",
"src/gpu/mtl/**/*.mm",
"third_party/**/*.h",
],
) + [
"src/image/SkSurface_GpuMtl.mm",
]
################################################################################
## INCLUDES
################################################################################
# Includes needed by Skia implementation. Not public includes.
INCLUDES = [
".",
"include/android",
"include/c",
"include/codec",
"include/config",
"include/core",
"include/docs",
"include/effects",
"include/encode",
"include/gpu",
"include/pathops",
"include/ports",
"include/private",
"include/third_party/skcms",
"include/utils",
"include/utils/mac",
"src/codec",
"src/core",
"src/gpu",
"src/image",
"src/images",
"src/lazy",
"src/opts",
"src/pdf",
"src/ports",
"src/sfnt",
"src/shaders",
"src/shaders/gradients",
"src/sksl",
"src/utils",
"third_party/gif",
]
################################################################################
## DM_SRCS
################################################################################
DM_SRCS_ALL = struct(
include = [
"dm/*.cpp",
"dm/*.h",
"experimental/pipe/*.cpp",
"experimental/pipe/*.h",
"gm/*.cpp",
"gm/*.h",
"gm/verifiers/*.cpp",
"gm/verifiers/*.h",
# TODO(fmalita): SVG sources should not be included here
"modules/svg/include/*.h",
"modules/svg/src/*.cpp",
"src/utils/SkMultiPictureDocument.cpp",
"src/xml/*.cpp",
"tests/*.cpp",
"tests/*.h",
"tools/AutoreleasePool.h",
"tools/BinaryAsset.h",
"tools/CrashHandler.cpp",
"tools/CrashHandler.h",
"tools/DDLPromiseImageHelper.cpp",
"tools/DDLPromiseImageHelper.h",
"tools/DDLTileHelper.cpp",
"tools/DDLTileHelper.h",
"tools/HashAndEncode.cpp",
"tools/HashAndEncode.h",
"tools/ProcStats.cpp",
"tools/ProcStats.h",
"tools/Registry.h",
"tools/ResourceFactory.h",
"tools/Resources.cpp",
"tools/Resources.h",
"tools/RuntimeBlendUtils.cpp",
"tools/RuntimeBlendUtils.h",
"tools/SkMetaData.cpp",
"tools/SkMetaData.h",
"tools/SkSharingProc.cpp",
"tools/ToolUtils.cpp",
"tools/ToolUtils.h",
"tools/UrlDataManager.cpp",
"tools/UrlDataManager.h",
"tools/debugger/*.cpp",
"tools/debugger/*.h",
"tools/flags/*.cpp",
"tools/flags/*.h",
"tools/fonts/RandomScalerContext.cpp",
"tools/fonts/RandomScalerContext.h",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestFontMgr.h",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestSVGTypeface.h",
"tools/fonts/TestTypeface.cpp",
"tools/fonts/TestTypeface.h",
"tools/fonts/ToolUtilsFont.cpp",
"tools/fonts/test_font_index.inc",
"tools/fonts/test_font_monospace.inc",
"tools/fonts/test_font_sans_serif.inc",
"tools/fonts/test_font_serif.inc",
"tools/gpu/**/*.cpp",
"tools/gpu/**/*.h",
"tools/ios_utils.h",
"tools/random_parse_path.cpp",
"tools/random_parse_path.h",
"tools/timer/*.cpp",
"tools/timer/*.h",
"tools/trace/*.cpp",
"tools/trace/*.h",
],
exclude = [
"gm/cgms.cpp",
"gm/fiddle.cpp",
"gm/video_decoder.cpp",
"tests/FontMgrAndroidParserTest.cpp", # Android-only.
"tests/FontMgrFontConfigTest.cpp", # FontConfig-only.
"tests/TypefaceMacTest.cpp", # CoreText-only.
"tests/SkParagraphTest.cpp", # Skipping tests for now.
"tools/gpu/d3d/*",
"tools/gpu/dawn/*",
"tools/gpu/gl/angle/*",
"tools/gpu/gl/egl/*",
"tools/gpu/gl/glx/*",
"tools/gpu/gl/iOS/*",
"tools/gpu/gl/mac/*",
"tools/gpu/gl/win/*",
"tools/timer/SysTimer_mach.cpp",
"tools/timer/SysTimer_windows.cpp",
],
)
################################################################################
## dm_srcs()
################################################################################
def dm_srcs(os_conditions):
"""Sources for the dm binary for the specified os."""
return skia_glob(DM_SRCS_ALL) + skia_select(
os_conditions,
[
["tests/FontMgrFontConfigTest.cpp"], # Unix
["tests/FontMgrAndroidParserTest.cpp"], # Android
["tests/TypefaceMacTest.cpp"], # iOS
[], # WASM
[], # Fuchsia
["tests/TypefaceMacTest.cpp"], # macOS
],
)
################################################################################
## DM_ARGS
################################################################################
def DM_ARGS(asan):
source = ["gm", "image", "lottie"]
# TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
config = ["565", "8888", "pdf"]
match = ["~Codec_78329453"]
return (["--src"] + source + ["--config"] + config + ["--nonativeFonts"] +
["--match"] + match)
################################################################################
## COPTS
################################################################################
def base_copts(os_conditions):
return ["-Wno-implicit-fallthrough"] + skia_select(
os_conditions,
[
# UNIX
[
# Internal use of deprecated methods. :(
"-Wno-deprecated-declarations",
# TODO(kjlubick)
"-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
],
# ANDROID
[
# 'GrResourceCache' declared with greater visibility than the
# type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
"-Wno-error=attributes",
],
[], # iOS
[], # wasm
[], # Fuchsia
[], # macOS
],
)
################################################################################
## DEFINES
################################################################################
def base_defines(os_conditions):
return [
# Chrome DEFINES.
"SK_USE_FREETYPE_EMBOLDEN",
# Turn on a few Google3-specific build fixes.
"SK_BUILD_FOR_GOOGLE3",
# Required for building dm.
"GR_TEST_UTILS",
# Staging flags for API changes
"SK_PARAGRAPH_GRAPHEME_EDGES",
# Should remove after we update golden images
"SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
# Experiment to diagnose image diffs in Google3
"SK_DISABLE_LOWP_RASTER_PIPELINE",
# JPEG is in codec_limited and is included in all
# builds except the no_codec android build
] + skia_select(
os_conditions,
[
# UNIX
[
"PNG_SKIP_SETJMP_CHECK",
"SK_BUILD_FOR_UNIX",
"SK_CODEC_DECODES_PNG",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_PNG",
"SK_ENCODE_WEBP",
"SK_R32_SHIFT=16",
"SK_GL",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# ANDROID
[
"SK_BUILD_FOR_ANDROID",
"SK_CODEC_DECODES_PNG",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_PNG",
"SK_ENCODE_WEBP",
"SK_GL",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# IOS
[
"SK_BUILD_FOR_IOS",
"SK_NO_COMMAND_BUFFER", # Test tools that use thread_local.
"SK_GL",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# WASM
[
"SK_DISABLE_LEGACY_SHADERCONTEXT",
"SK_DISABLE_TRACING",
"SK_GL",
"SK_SUPPORT_GPU=1",
"SK_DISABLE_AAA",
"SK_DISABLE_EFFECT_DESERIALIZATION",
"SK_FORCE_8_BYTE_ALIGNMENT",
"SKNX_NO_SIMD",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# FUCHSIA
[
"SK_BUILD_FOR_UNIX",
"SK_CODEC_DECODES_PNG",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_PNG",
"SK_ENCODE_WEBP",
"SK_R32_SHIFT=16",
"SK_VULKAN",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# MACOS
[
"SK_BUILD_FOR_MAC",
"SK_GL",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_HAS_ANDROID_CODEC",
],
# ANDROID W/ NO CODECS
[
"SK_BUILD_FOR_ANDROID",
"SK_GL",
],
],
)
################################################################################
## LINKOPTS
################################################################################
def base_linkopts(os_conditions):
return [
"-ldl",
] + skia_select(
os_conditions,
[
[], # Unix
# ANDROID
[
"-lEGL",
"-lGLESv2",
],
# IOS
[
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreText",
"-framework ImageIO",
"-framework MobileCoreServices",
],
[], # wasm
[], # Fuchsia
# MACOS
[
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreText",
"-framework ImageIO",
"-framework ApplicationServices",
],
],
)
################################################################################
## sksg_lib
################################################################################
def sksg_lib_hdrs():
return native.glob(["modules/sksg/include/*.h"])
def sksg_lib_srcs():
return native.glob([
"modules/sksg/src/*.cpp",
"modules/sksg/src/*.h",
])
################################################################################
## skparagraph_lib
################################################################################
def skparagraph_lib_hdrs():
return native.glob(["modules/skparagraph/include/*.h"])
def skparagraph_lib_srcs():
return native.glob(["modules/skparagraph/src/*.cpp"])
################################################################################
## skresources_lib
################################################################################
def skresources_lib_hdrs():
return ["modules/skresources/include/SkResources.h"]
def skresources_lib_srcs():
return ["modules/skresources/src/SkResources.cpp"]
################################################################################
## skottie_lib
################################################################################
def skottie_lib_hdrs():
return native.glob(["modules/skottie/include/*.h"])
def skottie_lib_srcs():
return native.glob(
[
"modules/skottie/src/*.cpp",
"modules/skottie/src/*.h",
"modules/skottie/src/animator/*.cpp",
"modules/skottie/src/animator/*.h",
"modules/skottie/src/effects/*.cpp",
"modules/skottie/src/effects/*.h",
"modules/skottie/src/layers/*.cpp",
"modules/skottie/src/layers/*.h",
"modules/skottie/src/layers/shapelayer/*.cpp",
"modules/skottie/src/layers/shapelayer/*.h",
"modules/skottie/src/text/*.cpp",
"modules/skottie/src/text/*.h",
],
exclude = [
"modules/skottie/src/SkottieTest.cpp",
"modules/skottie/src/SkottieTool.cpp",
],
)
################################################################################
## skottie_utils
################################################################################
SKOTTIE_UTILS_HDRS = [
"modules/skottie/utils/SkottieUtils.h",
]
SKOTTIE_UTILS_SRCS = [
"modules/skottie/utils/SkottieUtils.cpp",
]
################################################################################
## skottie_shaper
################################################################################
SKOTTIE_SHAPER_HDRS = [
"modules/skottie/src/text/SkottieShaper.h",
]
SKOTTIE_SHAPER_SRCS = [
"modules/skottie/src/text/SkottieShaper.cpp",
]
################################################################################
## skottie_tool
################################################################################
SKOTTIE_TOOL_SRCS = [
"modules/skottie/src/SkottieTool.cpp",
"modules/skresources/src/SkResources.cpp",
"modules/skresources/include/SkResources.h",
# TODO(benjaminwagner): Add "flags" target.
"tools/flags/CommandLineFlags.cpp",
"tools/flags/CommandLineFlags.h",
]
################################################################################
## SkShaper
################################################################################
# Stubs, pending SkUnicode fission
SKUNICODE_ICU_BUILTIN_SRCS = [
"modules/skunicode/include/SkUnicode.h",
"modules/skunicode/src/SkUnicode_icu.cpp",
"modules/skunicode/src/SkUnicode_icu.h",
"modules/skunicode/src/SkUnicode_icu_builtin.cpp",
]
SKUNICODE_ICU_RUNTIME_SRCS = [
"modules/skunicode/include/SkUnicode.h",
"modules/skunicode/src/SkUnicode_icu.cpp",
"modules/skunicode/src/SkUnicode_icu.h",