-
Notifications
You must be signed in to change notification settings - Fork 32
/
BUILD.gn
2476 lines (2275 loc) · 60.9 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/vulkan/config.gni")
}
declare_args() {
skia_enable_flutter_defines = false
}
declare_args() {
skia_use_angle = false
skia_use_egl = false
skia_use_expat = true
skia_use_fontconfig = is_linux
skia_use_fonthost_mac = is_mac
skia_use_freetype = is_android || is_fuchsia || is_linux
skia_use_fixed_gamma_text = is_android
skia_use_libjpeg_turbo = true
skia_use_libpng = true
skia_use_libwebp = !is_fuchsia
skia_use_lua = is_skia_dev_build && !is_ios
skia_use_opencl = false
skia_use_piex = !is_win
skia_use_wuffs = false
skia_use_zlib = true
skia_use_metal = false
skia_use_libheif = is_skia_dev_build
skia_use_x11 = is_linux
skia_use_xps = true
skia_android_serial = ""
skia_enable_ccpr = true
skia_enable_nvpr = !skia_enable_flutter_defines
skia_enable_discrete_gpu = true
skia_enable_nima = false
skia_enable_pdf = true
skia_enable_spirv_validation = is_skia_dev_build && is_debug
skia_enable_skpicture = true
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
skia_qt_path = getenv("QT_PATH")
skia_compile_processors = false
skia_generate_workarounds = false
skia_lex = false
skia_skqp_global_error_tolerance = 0
skia_llvm_path = ""
skia_llvm_lib = "LLVM"
skia_tools_require_resources = false
}
declare_args() {
skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
skia_use_sfntly = skia_use_icu
skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
skia_enable_fontmgr_empty = false
skia_enable_fontmgr_custom =
is_linux && skia_use_freetype && !skia_use_fontconfig
skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
skia_enable_fontmgr_fuchsia = is_fuchsia
skia_enable_fontmgr_win = is_win
skia_enable_fontmgr_win_gdi = is_win
if (is_android) {
skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
} else if (is_fuchsia) {
skia_use_vulkan = fuchsia_use_vulkan
} else {
skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
}
if (is_ios) {
skia_ios_identity = ".*Google.*"
skia_ios_profile = "Google Development"
}
}
if (defined(skia_settings)) {
import(skia_settings)
}
skia_public_includes = [
"include/android",
"include/c",
"include/codec",
"include/config",
"include/core",
"include/docs",
"include/effects",
"include/encode",
"include/gpu",
"include/atlastext",
"include/pathops",
"include/ports",
"include/svg",
"include/utils",
"include/utils/mac",
]
if (skia_enable_atlas_text) {
skia_public_includes += [ "include/atlastext" ]
}
# Skia public API, generally provided by :skia.
config("skia_public") {
include_dirs = skia_public_includes
defines = []
if (is_component_build) {
defines += [ "SKIA_DLL" ]
}
if (is_fuchsia || is_linux) {
defines += [ "SK_SAMPLES_FOR_X" ]
}
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
}
}
# Skia internal APIs, used by Skia itself and a few test tools.
config("skia_private") {
visibility = [ ":*" ]
include_dirs = [
"include/private",
"src/c",
"src/codec",
"src/core",
"src/effects",
"src/fonts",
"src/image",
"src/images",
"src/lazy",
"src/opts",
"src/pathops",
"src/pdf",
"src/ports",
"src/sfnt",
"src/shaders",
"src/shaders/gradients",
"src/sksl",
"src/utils",
"src/utils/win",
"src/xml",
"third_party/etc1",
"third_party/gif",
]
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_official_build || is_android) {
# TODO(bsalomon): it'd be nice to make Android normal.
defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
}
libs = []
lib_dirs = []
if (skia_enable_gpu) {
include_dirs += [ "src/gpu" ]
if (is_skia_dev_build && skia_use_vulkan) {
include_dirs += [ "tools/gpu/vk" ]
}
}
if (skia_use_angle) {
defines += [ "SK_ANGLE" ]
}
if (skia_enable_discrete_gpu) {
defines += [ "SK_ENABLE_DISCRETE_GPU" ]
}
if (!is_official_build) {
defines += [ "GR_TEST_UTILS=1" ]
}
if (skia_llvm_path != "") {
defines += [ "SK_LLVM_AVAILABLE" ]
include_dirs += [ "$skia_llvm_path/include" ]
libs += [ skia_llvm_lib ]
lib_dirs += [ "$skia_llvm_path/lib/" ]
}
}
# 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) {
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) {
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" ]
}
}
opts("hsw") {
enabled = is_x86
sources = skia_opts.hsw_sources
if (is_win) {
cflags = [ "/arch:AVX2" ]
} else {
cflags = [ "-march=haswell" ]
}
# Oddly, clang-cl doesn't recognize this as a valid flag.
# If it ever does, it'd nice to move this up with -mavx2 and co.
if (is_clang && !is_win) {
# This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
# but nice to have, generating slightly better code for paths without explicit FMAs.
cflags += [ "-ffp-contract=fast" ]
}
}
# 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
}
}
source_set(target_name) {
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 = [
"//sdk/fidl/fuchsia.fonts",
]
sources = [
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkFontMgr_fuchsia.h",
]
}
optional("fontmgr_wasm") {
enabled = target_cpu == "wasm"
deps = [
":typeface_freetype",
]
sources = [
"src/ports/SkFontMgr_custom.cpp",
"src/ports/SkFontMgr_custom.h",
"src/ports/SkFontMgr_custom_embedded.cpp",
"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 = [ "src/sksl/lex" ]
}
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
include_dirs = [
"src/gpu",
"src/sksl",
]
deps = [
":run_sksllex",
"//third_party/spirv-tools",
]
}
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/$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_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" ]
}
# These paths need to be absolute to match the ones produced by shared_sources.gni.
sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
"abspath")
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_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) {
public_deps +=
[ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
}
}
if (skia_enable_spirv_validation) {
deps += [ "//third_party/spirv-tools" ]
public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
}
cflags_objcc = []
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
sources += skia_metal_sources
libs += [ "Metal.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
sources = [
"src/codec/SkGifCodec.cpp",
"third_party/gif/SkGifImageReader.cpp",
]
}
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 = [
"third_party/skcms/skcms.h",
]
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",
]
}
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",
":sse2",
":sse41",
":sse42",
":ssse3",
":webp",
":wuffs",
":xml",
]
if (skia_enable_nima) {
deps += [ "//third_party/Nima-Cpp" ]
}
# 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([])
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 += [
"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/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",
"src/utils/mac/SkStream_mac.cpp",
"third_party/etc1/etc1.cpp",
]
defines = []
if (!skia_enable_skpicture) {
defines = [ "SK_DISABLE_SKPICTURE" ]
sources -= skia_skpicture_sources
sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
sources += [ "src/core/SkPicture_none.cpp" ]
}
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",