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 use_x11 variable 6import("gni/angle.gni") 7if (angle_has_build) { 8 import("//build/config/linux/pkg_config.gni") 9 import("//build/config/ui.gni") 10 import("//testing/libfuzzer/fuzzer_test.gni") 11 12 if (is_android) { 13 # android/rules.gni can only be imported for Android targets 14 import("//build/config/android/config.gni") 15 import("//build/config/android/rules.gni") 16 import("android/angle_apk.gni") 17 } 18} 19 20declare_args() { 21 # Use the PCI lib to collect GPU information on Linux. 22 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) && 23 (angle_use_x11 || use_ozone) 24 25 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md. 26 angle_link_glx = false 27 28 # Defaults to capture building to $root_out_dir/angle_libs/with_capture. 29 # Switch on to build capture to $root_out_dir. 30 angle_with_capture_by_default = false 31 32 # Don't build extra (test, samples etc) for Windows UWP. We don't have 33 # infrastructure (e.g. windowing helper functions) in place to run them. 34 angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build 35 36 # Enable generating current commit information using git 37 angle_enable_commit_id = true 38} 39 40if (angle_build_all) { 41 group("all") { 42 testonly = true 43 deps = [ 44 ":angle", 45 ":angle_shader_translator", 46 ":translator_fuzzer", 47 ":xxhash_fuzzer", 48 "$angle_root/samples:angle_samples", 49 "$angle_root/src/tests:angle_tests", 50 ] 51 } 52} 53 54if (ozone_platform_gbm) { 55 pkg_config("libdrm") { 56 packages = [ "libdrm" ] 57 } 58} 59 60import("src/compiler.gni") 61import("src/libGLESv2.gni") 62 63# This config is exported to dependent targets (and also applied to internal 64# ones). 65config("external_config") { 66 include_dirs = [ "include" ] 67} 68 69# Prevent the GL headers from redeclaring ANGLE entry points. 70config("no_gl_prototypes") { 71 defines = [ 72 "GL_GLES_PROTOTYPES=0", 73 "EGL_EGL_PROTOTYPES=0", 74 ] 75} 76 77config("gl_prototypes") { 78 defines = [ 79 "GL_GLES_PROTOTYPES=1", 80 "EGL_EGL_PROTOTYPES=1", 81 "GL_GLEXT_PROTOTYPES", 82 "EGL_EGLEXT_PROTOTYPES", 83 ] 84} 85 86# This config is applied to internal Angle targets (not pushed to dependents). 87config("internal_config") { 88 include_dirs = [ 89 "include", 90 "src", 91 ] 92 93 defines = [] 94 95 if (angle_64bit_current_cpu) { 96 defines += [ "ANGLE_IS_64_BIT_CPU" ] 97 } else { 98 defines += [ "ANGLE_IS_32_BIT_CPU" ] 99 } 100 101 if (angle_enable_trace) { 102 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ] 103 } 104 105 if (is_chromeos) { 106 defines += [ "ANGLE_PLATFORM_CHROMEOS" ] 107 } 108 109 if (is_ggp) { 110 defines += [ "__ggp__" ] 111 } 112} 113 114config("constructor_and_destructor_warnings") { 115 if (is_clang) { 116 cflags = [ 117 "-Wexit-time-destructors", 118 "-Wglobal-constructors", 119 ] 120 } 121} 122 123config("extra_warnings") { 124 cflags = [] 125 126 # Enable more default warnings on Windows. 127 if (is_win) { 128 cflags += [ 129 "/we4244", # Conversion: possible loss of data. 130 "/we4456", # Variable shadowing. 131 "/we4458", # declaration hides class member. 132 "/we4715", # not all control paths return a value 133 "/we4800", # forcing value to bool. 134 "/we4838", # narrowing conversion. 135 ] 136 } 137 if (is_clang) { 138 cflags += [ 139 "-Wconditional-uninitialized", 140 "-Wextra-semi-stmt", 141 "-Wfloat-conversion", 142 "-Winconsistent-missing-destructor-override", 143 "-Wmissing-field-initializers", 144 "-Wnon-virtual-dtor", 145 "-Wredundant-parens", 146 "-Wshadow-field", 147 "-Wtautological-type-limit-compare", 148 "-Wundefined-reinterpret-cast", 149 "-Wunneeded-internal-declaration", 150 151 # The below warnings are used by WebKit. We enable them to make rolling 152 # ANGLE in WebKit easier. 153 "-Wparentheses", 154 "-Wrange-loop-analysis", 155 "-Wstrict-prototypes", 156 "-Wunreachable-code", 157 "-Wshorten-64-to-32", 158 ] 159 } 160 161 if (angle_is_winuwp) { 162 cflags += [ "/wd4447" ] # 'main' signature found without threading model. 163 } 164} 165 166# This config adds build-ids to the associated library. 167# -Wl is a special option that indicates that clang should pass the associated 168# option --build-id to the linker. This will cause a build-id section to be added 169# to the associated library. The build-id makes it possible for a debugger to 170# find the right symbol file to use. 171config("build_id_config") { 172 ldflags = [ "-Wl,--build-id" ] 173} 174 175# Useful for more informative stack traces. 176config("better_linux_stack_traces") { 177 if (angle_better_stack_traces) { 178 ldflags = [ "-Wl,--export-dynamic" ] 179 } 180} 181 182_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64" 183 184# Windows ARM64 is available since 10.0.16299 so no need to copy 185# d3dcompiler_47.dll because this file is available as inbox. 186if (_use_copy_compiler_dll) { 187 # We also ship an older DLL for compatiblity with Windows 7 machines without 188 # the UCRT. This DLL isn't available in the standard SDK distribution. 189 _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll" 190 _has_old_compiler = 191 exec_script("scripts/file_exists.py", [ _old_compiler ], "value") 192 193 copy("copy_compiler_dll") { 194 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ] 195 196 if (_has_old_compiler) { 197 sources += [ _old_compiler ] 198 } 199 200 outputs = [ "$root_out_dir/{{source_file_part}}" ] 201 } 202} 203 204# Holds the shared includes so we only need to list them once. 205config("includes_config") { 206 include_dirs = [ "include" ] 207} 208 209angle_source_set("includes") { 210 sources = libangle_includes 211 public_configs = [ ":includes_config" ] 212} 213 214angle_static_library("preprocessor") { 215 sources = angle_preprocessor_sources 216 217 public_deps = [ 218 ":angle_common", 219 ":angle_translator_headers", 220 ] 221} 222 223config("angle_disable_pool_alloc") { 224 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ] 225} 226 227config("debug_annotations_config") { 228 if (is_debug) { 229 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ] 230 } 231} 232 233config("angle_release_asserts_config") { 234 if (dcheck_always_on) { 235 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ] 236 } 237} 238 239config("angle_common_config") { 240 include_dirs = [ "src/common/third_party/base" ] 241 if (is_android) { 242 libs = [ "log" ] 243 } 244} 245 246angle_source_set("angle_system_utils") { 247 sources = angle_system_utils_sources 248} 249 250angle_source_set("xxhash") { 251 sources = xxhash_sources 252} 253 254if (angle_has_build) { 255 fuzzer_test("xxhash_fuzzer") { 256 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ] 257 deps = [ ":xxhash" ] 258 } 259} 260 261angle_static_library("angle_common") { 262 sources = libangle_common_sources 263 264 configs += [ 265 ":angle_common_config", 266 ":debug_annotations_config", 267 ] 268 269 deps = [ ":xxhash" ] 270 271 public_deps = [ 272 ":angle_system_utils", 273 ":angle_version", 274 ":includes", 275 ] 276 public_configs += [ ":angle_common_config" ] 277 if (angle_has_build && use_fuzzing_engine) { 278 all_dependent_configs = [ ":angle_disable_pool_alloc" ] 279 } 280} 281 282config("angle_image_util_config") { 283 include_dirs = [ 284 "include", 285 "src", 286 ] 287} 288 289angle_source_set("angle_image_util_headers") { 290 sources = libangle_image_util_headers 291 public_deps = [ ":angle_common" ] 292} 293 294angle_static_library("angle_image_util") { 295 sources = libangle_image_util_sources 296 public_configs += [ ":angle_image_util_config" ] 297 public_deps = [ ":angle_image_util_headers" ] 298} 299 300config("angle_gl_visibility_config") { 301 if (is_win) { 302 defines = [ 303 "GL_APICALL=", 304 "GL_API=", 305 ] 306 } else { 307 defines = [ 308 "GL_APICALL=__attribute__((visibility(\"default\")))", 309 "GL_API=__attribute__((visibility(\"default\")))", 310 ] 311 } 312} 313 314config("angle_gpu_info_util_config") { 315 include_dirs = [ 316 "include", 317 "src", 318 ] 319} 320 321angle_static_library("angle_gpu_info_util") { 322 public_configs += [ 323 ":angle_gpu_info_util_config", 324 ":angle_backend_config", 325 ] 326 public_deps = [ ":angle_common" ] 327 sources = libangle_gpu_info_util_sources 328 deps = [] 329 libs = [] 330 defines = [] 331 332 if (is_android || is_fuchsia) { 333 sources += libangle_gpu_info_util_vulkan_sources 334 deps += [ "$angle_root/third_party/vulkan-headers/src:vulkan_headers" ] 335 } 336 337 if (is_android) { 338 sources += libangle_gpu_info_util_android_sources 339 } 340 341 if (is_fuchsia) { 342 sources += libangle_gpu_info_util_fuchsia_sources 343 deps += 344 [ "$angle_root/src/libANGLE/renderer/vulkan:angle_vulkan_entry_points" ] 345 } 346 347 if (is_win) { 348 sources += libangle_gpu_info_util_win_sources 349 if (!angle_is_winuwp) { 350 libs += [ "setupapi.lib" ] 351 } 352 libs += [ "dxgi.lib" ] 353 } 354 355 if (is_linux) { 356 sources += libangle_gpu_info_util_linux_sources 357 358 if (angle_use_x11) { 359 sources += libangle_gpu_info_util_x11_sources 360 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ] 361 defines += [ "GPU_INFO_USE_X11" ] 362 libs += [ 363 "X11", 364 "Xi", 365 "Xext", 366 ] 367 } 368 } 369 370 if (use_libpci) { 371 sources += libangle_gpu_info_util_libpci_sources 372 defines += [ "GPU_INFO_USE_LIBPCI" ] 373 libs += [ "pci" ] 374 } 375 376 if (is_mac) { 377 sources += libangle_gpu_info_util_mac_sources 378 libs += [ 379 "IOKit.framework", 380 "CoreFoundation.framework", 381 "CoreGraphics.framework", 382 "OpenGL.framework", 383 ] 384 } 385} 386 387angle_source_set("angle_translator_headers") { 388 sources = angle_translator_exported_headers 389 public_deps = [ ":includes" ] 390} 391 392angle_static_library("translator") { 393 sources = angle_translator_sources 394 defines = [] 395 396 if (angle_enable_essl || use_fuzzing_engine) { 397 sources += angle_translator_essl_sources 398 defines += [ "ANGLE_ENABLE_ESSL" ] 399 } 400 401 if (angle_enable_glsl || use_fuzzing_engine) { 402 sources += angle_translator_glsl_sources 403 defines += [ "ANGLE_ENABLE_GLSL" ] 404 } 405 406 if (angle_enable_hlsl || use_fuzzing_engine) { 407 sources += angle_translator_hlsl_sources 408 defines += [ "ANGLE_ENABLE_HLSL" ] 409 } 410 411 if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) { 412 # This translator is needed by metal backend also. 413 sources += angle_translator_lib_vulkan_sources 414 } 415 416 if (angle_enable_vulkan || use_fuzzing_engine) { 417 defines += [ "ANGLE_ENABLE_VULKAN" ] 418 } 419 420 if (angle_enable_metal) { 421 sources += angle_translator_lib_metal_sources 422 defines += [ "ANGLE_ENABLE_METAL" ] 423 } 424 425 if (angle_enable_swiftshader) { 426 defines += [ "ANGLE_ENABLE_SWIFTSHADER" ] 427 } 428 429 public_configs += [ ":external_config" ] 430 431 deps = [ 432 ":includes", 433 ":preprocessor", 434 ] 435 436 public_deps = [ 437 ":angle_common", 438 ":angle_translator_headers", 439 ] 440 441 if (is_win) { 442 # Necessary to suppress some system header xtree warnigns in Release. 443 # For some reason this warning doesn't get triggered in Chromium 444 cflags = [ "/wd4718" ] 445 } 446} 447 448angle_source_set("translator_fuzzer") { 449 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ] 450 451 include_dirs = [ 452 "include", 453 "src", 454 ] 455 456 deps = [ ":translator" ] 457} 458 459config("commit_id_config") { 460 include_dirs = [ "$root_gen_dir/angle" ] 461 visibility = [ ":commit_id" ] 462} 463 464commit_id_output_file = "$root_gen_dir/angle/commit.h" 465action("commit_id") { 466 script = "src/commit_id.py" 467 outputs = [ commit_id_output_file ] 468 469 # Add git as a dependency if it is available. 470 if (angle_enable_commit_id && 471 exec_script("src/commit_id.py", [ "check" ], "value") == 1) { 472 # commit id should depend on angle's HEAD revision 473 inputs = [ ".git/HEAD" ] 474 } 475 476 args = [ 477 "gen", 478 rebase_path(commit_id_output_file, root_build_dir), 479 ] 480 481 public_configs = [ ":commit_id_config" ] 482} 483 484angle_source_set("angle_version") { 485 sources = [ "src/common/version.h" ] 486 public_deps = [ ":commit_id" ] 487} 488 489config("angle_backend_config") { 490 defines = [] 491 492 if (angle_enable_d3d9) { 493 defines += [ "ANGLE_ENABLE_D3D9" ] 494 } 495 if (angle_enable_d3d11) { 496 defines += [ "ANGLE_ENABLE_D3D11" ] 497 } 498 if (angle_enable_gl) { 499 defines += [ "ANGLE_ENABLE_OPENGL" ] 500 if (angle_enable_gl_null) { 501 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ] 502 } 503 } 504 if (angle_enable_null) { 505 defines += [ "ANGLE_ENABLE_NULL" ] 506 } 507 508 configs = [] 509 510 if (angle_enable_metal) { 511 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ] 512 } 513 514 if (angle_enable_vulkan) { 515 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ] 516 } 517} 518 519config("libANGLE_config") { 520 cflags = [] 521 defines = [] 522 libs = [] 523 ldflags = [] 524 if (angle_enable_d3d9) { 525 ldflags += [ "/DELAYLOAD:d3d9.dll" ] 526 } 527 defines += [ "LIBANGLE_IMPLEMENTATION" ] 528 529 if (is_win) { 530 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics 531 # are not enabled. 532 } 533 534 if (is_android && (angle_enable_gl || angle_enable_vulkan)) { 535 # In API level 26 ANativeWindow APIs were moved from libandroid.so 536 # into a separate library, libnativewindow.so 537 if (ndk_api_level_at_least_26) { 538 libs += [ "nativewindow" ] 539 } else { 540 libs += [ "android" ] 541 } 542 } 543 544 if (angle_use_x11) { 545 defines += [ "ANGLE_USE_X11" ] 546 } 547 548 if (angle_enable_overlay) { 549 defines += [ "ANGLE_ENABLE_OVERLAY=1" ] 550 } 551} 552 553angle_source_set("libANGLE_headers") { 554 sources = libangle_headers 555 public_deps = [ 556 ":angle_common", 557 ":angle_translator_headers", 558 ] 559 public_configs += [ ":libANGLE_config" ] 560} 561 562# Don't even try to build glslang if Metal and Vulkan are disabled. 563if (angle_enable_vulkan || angle_enable_metal) { 564 angle_source_set("angle_glslang_wrapper") { 565 sources = [ 566 "src/libANGLE/renderer/glslang_wrapper_utils.cpp", 567 "src/libANGLE/renderer/glslang_wrapper_utils.h", 568 ] 569 deps = [ 570 ":libANGLE_headers", 571 "${angle_glslang_dir}:glslang_default_resource_limits_sources", 572 "${angle_glslang_dir}:glslang_sources", 573 "${angle_spirv_headers_dir}:spv_headers", 574 "${angle_spirv_tools_dir}:spvtools_headers", 575 ] 576 } 577} 578 579angle_source_set("libANGLE_base") { 580 sources = libangle_sources 581 582 include_dirs = [] 583 libs = [] 584 defines = [] 585 if (angle_link_glx) { 586 libs += [ "GL" ] 587 defines += [ "ANGLE_LINK_GLX" ] 588 } 589 public_deps = [ 590 ":angle_common", 591 ":angle_gpu_info_util", 592 ":angle_version", 593 ":libANGLE_headers", 594 ":translator", 595 ] 596 deps = [ 597 ":angle_image_util", 598 ":includes", 599 ] 600 601 if (is_win) { 602 if (angle_enable_d3d9) { 603 libs += [ "delayimp.lib" ] 604 } 605 libs += [ 606 "gdi32.lib", 607 "user32.lib", 608 ] 609 } 610 611 if (angle_enable_vulkan) { 612 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ] 613 } 614 615 if (angle_enable_metal) { 616 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ] 617 } 618 619 # Enable extra Chromium style warnings for libANGLE. 620 if (is_clang && angle_has_build) { 621 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ] 622 } 623 624 # Shared D3D sources. 625 if (angle_enable_d3d9 || angle_enable_d3d11) { 626 sources += libangle_d3d_shared_sources 627 628 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ] 629 } 630 631 if (angle_enable_d3d9) { 632 sources += libangle_d3d9_sources 633 libs += [ "d3d9.lib" ] 634 } 635 636 if (angle_enable_d3d11) { 637 sources += libangle_d3d11_sources 638 639 if (angle_is_winuwp) { 640 sources += libangle_d3d11_winuwp_sources 641 } else { 642 sources += libangle_d3d11_win32_sources 643 } 644 645 libs += [ "dxguid.lib" ] 646 import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni") 647 sources += libangle_d3d11_blit_shaders 648 } 649 650 if (angle_enable_gl) { 651 sources += libangle_gl_sources 652 include_dirs += [ "src/third_party/khronos" ] 653 654 if (angle_enable_gl_null) { 655 sources += libangle_gl_null_sources 656 } 657 if (is_win) { 658 sources += libangle_gl_wgl_sources 659 } 660 if (angle_use_x11) { 661 sources += libangle_gl_glx_sources 662 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ] 663 libs += [ 664 "X11", 665 "Xi", 666 "Xext", 667 ] 668 } 669 if (is_mac) { 670 sources += libangle_gl_cgl_sources 671 libs += [ 672 "Cocoa.framework", 673 "IOSurface.framework", 674 "OpenGL.framework", 675 "QuartzCore.framework", 676 ] 677 } 678 if (is_android) { 679 sources += libangle_gl_egl_sources 680 sources += libangle_gl_egl_dl_sources 681 sources += libangle_gl_egl_android_sources 682 } 683 if (is_linux) { 684 sources += libangle_gl_egl_sources 685 sources += libangle_gl_egl_dl_sources 686 } 687 if (ozone_platform_gbm) { 688 configs += [ ":libdrm" ] 689 defines += [ "ANGLE_USE_OZONE" ] 690 deps += [ "//third_party/minigbm" ] 691 sources += libangle_gl_ozone_sources 692 } 693 } 694 695 if (angle_enable_null) { 696 sources += libangle_null_sources 697 } 698 699 if (is_mac) { 700 sources += libangle_mac_sources 701 } 702 703 if (is_debug) { 704 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ] 705 } 706 707 configs += [ ":debug_annotations_config" ] 708 public_configs += [ 709 ":libANGLE_config", 710 ":angle_backend_config", 711 ] 712 713 # Windows ARM64 is available since 10.0.16299 so no need to copy 714 # d3dcompiler_47.dll because this file is available as inbox. 715 if (_use_copy_compiler_dll) { 716 data_deps = [ ":copy_compiler_dll" ] 717 } 718} 719 720config("angle_frame_capture_disabled") { 721 defines = [ "ANGLE_CAPTURE_ENABLED=0" ] 722} 723 724config("angle_frame_capture_enabled") { 725 defines = [ "ANGLE_CAPTURE_ENABLED=1" ] 726} 727 728angle_source_set("libANGLE") { 729 public_deps = [ ":libANGLE_base" ] 730 public_configs = [ ":angle_frame_capture_disabled" ] 731 sources = [ "src/libANGLE/FrameCapture_mock.cpp" ] 732 733 # gl_enum_utils defaults included in with_capture build 734 deps = [] 735 if (angle_enable_trace || is_debug) { 736 deps += [ ":angle_gl_enum_utils" ] 737 } 738} 739 740angle_source_set("angle_gl_enum_utils") { 741 public_deps = [ ":libANGLE_base" ] 742 sources = [ 743 "src/libANGLE/gl_enum_utils.cpp", 744 "src/libANGLE/gl_enum_utils_autogen.cpp", 745 ] 746} 747 748config("angle_compression_config") { 749 include_dirs = [ "//third_party/zlib/google" ] 750} 751 752group("angle_compression") { 753 public_configs = [ 754 ":angle_compression_config", 755 "//third_party/zlib:zlib_config", 756 ] 757 public_deps = [ "//third_party/zlib/google:compression_utils_portable" ] 758} 759 760angle_source_set("libANGLE_with_capture") { 761 public_deps = [ ":libANGLE_base" ] 762 deps = [ ":angle_compression" ] 763 public_configs = [ ":angle_frame_capture_enabled" ] 764 sources = libangle_capture_sources 765} 766 767config("shared_library_public_config") { 768 if (is_mac && !is_component_build) { 769 # Executable targets that depend on the shared libraries below need to have 770 # the rpath setup in non-component build configurations. 771 ldflags = [ 772 "-rpath", 773 "@executable_path/", 774 ] 775 if (build_with_chromium) { 776 ldflags += [ 777 # Path for loading shared libraries for unbundled binaries. 778 # From //build/config/mac/BUILD.gn, this is only added for 779 # component builds. However, since ANGLE always dynamically 780 # links to libvulkan, it should be re-added for non-component 781 # builds. (anglebug.com/4455) 782 "-Wl,-rpath,@loader_path/.", 783 ] 784 } 785 } 786 787 if (angle_is_winuwp) { 788 ldflags = [ 789 "/APPCONTAINER", 790 791 # Disable warning about invalid subsystem number. 792 # A default appropriate subsystem is selected automatically. 793 "/IGNORE:4010", 794 ] 795 } 796} 797 798config("library_name_config") { 799 if (is_component_build && is_android) { 800 defines = [ 801 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"", 802 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"", 803 ] 804 } else { 805 defines = [ 806 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"", 807 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"", 808 ] 809 } 810} 811 812# This config controls export definitions on ANGLE API calls. 813config("angle_static") { 814 defines = [ 815 "ANGLE_EXPORT=", 816 "ANGLE_UTIL_EXPORT=", 817 "EGLAPI=", 818 "GL_APICALL=", 819 "GL_API=", 820 ] 821} 822 823set_defaults("angle_libGLESv2") { 824 sources = [] 825 output_name = "libGLESv2" 826} 827 828template("angle_libGLESv2") { 829 angle_shared_library(target_name) { 830 sources = libglesv2_sources + invoker.sources 831 832 if (is_win) { 833 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ] 834 } 835 836 output_name = "${invoker.output_name}${angle_libs_suffix}" 837 838 configs += [ 839 ":angle_gl_visibility_config", 840 ":debug_annotations_config", 841 ":gl_prototypes", 842 ] 843 844 defines = [ "LIBGLESV2_IMPLEMENTATION" ] 845 846 deps = invoker.deps + [ ":includes" ] 847 848 public_deps = [ ":angle_version" ] 849 } 850} 851 852angle_libGLESv2("libGLESv2") { 853 if (angle_with_capture_by_default) { 854 deps = [ ":libANGLE_with_capture" ] 855 } else { 856 deps = [ ":libANGLE" ] 857 } 858} 859 860# Output capture lib when `angle_with_capture_by_default` disabled, vice versa. 861angle_libGLESv2("libGLESv2_capture_complement") { 862 if (angle_with_capture_by_default) { 863 deps = [ ":libANGLE" ] 864 output_name += "_no_capture" 865 } else { 866 deps = [ ":libANGLE_with_capture" ] 867 output_name += "_with_capture" 868 } 869} 870 871if (is_win && !angle_is_winuwp) { 872 angle_shared_library("libGL") { 873 sources = libgl_sources 874 875 output_name = "openGL32" 876 output_dir = "$root_out_dir/angle_libs" 877 878 configs += [ 879 ":angle_gl_visibility_config", 880 ":debug_annotations_config", 881 ":gl_prototypes", 882 ] 883 884 defines = [ 885 "ANGLE_CAPTURE_ENABLED=0", 886 "LIBGL_IMPLEMENTATION", 887 ] 888 889 deps = [ 890 ":includes", 891 ":libANGLE", 892 ] 893 894 public_deps = [ ":angle_version" ] 895 } 896} 897 898angle_static_library("libGLESv2_static") { 899 sources = libglesv2_sources 900 configs += [ ":debug_annotations_config" ] 901 public_configs += [ ":angle_static" ] 902 deps = [ ":includes" ] 903 public_deps = [ ":libANGLE" ] 904} 905 906angle_shared_library("libGLESv1_CM") { 907 sources = libglesv1_cm_sources 908 output_name = "libGLESv1_CM${angle_libs_suffix}" 909 910 configs += [ 911 ":angle_gl_visibility_config", 912 ":debug_annotations_config", 913 ":gl_prototypes", 914 ] 915 916 defines = [] 917 918 deps = [ 919 ":includes", 920 ":libGLESv2", 921 ] 922} 923 924angle_static_library("libGLESv1_CM_static") { 925 sources = libglesv1_cm_sources 926 configs += [ ":debug_annotations_config" ] 927 public_configs += [ ":angle_static" ] 928 deps = [ 929 ":includes", 930 ":libGLESv2_static", 931 ] 932} 933 934config("libEGL_egl_loader_config") { 935 defines = [ "ANGLE_USE_EGL_LOADER" ] 936} 937 938angle_source_set("libEGL_egl_loader") { 939 sources = [ 940 "src/libEGL/egl_loader_autogen.cpp", 941 "src/libEGL/egl_loader_autogen.h", 942 ] 943 944 public_configs += [ 945 ":libEGL_egl_loader_config", 946 ":gl_prototypes", 947 ] 948 949 deps = [ ":includes" ] 950} 951 952angle_shared_library("libEGL") { 953 sources = libegl_sources 954 output_name = "libEGL${angle_libs_suffix}" 955 956 configs += [ 957 ":debug_annotations_config", 958 ":library_name_config", 959 ] 960 961 defines = [ "LIBEGL_IMPLEMENTATION" ] 962 if (is_win) { 963 defines += [ "EGLAPI=" ] 964 } else { 965 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ] 966 } 967 968 if (is_win) { 969 sources += [ "src/libEGL/libEGL.def" ] 970 } 971 972 deps = [ 973 ":angle_common", 974 ":angle_system_utils", 975 ":angle_version", 976 ":libEGL_egl_loader", 977 ] 978 979 public_deps = [ ":includes" ] 980 981 data_deps = [ ":libGLESv2" ] 982} 983 984angle_static_library("libEGL_static") { 985 sources = libegl_sources 986 987 configs += [ 988 ":debug_annotations_config", 989 ":library_name_config", 990 ] 991 992 public_configs += [ ":angle_static" ] 993 994 deps = [ 995 ":includes", 996 ":libGLESv2_static", 997 ] 998} 999 1000# Convenience targets for some of the samples so they can be built 1001# with Chromium's toolchain. 1002angle_executable("angle_shader_translator") { 1003 testonly = true 1004 1005 sources = [ "samples/shader_translator/shader_translator.cpp" ] 1006 1007 deps = [ ":translator" ] 1008} 1009 1010if (angle_has_build) { 1011 config("angle_feature_support_config") { 1012 include_dirs = [ 1013 "include", 1014 "src", 1015 ] 1016 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ] 1017 if (is_debug) { 1018 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ] 1019 } 1020 } 1021 1022 angle_shared_library("libfeature_support") { 1023 output_name = "libfeature_support${angle_libs_suffix}" 1024 1025 if (is_android) { 1026 libs = [ "log" ] 1027 } 1028 1029 public_configs += [ 1030 ":angle_feature_support_config", 1031 "${angle_jsoncpp_dir}:jsoncpp_config", 1032 ] 1033 1034 if (is_mac && !is_component_build) { 1035 ldflags = [ 1036 "-install_name", 1037 "@rpath/${target_name}.dylib", 1038 ] 1039 } 1040 1041 sources = [ 1042 "src/feature_support_util/feature_support_util.cpp", 1043 "src/feature_support_util/feature_support_util.h", 1044 ] 1045 1046 deps = [ 1047 ":angle_gpu_info_util", 1048 "${angle_jsoncpp_dir}:jsoncpp", 1049 ] 1050 } 1051} 1052 1053if (!is_component_build && is_android && symbol_level != 0) { 1054 action_foreach("compressed_symbols") { 1055 sources = [] 1056 foreach(_library, angle_libraries) { 1057 sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ] 1058 } 1059 if (angle_enable_vulkan_validation_layers) { 1060 foreach(_layer, vulkan_validation_layers) { 1061 sources += [ "$root_out_dir/lib${_layer}.so" ] 1062 } 1063 } 1064 1065 script = rebase_path("${root_build_dir}/android/compress_symbols.py", 1066 root_build_dir) 1067 1068 deps = [] 1069 foreach(_library, angle_libraries) { 1070 deps += [ ":$_library" ] 1071 } 1072 1073 if (angle_enable_vulkan_validation_layers) { 1074 foreach(_layer, vulkan_validation_layers) { 1075 deps += [ 1076 "${angle_root}/third_party/vulkan-validation-layers/src:${_layer}", 1077 ] 1078 } 1079 } 1080 1081 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ] 1082 1083 android_nm = "${android_tool_prefix}nm" 1084 android_strip = "${android_tool_prefix}strip" 1085 1086 args = [ 1087 "--objcopy", 1088 rebase_path(android_objcopy, root_build_dir), 1089 "--nm", 1090 rebase_path(android_nm, root_build_dir), 1091 "--strip", 1092 rebase_path(android_strip, root_build_dir), 1093 "--unstrippedsofile", 1094 "{{source_dir}}/lib.unstripped/{{source_file_part}}", 1095 "--output", 1096 "{{source_dir}}/lib.compressed/{{source_file_part}}", 1097 ] 1098 } 1099} 1100 1101if (build_with_chromium && !is_component_build && is_android && 1102 current_toolchain == default_toolchain) { 1103 # Package ANGLE libraries 1104 angle_apk("angle_chromium_apk") { 1105 package_name = "com.chromium.angle" 1106 apk_name = "AngleLibraries" 1107 } 1108 1109 group("angle_apks") { 1110 deps = [ ":angle_chromium_apk" ] 1111 } 1112} 1113 1114group("angle") { 1115 data_deps = [ 1116 ":libEGL", 1117 ":libGLESv1_CM", 1118 ":libGLESv2", 1119 ] 1120} 1121