forked from aseprite/skia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.gn
2518 lines (2319 loc) · 59.7 KB
/
BUILD.gn
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
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("gn/flutter_defines.gni")
import("gn/fuchsia_defines.gni")
import("gn/shared_sources.gni")
import("gn/skia.gni")
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
import("build/fuchsia/fuchsia_download_sdk.gni")
}
if (skia_use_dawn) {
import("third_party/externals/dawn/scripts/dawn_features.gni")
}
if (defined(skia_settings)) {
import(skia_settings)
}
import("gn/ios.gni")
# Skia public API, generally provided by :skia.
config("skia_public") {
include_dirs = [ "." ]
defines = []
if (is_component_build) {
defines += [ "SKIA_DLL" ]
}
if (is_fuchsia || is_linux) {
defines += [ "SK_R32_SHIFT=16" ]
}
if (skia_enable_flutter_defines) {
defines += flutter_defines
}
if (!skia_enable_gpu) {
defines += [ "SK_SUPPORT_GPU=0" ]
}
if (skia_enable_atlas_text) {
defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
}
if (is_fuchsia) {
defines += fuchsia_defines
}
if (skia_gl_standard == "gles") {
defines += [ "SK_ASSUME_GL_ES=1" ]
} else if (skia_gl_standard == "gl") {
defines += [ "SK_ASSUME_GL=1" ]
} else if (skia_gl_standard == "webgl") {
defines += [ "SK_ASSUME_WEBGL=1" ]
}
}
# Skia internal APIs, used by Skia itself and a few test tools.
config("skia_private") {
visibility = [ ":*" ]
defines = [ "SK_GAMMA_APPLY_TO_A8" ]
if (skia_use_fixed_gamma_text) {
defines += [
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
]
}
if (is_skia_dev_build) {
defines += [
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"GR_TEST_UTILS=1",
]
}
libs = []
lib_dirs = []
if (skia_use_angle) {
defines += [ "SK_ANGLE" ]
}
}
# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
config("skia_library") {
visibility = [ ":*" ]
defines = [ "SKIA_IMPLEMENTATION=1" ]
}
skia_library_configs = [
":skia_public",
":skia_private",
":skia_library",
]
# Use for CPU-specific Skia code that needs particular compiler flags.
template("opts") {
visibility = [ ":*" ]
if (invoker.enabled) {
source_set(target_name) {
check_includes = false
forward_variables_from(invoker, "*")
configs += skia_library_configs
}
} else {
# If not enabled, a phony empty target that swallows all otherwise unused variables.
source_set(target_name) {
check_includes = false
forward_variables_from(invoker,
"*",
[
"sources",
"cflags",
])
}
}
}
is_x86 = current_cpu == "x64" || current_cpu == "x86"
opts("none") {
enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
sources = skia_opts.none_sources
cflags = []
}
opts("armv7") {
enabled = current_cpu == "arm"
sources = skia_opts.armv7_sources + skia_opts.neon_sources
cflags = []
}
opts("arm64") {
enabled = current_cpu == "arm64"
sources = skia_opts.arm64_sources
cflags = []
}
opts("crc32") {
enabled = current_cpu == "arm64"
sources = skia_opts.crc32_sources
cflags = [ "-march=armv8-a+crc" ]
}
opts("sse2") {
enabled = is_x86
sources = skia_opts.sse2_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
} else {
cflags = [ "-msse2" ]
}
}
opts("ssse3") {
enabled = is_x86
sources = skia_opts.ssse3_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
} else {
cflags = [ "-mssse3" ]
}
}
opts("sse41") {
enabled = is_x86
sources = skia_opts.sse41_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
} else {
cflags = [ "-msse4.1" ]
}
}
opts("sse42") {
enabled = is_x86
sources = skia_opts.sse42_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
} else {
cflags = [ "-msse4.2" ]
}
}
opts("avx") {
enabled = is_x86
sources = skia_opts.avx_sources
if (is_win) {
cflags = [ "/arch:AVX" ]
} else {
cflags = [ "-mavx" ]
if (is_mac && is_debug) {
cflags += [ "-O1" ] # Work around skia:9709
}
}
}
opts("hsw") {
enabled = is_x86
sources = skia_opts.hsw_sources
if (is_win) {
cflags = [ "/arch:AVX2" ]
} else {
cflags = [ "-march=haswell" ]
if (is_mac && is_debug) {
cflags += [ "-O1" ] # Work around skia:9709
}
}
}
# Any feature of Skia that requires third-party code should be optional and use this template.
template("optional") {
visibility = [ ":*" ]
if (invoker.enabled) {
config(target_name + "_public") {
if (defined(invoker.public_defines)) {
defines = invoker.public_defines
}
if (defined(invoker.public_configs)) {
configs = invoker.public_configs
}
if (defined(invoker.public_include_dirs)) {
include_dirs = invoker.public_include_dirs
}
}
source_set(target_name) {
check_includes = false
forward_variables_from(invoker,
"*",
[
"public_defines",
"sources_when_disabled",
"configs_to_remove",
])
all_dependent_configs = [ ":" + target_name + "_public" ]
configs += skia_library_configs
if (defined(invoker.configs_to_remove)) {
configs -= invoker.configs_to_remove
}
}
} else {
source_set(target_name) {
forward_variables_from(invoker,
"*",
[
"public_defines",
"public_deps",
"deps",
"libs",
"sources",
"sources_when_disabled",
"configs_to_remove",
])
if (defined(invoker.sources_when_disabled)) {
sources = invoker.sources_when_disabled
}
configs += skia_library_configs
}
}
}
optional("fontmgr_android") {
enabled = skia_enable_fontmgr_android
deps = [
":typeface_freetype",
"//third_party/expat",
]
sources = [
"src/ports/SkFontMgr_android.cpp",
"src/ports/SkFontMgr_android_factory.cpp",
"src/ports/SkFontMgr_android_parser.cpp",
]
}
optional("fontmgr_custom") {
enabled = skia_enable_fontmgr_custom
deps = [
":typeface_freetype",
]
sources = [
"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom.h",
"src/ports/SkFontMgr_custom_directory.cpp",
"src/ports/SkFontMgr_custom_directory_factory.cpp",
"src/ports/SkFontMgr_custom_embedded.cpp",
"src/ports/SkFontMgr_custom_empty.cpp",
]
}
optional("fontmgr_custom_empty") {
enabled = skia_enable_fontmgr_custom_empty
deps = [
":typeface_freetype",
]
sources = [
"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom_empty.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
]
}
optional("fontmgr_empty") {
enabled = skia_enable_fontmgr_empty
sources = [
"src/ports/SkFontMgr_empty_factory.cpp",
]
}
optional("fontmgr_fontconfig") {
enabled = skia_use_freetype && skia_use_fontconfig
deps = [
":typeface_freetype",
"//third_party:fontconfig",
]
sources = [
"src/ports/SkFontConfigInterface.cpp",
"src/ports/SkFontConfigInterface_direct.cpp",
"src/ports/SkFontConfigInterface_direct_factory.cpp",
"src/ports/SkFontMgr_FontConfigInterface.cpp",
"src/ports/SkFontMgr_fontconfig.cpp",
"src/ports/SkFontMgr_fontconfig_factory.cpp",
]
}
optional("fontmgr_fuchsia") {
enabled = skia_enable_fontmgr_fuchsia
deps = []
if (is_fuchsia && using_fuchsia_sdk) {
deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
} else {
deps = [
"//sdk/fidl/fuchsia.fonts",
]
}
sources = [
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkFontMgr_fuchsia.h",
]
}
optional("fontmgr_wasm") {
enabled = target_cpu == "wasm"
deps = []
# custom_embedded has the source for both embedding a font in the binary
# (only used for the all-included build) and reading in a font from
# raw bytes passed over the wire (a typical way to load fonts).
if (!skia_enable_fontmgr_empty) {
deps += [ ":typeface_freetype" ]
sources = [
"src/ports/SkFontMgr_custom_embedded.cpp",
]
# If we haven't opted for no fonts (empty) or fonts, but not the
# built-in one (custom), then, we need to provide the mechanism for
# using the built-in font.
if (!skia_enable_fontmgr_custom) {
sources += [
"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom.h",
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
]
}
}
}
optional("fontmgr_win") {
enabled = skia_enable_fontmgr_win
sources = [
"src/fonts/SkFontMgr_indirect.cpp",
"src/ports/SkFontMgr_win_dw.cpp",
"src/ports/SkFontMgr_win_dw_factory.cpp",
"src/ports/SkScalerContext_win_dw.cpp",
"src/ports/SkTypeface_win_dw.cpp",
]
}
optional("fontmgr_win_gdi") {
enabled = skia_enable_fontmgr_win_gdi
sources = [
"src/ports/SkFontHost_win.cpp",
]
libs = [ "Gdi32.lib" ]
}
if (skia_lex) {
executable("sksllex") {
sources = [
"src/sksl/lex/Main.cpp",
"src/sksl/lex/NFA.cpp",
"src/sksl/lex/RegexNode.cpp",
"src/sksl/lex/RegexParser.cpp",
]
include_dirs = [ "." ]
}
action("run_sksllex") {
script = "gn/run_sksllex.py"
deps = [
":sksllex(//gn/toolchain:$host_toolchain)",
]
sources = [
"src/sksl/lex/sksl.lex",
]
# GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
# path that starts with target_out_dir and then uses ".." to back up into the src dir.
outputs = [
"$target_out_dir/" +
rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
# the script also modifies the corresponding .cpp file, but if we tell GN that it gets
# confused due to the same file being named by two different paths
]
sksllex_path = "$root_out_dir/"
sksllex_path += "sksllex"
if (host_os == "win") {
sksllex_path += ".exe"
}
args = [
rebase_path(sksllex_path),
rebase_path("bin/clang-format"),
rebase_path("src"),
]
}
} else {
group("run_sksllex") {
}
}
if (skia_compile_processors) {
executable("skslc") {
defines = [ "SKSL_STANDALONE" ]
sources = [
"src/sksl/SkSLMain.cpp",
]
sources += skia_sksl_sources
sources += skia_sksl_gpu_sources
include_dirs = [ "." ]
deps = [
":run_sksllex",
"//third_party/spirv-tools:spvtools",
]
}
skia_gpu_processor_outputs = []
foreach(src, skia_gpu_processor_sources) {
dir = get_path_info(src, "dir")
name = get_path_info(src, "name")
# GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
# path that starts with target_out_dir and then uses ".." to back up into the src dir.
skia_gpu_processor_outputs += [
"$target_out_dir/" +
rebase_path("$dir/generated/$name.h", target_out_dir),
# the script also modifies the corresponding .cpp file, but if we tell GN that it gets
# confused due to the same file being named by two different paths
]
}
action("create_sksl_enums") {
script = "gn/create_sksl_enums.py"
sources = [
"include/private/GrSharedEnums.h",
]
outputs = [
"$target_out_dir/" +
rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
]
args = [
rebase_path(sources[0]),
rebase_path(outputs[0]),
]
}
action("compile_processors") {
script = "gn/compile_processors.py"
deps = [
":create_sksl_enums",
":skslc(//gn/toolchain:$host_toolchain)",
]
sources = skia_gpu_processor_sources
outputs = skia_gpu_processor_outputs
skslc_path = "$root_out_dir/"
if (host_toolchain != default_toolchain_name) {
skslc_path += "$host_toolchain/"
}
skslc_path += "skslc"
if (host_os == "win") {
skslc_path += ".exe"
}
args = [
rebase_path(skslc_path),
rebase_path("bin/clang-format"),
]
args += rebase_path(skia_gpu_processor_sources)
}
} else {
skia_gpu_processor_outputs = []
group("compile_processors") {
}
}
optional("gpu") {
enabled = skia_enable_gpu
deps = [
":compile_processors",
":run_sksllex",
]
if (skia_generate_workarounds) {
deps += [ ":workaround_list" ]
}
public_defines = []
public_configs = []
public_deps = []
sources =
skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
if (!skia_enable_ccpr) {
sources -= skia_ccpr_sources
sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
}
if (!skia_enable_nvpr) {
sources -= skia_nvpr_sources
sources += [ "src/gpu/GrPathRendering_none.cpp" ]
}
libs = []
if (is_android) {
sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
# this lib is required to link against AHardwareBuffer
if (defined(ndk_api) && ndk_api >= 26) {
libs += [ "android" ]
}
} else if (skia_use_egl) {
sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
libs += [ "EGL" ]
} else if (is_linux && skia_use_x11) {
sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
libs += [ "GL" ]
} else if (is_mac) {
sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
} else if (is_ios) {
sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
} else if (is_win) {
sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
if (target_cpu != "arm64") {
libs += [ "OpenGL32.lib" ]
}
} else {
sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
}
if (skia_use_gl) {
public_defines += [ "SK_GL" ]
sources += skia_gl_gpu_sources
}
if (skia_use_vulkan) {
public_defines += [ "SK_VULKAN" ]
deps += [ "third_party/vulkanmemoryallocator" ]
sources += skia_vk_sources
if (skia_enable_vulkan_debug_layers) {
public_defines += [ "SK_ENABLE_VK_LAYERS" ]
}
if (is_fuchsia) {
if (using_fuchsia_sdk) {
public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
} else {
public_deps += [ "//src/graphics/lib/vulkan" ]
}
}
}
if (skia_use_dawn) {
public_defines += [ "SK_DAWN" ]
sources += skia_dawn_sources
public_deps += [ "//third_party/dawn:dawn_headers" ]
deps += [
"//third_party/dawn:dawncpp",
"//third_party/dawn:libdawn_native",
"//third_party/dawn:libdawn_proc",
]
if (dawn_enable_d3d12) {
libs += [
"d3d12.lib",
"dxgi.lib",
"d3dcompiler.lib",
]
} else if (dawn_enable_metal) {
libs += [ "Metal.framework" ]
}
}
cflags_objcc = []
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
sources += skia_metal_sources
libs += [ "Metal.framework" ]
libs += [ "MetalKit.framework" ]
libs += [ "Foundation.framework" ]
cflags_objcc += [ "-fobjc-arc" ]
}
if (skia_enable_atlas_text) {
sources += skia_atlas_text_sources
}
if (is_debug) {
public_defines += [ "SK_ENABLE_DUMP_GPU" ]
}
}
optional("gif") {
enabled = !skia_use_wuffs && skia_use_libgifcodec
_libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
if ("True" ==
exec_script("gn/checkpath.py",
[ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
"trim string")) {
public_defines = [ "SK_USE_LIBGIFCODEC" ]
public_include_dirs = [
".",
skia_libgifcodec_path,
]
include_dirs = public_include_dirs
import(_libgifcodec_gni_path)
sources = rebase_path(libgifcodec_sources + libgifcodec_public,
".",
skia_libgifcodec_path)
}
}
optional("heif") {
enabled = skia_use_libheif
public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
deps = []
sources = [
"src/codec/SkHeifCodec.cpp",
]
}
optional("jpeg") {
enabled = skia_use_libjpeg_turbo
public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
deps = [
"//third_party/libjpeg-turbo:libjpeg",
]
public = [
"include/encode/SkJpegEncoder.h",
]
sources = [
"src/codec/SkJpegCodec.cpp",
"src/codec/SkJpegDecoderMgr.cpp",
"src/codec/SkJpegUtility.cpp",
"src/images/SkJPEGWriteUtility.cpp",
"src/images/SkJpegEncoder.cpp",
]
}
optional("pdf") {
enabled = skia_use_zlib && skia_enable_pdf
public_defines = [ "SK_SUPPORT_PDF" ]
deps = [
"//third_party/zlib",
]
if (skia_use_libjpeg_turbo) {
deps += [ ":jpeg" ]
}
sources = skia_pdf_sources
sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
deps += [ "//third_party/harfbuzz" ]
defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
} else if (skia_use_icu && skia_use_sfntly) {
deps += [ "//third_party/sfntly" ]
defines = [ "SK_PDF_USE_SFNTLY" ]
}
}
optional("png") {
enabled = skia_use_libpng
public_defines = [ "SK_HAS_PNG_LIBRARY" ]
deps = [
"//third_party/libpng",
]
sources = [
"src/codec/SkIcoCodec.cpp",
"src/codec/SkPngCodec.cpp",
"src/images/SkPngEncoder.cpp",
]
}
optional("raw") {
enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
public_defines = [ "SK_CODEC_DECODES_RAW" ]
deps = [
"//third_party/dng_sdk",
"//third_party/libjpeg-turbo:libjpeg",
"//third_party/piex",
]
# SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
# Skia.
configs_to_remove = [ "//gn:no_exceptions" ]
sources = [
"src/codec/SkRawCodec.cpp",
]
}
import("third_party/skcms/skcms.gni")
source_set("skcms") {
cflags = []
if (!is_win || is_clang) {
cflags += [
"-w",
"-std=c11",
]
}
public = [
"include/third_party/skcms/skcms.h",
]
include_dirs = [ "include/third_party/skcms" ]
sources = rebase_path(skcms_sources, ".", "third_party/skcms")
}
optional("typeface_freetype") {
enabled = skia_use_freetype
deps = [
"//third_party/freetype2",
]
sources = [
"src/ports/SkFontHost_FreeType.cpp",
"src/ports/SkFontHost_FreeType_common.cpp",
]
}
optional("webp") {
enabled = skia_use_libwebp
public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
deps = [
"//third_party/libwebp",
]
sources = [
"src/codec/SkWebpCodec.cpp",
"src/images/SkWebpEncoder.cpp",
]
}
optional("wuffs") {
enabled = skia_use_wuffs
public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
deps = [
"//third_party/wuffs",
]
sources = [
"src/codec/SkWuffsCodec.cpp",
]
}
optional("xml") {
enabled = skia_use_expat
public_defines = [ "SK_XML" ]
deps = [
"//third_party/expat",
]
sources = [
"src/svg/SkSVGCanvas.cpp",
"src/svg/SkSVGDevice.cpp",
"src/xml/SkDOM.cpp",
"src/xml/SkXMLParser.cpp",
"src/xml/SkXMLWriter.cpp",
]
}
optional("sksl_interpreter") {
enabled = skia_enable_sksl_interpreter
public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
}
optional("skvm_jit") {
enabled = skia_enable_skvm_jit
public_defines = [ "SKVM_JIT" ]
}
if (skia_enable_gpu && skia_generate_workarounds) {
action("workaround_list") {
script = "tools/build_workaround_header.py"
inputs = [
"src/gpu/gpu_workaround_list.txt",
]
# see comments in skia_compile_processors about out dir path shenanigans.
output_file =
rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
outputs = [
"$root_out_dir/$output_file",
]
args = [
"--output-file",
"$output_file",
]
foreach(file, inputs) {
args += [ rebase_path(file, root_build_dir) ]
}
}
}
component("skia") {
public_configs = [ ":skia_public" ]
configs += skia_library_configs
public_deps = [
":gpu",
":pdf",
":skcms",
]
deps = [
":arm64",
":armv7",
":avx",
":compile_processors",
":crc32",
":fontmgr_android",
":fontmgr_custom",
":fontmgr_custom_empty",
":fontmgr_empty",
":fontmgr_fontconfig",
":fontmgr_fuchsia",
":fontmgr_wasm",
":fontmgr_win",
":fontmgr_win_gdi",
":gif",
":heif",
":hsw",
":jpeg",
":none",
":png",
":raw",
":sksl_interpreter",
":skvm_jit",
":sse2",
":sse41",
":sse42",
":ssse3",
":webp",
":wuffs",
":xml",
]
# This file (and all GN files in Skia) are designed to work with an
# empty sources assignment filter; we handle all that explicitly.
# We clear the filter here for clients who may have set up a global filter.
set_sources_assignment_filter([])
public = skia_core_public
public += skia_utils_public
public += skia_effects_public
public += skia_effects_imagefilter_public
public += skia_xps_public
sources = []
sources += skia_core_sources
sources += skia_utils_sources
if (skia_use_xps) {
sources += skia_xps_sources
}
sources += skia_effects_sources
sources += skia_effects_imagefilter_sources
sources += skia_sksl_sources
sources += [
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
"src/android/SkBitmapRegionCodec.cpp",
"src/android/SkBitmapRegionDecoder.cpp",
"src/codec/SkAndroidCodec.cpp",
"src/codec/SkAndroidCodecAdapter.cpp",
"src/codec/SkBmpBaseCodec.cpp",
"src/codec/SkBmpCodec.cpp",
"src/codec/SkBmpMaskCodec.cpp",
"src/codec/SkBmpRLECodec.cpp",
"src/codec/SkBmpStandardCodec.cpp",
"src/codec/SkCodec.cpp",
"src/codec/SkCodecImageGenerator.cpp",
"src/codec/SkColorTable.cpp",
"src/codec/SkEncodedInfo.cpp",
"src/codec/SkMaskSwizzler.cpp",
"src/codec/SkMasks.cpp",
"src/codec/SkParseEncodedOrigin.cpp",
"src/codec/SkSampledCodec.cpp",
"src/codec/SkSampler.cpp",
"src/codec/SkStreamBuffer.cpp",
"src/codec/SkSwizzler.cpp",
"src/codec/SkWbmpCodec.cpp",
"src/images/SkImageEncoder.cpp",
"src/ports/SkDiscardableMemory_none.cpp",
"src/ports/SkGlobalInitialization_default.cpp",
"src/ports/SkImageGenerator_skia.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/ports/SkOSFile_stdio.cpp",
"src/sfnt/SkOTTable_name.cpp",
"src/sfnt/SkOTUtils.cpp",
]
defines = []
libs = []
if (is_win) {
sources += [
"src/ports/SkDebug_win.cpp",
"src/ports/SkImageEncoder_WIC.cpp",
"src/ports/SkImageGeneratorWIC.cpp",
"src/ports/SkOSFile_win.cpp",
"src/ports/SkOSLibrary_win.cpp",
"src/ports/SkTLS_win.cpp",
]
libs += [
"FontSub.lib",
"Ole32.lib",
"OleAut32.lib",
"User32.lib",
"Usp10.lib",
]
} else {
sources += [
"src/ports/SkOSFile_posix.cpp",
"src/ports/SkOSLibrary_posix.cpp",
"src/ports/SkTLS_pthread.cpp",
]
libs += [ "dl" ]
}
if (is_android) {
deps += [ "//third_party/expat" ]
if (defined(ndk) && ndk != "") {
deps += [ "//third_party/cpu-features" ]
}
sources += [ "src/ports/SkDebug_android.cpp" ]
libs += [
"EGL",
"GLESv2",
"log",
]
}
if (is_linux || target_cpu == "wasm") {
sources += [ "src/ports/SkDebug_stdio.cpp" ]
if (skia_use_egl) {
libs += [ "GLESv2" ]
}
}
if (skia_use_fonthost_mac) {
sources += [ "src/ports/SkFontHost_mac.cpp" ]
}
if (is_mac) {
sources += [
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkImageEncoder_CG.cpp",
"src/ports/SkImageGeneratorCG.cpp",
]
libs += [
# AppKit symbols NSFontWeightXXX may be dlsym'ed.
"AppKit.framework",
"ApplicationServices.framework",
"OpenGL.framework",
]
}
if (is_ios) {
sources += [
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkFontHost_mac.cpp",
"src/ports/SkImageEncoder_CG.cpp",
"src/ports/SkImageGeneratorCG.cpp",
]
libs += [
"CoreFoundation.framework",