forked from google/angle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
BUILD.gn
1677 lines (1425 loc) · 42.4 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 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# import the ozone_platform_x11 variable
import("gni/angle.gni")
if (angle_enable_vulkan) {
import("//build_overrides//vulkan_headers.gni")
}
if (angle_use_wayland) {
import("//build_overrides/wayland.gni")
}
if (angle_has_build) {
import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
if (is_android) {
# android/rules.gni can only be imported for Android targets
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("android/angle_apk.gni")
}
} else {
using_sanitizer = false
}
declare_args() {
# Use the PCI lib to collect GPU information on Linux.
use_libpci = (is_linux || is_chromeos) && (angle_use_x11 || use_ozone) &&
angle_has_build
# Enable using Vulkan to collect system info as a fallback.
angle_enable_vulkan_system_info = false
# Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
angle_link_glx = false
# Don't build extra (test, samples etc) for Windows UWP. We don't have
# infrastructure (e.g. windowing helper functions) in place to run them.
angle_build_all = !build_with_chromium && !angle_is_winuwp &&
angle_has_build && angle_build_tests
# Enable generating current commit information using git
angle_enable_commit_id = true
# Abseil has trouble supporting MSVC, particularly regarding component builds.
# http://crbug.com/1126524
angle_enable_abseil = angle_has_build && is_clang
# Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled.
angle_enable_annotator_run_time_checks = false
# Enables non-conformant extensions and features
angle_expose_non_conformant_extensions_and_versions = false
# Optional feature that forces dirty state whenever we use a new context regardless of thread.
angle_force_context_check_every_call = false
# Allow shared library custom name extensions for setting soname such as libEGL.so.1
angle_egl_extension = ""
angle_glesv2_extension = ""
# Enable share context lock. If it is false, the client need to use gl calls in a threadsafe way.
# Chromium only uses share contexts on the GPU thread.
# angle_deqp_tests contains threading related tests.
angle_enable_share_context_lock =
!build_with_chromium || build_angle_deqp_tests
if (is_android) {
# Use Android TLS slot to store current context.
angle_use_android_tls_slot = !build_with_chromium
}
}
if (angle_build_all) {
group("all") {
testonly = true
deps = [
":angle",
":angle_shader_translator",
":translator_fuzzer",
":xxhash_fuzzer",
"$angle_root/samples:angle_samples",
"$angle_root/src/tests:angle_tests",
]
if (angle_enable_cl) {
deps += [ "$angle_root/src/libOpenCL:angle_cl" ]
}
if (angle_build_mesa) {
deps += [ "$angle_root/third_party/mesa" ]
}
}
}
import("src/compiler.gni")
import("src/libGLESv2.gni")
# This config is exported to dependent targets (and also applied to internal
# ones).
config("external_config") {
include_dirs = [ "include" ]
}
# Prevent the GL headers from redeclaring ANGLE entry points.
config("no_gl_prototypes") {
defines = [
"GL_GLES_PROTOTYPES=0",
"EGL_EGL_PROTOTYPES=0",
]
}
config("gl_prototypes") {
defines = [
"GL_GLES_PROTOTYPES=1",
"EGL_EGL_PROTOTYPES=1",
"GL_GLEXT_PROTOTYPES",
"EGL_EGLEXT_PROTOTYPES",
]
}
# This config is applied to internal Angle targets (not pushed to dependents).
config("internal_config") {
include_dirs = [
"include",
"src",
]
# Handle breaking changes in VulkanMemoryAllocator.
angle_vma_version_define = "ANGLE_VMA_VERSION="
if (defined(angle_vma_version)) {
angle_vma_version_define += angle_vma_version
} else {
# Default to 2.3.0. This can be bumped and include guards removed when all
# clients have migrated to 3.x.
angle_vma_version_define += 2003000
}
defines = [ angle_vma_version_define ]
if (is_win) {
defines += [ "ANGLE_IS_WIN" ]
if (angle_is_winuwp) {
defines += [ "ANGLE_IS_WINUWP" ]
}
} else if (is_linux || is_chromeos) {
defines += [ "ANGLE_IS_LINUX" ]
}
if (angle_enable_share_context_lock) {
defines += [ "ANGLE_ENABLE_SHARE_CONTEXT_LOCK=1" ]
}
if (is_android) {
if (angle_use_android_tls_slot) {
defines += [ "ANGLE_USE_ANDROID_TLS_SLOT=1" ]
}
}
# Enables debug/trace-related functionality, including logging every GLES/EGL API command to the
# "angle_debug.txt" file on desktop. Enables debug markers for AGI, but must also set
# angle_enable_annotator_run_time_checks to improve performance.
if (angle_enable_trace) {
defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
}
# When used with angle_enable_trace, enables logging every GLES/EGL API command to Android logcat
# Enables debug markers for AGI regardless of run-time checks.
if (angle_enable_trace_android_logcat) {
defines += [ "ANGLE_ENABLE_TRACE_ANDROID_LOGCAT=1" ]
}
# When used with angle_enable_trace, enables logging every GLES/EGL API command to the terminal
if (angle_enable_trace_events) {
defines += [ "ANGLE_ENABLE_TRACE_EVENTS=1" ]
}
if (is_chromeos) {
defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
}
if (is_ggp) {
defines += [ "__ggp__" ]
}
if (angle_use_vulkan_null_display) {
defines += [ "ANGLE_USE_VULKAN_NULL_DISPLAY" ]
} else if (angle_use_vulkan_display) {
defines += [ "ANGLE_USE_VULKAN_DISPLAY" ]
if (!angle_use_x11) {
defines += [ "EGL_NO_X11" ]
}
# These two are needed here to correctly select OSWindow::New
if (angle_use_x11) {
defines += [ "ANGLE_USE_X11" ]
}
if (angle_use_wayland) {
defines += [ "ANGLE_USE_WAYLAND" ]
}
if (angle_vulkan_display_mode == "simple") {
defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ]
} else if (angle_vulkan_display_mode == "headless") {
defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ]
}
}
if (is_lsan) {
defines += [ "ANGLE_WITH_LSAN" ]
}
if (angle_has_astc_encoder) {
defines += [ "ANGLE_HAS_ASTCENC" ]
}
if (angle_test_enable_system_egl) {
defines += [ "ANGLE_TEST_ENABLE_SYSTEM_EGL" ]
}
if (angle_debug_layers_enabled) {
defines += [ "ANGLE_DEBUG_LAYERS_ENABLED" ]
}
if (angle_build_mesa) {
defines += [ "ANGLE_HAS_MESA" ]
}
}
config("constructor_and_destructor_warnings") {
if (is_clang) {
cflags = [
"-Wexit-time-destructors",
"-Wglobal-constructors",
]
}
}
config("extra_warnings") {
cflags = []
is_gcc = !is_clang && !is_win
# Avoid failing builds for warnings enabled by Skia build.
if (defined(is_skia_standalone)) {
cflags += [ "-w" ]
}
# Enable more default warnings on Windows.
if (is_win) {
cflags += [
"/we4244", # Conversion: possible loss of data.
"/we4312", # Conversion: greater size.
"/we4456", # Variable shadowing.
"/we4458", # declaration hides class member.
"/we4715", # not all control paths return a value
"/we4800", # forcing value to bool.
"/we4838", # narrowing conversion.
]
}
if (is_clang) {
cflags += [
"-Wbad-function-cast",
"-Wconditional-uninitialized",
"-Wextra-semi-stmt",
"-Wfloat-conversion",
"-Winconsistent-missing-destructor-override",
"-Wmissing-field-initializers",
"-Wnewline-eof",
"-Wnon-virtual-dtor",
"-Wredundant-parens",
"-Wreturn-std-move",
"-Wshadow",
"-Wshadow-field",
"-Wtautological-type-limit-compare",
"-Wundefined-reinterpret-cast",
"-Wunneeded-internal-declaration",
"-Wunused-but-set-variable",
"-Wsuggest-destructor-override",
"-Wsuggest-override",
# The below warnings are used by WebKit. We enable them to make rolling
# ANGLE in WebKit easier.
"-Wparentheses",
"-Wrange-loop-analysis",
"-Wstrict-prototypes",
"-Wunreachable-code-aggressive",
"-Wshorten-64-to-32",
]
}
if (is_gcc) {
cflags_cc = [ "-Wdeprecated-copy" ]
}
if (angle_is_winuwp) {
cflags += [
"/wd4091", # keyword ignored on left of type when no variable is declared
"/wd4447", # 'main' signature found without threading model.
]
}
}
# This config adds build-ids to the associated library.
# -Wl is a special option that indicates that clang should pass the associated
# option --build-id to the linker. This will cause a build-id section to be added
# to the associated library. The build-id makes it possible for a debugger to
# find the right symbol file to use.
config("build_id_config") {
ldflags = [ "-Wl,--build-id" ]
}
_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
# Windows ARM64 is available since 10.0.16299 so no need to copy
# d3dcompiler_47.dll because this file is available as inbox.
if (_use_copy_compiler_dll) {
# We also ship an older DLL for compatiblity with Windows 7 machines without
# the UCRT. This DLL isn't available in the standard SDK distribution.
_old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
_has_old_compiler =
exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
copy("copy_compiler_dll") {
sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
if (_has_old_compiler) {
sources += [ _old_compiler ]
}
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
}
# Holds the shared includes so we only need to list them once.
config("includes_config") {
include_dirs = [ "include" ]
}
config("angle_uwp_env") {
if (angle_is_winuwp) {
defines = [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
}
}
angle_source_set("cl_includes") {
sources = cl_includes
public_configs = [ ":external_config" ]
}
angle_source_set("includes") {
sources = libangle_includes
public_configs = [ ":includes_config" ]
if (angle_enable_cl) {
public_deps = [ ":cl_includes" ]
}
}
config("disable_unreachable_code_break_warning") {
if (is_clang) {
cflags = [ "-Wno-unreachable-code-break" ]
}
}
angle_static_library("preprocessor") {
sources = angle_preprocessor_sources
# preprocessor_tab_autogen.cpp contains an instance of this.
configs += [ ":disable_unreachable_code_break_warning" ]
public_deps = [
":angle_common",
":angle_translator_headers",
]
}
config("angle_disable_pool_alloc") {
defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
}
config("debug_annotations_config") {
defines = []
if (is_debug) {
defines += [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
}
if (angle_enable_annotator_run_time_checks) {
# When used with angle_enable_trace, enables debug markers for AGI with run-time checks to
# filter out EVENT() messages when the debug annotator is disabled.
defines += [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
}
}
config("angle_asserts_config") {
if (angle_assert_always_on) {
defines = [ "ANGLE_ASSERT_ALWAYS_ON" ]
}
}
config("angle_common_config") {
include_dirs = [ "src/common/third_party/base" ]
if (is_android) {
libs = [ "log" ]
}
defines = []
if (angle_delegate_workers) {
defines += [ "ANGLE_DELEGATE_WORKERS" ]
}
}
# Silences the "indirect call of a function with wrong dynamic type" cfi error
config("angle_no_cfi_icall") {
if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
cflags = [ "-fno-sanitize=cfi-icall" ]
}
}
# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
config("angle_no_cfi_unrelated_cast") {
if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
}
}
angle_source_set("xxhash") {
sources = xxhash_sources
if (is_clang) {
cflags_c = [ "-Wno-implicit-fallthrough" ]
}
}
if (angle_has_build) {
fuzzer_test("xxhash_fuzzer") {
sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
deps = [ ":xxhash" ]
}
}
angle_static_library("angle_common") {
sources = libangle_common_sources
if (angle_enable_cl) {
sources += libangle_common_cl_sources
}
configs += [
":angle_common_config",
":debug_annotations_config",
]
deps = [ ":xxhash" ]
public_deps = [
":angle_abseil",
":includes",
]
public_configs += [ ":angle_common_config" ]
if (angle_has_build && use_fuzzing_engine) {
all_dependent_configs = [ ":angle_disable_pool_alloc" ]
}
if (is_linux || is_chromeos) {
libs = [ "dl" ]
}
if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
# In API level 26 ANativeWindow APIs were moved from libandroid.so
# into a separate library, libnativewindow.so
if (ndk_api_level_at_least_26) {
libs = [ "nativewindow" ]
} else {
libs = [ "android" ]
}
}
if (angle_expose_non_conformant_extensions_and_versions) {
defines = [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
}
if (using_sanitizer && !build_with_chromium) {
data_deps = [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ]
}
if (is_apple) {
frameworks = [ "Metal.framework" ]
}
}
angle_source_set("angle_capture_common") {
sources = [
"src/common/frame_capture_utils.cpp",
"src/common/frame_capture_utils.h",
"src/common/frame_capture_utils_autogen.cpp",
"src/common/frame_capture_utils_autogen.h",
]
deps = [ ":angle_common" ]
public_deps = [ ":angle_gl_enum_utils" ]
}
config("angle_image_util_config") {
include_dirs = [
"include",
"src",
]
}
angle_source_set("angle_image_util_headers") {
sources = libangle_image_util_headers
public_deps = [ ":angle_common" ]
}
angle_static_library("angle_image_util") {
sources = libangle_image_util_sources
public_configs += [ ":angle_image_util_config" ]
public_deps = [ ":angle_image_util_headers" ]
if (angle_has_astc_encoder) {
public_deps += [ "third_party/astc-encoder:astcenc" ]
include_dirs = [ "third_party/astc-encoder/src/Source/" ]
}
}
config("angle_gl_visibility_config") {
if (is_win) {
defines = [
"GL_APICALL=",
"GL_API=",
]
} else {
defines = [
"GL_APICALL=__attribute__((visibility(\"default\")))",
"GL_API=__attribute__((visibility(\"default\")))",
]
}
}
config("angle_vulkan_wayland_config") {
if (angle_enable_vulkan && angle_use_wayland &&
defined(vulkan_wayland_include_dirs)) {
include_dirs = vulkan_wayland_include_dirs
}
}
config("angle_gpu_info_util_config") {
include_dirs = [
"include",
"src",
]
}
angle_static_library("angle_gpu_info_util") {
public_configs += [
":angle_gpu_info_util_config",
":angle_backend_config",
]
public_deps = [ ":angle_common" ]
sources = libangle_gpu_info_util_sources
deps = []
libs = []
defines = []
if (angle_build_vulkan_system_info) {
sources += libangle_gpu_info_util_vulkan_sources
deps += [
"$angle_vulkan_headers_dir:vulkan_headers",
"src/common/vulkan:angle_libvulkan_loader",
"src/common/vulkan:angle_vulkan_icd",
]
configs += [ "$angle_root:angle_no_cfi_icall" ]
if (angle_enable_vulkan_system_info) {
defines += [ "ANGLE_USE_VULKAN_SYSTEM_INFO" ]
}
}
if (is_android) {
sources += libangle_gpu_info_util_android_sources
}
if (is_fuchsia) {
sources += libangle_gpu_info_util_fuchsia_sources
deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ]
}
if (is_win) {
sources += libangle_gpu_info_util_win_sources
if (!angle_is_winuwp) {
libs += [ "setupapi.lib" ]
}
libs += [ "dxgi.lib" ]
}
if (is_linux || is_chromeos) {
sources += libangle_gpu_info_util_linux_sources
if (angle_use_x11 && angle_has_build) {
sources += libangle_gpu_info_util_x11_sources
deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
defines += [ "GPU_INFO_USE_X11" ]
libs += [
"X11",
"Xi",
"Xext",
]
}
if (angle_use_wayland && angle_has_build) {
public_deps += [ ":angle_wayland" ]
}
}
if (use_libpci) {
sources += libangle_gpu_info_util_libpci_sources
defines += [ "GPU_INFO_USE_LIBPCI" ]
libs += [ "pci" ]
}
if (is_apple) {
frameworks = [
"IOKit.framework",
"CoreFoundation.framework",
"CoreGraphics.framework",
]
if (angle_enable_eagl) {
frameworks += [ "OpenGLES.framework" ]
} else if (angle_enable_cgl) {
frameworks += [ "OpenGL.framework" ]
}
if (is_mac || angle_enable_cgl) {
sources += libangle_gpu_info_util_mac_sources
}
if (is_ios && !angle_enable_cgl) {
sources += libangle_gpu_info_util_ios_sources
}
}
}
angle_source_set("angle_translator_headers") {
sources = angle_translator_exported_headers
public_deps = [ ":includes" ]
}
template("translator_lib") {
angle_static_library(target_name) {
sources = angle_translator_sources
defines = []
_needs_glsl_base = false
_needs_glsl_and_vulkan_base = false
_uses_spirv = false
# Frontend support:
if (angle_enable_desktop_glsl) {
sources += angle_translator_glsl_symbol_table_sources
} else {
sources += angle_translator_essl_symbol_table_sources
}
# Backend support:
if (angle_enable_essl || use_fuzzing_engine) {
_needs_glsl_base = true
sources += angle_translator_essl_sources
defines += [ "ANGLE_ENABLE_ESSL" ]
}
if (angle_enable_glsl || use_fuzzing_engine) {
_needs_glsl_base = true
_needs_glsl_and_vulkan_base = true
sources += angle_translator_glsl_sources
defines += [ "ANGLE_ENABLE_GLSL" ]
}
if (angle_enable_apple_translator_workarounds) {
sources += angle_translator_apple_sources
defines += [ "ANGLE_ENABLE_APPLE_WORKAROUNDS" ]
}
if (angle_enable_hlsl || use_fuzzing_engine) {
sources += angle_translator_hlsl_sources
defines += [ "ANGLE_ENABLE_HLSL" ]
}
if (!invoker.gl_d3d_only) {
if (angle_enable_vulkan || use_fuzzing_engine ||
angle_enable_msl_through_spirv) {
_needs_glsl_base = true
_needs_glsl_and_vulkan_base = true
_uses_spirv = true
# This translator is needed by metal backend also.
sources += angle_translator_lib_vulkan_sources
}
if (angle_enable_vulkan || use_fuzzing_engine) {
defines += [ "ANGLE_ENABLE_VULKAN" ]
}
if (angle_enable_metal) {
sources += angle_translator_lib_metal_sources
defines += [ "ANGLE_ENABLE_METAL" ]
if (angle_enable_msl_through_spirv) {
defines += [ "ANGLE_ENABLE_METAL_SPIRV" ]
}
}
}
if (_needs_glsl_base) {
sources += angle_translator_glsl_base_sources
}
if (_needs_glsl_and_vulkan_base) {
sources += angle_translator_glsl_and_vulkan_base_sources
}
public_configs += [ ":external_config" ]
deps = [
":includes",
":preprocessor",
"$angle_root/src/common/spirv:angle_spirv_headers",
]
if (_uses_spirv) {
deps += [
"$angle_root/src/common/spirv:angle_spirv_base",
"$angle_root/src/common/spirv:angle_spirv_builder",
"${angle_spirv_headers_dir}:spv_headers",
"${angle_spirv_tools_dir}:spvtools_headers",
"${angle_spirv_tools_dir}:spvtools_val",
]
}
public_deps = [
":angle_common",
":angle_translator_headers",
]
if (is_win) {
# Necessary to suppress some system header xtree warnings in Release.
# For some reason this warning doesn't get triggered in Chromium
cflags = [ "/wd4718" ]
}
}
}
translator_lib("translator") {
gl_d3d_only = false
}
if (angle_enable_essl || angle_enable_glsl || angle_enable_hlsl) {
translator_lib("translator_gl_d3d_only") {
gl_d3d_only = true
}
}
angle_source_set("translator_fuzzer") {
sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
include_dirs = [
"include",
"src",
]
deps = [ ":translator" ]
}
config("angle_commit_id_config") {
include_dirs = [ "$root_gen_dir/angle" ]
visibility = [ ":angle_commit_id" ]
}
action("angle_commit_id") {
_commit_id_header = "$root_gen_dir/angle/angle_commit.h"
script = "src/commit_id.py"
outputs = [ _commit_id_header ]
visibility = [ ":angle_version" ]
# Add git as a dependency if it is available.
if (angle_enable_commit_id &&
exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
# commit id should depend on angle's HEAD revision
inputs = [ ".git/HEAD" ]
branch = read_file(".git/HEAD", "string")
result = string_split(branch)
if (result[0] == "ref:") {
_ref_file = result[1]
# If git has packed the contents of .git/refs/heads/ in .git/packed-refs,
# unpack the head before depending on it.
exec_script("src/commit_id.py",
[
"unpack",
_ref_file,
],
"")
inputs += [ ".git/" + _ref_file ]
}
}
args = [
"gen",
rebase_path(_commit_id_header, root_build_dir),
]
public_configs = [ ":angle_commit_id_config" ]
}
angle_source_set("angle_version") {
sources = [ "src/common/angle_version.h" ]
public_deps = [ ":angle_commit_id" ]
visibility = [ ":angle_version_info" ]
# The version headers are used directly in Windows .RC files.
if (is_win) {
visibility += [
":libEGL",
":libGL",
":libGLESv1_CM",
":libGLESv2",
":libGLESv2_capture_complement",
]
}
}
angle_source_set("angle_version_info") {
sources = [
"src/common/angle_version_info.cpp",
"src/common/angle_version_info.h",
]
deps = [ ":angle_version" ]
}
config("angle_backend_config") {
defines = []
if (angle_force_context_check_every_call) {
defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ]
}
if (angle_expose_non_conformant_extensions_and_versions) {
defines += [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
}
configs = []
if (angle_enable_d3d11) {
configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ]
}
if (angle_enable_d3d9) {
configs += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend_config" ]
}
if (angle_enable_gl) {
configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ]
}
if (angle_enable_null) {
configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ]
}
if (angle_enable_metal) {
configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
}
if (angle_enable_vulkan) {
configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
}
if (angle_enable_cl_passthrough) {
configs += [ "src/libANGLE/renderer/cl:angle_cl_backend_config" ]
}
if (angle_is_winuwp) {
configs += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp_config" ]
}
}
config("libANGLE_config") {
cflags = []
defines = []
libs = []
ldflags = []
defines += [ "LIBANGLE_IMPLEMENTATION" ]
if (is_win) {
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
# are not enabled.
}
if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
# In API level 26 ANativeWindow APIs were moved from libandroid.so
# into a separate library, libnativewindow.so
if (ndk_api_level_at_least_26) {
libs += [ "nativewindow" ]
} else {
libs += [ "android" ]
}
}
if (angle_use_x11) {
defines += [ "ANGLE_USE_X11" ]
}
if (angle_use_wayland) {
defines += [ "ANGLE_USE_WAYLAND" ]
}
if (angle_enable_overlay) {
defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
}
if (angle_enable_perf_counter_output) {
defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ]
}
}
angle_source_set("libANGLE_headers") {
sources = libangle_headers
if (angle_enable_cl) {
sources += libangle_cl_headers
}
public_deps = [
":angle_common",
":angle_translator_headers",
]
public_configs += [ ":libANGLE_config" ]
}
# Don't even try to build the SPIR-V transformer if Metal and Vulkan are disabled.
if (angle_enable_vulkan || angle_enable_metal) {
angle_source_set("angle_glslang_wrapper") {
sources = [
"src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.cpp",
"src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.h",
"src/libANGLE/renderer/glslang_wrapper_utils.cpp",
"src/libANGLE/renderer/glslang_wrapper_utils.h",
]
deps = [
":libANGLE_headers",
"$angle_root/src/common/spirv:angle_spirv_base",
"$angle_root/src/common/spirv:angle_spirv_builder",
"$angle_root/src/common/spirv:angle_spirv_headers",
"$angle_root/src/common/spirv:angle_spirv_parser",
"${angle_spirv_headers_dir}:spv_headers",
]
}
}
if ((is_win && angle_enable_gl) || angle_enable_d3d11 || angle_enable_d3d9) {
angle_source_set("angle_d3d_format_tables") {
sources = [
"src/libANGLE/renderer/dxgi_format_map.h",
"src/libANGLE/renderer/dxgi_format_map_autogen.cpp",
"src/libANGLE/renderer/dxgi_support_table.h",
"src/libANGLE/renderer/dxgi_support_table_autogen.cpp",
]
if (!angle_is_winuwp) {
sources += [
"src/libANGLE/renderer/d3d_format.cpp",
"src/libANGLE/renderer/d3d_format.h",
]
}
public_deps = [ ":libANGLE_headers" ]
configs += [ ":angle_backend_config" ]
}
}
angle_source_set("libANGLE_base") {
sources = libangle_sources
if (angle_enable_cl) {
sources += libangle_cl_sources
}
defines = []
if (angle_enable_gl_desktop_frontend) {
defines += [ "ANGLE_ENABLE_GL_DESKTOP_FRONTEND" ]
}
include_dirs = []
libs = []
if (angle_link_glx) {
libs += [ "GL" ]
defines += [ "ANGLE_LINK_GLX" ]
}
public_deps = [
":angle_common",
":angle_gpu_info_util",
":angle_image_util",
":angle_version_info",
":libANGLE_headers",
":translator",
]
deps = [
":angle_compression",
":includes",
]
if (is_win && !angle_is_winuwp) {
libs += [
"gdi32.lib",