1# Copyright 2019 The ANGLE Project Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# import the ozone_platform_x11 variable 6import("gni/angle.gni") 7if (angle_enable_vulkan) { 8 import("//build_overrides//vulkan_headers.gni") 9} 10if (angle_use_wayland) { 11 import("//build_overrides/wayland.gni") 12} 13if (angle_enable_wgpu) { 14 import("//build_overrides/dawn.gni") 15 import("//build_overrides/tint.gni") 16} 17if (angle_has_build) { 18 import("//build/config/linux/pkg_config.gni") 19 import("//build/config/sanitizers/sanitizers.gni") 20 import("//build/config/ui.gni") 21 import("//testing/libfuzzer/fuzzer_test.gni") 22 23 if (is_android) { 24 # android/rules.gni can only be imported for Android targets 25 import("//build/config/android/config.gni") 26 import("//build/config/android/rules.gni") 27 import("android/angle_apk.gni") 28 } 29} else { 30 using_sanitizer = false 31} 32 33declare_args() { 34 # Use the PCI lib to collect GPU information on Linux. 35 use_libpci = (is_linux || is_chromeos) && (angle_use_x11 || use_ozone) && 36 angle_has_build 37 38 # Enable using Vulkan to collect system info as a fallback. 39 angle_enable_vulkan_system_info = false 40 41 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md. 42 angle_link_glx = false 43 44 # Don't build extra (test, samples etc) for Windows UWP. We don't have 45 # infrastructure (e.g. windowing helper functions) in place to run them. 46 # Also don't build them with MSVC, because tests and unused dependencies 47 # often have problems building with it, e.g. for C++20. 48 angle_build_all = !build_with_chromium && !angle_is_winuwp && 49 !angle_is_msvc && angle_has_build && angle_build_tests 50 51 # Enable generating current commit information using git 52 angle_enable_commit_id = true 53 54 # Abseil has trouble supporting MSVC, particularly regarding component builds. 55 # http://crbug.com/1126524 56 angle_enable_abseil = angle_has_build && is_clang 57 58 # Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled. 59 angle_enable_annotator_run_time_checks = false 60 61 # Enables non-conformant extensions and features 62 angle_expose_non_conformant_extensions_and_versions = false 63 64 # Optional feature that forces dirty state whenever we use a new context regardless of thread. 65 angle_force_context_check_every_call = false 66 67 # Allow shared library custom name extensions for setting soname such as libEGL.so.1 68 angle_egl_extension = "" 69 angle_glesv2_extension = "" 70 71 # Enable share context lock. If it is false, the client need to use gl calls in a threadsafe way. 72 angle_enable_share_context_lock = 73 !build_with_chromium || build_angle_deqp_tests 74 75 if (is_android) { 76 # Use Android TLS slot to store current context. 77 angle_use_android_tls_slot = !build_with_chromium 78 } 79 80 angle_enable_global_mutex_recursion = 81 is_android && angle_enable_vulkan && !build_with_chromium 82 83 # Potentially can be enabled for other platforms, but limiting to Android platform for now. 84 # Chromium may have problems (requires verification), disabled for safety. 85 angle_enable_global_mutex_load_time_allocate = 86 is_android && !build_with_chromium 87 88 angle_enable_context_mutex = true 89 90 # Prefix where the artifacts should be installed on the system 91 install_prefix = "" 92} 93 94declare_args() { 95 # May need to enable to fix recursion when vkAcquireNextImageKHR() returns back to ANGLE from 96 # eglClientWaitSyncKHR(). May happen if Android Presentation Engine uses 97 # EGL_KHR_fence_sync instead of EGL_ANDROID_native_fence_sync for synchronization. 98 # To check call: adb shell "dumpsys SurfaceFlinger | grep 'Sync configuration'" 99 # The Android's "testDrawingHardwareBitmapNotLeaking" test may be used for testing. 100 # Disable this option to save performance on platforms that does not require recursion. 101 angle_enable_context_mutex_recursion = angle_enable_global_mutex_recursion 102} 103 104if (angle_build_all) { 105 group("all") { 106 testonly = true 107 deps = [ 108 ":angle", 109 ":angle_shader_translator", 110 ":translator_fuzzer", 111 ":xxhash_fuzzer", 112 "$angle_root/samples:angle_samples", 113 "$angle_root/src/tests:angle_tests", 114 ] 115 if (angle_enable_cl) { 116 deps += [ "$angle_root/src/libOpenCL:angle_cl" ] 117 } 118 if (angle_enable_cl_testing) { 119 deps += [ "$angle_root/third_party/OpenCL-CTS/:opencl_cts" ] 120 } 121 if (angle_enable_cl && angle_enable_vulkan) { 122 # OpenCL through Vulkan in ANGLE requires clspv for online compiler 123 deps += [ "$angle_clspv_dir:clspv" ] 124 } 125 if (angle_build_mesa) { 126 deps += [ "$angle_root/third_party/mesa" ] 127 } 128 } 129} 130 131import("src/angle_program_serialize_data_version.gni") 132import("src/compiler.gni") 133import("src/libGLESv2.gni") 134 135# This config is exported to dependent targets (and also applied to internal 136# ones). 137config("external_config") { 138 include_dirs = [ "include" ] 139} 140 141# Prevent the GL headers from redeclaring ANGLE entry points. 142config("no_gl_prototypes") { 143 defines = [ 144 "GL_GLES_PROTOTYPES=0", 145 "EGL_EGL_PROTOTYPES=0", 146 ] 147} 148 149config("gl_prototypes") { 150 defines = [ 151 "GL_GLES_PROTOTYPES=1", 152 "EGL_EGL_PROTOTYPES=1", 153 "GL_GLEXT_PROTOTYPES", 154 "EGL_EGLEXT_PROTOTYPES", 155 ] 156} 157 158# This config is applied to internal Angle targets (not pushed to dependents). 159config("internal_config") { 160 include_dirs = [ 161 "include", 162 "src", 163 ] 164 165 defines = [] 166 167 if (is_win) { 168 defines += [ "ANGLE_IS_WIN" ] 169 if (angle_is_winuwp) { 170 defines += [ "ANGLE_IS_WINUWP" ] 171 } 172 if (angle_is_winappsdk) { 173 defines += [ "ANGLE_IS_WINAPPSDK" ] 174 } 175 } else if (is_linux || is_chromeos) { 176 defines += [ "ANGLE_IS_LINUX" ] 177 } 178 179 if (angle_enable_share_context_lock) { 180 defines += [ "ANGLE_ENABLE_SHARE_CONTEXT_LOCK=1" ] 181 } 182 183 if (is_android) { 184 if (angle_use_android_tls_slot) { 185 defines += [ "ANGLE_USE_ANDROID_TLS_SLOT=1" ] 186 } 187 } 188 189 if (angle_enable_global_mutex_recursion) { 190 defines += [ "ANGLE_ENABLE_GLOBAL_MUTEX_RECURSION=1" ] 191 } 192 193 if (angle_enable_global_mutex_load_time_allocate) { 194 defines += [ "ANGLE_ENABLE_GLOBAL_MUTEX_LOAD_TIME_ALLOCATE=1" ] 195 } 196 197 if (angle_enable_context_mutex && angle_enable_share_context_lock && 198 !angle_force_context_check_every_call) { 199 defines += [ "ANGLE_ENABLE_CONTEXT_MUTEX=1" ] 200 } 201 202 if (angle_enable_context_mutex_recursion) { 203 defines += [ "ANGLE_ENABLE_CONTEXT_MUTEX_RECURSION=1" ] 204 } 205 206 # Enables debug/trace-related functionality, including logging every GLES/EGL API command to the 207 # "angle_debug.txt" file on desktop. Enables debug markers for AGI, but must also set 208 # angle_enable_annotator_run_time_checks to improve performance. 209 if (angle_enable_trace) { 210 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ] 211 } 212 213 # When used with angle_enable_trace, enables logging every GLES/EGL API command to Android logcat 214 # Enables debug markers for AGI regardless of run-time checks. 215 if (angle_enable_trace_android_logcat) { 216 defines += [ "ANGLE_ENABLE_TRACE_ANDROID_LOGCAT=1" ] 217 } 218 219 # When used with angle_enable_trace, enables logging every GLES/EGL API command to the terminal 220 if (angle_enable_trace_events) { 221 defines += [ "ANGLE_ENABLE_TRACE_EVENTS=1" ] 222 } 223 224 # Output `INFO`-level logs and up. 225 if (angle_always_log_info) { 226 defines += [ "ANGLE_ALWAYS_LOG_INFO" ] 227 } 228 229 # Enables pipeline cache graph dump functionality. 230 # The dump path must have appropriate permissions for this to work. 231 if (angle_dump_pipeline_cache_graph) { 232 defines += [ "ANGLE_DUMP_PIPELINE_CACHE_GRAPH=1" ] 233 } 234 235 # Checks that unwind backtrace support for Android is enabled only for debug mode. 236 assert(is_debug || !angle_enable_unwind_backtrace_support) 237 238 if (is_chromeos) { 239 defines += [ "ANGLE_PLATFORM_CHROMEOS" ] 240 } 241 242 if (is_ggp) { 243 defines += [ "__ggp__" ] 244 } 245 246 if (angle_use_vulkan_null_display) { 247 defines += [ "ANGLE_USE_VULKAN_NULL_DISPLAY" ] 248 } else if (angle_use_vulkan_display) { 249 defines += [ "ANGLE_USE_VULKAN_DISPLAY" ] 250 if (!angle_use_x11) { 251 defines += [ "EGL_NO_X11" ] 252 } 253 254 # These two are needed here to correctly select OSWindow::New 255 if (angle_use_x11) { 256 defines += [ "ANGLE_USE_X11" ] 257 } 258 if (angle_use_wayland) { 259 defines += [ "ANGLE_USE_WAYLAND" ] 260 } 261 262 if (angle_vulkan_display_mode == "simple") { 263 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ] 264 } else if (angle_vulkan_display_mode == "headless") { 265 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ] 266 } else if (angle_vulkan_display_mode == "offscreen") { 267 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_OFFSCREEN" ] 268 } else { 269 assert(false) 270 } 271 } 272 273 if (is_lsan) { 274 defines += [ "ANGLE_WITH_LSAN" ] 275 } 276 277 if (angle_has_astc_encoder) { 278 defines += [ "ANGLE_HAS_ASTCENC" ] 279 } 280 281 if (angle_test_enable_system_egl) { 282 defines += [ "ANGLE_TEST_ENABLE_SYSTEM_EGL" ] 283 } 284 285 if (angle_debug_layers_enabled) { 286 defines += [ "ANGLE_DEBUG_LAYERS_ENABLED" ] 287 } 288 289 if (angle_build_mesa) { 290 defines += [ "ANGLE_HAS_MESA" ] 291 } 292 293 if (angle_standalone || build_with_chromium) { 294 defines += [ "ANGLE_OUTSIDE_WEBKIT" ] 295 } 296 297 if (is_win && build_with_chromium) { 298 defines += [ "ANGLE_WINDOWS_NO_FUTEX=1" ] 299 } 300} 301 302config("constructor_and_destructor_warnings") { 303 if (is_clang) { 304 cflags = [ 305 "-Wexit-time-destructors", 306 "-Wglobal-constructors", 307 ] 308 } 309} 310 311config("extra_warnings") { 312 cflags = [] 313 314 is_gcc = !is_clang && !is_win 315 316 # Avoid failing builds for warnings enabled by Skia build. 317 if (defined(is_skia_standalone)) { 318 cflags += [ "-w" ] 319 } 320 321 # Enable more default warnings on Windows. 322 if (is_win) { 323 cflags += [ 324 "/we4244", # Conversion: possible loss of data. 325 "/we4312", # Conversion: greater size. 326 "/we4456", # Variable shadowing. 327 "/we4458", # declaration hides class member. 328 "/we4715", # not all control paths return a value 329 "/we4800", # forcing value to bool. 330 "/we4838", # narrowing conversion. 331 ] 332 } 333 if (is_clang) { 334 cflags += [ 335 "-Wbad-function-cast", 336 "-Wconditional-uninitialized", 337 "-Wextra-semi-stmt", 338 "-Wfloat-conversion", 339 "-Winconsistent-missing-destructor-override", 340 "-Wmissing-field-initializers", 341 "-Wnewline-eof", 342 "-Wnon-virtual-dtor", 343 "-Wredundant-parens", 344 "-Wreturn-std-move", 345 "-Wshadow", 346 "-Wshadow-field", 347 "-Wtautological-type-limit-compare", 348 "-Wundefined-reinterpret-cast", 349 "-Wunneeded-internal-declaration", 350 "-Wunused-but-set-variable", 351 "-Wsuggest-destructor-override", 352 "-Wsuggest-override", 353 354 # The below warnings are used by WebKit. We enable them to make rolling 355 # ANGLE in WebKit easier. 356 "-Wparentheses", 357 "-Wrange-loop-analysis", 358 "-Wstrict-prototypes", 359 "-Wunreachable-code-aggressive", 360 "-Wshorten-64-to-32", 361 ] 362 } 363 364 if (is_gcc) { 365 cflags_cc = [ "-Wdeprecated-copy" ] 366 } 367 368 if (angle_is_winuwp) { 369 cflags += [ 370 "/wd4091", # keyword ignored on left of type when no variable is declared 371 "/wd4447", # 'main' signature found without threading model. 372 ] 373 } 374} 375 376# This config adds build-ids to the associated library. 377# -Wl is a special option that indicates that clang should pass the associated 378# option --build-id to the linker. This will cause a build-id section to be added 379# to the associated library. The build-id makes it possible for a debugger to 380# find the right symbol file to use. 381config("build_id_config") { 382 ldflags = [ "-Wl,--build-id" ] 383} 384 385_use_copy_compiler_dll = angle_has_build && is_win 386 387if (_use_copy_compiler_dll) { 388 copy("copy_compiler_dll") { 389 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ] 390 outputs = [ "$root_out_dir/{{source_file_part}}" ] 391 } 392} 393 394# Holds the shared includes so we only need to list them once. 395config("includes_config") { 396 include_dirs = [ "include" ] 397} 398 399config("angle_uwp_env") { 400 if (angle_is_winuwp && !angle_is_winappsdk) { 401 defines = [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ] 402 } 403} 404 405angle_source_set("cl_includes") { 406 sources = cl_includes 407 public_configs = [ ":external_config" ] 408} 409 410angle_source_set("includes") { 411 sources = libangle_includes 412 public_configs = [ ":includes_config" ] 413 if (angle_enable_cl) { 414 public_deps = [ ":cl_includes" ] 415 } 416} 417 418config("disable_unreachable_code_break_warning") { 419 if (is_clang) { 420 cflags = [ "-Wno-unreachable-code-break" ] 421 } 422} 423 424angle_static_library("preprocessor") { 425 sources = angle_preprocessor_sources 426 427 # preprocessor_tab_autogen.cpp contains an instance of this. 428 configs += [ ":disable_unreachable_code_break_warning" ] 429 430 public_deps = [ 431 ":angle_common", 432 ":angle_translator_headers", 433 ] 434} 435 436config("angle_disable_pool_alloc") { 437 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ] 438} 439 440config("debug_annotations_config") { 441 defines = [] 442 if (is_debug) { 443 defines += [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ] 444 } 445 if (angle_enable_annotator_run_time_checks) { 446 # When used with angle_enable_trace, enables debug markers for AGI with run-time checks to 447 # filter out EVENT() messages when the debug annotator is disabled. 448 defines += [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ] 449 } 450} 451 452config("angle_asserts_config") { 453 if (angle_assert_always_on) { 454 defines = [ "ANGLE_ASSERT_ALWAYS_ON" ] 455 } 456} 457 458config("angle_common_config") { 459 include_dirs = [ 460 "src/common/base", 461 "src/common/third_party/xxhash", 462 ] 463 libs = [] 464 if (is_android) { 465 libs += [ "log" ] 466 } 467 468 if (is_win && !angle_is_winuwp && !build_with_chromium) { 469 # Needed for futex support 470 libs += [ "synchronization.lib" ] 471 } 472 473 defines = [] 474 if (angle_delegate_workers) { 475 defines += [ "ANGLE_DELEGATE_WORKERS=1" ] 476 } 477} 478 479# Silences the "indirect call of a function with wrong dynamic type" cfi error 480config("angle_no_cfi_icall") { 481 if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) { 482 cflags = [ "-fno-sanitize=cfi-icall" ] 483 } 484} 485 486# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error 487config("angle_no_cfi_unrelated_cast") { 488 if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) { 489 cflags = [ "-fno-sanitize=cfi-unrelated-cast" ] 490 } 491} 492 493angle_source_set("xxhash") { 494 sources = xxhash_sources 495 if (is_clang) { 496 cflags_c = [ "-Wno-implicit-fallthrough" ] 497 } 498} 499 500if (angle_has_build) { 501 fuzzer_test("xxhash_fuzzer") { 502 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ] 503 deps = [ ":xxhash" ] 504 } 505} 506 507template("angle_common_lib") { 508 angle_static_library(target_name) { 509 sources = invoker.sources 510 511 configs += [ 512 ":angle_common_config", 513 ":debug_annotations_config", 514 ] 515 516 deps = [ ":xxhash" ] 517 518 public_deps = [ 519 ":angle_abseil", 520 ":includes", 521 ] 522 public_configs += [ ":angle_common_config" ] 523 if (angle_has_build && use_fuzzing_engine) { 524 all_dependent_configs = [ ":angle_disable_pool_alloc" ] 525 } 526 527 if (is_linux || is_chromeos) { 528 libs = [ "dl" ] 529 } 530 531 if (is_android && (angle_enable_gl || angle_enable_vulkan)) { 532 # In API level 26 ANativeWindow APIs were moved from libandroid.so 533 # into a separate library, libnativewindow.so 534 if (ndk_api_level_at_least_26) { 535 libs = [ "nativewindow" ] 536 } else { 537 libs = [ "android" ] 538 } 539 } 540 541 if (angle_expose_non_conformant_extensions_and_versions) { 542 defines = [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ] 543 } 544 545 if (using_sanitizer && !build_with_chromium) { 546 data_deps = 547 [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ] 548 } 549 550 if (is_apple) { 551 frameworks = [ "Metal.framework" ] 552 } 553 } 554} 555 556angle_common_lib("angle_common") { 557 sources = libangle_common_sources 558 if (angle_enable_cl) { 559 sources += libangle_common_cl_sources 560 } 561} 562 563angle_common_lib("angle_common_shader_state") { 564 sources = libangle_common_shader_state_sources 565} 566 567angle_source_set("angle_capture_common") { 568 sources = [ 569 "src/common/frame_capture_utils.cpp", 570 "src/common/frame_capture_utils.h", 571 "src/common/frame_capture_utils_autogen.cpp", 572 "src/common/frame_capture_utils_autogen.h", 573 ] 574 deps = [ ":angle_common" ] 575 public_deps = [ ":angle_gl_enum_utils" ] 576} 577 578config("angle_image_util_config") { 579 include_dirs = [ 580 "include", 581 "src", 582 ] 583} 584 585angle_source_set("angle_image_util_headers") { 586 sources = libangle_image_util_headers 587 public_deps = [ ":angle_common" ] 588} 589 590angle_static_library("angle_image_util") { 591 sources = libangle_image_util_sources 592 public_configs += [ ":angle_image_util_config" ] 593 public_deps = [ ":angle_image_util_headers" ] 594 595 if (angle_has_astc_encoder) { 596 public_deps += [ "third_party/astc-encoder:astcenc" ] 597 include_dirs = [ "third_party/astc-encoder/src/Source/" ] 598 } 599} 600 601config("angle_gl_visibility_config") { 602 if (is_win) { 603 defines = [ 604 "GL_APICALL=", 605 "GL_API=", 606 ] 607 } else { 608 defines = [ 609 "GL_APICALL=__attribute__((visibility(\"default\")))", 610 "GL_API=__attribute__((visibility(\"default\")))", 611 ] 612 } 613} 614 615config("angle_vulkan_wayland_config") { 616 if (angle_enable_vulkan && angle_use_wayland && 617 defined(vulkan_wayland_include_dirs)) { 618 include_dirs = vulkan_wayland_include_dirs 619 } 620} 621 622config("angle_gpu_info_util_config") { 623 include_dirs = [ 624 "include", 625 "src", 626 ] 627} 628 629angle_static_library("angle_gpu_info_util") { 630 public_configs += [ 631 ":angle_gpu_info_util_config", 632 ":angle_backend_config", 633 ] 634 public_deps = [ ":angle_common" ] 635 sources = libangle_gpu_info_util_sources 636 deps = [] 637 libs = [] 638 defines = [] 639 640 if (angle_build_vulkan_system_info) { 641 sources += libangle_gpu_info_util_vulkan_sources 642 deps += [ 643 "$angle_vulkan_headers_dir:vulkan_headers", 644 "src/common/vulkan:angle_libvulkan_loader", 645 "src/common/vulkan:angle_vulkan_icd", 646 ] 647 configs += [ "$angle_root:angle_no_cfi_icall" ] 648 if (angle_enable_vulkan_system_info) { 649 defines += [ "ANGLE_USE_VULKAN_SYSTEM_INFO" ] 650 } 651 } 652 653 if (is_android) { 654 sources += libangle_gpu_info_util_android_sources 655 } 656 657 if (is_fuchsia) { 658 sources += libangle_gpu_info_util_fuchsia_sources 659 deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ] 660 } 661 662 if (is_win) { 663 sources += libangle_gpu_info_util_win_sources 664 if (!angle_is_winuwp) { 665 libs += [ "setupapi.lib" ] 666 } 667 libs += [ "dxgi.lib" ] 668 } 669 670 if (is_linux || is_chromeos) { 671 sources += libangle_gpu_info_util_linux_sources 672 673 if (angle_use_x11 && angle_has_build) { 674 sources += libangle_gpu_info_util_x11_sources 675 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ] 676 defines += [ "GPU_INFO_USE_X11" ] 677 libs += [ 678 "X11", 679 "Xi", 680 "Xext", 681 ] 682 } 683 684 if (angle_use_wayland && angle_has_build) { 685 public_deps += [ ":angle_wayland" ] 686 } 687 } 688 689 if (use_libpci) { 690 sources += libangle_gpu_info_util_libpci_sources 691 defines += [ "GPU_INFO_USE_LIBPCI" ] 692 libs += [ "pci" ] 693 } 694 695 if (is_apple) { 696 frameworks = [ 697 "IOKit.framework", 698 "CoreFoundation.framework", 699 "CoreGraphics.framework", 700 ] 701 if (angle_enable_eagl) { 702 frameworks += [ "OpenGLES.framework" ] 703 } else if (angle_enable_cgl) { 704 frameworks += [ "OpenGL.framework" ] 705 } 706 if (is_mac || angle_enable_cgl) { 707 sources += libangle_gpu_info_util_mac_sources 708 } 709 if (is_ios && !angle_enable_cgl) { 710 sources += libangle_gpu_info_util_ios_sources 711 } 712 } 713} 714 715angle_source_set("angle_translator_headers") { 716 sources = angle_translator_exported_headers 717 public_deps = [ ":includes" ] 718} 719 720template("translator_lib") { 721 angle_static_library(target_name) { 722 sources = angle_translator_sources 723 defines = [] 724 725 _needs_glsl_base = false 726 _needs_glsl_and_vulkan_base = false 727 _uses_spirv = false 728 729 # Frontend support: 730 if (angle_enable_desktop_glsl) { 731 sources += angle_translator_glsl_symbol_table_sources 732 } else { 733 sources += angle_translator_essl_symbol_table_sources 734 } 735 736 # Backend support: 737 if (angle_enable_essl || use_fuzzing_engine) { 738 _needs_glsl_base = true 739 sources += angle_translator_essl_sources 740 defines += [ "ANGLE_ENABLE_ESSL" ] 741 } 742 743 if (angle_enable_glsl || use_fuzzing_engine) { 744 _needs_glsl_base = true 745 _needs_glsl_and_vulkan_base = true 746 sources += angle_translator_glsl_sources 747 defines += [ "ANGLE_ENABLE_GLSL" ] 748 749 if (is_apple) { 750 sources += angle_translator_glsl_apple_sources 751 } 752 } 753 754 if (angle_enable_hlsl || use_fuzzing_engine) { 755 sources += angle_translator_hlsl_sources 756 defines += [ "ANGLE_ENABLE_HLSL" ] 757 } 758 759 if (!invoker.gl_d3d_only) { 760 if (angle_enable_vulkan || use_fuzzing_engine) { 761 _needs_glsl_base = true 762 _needs_glsl_and_vulkan_base = true 763 _uses_spirv = true 764 765 sources += angle_translator_lib_spirv_sources 766 } 767 768 if (angle_enable_vulkan || use_fuzzing_engine) { 769 defines += [ "ANGLE_ENABLE_VULKAN" ] 770 } 771 772 if (angle_enable_metal) { 773 sources += angle_translator_lib_msl_sources 774 defines += [ "ANGLE_ENABLE_METAL" ] 775 } 776 777 if (angle_enable_wgpu) { 778 sources += angle_translator_lib_wgsl_sources 779 defines += [ "ANGLE_ENABLE_WGPU" ] 780 } 781 } 782 783 if (_needs_glsl_base) { 784 sources += angle_translator_glsl_base_sources 785 } 786 if (_needs_glsl_and_vulkan_base) { 787 sources += angle_translator_glsl_and_vulkan_base_sources 788 } 789 790 public_configs += [ ":external_config" ] 791 792 deps = [ 793 ":angle_common_shader_state", 794 ":includes", 795 ":preprocessor", 796 "$angle_root/src/common/spirv:angle_spirv_headers", 797 ] 798 799 if (_uses_spirv) { 800 deps += [ 801 "$angle_root/src/common/spirv:angle_spirv_base", 802 "$angle_root/src/common/spirv:angle_spirv_builder", 803 "${angle_spirv_headers_dir}:spv_headers", 804 "${angle_spirv_tools_dir}:spvtools_headers", 805 "${angle_spirv_tools_dir}:spvtools_val", 806 ] 807 } 808 809 public_deps = [ 810 ":angle_common", 811 ":angle_translator_headers", 812 ":angle_version_info", 813 ] 814 815 if (is_win) { 816 # Necessary to suppress some system header xtree warnings in Release. 817 # For some reason this warning doesn't get triggered in Chromium 818 cflags = [ "/wd4718" ] 819 } 820 } 821} 822 823translator_lib("translator") { 824 gl_d3d_only = false 825} 826 827if (angle_enable_essl || angle_enable_glsl || angle_enable_hlsl) { 828 translator_lib("translator_gl_d3d_only") { 829 gl_d3d_only = true 830 } 831} 832 833angle_source_set("translator_fuzzer") { 834 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ] 835 836 include_dirs = [ 837 "include", 838 "src", 839 ] 840 841 deps = [ ":translator" ] 842} 843 844config("angle_program_version_id_config") { 845 include_dirs = [ "$root_gen_dir/angle" ] 846 visibility = [ ":angle_program_version_id" ] 847} 848 849action("angle_program_version_id") { 850 response_file_contents = 851 rebase_path(angle_code_affecting_program_serialize, root_build_dir) 852 853 _program_version_header = "$root_gen_dir/angle/ANGLEShaderProgramVersion.h" 854 script = "src/program_serialize_data_version.py" 855 outputs = [ _program_version_header ] 856 857 visibility = [ ":angle_version" ] 858 859 inputs = angle_code_affecting_program_serialize 860 deps = angle_dependencies_affecting_program_serialize 861 862 args = [ 863 rebase_path(_program_version_header, root_build_dir), 864 "{{response_file_name}}", 865 ] 866 867 public_configs = [ ":angle_program_version_id_config" ] 868} 869 870config("angle_commit_id_config") { 871 include_dirs = [ "$root_gen_dir/angle" ] 872 visibility = [ ":angle_commit_id" ] 873} 874 875action("angle_commit_id") { 876 _commit_id_header = "$root_gen_dir/angle/angle_commit.h" 877 script = "src/commit_id.py" 878 outputs = [ _commit_id_header ] 879 880 visibility = [ ":angle_version" ] 881 882 # Add git as a dependency if it is available. 883 if (angle_enable_commit_id && 884 exec_script("src/commit_id.py", [ "check" ], "value") == 1) { 885 # commit id should depend on angle's HEAD revision 886 git_dirs = exec_script("src/commit_id.py", [ "get_git_dirs" ], "list lines") 887 inputs = [ git_dirs[0] + "/HEAD" ] 888 branch = read_file(git_dirs[0] + "/HEAD", "string") 889 result = string_split(branch) 890 if (result[0] == "ref:") { 891 _ref_file = result[1] 892 893 # If git has packed the contents of .git/refs/heads/ in .git/packed-refs, 894 # unpack the head before depending on it. 895 exec_script("src/commit_id.py", 896 [ 897 "unpack", 898 _ref_file, 899 ], 900 "") 901 inputs += [ git_dirs[1] + "/" + _ref_file ] 902 } 903 } 904 905 args = [ 906 "gen", 907 rebase_path(_commit_id_header, root_build_dir), 908 ] 909 910 public_configs = [ ":angle_commit_id_config" ] 911} 912 913angle_source_set("angle_version") { 914 sources = [ "src/common/angle_version.h" ] 915 public_deps = [ 916 ":angle_commit_id", 917 ":angle_program_version_id", 918 ] 919 visibility = [ ":angle_version_info" ] 920 921 # The version headers are used directly in Windows .RC files. 922 if (is_win) { 923 visibility += [ 924 ":libEGL", 925 ":libGL", 926 ":libGLESv1_CM", 927 ":libGLESv2", 928 ":libGLESv2_capture_complement", 929 ] 930 if (angle_enable_vulkan) { 931 visibility += [ 932 ":libEGL_vulkan_secondaries", 933 ":libGLESv2_vulkan_secondaries", 934 ] 935 } 936 } 937} 938 939angle_source_set("angle_version_info") { 940 sources = [ 941 "src/common/angle_version_info.cpp", 942 "src/common/angle_version_info.h", 943 ] 944 deps = [ 945 ":angle_translator_headers", 946 ":angle_version", 947 ] 948} 949 950config("angle_backend_config") { 951 defines = [] 952 953 if (angle_force_context_check_every_call) { 954 defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ] 955 } 956 957 if (angle_expose_non_conformant_extensions_and_versions) { 958 defines += [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ] 959 } 960 961 configs = [] 962 963 if (angle_enable_d3d11) { 964 configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ] 965 } 966 967 if (angle_enable_d3d9) { 968 configs += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend_config" ] 969 } 970 971 if (angle_enable_gl) { 972 configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ] 973 } 974 975 if (angle_enable_null) { 976 configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ] 977 } 978 979 if (angle_enable_wgpu) { 980 configs += [ "src/libANGLE/renderer/wgpu:angle_wgpu_backend_config" ] 981 } 982 983 if (angle_enable_metal) { 984 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ] 985 } 986 987 if (angle_enable_vulkan) { 988 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ] 989 } 990 991 if (angle_enable_cl_passthrough) { 992 configs += [ "src/libANGLE/renderer/cl:angle_cl_backend_config" ] 993 } 994 995 if (angle_is_winuwp) { 996 configs += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp_config" ] 997 } 998} 999 1000config("libANGLE_config") { 1001 cflags = [] 1002 defines = [] 1003 libs = [] 1004 ldflags = [] 1005 defines += [ "LIBANGLE_IMPLEMENTATION" ] 1006 1007 if (is_win) { 1008 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics 1009 # are not enabled. 1010 } 1011 1012 if (is_android && (angle_enable_gl || angle_enable_vulkan)) { 1013 # In API level 26 ANativeWindow APIs were moved from libandroid.so 1014 # into a separate library, libnativewindow.so 1015 if (ndk_api_level_at_least_26) { 1016 libs += [ "nativewindow" ] 1017 } else { 1018 libs += [ "android" ] 1019 } 1020 } 1021 1022 if (angle_use_x11) { 1023 defines += [ "ANGLE_USE_X11" ] 1024 } 1025 1026 if (angle_use_wayland) { 1027 defines += [ "ANGLE_USE_WAYLAND" ] 1028 } 1029 1030 if (angle_enable_overlay) { 1031 defines += [ "ANGLE_ENABLE_OVERLAY=1" ] 1032 } 1033 if (angle_enable_perf_counter_output) { 1034 defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ] 1035 } 1036 1037 if (!is_android) { 1038 # b/283233503 1039 # Only export the ANGLE platform methods on Android, the EGL loader depends on them for 1040 # detecting ANGLE. Normally, users are expected to load them through eglGetProcAddress. 1041 defines += [ "ANGLE_PLATFORM_EXPORT=" ] 1042 } 1043} 1044 1045angle_source_set("libANGLE_headers") { 1046 sources = libangle_headers 1047 if (angle_enable_cl) { 1048 sources += libangle_cl_headers 1049 } 1050 public_deps = [ 1051 ":angle_common", 1052 ":angle_translator_headers", 1053 ] 1054 public_configs += [ ":libANGLE_config" ] 1055} 1056 1057if ((is_win && angle_enable_gl) || angle_enable_d3d11 || angle_enable_d3d9) { 1058 angle_source_set("angle_d3d_format_tables") { 1059 sources = [ 1060 "src/libANGLE/renderer/dxgi_format_map.h", 1061 "src/libANGLE/renderer/dxgi_format_map_autogen.cpp", 1062 "src/libANGLE/renderer/dxgi_support_table.h", 1063 "src/libANGLE/renderer/dxgi_support_table_autogen.cpp", 1064 ] 1065 1066 if (!angle_is_winuwp) { 1067 sources += [ 1068 "src/libANGLE/renderer/d3d_format.cpp", 1069 "src/libANGLE/renderer/d3d_format.h", 1070 ] 1071 } 1072 1073 public_deps = [ ":libANGLE_headers" ] 1074 configs += [ ":angle_backend_config" ] 1075 } 1076} 1077 1078# Vulkan gets mixed in later depending on secondary command buffer configs 1079angle_source_set("libANGLE_no_vulkan") { 1080 sources = libangle_sources 1081 if (angle_enable_cl) { 1082 sources += libangle_cl_sources 1083 } 1084 defines = [] 1085 if (angle_enable_gl_desktop_frontend) { 1086 defines += [ "ANGLE_ENABLE_GL_DESKTOP_FRONTEND" ] 1087 sources += libangle_gl_sources 1088 } 1089 1090 include_dirs = [] 1091 libs = [] 1092 if (angle_link_glx) { 1093 libs += [ "GL" ] 1094 defines += [ "ANGLE_LINK_GLX" ] 1095 } 1096 public_deps = [ 1097 ":angle_common", 1098 ":angle_common_shader_state", 1099 ":angle_gpu_info_util", 1100 ":angle_image_util", 1101 ":angle_version_info", 1102 ":libANGLE_headers", 1103 ":translator", 1104 ] 1105 deps = [ 1106 ":angle_compression", 1107 ":includes", 1108 ] 1109 1110 if (is_win && !angle_is_winuwp) { 1111 libs += [ 1112 "gdi32.lib", 1113 "user32.lib", 1114 ] 1115 } 1116 1117 if (angle_enable_d3d11) { 1118 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend" ] 1119 } 1120 1121 if (angle_enable_d3d9) { 1122 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend" ] 1123 } 1124 1125 if (angle_enable_gl) { 1126 public_deps += [ "src/libANGLE/renderer/gl:angle_gl_backend" ] 1127 } 1128 1129 if (angle_enable_null) { 1130 public_deps += [ "src/libANGLE/renderer/null:angle_null_backend" ] 1131 } 1132 1133 if (angle_enable_wgpu) { 1134 public_deps += [ "src/libANGLE/renderer/wgpu:angle_wgpu_backend" ] 1135 } 1136 1137 if (angle_is_winuwp) { 1138 public_deps += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp" ] 1139 } 1140 1141 if (angle_enable_d3d11) { 1142 libs += [ "dxguid.lib" ] 1143 } 1144 1145 if (angle_enable_metal) { 1146 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ] 1147 } 1148 1149 if (angle_enable_cl_passthrough) { 1150 public_deps += [ "src/libANGLE/renderer/cl:angle_cl_backend" ] 1151 } 1152 1153 # Enable extra Chromium style warnings for libANGLE. 1154 if (is_clang && angle_has_build) { 1155 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ] 1156 } 1157 1158 if (is_apple) { 1159 sources += libangle_mac_sources 1160 } 1161 1162 if (is_ios) { 1163 sources += [ "src/libANGLE/renderer/driver_utils_ios.mm" ] 1164 } 1165 1166 if (is_debug) { 1167 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ] 1168 } 1169 1170 configs += [ ":debug_annotations_config" ] 1171 public_configs += [ 1172 ":libANGLE_config", 1173 ":angle_backend_config", 1174 ] 1175 1176 if (_use_copy_compiler_dll) { 1177 data_deps = [ ":copy_compiler_dll" ] 1178 } 1179} 1180 1181config("angle_frame_capture_disabled") { 1182 defines = [ "ANGLE_CAPTURE_ENABLED=0" ] 1183} 1184 1185angle_source_set("angle_frame_capture_mock") { 1186 public_deps = [ ":libANGLE_headers" ] 1187 public_configs = [ ":angle_frame_capture_disabled" ] 1188 sources = [ 1189 "src/common/frame_capture_utils.h", 1190 "src/common/frame_capture_utils_autogen.h", 1191 "src/common/gl_enum_utils_autogen.h", 1192 "src/libANGLE/capture/FrameCapture.h", 1193 "src/libANGLE/capture/FrameCapture_mock.cpp", 1194 "src/libANGLE/capture/serialize.h", 1195 "src/libANGLE/capture/serialize_mock.cpp", 1196 ] 1197} 1198 1199angle_source_set("angle_gl_enum_utils") { 1200 deps = [ ":angle_common" ] 1201 sources = [ 1202 "src/common/gl_enum_utils.cpp", 1203 "src/common/gl_enum_utils.h", 1204 "src/common/gl_enum_utils_autogen.cpp", 1205 "src/common/gl_enum_utils_autogen.h", 1206 ] 1207} 1208 1209if (angle_use_wayland) { 1210 config("angle_wayland_config") { 1211 if ("$wayland_gn_dir" == "") { 1212 libs = [ 1213 "wayland-client", 1214 "wayland-egl", 1215 ] 1216 } 1217 1218 include_dirs = [ 1219 "$wayland_dir/egl", 1220 "$wayland_dir/src", 1221 ] 1222 } 1223 1224 group("angle_wayland") { 1225 public_configs = [ ":angle_wayland_config" ] 1226 1227 if ("$wayland_gn_dir" != "") { 1228 # Use third-party targets 1229 public_deps = [ 1230 "$wayland_gn_dir:wayland_client", 1231 "$wayland_gn_dir:wayland_egl", 1232 ] 1233 } 1234 } 1235} 1236 1237if (!defined(angle_abseil_cpp_dir)) { 1238 angle_abseil_cpp_dir = "//third_party/abseil-cpp" 1239} 1240 1241config("angle_abseil_config") { 1242 if (angle_enable_abseil) { 1243 defines = [ "ANGLE_USE_ABSEIL" ] 1244 1245 configs = [ 1246 "$angle_abseil_cpp_dir:absl_define_config", 1247 "$angle_abseil_cpp_dir:absl_include_config", 1248 ] 1249 } 1250} 1251 1252group("angle_abseil") { 1253 if (angle_enable_abseil) { 1254 # When build_with_chromium=true we need to include "//third_party/abseil-cpp:absl" while 1255 # we can be more specific when building standalone non-component ANGLE. 1256 # Also build the combined target when building Dawn to avoid multiply defined globals. 1257 if (build_with_chromium || angle_enable_wgpu || is_component_build) { 1258 public_deps = [ "$angle_abseil_cpp_dir:absl" ] 1259 } else { 1260 public_deps = [ 1261 "$angle_abseil_cpp_dir/absl/container:flat_hash_map", 1262 "$angle_abseil_cpp_dir/absl/container:flat_hash_set", 1263 ] 1264 } 1265 1266 public_configs = [ ":angle_abseil_config" ] 1267 } 1268} 1269 1270config("angle_compression_config") { 1271 include_dirs = [ "//third_party/zlib/google" ] 1272} 1273 1274group("angle_compression") { 1275 public_configs = [ 1276 ":angle_compression_config", 1277 "//third_party/zlib:zlib_config", 1278 ] 1279 public_deps = 1280 [ "$angle_zlib_compression_utils_dir:compression_utils_portable" ] 1281} 1282 1283if (angle_has_rapidjson) { 1284 config("angle_rapidjson_config") { 1285 defines = [ "ANGLE_HAS_RAPIDJSON" ] 1286 } 1287 angle_source_set("angle_json_serializer") { 1288 public_deps = [ 1289 ":angle_common", 1290 "$angle_root/third_party/rapidjson", 1291 ] 1292 sources = [ 1293 "src/common/serializer/JsonSerializer.cpp", 1294 "src/common/serializer/JsonSerializer.h", 1295 ] 1296 public_configs = [ ":angle_rapidjson_config" ] 1297 } 1298} 1299 1300assert(angle_has_frame_capture || !angle_with_capture_by_default) 1301if (angle_has_frame_capture) { 1302 config("angle_frame_capture_enabled") { 1303 defines = [ "ANGLE_CAPTURE_ENABLED=1" ] 1304 } 1305} 1306 1307template("libANGLE_template") { 1308 angle_source_set("${target_name}") { 1309 public_deps = invoker.public_deps + [ ":libANGLE_no_vulkan" ] 1310 public_configs = [ ":angle_frame_capture_disabled" ] 1311 1312 # gl_enum_utils defaults included in with_capture build 1313 deps = [ ":angle_frame_capture_mock" ] 1314 if (angle_enable_trace || is_debug) { 1315 deps += [ ":angle_gl_enum_utils" ] 1316 } 1317 } 1318 1319 if (angle_has_frame_capture) { 1320 angle_source_set("${target_name}_with_capture") { 1321 public_deps = invoker.public_deps + [ 1322 ":angle_gl_enum_utils", 1323 ":libANGLE_no_vulkan", 1324 ] 1325 deps = [ 1326 ":angle_capture_common", 1327 ":angle_compression", 1328 ] 1329 public_configs = [ ":angle_frame_capture_enabled" ] 1330 sources = libangle_capture_sources 1331 1332 if (angle_has_rapidjson) { 1333 public_deps += [ ":angle_json_serializer" ] 1334 sources += [ "src/libANGLE/capture/serialize.cpp" ] 1335 } else { 1336 sources += [ "src/libANGLE/capture/serialize_mock.cpp" ] 1337 } 1338 } 1339 } 1340} 1341 1342libANGLE_template("libANGLE") { 1343 public_deps = [] 1344 if (angle_enable_vulkan) { 1345 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ] 1346 } 1347} 1348 1349if (angle_enable_vulkan) { 1350 libANGLE_template("libANGLE_vulkan_secondaries") { 1351 public_deps = 1352 [ "src/libANGLE/renderer/vulkan:angle_vulkan_secondaries_backend" ] 1353 } 1354} 1355 1356config("shared_library_public_config") { 1357 if (is_mac && !is_component_build) { 1358 # Executable targets that depend on the shared libraries below need to have 1359 # the rpath setup in non-component build configurations. 1360 ldflags = [ 1361 "-rpath", 1362 "@executable_path/", 1363 ] 1364 if (build_with_chromium) { 1365 ldflags += [ 1366 # Path for loading shared libraries for unbundled binaries. 1367 # From //build/config/mac/BUILD.gn, this is only added for 1368 # component builds. However, since ANGLE always dynamically 1369 # links to libvulkan, it should be re-added for non-component 1370 # builds. (anglebug.com/4455) 1371 "-Wl,-rpath,@loader_path/.", 1372 ] 1373 } 1374 } 1375 1376 if (angle_is_winuwp && !angle_is_winappsdk) { 1377 ldflags = [ 1378 "/APPCONTAINER", 1379 1380 # Disable warning about invalid subsystem number. 1381 # A default appropriate subsystem is selected automatically. 1382 "/IGNORE:4010", 1383 ] 1384 } 1385} 1386 1387if (angle_expose_wgl_entry_points) { 1388 _angle_glesv2_library_name = "opengl32${angle_libs_suffix}" 1389} else { 1390 _angle_glesv2_library_name = "libGLESv2${angle_libs_suffix}" 1391} 1392_angle_glesv2_vulkan_secondaries_library_name = 1393 "libGLESv2_vulkan_secondaries${angle_libs_suffix}" 1394 1395config("library_name_config") { 1396 _egllib = "libEGL${angle_libs_suffix}" 1397 _vk2egllib = "libEGL_vulkan_secondaries${angle_libs_suffix}" 1398 defines = [ 1399 "ANGLE_EGL_LIBRARY_NAME=\"${_egllib}\"", 1400 "ANGLE_GLESV2_LIBRARY_NAME=\"${_angle_glesv2_library_name}\"", 1401 "ANGLE_MESA_EGL_LIBRARY_NAME=\"mesa/src/egl/libEGL\"", 1402 "ANGLE_MESA_GLESV2_LIBRARY_NAME=\"mesa/src/mapi/es2api/libGLESv2\"", 1403 "ANGLE_VULKAN_SECONDARIES_EGL_LIBRARY_NAME=\"${_vk2egllib}\"", 1404 "ANGLE_VULKAN_SECONDARIES_GLESV2_LIBRARY_NAME=\"${_angle_glesv2_vulkan_secondaries_library_name}\"", 1405 ] 1406} 1407 1408# This config controls export definitions on ANGLE API calls. 1409config("angle_static_config") { 1410 defines = [ 1411 "ANGLE_EXPORT=", 1412 "ANGLE_STATIC=1", 1413 "ANGLE_UTIL_EXPORT=", 1414 "EGLAPI=", 1415 "GL_APICALL=", 1416 "GL_API=", 1417 ] 1418} 1419 1420set_defaults("angle_libGLESv2") { 1421 sources = [] 1422 output_name = "libGLESv2" 1423} 1424 1425template("angle_libGLESv2") { 1426 angle_shared_library(target_name) { 1427 sources = invoker.sources + libglesv2_sources 1428 deps = invoker.deps + [ ":includes" ] 1429 defines = [ "LIBGLESV2_IMPLEMENTATION" ] 1430 1431 output_name = "${invoker.output_name}${angle_libs_suffix}" 1432 if (angle_glesv2_extension != "") { 1433 output_extension = angle_glesv2_extension 1434 } 1435 1436 configs += [ 1437 ":angle_gl_visibility_config", 1438 ":debug_annotations_config", 1439 ":gl_prototypes", 1440 ] 1441 1442 if (angle_enable_gl_desktop_frontend) { 1443 sources += libglesv2_gl_sources 1444 defines += [ "ANGLE_ENABLE_GL_DESKTOP_FRONTEND" ] 1445 if (angle_expose_wgl_entry_points) { 1446 sources += [ 1447 "src/libGLESv2/entry_points_wgl.cpp", 1448 "src/libGLESv2/entry_points_wgl.h", 1449 "src/libGLESv2/proc_table_wgl.h", 1450 "src/libGLESv2/proc_table_wgl_autogen.cpp", 1451 ] 1452 defines += [ "ANGLE_EXPOSE_WGL_ENTRY_POINTS" ] 1453 } else if (angle_expose_glx_entry_points) { 1454 sources += [ 1455 "src/libGLESv2/entry_points_glx.cpp", 1456 "src/libGLESv2/entry_points_glx.h", 1457 "src/libGLESv2/proc_table_glx.h", 1458 "src/libGLESv2/proc_table_glx_autogen.cpp", 1459 ] 1460 } else { 1461 #TODO(http://anglebug.com/7533): Add CGL entry points for mac support 1462 } 1463 } 1464 1465 if (angle_enable_cl) { 1466 sources += libglesv2_cl_sources 1467 } 1468 1469 if (is_win) { 1470 if (angle_expose_wgl_entry_points) { 1471 sources += [ "src/libGLESv2/opengl32_with_wgl_autogen.def" ] 1472 } else { 1473 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ] 1474 } 1475 sources += [ "src/libGLESv2/libGLESv2.rc" ] 1476 deps += [ ":angle_version" ] 1477 } 1478 } 1479} 1480 1481angle_libGLESv2("libGLESv2") { 1482 if (angle_with_capture_by_default) { 1483 deps = [ ":libANGLE_with_capture" ] 1484 } else { 1485 deps = [ ":libANGLE" ] 1486 } 1487} 1488 1489if (angle_enable_vulkan) { 1490 angle_libGLESv2("libGLESv2_vulkan_secondaries") { 1491 output_name = "libGLESv2_vulkan_secondaries" 1492 if (angle_with_capture_by_default) { 1493 deps = [ ":libANGLE_vulkan_secondaries_with_capture" ] 1494 } else { 1495 deps = [ ":libANGLE_vulkan_secondaries" ] 1496 } 1497 } 1498} 1499 1500# Output capture lib when `angle_with_capture_by_default` disabled, vice versa. 1501if (angle_has_frame_capture) { 1502 angle_libGLESv2("libGLESv2_capture_complement") { 1503 if (angle_with_capture_by_default) { 1504 deps = [ ":libANGLE" ] 1505 output_name += "_no_capture" 1506 } else { 1507 deps = [ ":libANGLE_with_capture" ] 1508 output_name += "_with_capture" 1509 } 1510 } 1511} 1512 1513if (angle_enable_gl_desktop_frontend) { 1514 angle_libGLESv2("libGL") { 1515 if (is_win) { 1516 output_name = "opengl32" 1517 } else { 1518 output_name = "libGL" 1519 } 1520 1521 deps = [ ":libANGLE" ] 1522 } 1523} 1524 1525angle_static_library("libGLESv2_static") { 1526 sources = libglesv2_sources 1527 if (angle_enable_gl_desktop_frontend) { 1528 sources += libglesv2_gl_sources 1529 defines = [ "ANGLE_ENABLE_GL_DESKTOP_FRONTEND" ] 1530 if (angle_expose_wgl_entry_points) { 1531 sources += [ 1532 "src/libGLESv2/entry_points_wgl.cpp", 1533 "src/libGLESv2/entry_points_wgl.h", 1534 "src/libGLESv2/proc_table_wgl.h", 1535 "src/libGLESv2/proc_table_wgl_autogen.cpp", 1536 ] 1537 defines += [ "ANGLE_EXPOSE_WGL_ENTRY_POINTS" ] 1538 } else if (angle_expose_glx_entry_points) { 1539 sources += [ 1540 "src/libGLESv2/entry_points_glx.cpp", 1541 "src/libGLESv2/entry_points_glx.h", 1542 "src/libGLESv2/proc_table_glx.h", 1543 "src/libGLESv2/proc_table_glx_autogen.cpp", 1544 ] 1545 } else { 1546 #TODO(http://anglebug.com/7533): Add CGL entry points for mac support 1547 } 1548 } 1549 if (angle_enable_cl) { 1550 sources += libglesv2_cl_sources 1551 } 1552 configs += [ ":debug_annotations_config" ] 1553 1554 public_configs += [ ":angle_static_config" ] 1555 deps = [ ":includes" ] 1556 public_deps = [ ":libANGLE" ] 1557} 1558 1559angle_shared_library("libGLESv1_CM") { 1560 sources = libglesv1_cm_sources 1561 output_name = "libGLESv1_CM${angle_libs_suffix}" 1562 1563 configs += [ 1564 ":angle_gl_visibility_config", 1565 ":debug_annotations_config", 1566 ":gl_prototypes", 1567 ] 1568 1569 defines = [] 1570 1571 deps = [ 1572 ":includes", 1573 ":libGLESv2", 1574 ] 1575 1576 if (is_win) { 1577 sources += [ "src/libGLESv1_CM/libGLESv1_CM.def" ] 1578 deps += [ ":angle_version" ] 1579 } 1580} 1581 1582config("libEGL_egl_loader_config") { 1583 defines = [ "ANGLE_USE_EGL_LOADER" ] 1584} 1585 1586angle_source_set("libEGL_egl_loader") { 1587 sources = [ 1588 "src/libEGL/egl_loader_autogen.cpp", 1589 "src/libEGL/egl_loader_autogen.h", 1590 ] 1591 1592 public_configs += [ 1593 ":libEGL_egl_loader_config", 1594 ":gl_prototypes", 1595 ] 1596 1597 deps = [ ":includes" ] 1598} 1599 1600set_defaults("libEGL_template") { 1601 sources = [] 1602 deps = [] 1603 public_configs = [] 1604} 1605 1606template("libEGL_template") { 1607 target(invoker.target_type, target_name) { 1608 forward_variables_from(invoker, "*") 1609 sources += libegl_sources 1610 configs += [ 1611 ":debug_annotations_config", 1612 ":library_name_config", 1613 ] 1614 deps += [ ":includes" ] 1615 } 1616} 1617 1618template("libEGL_shared_template") { 1619 libEGL_template(target_name) { 1620 target_type = "angle_shared_library" 1621 output_name = "${invoker.output_name}${angle_libs_suffix}" 1622 if (angle_egl_extension != "") { 1623 output_extension = angle_egl_extension 1624 } 1625 1626 defines = invoker.defines + [ "LIBEGL_IMPLEMENTATION" ] 1627 if (is_win) { 1628 defines += [ "EGLAPI=" ] 1629 } else { 1630 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ] 1631 } 1632 1633 deps = [ 1634 ":angle_common", 1635 ":libEGL_egl_loader", 1636 ] 1637 1638 sources += invoker.sources 1639 1640 if (is_win) { 1641 sources += [ "src/libEGL/libEGL.rc" ] 1642 deps += [ ":angle_version" ] 1643 } 1644 1645 data_deps = [ ":${invoker.gles_library}" ] 1646 } 1647} 1648 1649libEGL_shared_template("libEGL") { 1650 defines = [ "ANGLE_DISPATCH_LIBRARY=\"${_angle_glesv2_library_name}\"" ] 1651 output_name = "libEGL" 1652 gles_library = "libGLESv2" 1653 sources = [] 1654 if (is_win) { 1655 sources += [ "src/libEGL/libEGL_autogen.def" ] 1656 } 1657} 1658 1659if (angle_enable_vulkan) { 1660 libEGL_shared_template("libEGL_vulkan_secondaries") { 1661 defines = [ "ANGLE_DISPATCH_LIBRARY=\"${_angle_glesv2_vulkan_secondaries_library_name}\"" ] 1662 output_name = "libEGL_vulkan_secondaries" 1663 gles_library = "libGLESv2_vulkan_secondaries" 1664 sources = [] 1665 if (is_win) { 1666 sources += [ "src/libEGL/libEGL_vulkan_secondaries_autogen.def" ] 1667 } 1668 } 1669} 1670 1671libEGL_template("libEGL_static") { 1672 target_type = "angle_static_library" 1673 public_configs = [ ":angle_static_config" ] 1674 deps = [ ":libGLESv2_static" ] 1675} 1676 1677# Convenience targets for some of the samples so they can be built 1678# with Chromium's toolchain. 1679angle_executable("angle_shader_translator") { 1680 testonly = true 1681 1682 sources = [ "samples/shader_translator/shader_translator.cpp" ] 1683 1684 deps = [ ":translator" ] 1685 1686 defines = [] 1687 1688 if (angle_enable_vulkan) { 1689 deps += [ 1690 "${angle_spirv_tools_dir}:spvtools_headers", 1691 "${angle_spirv_tools_dir}:spvtools_val", 1692 ] 1693 1694 defines += [ "ANGLE_ENABLE_VULKAN" ] 1695 } 1696} 1697 1698if (angle_standalone || build_with_chromium) { 1699 config("angle_feature_support_config") { 1700 include_dirs = [ 1701 "include", 1702 "src", 1703 ] 1704 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ] 1705 if (is_debug) { 1706 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ] 1707 } 1708 } 1709 1710 angle_shared_library("libfeature_support") { 1711 output_name = "libfeature_support${angle_libs_suffix}" 1712 1713 if (is_android) { 1714 libs = [ "log" ] 1715 } 1716 1717 configs += [ 1718 ":angle_feature_support_config", 1719 "${angle_jsoncpp_dir}:jsoncpp_config", 1720 ] 1721 1722 if (is_apple && !is_component_build) { 1723 ldflags = [ 1724 "-install_name", 1725 "@rpath/${target_name}.dylib", 1726 ] 1727 } 1728 1729 sources = [ 1730 "src/feature_support_util/feature_support_util.cpp", 1731 "src/feature_support_util/feature_support_util.h", 1732 ] 1733 1734 deps = [ 1735 ":angle_gpu_info_util", 1736 "${angle_jsoncpp_dir}:jsoncpp", 1737 ] 1738 } 1739} 1740 1741if (angle_enable_cgl) { 1742 config("supports_automatic_graphics_switching") { 1743 # For discussion about config, inputs, etc, see: 1744 # https://bugs.chromium.org/p/chromium/issues/detail?id=781858 1745 _plist_file = "util/osx/supports_automatic_graphics_switching.plist" 1746 inputs = [ _plist_file ] 1747 ldflags = [ 1748 "-sectcreate", 1749 "__TEXT", 1750 "__info_plist", 1751 rebase_path(_plist_file, root_build_dir), 1752 ] 1753 } 1754} 1755 1756if (is_android && symbol_level != 0) { 1757 action_foreach("compressed_symbols") { 1758 sources = [] 1759 foreach(_library, angle_libraries) { 1760 sources += [ "$root_out_dir/$_library$angle_libs_suffix$shlib_extension" ] 1761 } 1762 if (angle_enable_vulkan_validation_layers) { 1763 foreach(_layer, vulkan_validation_layers) { 1764 sources += [ "$root_out_dir/lib$_layer$shlib_extension" ] 1765 } 1766 } 1767 1768 script = rebase_path("${root_build_dir}/android/compress_symbols.py", 1769 root_build_dir) 1770 1771 deps = [] 1772 foreach(_library, angle_libraries) { 1773 deps += [ ":$_library" ] 1774 } 1775 1776 if (angle_enable_vulkan_validation_layers) { 1777 foreach(_layer, vulkan_validation_layers) { 1778 deps += [ "$angle_vulkan_validation_layers_dir:${_layer}" ] 1779 } 1780 } 1781 1782 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ] 1783 1784 android_nm = "${android_tool_prefix}nm" 1785 android_strip = "${android_tool_prefix}strip" 1786 1787 args = [ 1788 "--objcopy", 1789 rebase_path(android_objcopy, root_build_dir), 1790 "--nm", 1791 rebase_path(android_nm, root_build_dir), 1792 "--strip", 1793 rebase_path(android_strip, root_build_dir), 1794 "--unstrippedsofile", 1795 "{{source_dir}}/lib.unstripped/{{source_file_part}}", 1796 "--output", 1797 "{{source_dir}}/lib.compressed/{{source_file_part}}", 1798 ] 1799 } 1800} 1801 1802if ((angle_standalone || build_with_chromium) && is_android && 1803 current_toolchain == default_toolchain) { 1804 apk_version_code = "0" 1805 if (angle_enable_commit_id) { 1806 apk_version_code = 1807 exec_script("src/commit_id.py", [ "position" ], "trim string") 1808 } 1809 1810 # Package ANGLE libraries for normal use on Android 1811 angle_apk("angle_chromium_apk") { 1812 package_name = "org.chromium.angle" 1813 apk_name = "AngleLibraries" 1814 version_name = "ANGLE Developer Build" 1815 version_code = apk_version_code 1816 } 1817 1818 # Package ANGLE libraries for AGI use on Android 1819 angle_apk("angle_agi_chromium_apk") { 1820 package_name = "org.chromium.angle.agi" 1821 apk_name = "AngleAgiLibraries" 1822 version_name = "ANGLE AGI Build" 1823 version_code = apk_version_code 1824 } 1825 1826 group("angle_apks") { 1827 deps = [ 1828 ":angle_agi_chromium_apk", 1829 ":angle_chromium_apk", 1830 ] 1831 } 1832} 1833 1834if (install_prefix != "") { 1835 template("install_target") { 1836 install_deps = [] 1837 1838 foreach(_lib, invoker.libs) { 1839 install_deps += [ ":install_${_lib}" ] 1840 1841 source = "${root_build_dir}/${_lib}${angle_libs_suffix}${shlib_extension}" 1842 1843 action("install_${_lib}") { 1844 deps = [ ":${_lib}" ] 1845 script = "scripts/install_target.py" 1846 sources = [ source ] 1847 1848 outputs = [ "${target_gen_dir}/install_${_lib}.stamp" ] 1849 args = [ 1850 "--name", 1851 _lib, 1852 "--prefix", 1853 "$install_prefix", 1854 "--libs", 1855 rebase_path(source), 1856 ] 1857 } 1858 } 1859 1860 install_deps += [ ":install_includes" ] 1861 action("install_includes") { 1862 script = "scripts/install_target.py" 1863 configs = invoker.configs 1864 1865 outputs = [ "${target_gen_dir}/install_${target_name}.stamp" ] 1866 args = [ 1867 "--prefix", 1868 "$install_prefix", 1869 "{{include_dirs}}", 1870 ] 1871 } 1872 1873 group("install_${target_name}") { 1874 deps = install_deps 1875 } 1876 } 1877 1878 install_target("angle") { 1879 libs = [ 1880 "libEGL", 1881 "libGLESv1_CM", 1882 "libGLESv2", 1883 ] 1884 configs = [ ":includes_config" ] 1885 } 1886} 1887 1888group("angle") { 1889 data_deps = [ 1890 ":libEGL", 1891 ":libGLESv1_CM", 1892 ":libGLESv2", 1893 ] 1894 if (angle_enable_vulkan) { 1895 data_deps += [ 1896 ":libEGL_vulkan_secondaries", 1897 ":libGLESv2_vulkan_secondaries", 1898 ] 1899 } 1900 if (is_ios) { 1901 # Need to bundle the libraries inside the .app. 1902 deps = data_deps 1903 } 1904} 1905 1906group("angle_static") { 1907 public_deps = [ 1908 ":libEGL_static", 1909 ":libGLESv2_static", 1910 ":preprocessor", 1911 ":translator", 1912 ] 1913} 1914