• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_has_build) {
11  import("//build/config/linux/pkg_config.gni")
12  import("//build/config/sanitizers/sanitizers.gni")
13  import("//build/config/ui.gni")
14  import("//testing/libfuzzer/fuzzer_test.gni")
15
16  if (is_android) {
17    # android/rules.gni can only be imported for Android targets
18    import("//build/config/android/config.gni")
19    import("//build/config/android/rules.gni")
20    import("android/angle_apk.gni")
21  }
22} else {
23  using_sanitizer = false
24}
25
26declare_args() {
27  # Use the PCI lib to collect GPU information on Linux.
28  use_libpci = (is_linux || is_chromeos) && (angle_use_x11 || use_ozone) &&
29               angle_has_build
30
31  # Enable using Vulkan to collect system info as a fallback.
32  angle_enable_vulkan_system_info = false
33
34  # Link in system libGL, to work with apitrace.  See doc/DebuggingTips.md.
35  angle_link_glx = false
36
37  # Don't build extra (test, samples etc) for Windows UWP. We don't have
38  # infrastructure (e.g. windowing helper functions) in place to run them.
39  angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build
40
41  # Enable generating current commit information using git
42  angle_enable_commit_id = true
43
44  # Abseil has trouble supporting MSVC, particularly regarding component builds.
45  # http://crbug.com/1126524
46  angle_enable_abseil = angle_has_build && is_clang
47
48  # Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled.
49  angle_enable_annotator_run_time_checks = false
50
51  # Enables non-conformant extensions and features
52  angle_expose_non_conformant_extensions_and_versions = false
53
54  # Optional feature that forces dirty state whenever we use a new context regardless of thread.
55  angle_force_context_check_every_call = false
56
57  # Allow shared library custom name extensions for setting soname such as libEGL.so.1
58  angle_egl_extension = ""
59  angle_glesv2_extension = ""
60}
61
62if (angle_build_all) {
63  group("all") {
64    testonly = true
65    deps = [
66      ":angle",
67      ":angle_shader_translator",
68      ":translator_fuzzer",
69      ":xxhash_fuzzer",
70      "$angle_root/samples:angle_samples",
71      "$angle_root/src/tests:angle_tests",
72    ]
73    if (angle_enable_cl) {
74      deps += [ "$angle_root/src/libOpenCL:angle_cl" ]
75    }
76  }
77}
78
79import("src/compiler.gni")
80import("src/libGLESv2.gni")
81
82# This config is exported to dependent targets (and also applied to internal
83# ones).
84config("external_config") {
85  include_dirs = [ "include" ]
86}
87
88# Prevent the GL headers from redeclaring ANGLE entry points.
89config("no_gl_prototypes") {
90  defines = [
91    "GL_GLES_PROTOTYPES=0",
92    "EGL_EGL_PROTOTYPES=0",
93  ]
94}
95
96config("gl_prototypes") {
97  defines = [
98    "GL_GLES_PROTOTYPES=1",
99    "EGL_EGL_PROTOTYPES=1",
100    "GL_GLEXT_PROTOTYPES",
101    "EGL_EGLEXT_PROTOTYPES",
102  ]
103}
104
105# This config is applied to internal Angle targets (not pushed to dependents).
106config("internal_config") {
107  include_dirs = [
108    "include",
109    "src",
110  ]
111
112  defines = []
113
114  if (is_win) {
115    defines += [ "ANGLE_IS_WIN" ]
116    if (angle_is_winuwp) {
117      defines += [ "ANGLE_IS_WINUWP" ]
118    }
119  } else if (is_linux || is_chromeos) {
120    defines += [ "ANGLE_IS_LINUX" ]
121  }
122
123  # Enables debug/trace-related functionality, including logging every GLES/EGL API command to the
124  # "angle_debug.txt" file on desktop.  Enables debug markers for AGI, but must also set
125  # angle_enable_annotator_run_time_checks to improve performance.
126  if (angle_enable_trace) {
127    defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
128  }
129
130  # When used with angle_enable_trace, enables logging every GLES/EGL API command to Android logcat
131  # Enables debug markers for AGI regardless of run-time checks.
132  if (angle_enable_trace_android_logcat) {
133    defines += [ "ANGLE_ENABLE_TRACE_ANDROID_LOGCAT=1" ]
134  }
135
136  # When used with angle_enable_trace, enables logging every GLES/EGL API command to the terminal
137  if (angle_enable_trace_events) {
138    defines += [ "ANGLE_ENABLE_TRACE_EVENTS=1" ]
139  }
140
141  if (is_chromeos) {
142    defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
143  }
144
145  if (is_ggp) {
146    defines += [ "__ggp__" ]
147  }
148
149  if (angle_use_vulkan_null_display) {
150    defines += [ "ANGLE_USE_VULKAN_NULL_DISPLAY" ]
151  } else if (angle_use_vulkan_display) {
152    defines += [ "ANGLE_USE_VULKAN_DISPLAY" ]
153    if (!angle_use_x11) {
154      defines += [ "EGL_NO_X11" ]
155    }
156
157    # These two are needed here to correctly select OSWindow::New
158    if (angle_use_x11) {
159      defines += [ "ANGLE_USE_X11" ]
160    }
161    if (angle_use_wayland) {
162      defines += [ "ANGLE_USE_WAYLAND" ]
163    }
164
165    if (angle_vulkan_display_mode == "simple") {
166      defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ]
167    } else if (angle_vulkan_display_mode == "headless") {
168      defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ]
169    }
170  }
171
172  if (is_lsan) {
173    defines += [ "ANGLE_WITH_LSAN" ]
174  }
175}
176
177config("constructor_and_destructor_warnings") {
178  if (is_clang) {
179    cflags = [
180      "-Wexit-time-destructors",
181      "-Wglobal-constructors",
182    ]
183  }
184}
185
186config("extra_warnings") {
187  cflags = []
188
189  is_gcc = !is_clang && !is_win
190
191  # Avoid failing builds for warnings enabled by Skia build.
192  if (defined(is_skia_standalone)) {
193    cflags += [ "-w" ]
194  }
195
196  # Enable more default warnings on Windows.
197  if (is_win) {
198    cflags += [
199      "/we4244",  # Conversion: possible loss of data.
200      "/we4312",  # Conversion: greater size.
201      "/we4456",  # Variable shadowing.
202      "/we4458",  # declaration hides class member.
203      "/we4715",  # not all control paths return a value
204      "/we4800",  # forcing value to bool.
205      "/we4838",  # narrowing conversion.
206    ]
207  }
208  if (is_clang) {
209    cflags += [
210      "-Wbad-function-cast",
211      "-Wconditional-uninitialized",
212      "-Wextra-semi-stmt",
213      "-Wfloat-conversion",
214      "-Winconsistent-missing-destructor-override",
215      "-Wmissing-field-initializers",
216      "-Wnewline-eof",
217      "-Wnon-virtual-dtor",
218      "-Wredundant-parens",
219      "-Wreturn-std-move",
220      "-Wshadow",
221      "-Wshadow-field",
222      "-Wtautological-type-limit-compare",
223      "-Wundefined-reinterpret-cast",
224      "-Wunneeded-internal-declaration",
225      "-Wunused-but-set-variable",
226      "-Wsuggest-destructor-override",
227      "-Wsuggest-override",
228
229      # The below warnings are used by WebKit. We enable them to make rolling
230      # ANGLE in WebKit easier.
231      "-Wparentheses",
232      "-Wrange-loop-analysis",
233      "-Wstrict-prototypes",
234      "-Wunreachable-code-aggressive",
235      "-Wshorten-64-to-32",
236    ]
237  }
238
239  if (is_gcc) {
240    cflags_cc = [ "-Wdeprecated-copy" ]
241  }
242
243  if (angle_is_winuwp) {
244    cflags += [
245      "/wd4091",  # keyword ignored on left of type when no variable is declared
246      "/wd4447",  # 'main' signature found without threading model.
247    ]
248  }
249}
250
251# This config adds build-ids to the associated library.
252# -Wl is a special option that indicates that clang should pass the associated
253# option --build-id to the linker. This will cause a build-id section to be added
254# to the associated library. The build-id makes it possible for a debugger to
255# find the right symbol file to use.
256config("build_id_config") {
257  ldflags = [ "-Wl,--build-id" ]
258}
259
260_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
261
262# Windows ARM64 is available since 10.0.16299 so no need to copy
263# d3dcompiler_47.dll because this file is available as inbox.
264if (_use_copy_compiler_dll) {
265  # We also ship an older DLL for compatiblity with Windows 7 machines without
266  # the UCRT. This DLL isn't available in the standard SDK distribution.
267  _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
268  _has_old_compiler =
269      exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
270
271  copy("copy_compiler_dll") {
272    sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
273
274    if (_has_old_compiler) {
275      sources += [ _old_compiler ]
276    }
277
278    outputs = [ "$root_out_dir/{{source_file_part}}" ]
279  }
280}
281
282# Holds the shared includes so we only need to list them once.
283config("includes_config") {
284  include_dirs = [ "include" ]
285}
286
287config("angle_uwp_env") {
288  if (angle_is_winuwp) {
289    defines = [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
290  }
291}
292
293angle_source_set("cl_includes") {
294  sources = cl_includes
295  public_configs = [ ":external_config" ]
296}
297
298angle_source_set("includes") {
299  sources = libangle_includes
300  public_configs = [ ":includes_config" ]
301  if (angle_enable_cl) {
302    public_deps = [ ":cl_includes" ]
303  }
304}
305
306config("disable_unreachable_code_break_warning") {
307  if (is_clang) {
308    cflags = [ "-Wno-unreachable-code-break" ]
309  }
310}
311
312angle_static_library("preprocessor") {
313  sources = angle_preprocessor_sources
314
315  # preprocessor_tab_autogen.cpp contains an instance of this.
316  configs += [ ":disable_unreachable_code_break_warning" ]
317
318  public_deps = [
319    ":angle_common",
320    ":angle_translator_headers",
321  ]
322}
323
324config("angle_disable_pool_alloc") {
325  defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
326}
327
328config("debug_annotations_config") {
329  defines = []
330  if (is_debug) {
331    defines += [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
332  }
333  if (angle_enable_annotator_run_time_checks) {
334    # When used with angle_enable_trace, enables debug markers for AGI with run-time checks to
335    # filter out EVENT() messages when the debug annotator is disabled.
336    defines += [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
337  }
338}
339
340config("angle_asserts_config") {
341  if (angle_assert_always_on) {
342    defines = [ "ANGLE_ASSERT_ALWAYS_ON" ]
343  }
344}
345
346config("angle_common_config") {
347  include_dirs = [ "src/common/third_party/base" ]
348  if (is_android) {
349    libs = [ "log" ]
350  }
351}
352
353# Silences the "indirect call of a function with wrong dynamic type" cfi error
354config("angle_no_cfi_icall") {
355  if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
356    cflags = [ "-fno-sanitize=cfi-icall" ]
357  }
358}
359
360# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
361config("angle_no_cfi_unrelated_cast") {
362  if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
363    cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
364  }
365}
366
367angle_source_set("xxhash") {
368  sources = xxhash_sources
369  if (is_clang) {
370    cflags_c = [ "-Wno-implicit-fallthrough" ]
371  }
372}
373
374if (angle_has_build) {
375  fuzzer_test("xxhash_fuzzer") {
376    sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
377    deps = [ ":xxhash" ]
378  }
379}
380
381angle_static_library("angle_common") {
382  sources = libangle_common_sources
383  if (angle_enable_cl) {
384    sources += libangle_common_cl_sources
385  }
386
387  configs += [
388    ":angle_common_config",
389    ":debug_annotations_config",
390  ]
391
392  deps = [ ":xxhash" ]
393
394  public_deps = [
395    ":angle_abseil",
396    ":includes",
397  ]
398  public_configs += [ ":angle_common_config" ]
399  if (angle_has_build && use_fuzzing_engine) {
400    all_dependent_configs = [ ":angle_disable_pool_alloc" ]
401  }
402
403  if (is_linux || is_chromeos) {
404    libs = [ "dl" ]
405  }
406
407  if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
408    # In API level 26 ANativeWindow APIs were moved from libandroid.so
409    # into a separate library, libnativewindow.so
410    if (ndk_api_level_at_least_26) {
411      libs = [ "nativewindow" ]
412    } else {
413      libs = [ "android" ]
414    }
415  }
416
417  if (angle_expose_non_conformant_extensions_and_versions) {
418    defines = [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
419  }
420
421  if (using_sanitizer && !build_with_chromium) {
422    data_deps = [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ]
423  }
424}
425
426config("angle_image_util_config") {
427  include_dirs = [
428    "include",
429    "src",
430  ]
431}
432
433angle_source_set("angle_image_util_headers") {
434  sources = libangle_image_util_headers
435  public_deps = [ ":angle_common" ]
436}
437
438angle_static_library("angle_image_util") {
439  sources = libangle_image_util_sources
440  public_configs += [ ":angle_image_util_config" ]
441  public_deps = [ ":angle_image_util_headers" ]
442}
443
444config("angle_gl_visibility_config") {
445  if (is_win) {
446    defines = [
447      "GL_APICALL=",
448      "GL_API=",
449    ]
450  } else {
451    defines = [
452      "GL_APICALL=__attribute__((visibility(\"default\")))",
453      "GL_API=__attribute__((visibility(\"default\")))",
454    ]
455  }
456}
457
458config("angle_vulkan_wayland_config") {
459  if (angle_enable_vulkan && angle_use_wayland &&
460      defined(vulkan_wayland_include_dirs)) {
461    include_dirs = vulkan_wayland_include_dirs
462  }
463}
464
465config("angle_gpu_info_util_config") {
466  include_dirs = [
467    "include",
468    "src",
469  ]
470}
471
472angle_static_library("angle_gpu_info_util") {
473  public_configs += [
474    ":angle_gpu_info_util_config",
475    ":angle_backend_config",
476  ]
477  public_deps = [ ":angle_common" ]
478  sources = libangle_gpu_info_util_sources
479  deps = []
480  libs = []
481  defines = []
482
483  if (angle_build_vulkan_system_info) {
484    sources += libangle_gpu_info_util_vulkan_sources
485    deps += [
486      "$angle_vulkan_headers_dir:vulkan_headers",
487      "src/common/vulkan:angle_libvulkan_loader",
488      "src/common/vulkan:angle_vulkan_icd",
489    ]
490    if (angle_enable_vulkan_system_info) {
491      defines += [ "ANGLE_USE_VULKAN_SYSTEM_INFO" ]
492    }
493  }
494
495  if (is_android) {
496    sources += libangle_gpu_info_util_android_sources
497  }
498
499  if (is_fuchsia) {
500    sources += libangle_gpu_info_util_fuchsia_sources
501    deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ]
502  }
503
504  if (is_win) {
505    sources += libangle_gpu_info_util_win_sources
506    if (!angle_is_winuwp) {
507      libs += [ "setupapi.lib" ]
508    }
509    libs += [ "dxgi.lib" ]
510  }
511
512  if (is_linux || is_chromeos) {
513    sources += libangle_gpu_info_util_linux_sources
514
515    if (angle_use_x11 && angle_has_build) {
516      sources += libangle_gpu_info_util_x11_sources
517      deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
518      defines += [ "GPU_INFO_USE_X11" ]
519      libs += [
520        "X11",
521        "Xi",
522        "Xext",
523      ]
524    }
525
526    if (angle_use_wayland && angle_has_build) {
527      public_deps += [ ":angle_wayland" ]
528    }
529  }
530
531  if (use_libpci) {
532    sources += libangle_gpu_info_util_libpci_sources
533    defines += [ "GPU_INFO_USE_LIBPCI" ]
534    libs += [ "pci" ]
535  }
536
537  if (is_apple) {
538    frameworks = [
539      "IOKit.framework",
540      "CoreFoundation.framework",
541      "CoreGraphics.framework",
542    ]
543    if (angle_enable_eagl) {
544      frameworks += [ "OpenGLES.framework" ]
545    } else if (angle_enable_cgl) {
546      frameworks += [ "OpenGL.framework" ]
547    }
548    if (is_mac || angle_enable_cgl) {
549      sources += libangle_gpu_info_util_mac_sources
550    }
551    if (is_ios && !angle_enable_cgl) {
552      sources += libangle_gpu_info_util_ios_sources
553    }
554  }
555}
556
557angle_source_set("angle_translator_headers") {
558  sources = angle_translator_exported_headers
559  public_deps = [ ":includes" ]
560}
561
562template("translator_lib") {
563  angle_static_library(target_name) {
564    sources = angle_translator_sources
565    defines = []
566
567    _needs_glsl_base = false
568    _needs_glsl_and_vulkan_base = false
569    _uses_spirv = false
570
571    # Frontend support:
572    if (angle_enable_desktop_glsl) {
573      sources += angle_translator_glsl_symbol_table_sources
574    } else {
575      sources += angle_translator_essl_symbol_table_sources
576    }
577
578    # Backend support:
579    if (angle_enable_essl || use_fuzzing_engine) {
580      _needs_glsl_base = true
581      sources += angle_translator_essl_sources
582      defines += [ "ANGLE_ENABLE_ESSL" ]
583    }
584
585    if (angle_enable_glsl || use_fuzzing_engine) {
586      _needs_glsl_base = true
587      _needs_glsl_and_vulkan_base = true
588      sources += angle_translator_glsl_sources
589      defines += [ "ANGLE_ENABLE_GLSL" ]
590    }
591
592    if (angle_enable_apple_translator_workarounds) {
593      sources += angle_translator_apple_sources
594      defines += [ "ANGLE_ENABLE_APPLE_WORKAROUNDS" ]
595    }
596
597    if (angle_enable_hlsl || use_fuzzing_engine) {
598      sources += angle_translator_hlsl_sources
599      defines += [ "ANGLE_ENABLE_HLSL" ]
600    }
601
602    if (!invoker.gl_d3d_only) {
603      if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
604        _needs_glsl_base = true
605        _needs_glsl_and_vulkan_base = true
606        _uses_spirv = true
607
608        # This translator is needed by metal backend also.
609        sources += angle_translator_lib_vulkan_sources
610      }
611
612      if (angle_enable_vulkan || use_fuzzing_engine) {
613        defines += [ "ANGLE_ENABLE_VULKAN" ]
614      }
615
616      if (angle_enable_metal) {
617        sources += angle_translator_lib_metal_sources
618        defines += [
619          "ANGLE_ENABLE_METAL",
620          "ANGLE_ENABLE_METAL_SPIRV",
621        ]
622      }
623    }
624
625    if (_needs_glsl_base) {
626      sources += angle_translator_glsl_base_sources
627    }
628    if (_needs_glsl_and_vulkan_base) {
629      sources += angle_translator_glsl_and_vulkan_base_sources
630    }
631
632    public_configs += [ ":external_config" ]
633
634    deps = [
635      ":includes",
636      ":preprocessor",
637      "$angle_root/src/common/spirv:angle_spirv_headers",
638    ]
639
640    if (_uses_spirv) {
641      deps += [
642        "$angle_root/src/common/spirv:angle_spirv_base",
643        "$angle_root/src/common/spirv:angle_spirv_builder",
644        "${angle_spirv_headers_dir}:spv_headers",
645        "${angle_spirv_tools_dir}:spvtools_headers",
646        "${angle_spirv_tools_dir}:spvtools_val",
647      ]
648
649      if (angle_enable_spirv_gen_through_glslang) {
650        defines += [ "ANGLE_ENABLE_SPIRV_GENERATION_THROUGH_GLSLANG" ]
651        sources += [ "src/compiler/translator/glslang_wrapper.cpp" ]
652        deps += [
653          "${angle_glslang_dir}:glslang_default_resource_limits_sources",
654          "${angle_glslang_dir}:glslang_lib_sources",
655        ]
656      }
657    }
658
659    public_deps = [
660      ":angle_common",
661      ":angle_translator_headers",
662    ]
663
664    if (is_win) {
665      # Necessary to suppress some system header xtree warnings in Release.
666      # For some reason this warning doesn't get triggered in Chromium
667      cflags = [ "/wd4718" ]
668    }
669  }
670}
671
672translator_lib("translator") {
673  gl_d3d_only = false
674}
675
676if (angle_enable_essl || angle_enable_glsl || angle_enable_hlsl) {
677  translator_lib("translator_gl_d3d_only") {
678    gl_d3d_only = true
679  }
680}
681
682angle_source_set("translator_fuzzer") {
683  sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
684
685  include_dirs = [
686    "include",
687    "src",
688  ]
689
690  deps = [ ":translator" ]
691}
692
693config("angle_commit_id_config") {
694  include_dirs = [ "$root_gen_dir/angle" ]
695  visibility = [ ":angle_commit_id" ]
696}
697
698action("angle_commit_id") {
699  _commit_id_header = "$root_gen_dir/angle/angle_commit.h"
700  script = "src/commit_id.py"
701  outputs = [ _commit_id_header ]
702
703  visibility = [ ":angle_version" ]
704
705  # Add git as a dependency if it is available.
706  if (angle_enable_commit_id &&
707      exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
708    # commit id should depend on angle's HEAD revision
709    inputs = [ ".git/HEAD" ]
710    branch = read_file(".git/HEAD", "string")
711    result = string_split(branch)
712    if (result[0] == "ref:") {
713      _ref_file = result[1]
714
715      # If git has packed the contents of .git/refs/heads/ in .git/packed-refs,
716      # unpack the head before depending on it.
717      exec_script("src/commit_id.py",
718                  [
719                    "unpack",
720                    _ref_file,
721                  ],
722                  "")
723      inputs += [ ".git/" + _ref_file ]
724    }
725  }
726
727  args = [
728    "gen",
729    rebase_path(_commit_id_header, root_build_dir),
730  ]
731
732  public_configs = [ ":angle_commit_id_config" ]
733}
734
735angle_source_set("angle_version") {
736  sources = [ "src/common/angle_version.h" ]
737  public_deps = [ ":angle_commit_id" ]
738  visibility = [ ":angle_version_info" ]
739
740  # The version headers are used directly in Windows .RC files.
741  if (is_win) {
742    visibility += [
743      ":libEGL",
744      ":libGL",
745      ":libGLESv1_CM",
746      ":libGLESv2",
747      ":libGLESv2_capture_complement",
748    ]
749  }
750}
751
752angle_source_set("angle_version_info") {
753  sources = [
754    "src/common/angle_version_info.cpp",
755    "src/common/angle_version_info.h",
756  ]
757  deps = [ ":angle_version" ]
758}
759
760config("angle_backend_config") {
761  defines = []
762
763  if (angle_delegate_workers) {
764    defines += [ "ANGLE_DELEGATE_WORKERS" ]
765  }
766
767  if (angle_force_context_check_every_call) {
768    defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ]
769  }
770
771  if (angle_expose_non_conformant_extensions_and_versions) {
772    defines += [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
773  }
774
775  if (angle_use_spirv_gen_through_glslang) {
776    defines += [ "ANGLE_USE_SPIRV_GENERATION_THROUGH_GLSLANG" ]
777  }
778
779  configs = []
780
781  if (angle_enable_d3d11) {
782    configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ]
783  }
784
785  if (angle_enable_d3d9) {
786    configs += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend_config" ]
787  }
788
789  if (angle_enable_gl) {
790    configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ]
791  }
792
793  if (angle_enable_null) {
794    configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ]
795  }
796
797  if (angle_enable_metal) {
798    configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
799  }
800
801  if (angle_enable_vulkan) {
802    configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
803  }
804
805  if (angle_enable_cl_passthrough) {
806    configs += [ "src/libANGLE/renderer/cl:angle_cl_backend_config" ]
807  }
808
809  if (angle_is_winuwp) {
810    configs += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp_config" ]
811  }
812}
813
814config("libANGLE_config") {
815  cflags = []
816  defines = []
817  libs = []
818  ldflags = []
819  defines += [ "LIBANGLE_IMPLEMENTATION" ]
820
821  if (is_win) {
822    cflags += [ "/wd4530" ]  # C++ exception handler used, but unwind semantics
823                             # are not enabled.
824  }
825
826  if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
827    # In API level 26 ANativeWindow APIs were moved from libandroid.so
828    # into a separate library, libnativewindow.so
829    if (ndk_api_level_at_least_26) {
830      libs += [ "nativewindow" ]
831    } else {
832      libs += [ "android" ]
833    }
834  }
835
836  if (angle_use_x11) {
837    defines += [ "ANGLE_USE_X11" ]
838  }
839
840  if (angle_use_wayland) {
841    defines += [ "ANGLE_USE_WAYLAND" ]
842  }
843
844  if (angle_enable_overlay) {
845    defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
846  }
847  if (angle_enable_perf_counter_output) {
848    defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ]
849  }
850}
851
852angle_source_set("libANGLE_headers") {
853  sources = libangle_headers
854  if (angle_enable_cl) {
855    sources += libangle_cl_headers
856  }
857  public_deps = [
858    ":angle_common",
859    ":angle_translator_headers",
860  ]
861  public_configs += [ ":libANGLE_config" ]
862}
863
864# Don't even try to build glslang if Metal and Vulkan are disabled.
865if (angle_enable_vulkan || angle_enable_metal) {
866  angle_source_set("angle_glslang_wrapper") {
867    sources = [
868      "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.cpp",
869      "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.h",
870      "src/libANGLE/renderer/glslang_wrapper_utils.cpp",
871      "src/libANGLE/renderer/glslang_wrapper_utils.h",
872    ]
873    deps = [
874      ":libANGLE_headers",
875      "$angle_root/src/common/spirv:angle_spirv_base",
876      "$angle_root/src/common/spirv:angle_spirv_builder",
877      "$angle_root/src/common/spirv:angle_spirv_headers",
878      "$angle_root/src/common/spirv:angle_spirv_parser",
879      "${angle_spirv_headers_dir}:spv_headers",
880    ]
881  }
882}
883
884if ((is_win && angle_enable_gl) || angle_enable_d3d11 || angle_enable_d3d9) {
885  angle_source_set("angle_d3d_format_tables") {
886    sources = [
887      "src/libANGLE/renderer/dxgi_format_map.h",
888      "src/libANGLE/renderer/dxgi_format_map_autogen.cpp",
889      "src/libANGLE/renderer/dxgi_support_table.h",
890      "src/libANGLE/renderer/dxgi_support_table_autogen.cpp",
891    ]
892
893    if (!angle_is_winuwp) {
894      sources += [
895        "src/libANGLE/renderer/d3d_format.cpp",
896        "src/libANGLE/renderer/d3d_format.h",
897      ]
898    }
899
900    public_deps = [ ":libANGLE_headers" ]
901    configs += [ ":angle_backend_config" ]
902  }
903}
904
905angle_source_set("libANGLE_base") {
906  sources = libangle_sources
907  if (angle_enable_cl) {
908    sources += libangle_cl_sources
909  }
910
911  include_dirs = []
912  libs = []
913  defines = []
914  if (angle_link_glx) {
915    libs += [ "GL" ]
916    defines += [ "ANGLE_LINK_GLX" ]
917  }
918  public_deps = [
919    ":angle_common",
920    ":angle_gpu_info_util",
921    ":angle_version_info",
922    ":libANGLE_headers",
923    ":translator",
924  ]
925  deps = [
926    ":angle_compression",
927    ":angle_image_util",
928    ":includes",
929  ]
930
931  if (is_win && !angle_is_winuwp) {
932    libs += [
933      "gdi32.lib",
934      "user32.lib",
935    ]
936  }
937
938  if (angle_enable_d3d11) {
939    public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend" ]
940  }
941
942  if (angle_enable_d3d9) {
943    public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend" ]
944  }
945
946  if (angle_enable_gl) {
947    public_deps += [ "src/libANGLE/renderer/gl:angle_gl_backend" ]
948  }
949
950  if (angle_enable_null) {
951    public_deps += [ "src/libANGLE/renderer/null:angle_null_backend" ]
952  }
953
954  if (angle_enable_vulkan) {
955    public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
956  }
957
958  if (angle_is_winuwp) {
959    public_deps += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp" ]
960  }
961
962  if (angle_enable_d3d11) {
963    libs += [ "dxguid.lib" ]
964  }
965
966  if (angle_enable_metal) {
967    public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
968  }
969
970  if (angle_enable_cl_passthrough) {
971    public_deps += [ "src/libANGLE/renderer/cl:angle_cl_backend" ]
972  }
973
974  # Enable extra Chromium style warnings for libANGLE.
975  if (is_clang && angle_has_build) {
976    suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
977  }
978
979  if (is_apple) {
980    sources += libangle_mac_sources
981  }
982
983  if (is_ios) {
984    sources += [ "src/libANGLE/renderer/driver_utils_ios.mm" ]
985  }
986
987  if (is_debug) {
988    defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
989  }
990
991  # If VVL are enabled, enable RenderDoc capture as well.
992  if (angle_enable_vulkan_validation_layers) {
993    defines += [ "ANGLE_TEST_ENABLE_RENDERDOC_CAPTURE" ]
994  }
995
996  configs += [ ":debug_annotations_config" ]
997  public_configs += [
998    ":libANGLE_config",
999    ":angle_backend_config",
1000  ]
1001
1002  # Windows ARM64 is available since 10.0.16299 so no need to copy
1003  # d3dcompiler_47.dll because this file is available as inbox.
1004  if (_use_copy_compiler_dll) {
1005    data_deps = [ ":copy_compiler_dll" ]
1006  }
1007}
1008
1009config("angle_frame_capture_disabled") {
1010  defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
1011}
1012
1013angle_source_set("libANGLE") {
1014  public_deps = [ ":libANGLE_base" ]
1015  public_configs = [ ":angle_frame_capture_disabled" ]
1016  sources = [
1017    "src/libANGLE/capture/FrameCapture_mock.cpp",
1018    "src/libANGLE/capture/frame_capture_utils_mock.cpp",
1019  ]
1020
1021  # gl_enum_utils defaults included in with_capture build
1022  deps = []
1023  if (angle_enable_trace || is_debug) {
1024    deps += [ ":angle_gl_enum_utils" ]
1025  }
1026}
1027
1028angle_source_set("angle_gl_enum_utils") {
1029  deps = [ ":angle_common" ]
1030  sources = [
1031    "src/libANGLE/capture/gl_enum_utils.cpp",
1032    "src/libANGLE/capture/gl_enum_utils.h",
1033    "src/libANGLE/capture/gl_enum_utils_autogen.cpp",
1034    "src/libANGLE/capture/gl_enum_utils_autogen.h",
1035  ]
1036}
1037
1038if (angle_use_wayland) {
1039  config("angle_wayland_config") {
1040    if (!defined(use_system_libwayland) || use_system_libwayland) {
1041      libs = [
1042        "wayland-client",
1043        "wayland-egl",
1044      ]
1045    }
1046
1047    include_dirs = [
1048      "$angle_wayland_dir/egl",
1049      "$angle_wayland_dir/src",
1050
1051      # In case we are building with chromium, we need to take into account the case
1052      # where wayland-egl-backend.h is not installed in the system include directories
1053      "//third_party/wayland/src/egl",
1054    ]
1055  }
1056
1057  group("angle_wayland") {
1058    public_configs = [ ":angle_wayland_config" ]
1059
1060    if (defined(use_system_libwayland) && !use_system_libwayland) {
1061      # Use chromium third-party targets
1062      public_deps = [
1063        "//third_party/wayland:wayland_client",
1064        "//third_party/wayland:wayland_egl",
1065      ]
1066    }
1067  }
1068}
1069
1070if (!defined(angle_abseil_cpp_dir)) {
1071  angle_abseil_cpp_dir = "//third_party/abseil-cpp"
1072}
1073
1074config("angle_abseil_config") {
1075  if (angle_enable_abseil) {
1076    defines = [ "ANGLE_USE_ABSEIL" ]
1077
1078    configs = [
1079      "$angle_abseil_cpp_dir:absl_define_config",
1080      "$angle_abseil_cpp_dir:absl_include_config",
1081    ]
1082  }
1083}
1084
1085group("angle_abseil") {
1086  if (angle_enable_abseil) {
1087    # When build_with_chromium=true we need to include "//third_party/abseil-cpp:absl" while
1088    # we can be more specific when building standalone ANGLE.
1089    if (build_with_chromium || is_component_build) {
1090      public_deps = [ "$angle_abseil_cpp_dir:absl" ]
1091    } else {
1092      public_deps = [
1093        "$angle_abseil_cpp_dir/absl/container:flat_hash_map",
1094        "$angle_abseil_cpp_dir/absl/container:flat_hash_set",
1095      ]
1096    }
1097
1098    public_configs = [ ":angle_abseil_config" ]
1099  }
1100}
1101
1102config("angle_compression_config") {
1103  include_dirs = [ "//third_party/zlib/google" ]
1104}
1105
1106group("angle_compression") {
1107  public_configs = [
1108    ":angle_compression_config",
1109    "//third_party/zlib:zlib_config",
1110  ]
1111  public_deps =
1112      [ "$angle_zlib_compression_utils_dir:compression_utils_portable" ]
1113}
1114
1115if (angle_has_rapidjson) {
1116  config("angle_rapidjson_config") {
1117    defines = [ "ANGLE_HAS_RAPIDJSON" ]
1118  }
1119  angle_source_set("angle_json_serializer") {
1120    public_deps = [
1121      ":angle_common",
1122      "$angle_root/third_party/rapidjson",
1123    ]
1124    sources = [
1125      "src/common/serializer/JsonSerializer.cpp",
1126      "src/common/serializer/JsonSerializer.h",
1127    ]
1128    public_configs = [ ":angle_rapidjson_config" ]
1129  }
1130}
1131
1132assert(angle_has_frame_capture || !angle_with_capture_by_default)
1133if (angle_has_frame_capture) {
1134  config("angle_frame_capture_enabled") {
1135    defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
1136  }
1137
1138  angle_source_set("libANGLE_with_capture") {
1139    public_deps = [ ":libANGLE_base" ]
1140    deps = [ ":angle_compression" ]
1141    public_configs = [ ":angle_frame_capture_enabled" ]
1142    sources = libangle_capture_sources
1143
1144    if (angle_has_rapidjson) {
1145      public_deps += [ ":angle_json_serializer" ]
1146      sources += [ "src/libANGLE/capture/frame_capture_utils.cpp" ]
1147    } else {
1148      sources += [ "src/libANGLE/capture/frame_capture_utils_mock.cpp" ]
1149    }
1150  }
1151}
1152
1153config("shared_library_public_config") {
1154  if (is_mac && !is_component_build) {
1155    # Executable targets that depend on the shared libraries below need to have
1156    # the rpath setup in non-component build configurations.
1157    ldflags = [
1158      "-rpath",
1159      "@executable_path/",
1160    ]
1161    if (build_with_chromium) {
1162      ldflags += [
1163        # Path for loading shared libraries for unbundled binaries.
1164        # From //build/config/mac/BUILD.gn, this is only added for
1165        # component builds. However, since ANGLE always dynamically
1166        # links to libvulkan, it should be re-added for non-component
1167        # builds. (anglebug.com/4455)
1168        "-Wl,-rpath,@loader_path/.",
1169      ]
1170    }
1171  }
1172
1173  if (angle_is_winuwp) {
1174    ldflags = [
1175      "/APPCONTAINER",
1176
1177      # Disable warning about invalid subsystem number.
1178      # A default appropriate subsystem is selected automatically.
1179      "/IGNORE:4010",
1180    ]
1181  }
1182}
1183
1184config("library_name_config") {
1185  if (is_component_build && is_android) {
1186    defines = [
1187      "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"",
1188      "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"",
1189    ]
1190  } else {
1191    defines = [
1192      "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
1193      "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
1194    ]
1195  }
1196}
1197
1198# This config controls export definitions on ANGLE API calls.
1199config("angle_static") {
1200  defines = [
1201    "ANGLE_EXPORT=",
1202    "ANGLE_STATIC=1",
1203    "ANGLE_UTIL_EXPORT=",
1204    "EGLAPI=",
1205    "GL_APICALL=",
1206    "GL_API=",
1207  ]
1208}
1209
1210set_defaults("angle_libGLESv2") {
1211  sources = []
1212  output_name = "libGLESv2"
1213}
1214
1215template("angle_libGLESv2") {
1216  angle_shared_library(target_name) {
1217    sources = libglesv2_sources + invoker.sources
1218    if (angle_enable_cl) {
1219      sources += libglesv2_cl_sources
1220    }
1221
1222    output_name = "${invoker.output_name}${angle_libs_suffix}"
1223    if (angle_glesv2_extension != "") {
1224      output_extension = angle_glesv2_extension
1225    }
1226
1227    configs += [
1228      ":angle_gl_visibility_config",
1229      ":debug_annotations_config",
1230      ":gl_prototypes",
1231    ]
1232
1233    defines = [ "LIBGLESV2_IMPLEMENTATION" ]
1234
1235    deps = invoker.deps + [ ":includes" ]
1236
1237    if (is_win) {
1238      sources += [
1239        "src/libGLESv2/${invoker.output_name}_autogen.def",
1240        "src/libGLESv2/libGLESv2.rc",
1241      ]
1242      deps += [ ":angle_version" ]
1243    }
1244  }
1245}
1246
1247angle_libGLESv2("libGLESv2") {
1248  if (angle_with_capture_by_default) {
1249    deps = [ ":libANGLE_with_capture" ]
1250  } else {
1251    deps = [ ":libANGLE" ]
1252  }
1253}
1254
1255# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
1256if (angle_has_frame_capture) {
1257  angle_libGLESv2("libGLESv2_capture_complement") {
1258    if (angle_with_capture_by_default) {
1259      deps = [ ":libANGLE" ]
1260      output_name += "_no_capture"
1261    } else {
1262      deps = [ ":libANGLE_with_capture" ]
1263      output_name += "_with_capture"
1264    }
1265  }
1266}
1267
1268if (is_win && !angle_is_winuwp) {
1269  angle_shared_library("libGL") {
1270    sources = libgl_sources
1271
1272    output_name = "openGL32"
1273    output_dir = "$root_out_dir/angle_libs"
1274
1275    configs += [
1276      ":angle_gl_visibility_config",
1277      ":debug_annotations_config",
1278      ":gl_prototypes",
1279    ]
1280
1281    defines = [
1282      "ANGLE_CAPTURE_ENABLED=0",
1283      "LIBGL_IMPLEMENTATION",
1284    ]
1285
1286    deps = [
1287      ":includes",
1288      ":libANGLE",
1289    ]
1290
1291    if (is_win) {
1292      deps += [ ":angle_version" ]
1293    }
1294  }
1295}
1296
1297angle_static_library("libGLESv2_static") {
1298  sources = libglesv2_sources
1299  if (angle_enable_cl) {
1300    sources += libglesv2_cl_sources
1301  }
1302  configs += [ ":debug_annotations_config" ]
1303
1304  public_configs += [ ":angle_static" ]
1305  deps = [ ":includes" ]
1306  public_deps = [ ":libANGLE" ]
1307}
1308
1309angle_shared_library("libGLESv1_CM") {
1310  sources = libglesv1_cm_sources
1311  output_name = "libGLESv1_CM${angle_libs_suffix}"
1312
1313  configs += [
1314    ":angle_gl_visibility_config",
1315    ":debug_annotations_config",
1316    ":gl_prototypes",
1317  ]
1318
1319  defines = []
1320
1321  deps = [
1322    ":includes",
1323    ":libGLESv2",
1324  ]
1325
1326  if (is_win) {
1327    sources += [ "src/libGLESv1_CM/libGLESv1_CM.def" ]
1328    deps += [ ":angle_version" ]
1329  }
1330}
1331
1332config("libEGL_egl_loader_config") {
1333  defines = [ "ANGLE_USE_EGL_LOADER" ]
1334}
1335
1336angle_source_set("libEGL_egl_loader") {
1337  sources = [
1338    "src/libEGL/egl_loader_autogen.cpp",
1339    "src/libEGL/egl_loader_autogen.h",
1340  ]
1341
1342  public_configs += [
1343    ":libEGL_egl_loader_config",
1344    ":gl_prototypes",
1345  ]
1346
1347  deps = [ ":includes" ]
1348}
1349
1350angle_shared_library("libEGL") {
1351  sources = libegl_sources
1352  if (is_win) {
1353    sources += [ "src/libEGL/libEGL.rc" ]
1354  }
1355
1356  output_name = "libEGL${angle_libs_suffix}"
1357  if (angle_egl_extension != "") {
1358    output_extension = angle_egl_extension
1359  }
1360
1361  configs += [
1362    ":debug_annotations_config",
1363    ":library_name_config",
1364  ]
1365
1366  defines = [ "LIBEGL_IMPLEMENTATION" ]
1367  if (is_win) {
1368    defines += [ "EGLAPI=" ]
1369  } else {
1370    defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
1371  }
1372
1373  deps = [
1374    ":angle_common",
1375    ":libEGL_egl_loader",
1376  ]
1377
1378  if (is_win) {
1379    sources += [ "src/libEGL/libEGL_autogen.def" ]
1380    deps += [ ":angle_version" ]
1381  }
1382
1383  public_deps = [ ":includes" ]
1384
1385  data_deps = [ ":libGLESv2" ]
1386}
1387
1388angle_static_library("libEGL_static") {
1389  sources = libegl_sources
1390  configs += [
1391    ":debug_annotations_config",
1392    ":library_name_config",
1393  ]
1394  public_configs += [ ":angle_static" ]
1395  deps = [
1396    ":includes",
1397    ":libGLESv2_static",
1398  ]
1399}
1400
1401# Convenience targets for some of the samples so they can be built
1402# with Chromium's toolchain.
1403angle_executable("angle_shader_translator") {
1404  testonly = true
1405
1406  sources = [ "samples/shader_translator/shader_translator.cpp" ]
1407
1408  deps = [ ":translator" ]
1409
1410  defines = []
1411
1412  if (angle_enable_vulkan) {
1413    deps += [
1414      "${angle_spirv_tools_dir}:spvtools_headers",
1415      "${angle_spirv_tools_dir}:spvtools_val",
1416    ]
1417
1418    defines += [ "ANGLE_ENABLE_VULKAN" ]
1419  }
1420}
1421
1422if (angle_standalone || build_with_chromium) {
1423  config("angle_feature_support_config") {
1424    include_dirs = [
1425      "include",
1426      "src",
1427    ]
1428    defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1429    if (is_debug) {
1430      defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
1431    }
1432  }
1433
1434  angle_shared_library("libfeature_support") {
1435    output_name = "libfeature_support${angle_libs_suffix}"
1436
1437    if (is_android) {
1438      libs = [ "log" ]
1439    }
1440
1441    configs += [
1442      ":angle_feature_support_config",
1443      "${angle_jsoncpp_dir}:jsoncpp_config",
1444    ]
1445
1446    if (is_apple && !is_component_build) {
1447      ldflags = [
1448        "-install_name",
1449        "@rpath/${target_name}.dylib",
1450      ]
1451    }
1452
1453    sources = [
1454      "src/feature_support_util/feature_support_util.cpp",
1455      "src/feature_support_util/feature_support_util.h",
1456    ]
1457
1458    deps = [
1459      ":angle_gpu_info_util",
1460      "${angle_jsoncpp_dir}:jsoncpp",
1461    ]
1462  }
1463}
1464
1465if (angle_enable_cgl) {
1466  config("supports_automatic_graphics_switching") {
1467    # For discussion about config, inputs, etc, see:
1468    # https://bugs.chromium.org/p/chromium/issues/detail?id=781858
1469    _plist_file = "util/osx/supports_automatic_graphics_switching.plist"
1470    inputs = [ _plist_file ]
1471    ldflags = [
1472      "-sectcreate",
1473      "__TEXT",
1474      "__info_plist",
1475      rebase_path(_plist_file, root_build_dir),
1476    ]
1477  }
1478}
1479
1480if (is_android && symbol_level != 0) {
1481  action_foreach("compressed_symbols") {
1482    sources = []
1483    foreach(_library, angle_libraries) {
1484      if (is_component_build) {
1485        sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.cr.so" ]
1486      } else {
1487        sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
1488      }
1489    }
1490    if (angle_enable_vulkan_validation_layers) {
1491      foreach(_layer, vulkan_validation_layers) {
1492        if (is_component_build) {
1493          sources += [ "$root_out_dir/lib${_layer}.cr.so" ]
1494        } else {
1495          sources += [ "$root_out_dir/lib${_layer}.so" ]
1496        }
1497      }
1498    }
1499
1500    script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1501                         root_build_dir)
1502
1503    deps = []
1504    foreach(_library, angle_libraries) {
1505      deps += [ ":$_library" ]
1506    }
1507
1508    if (angle_enable_vulkan_validation_layers) {
1509      foreach(_layer, vulkan_validation_layers) {
1510        deps += [ "$angle_vulkan_validation_layers_dir:${_layer}" ]
1511      }
1512    }
1513
1514    outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
1515
1516    android_nm = "${android_tool_prefix}nm"
1517    android_strip = "${android_tool_prefix}strip"
1518
1519    args = [
1520      "--objcopy",
1521      rebase_path(android_objcopy, root_build_dir),
1522      "--nm",
1523      rebase_path(android_nm, root_build_dir),
1524      "--strip",
1525      rebase_path(android_strip, root_build_dir),
1526      "--unstrippedsofile",
1527      "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1528      "--output",
1529      "{{source_dir}}/lib.compressed/{{source_file_part}}",
1530    ]
1531  }
1532}
1533
1534if ((angle_standalone || build_with_chromium) && is_android &&
1535    current_toolchain == default_toolchain) {
1536  apk_version_code = "0"
1537  if (angle_enable_commit_id) {
1538    apk_version_code =
1539        exec_script("src/commit_id.py", [ "position" ], "trim string")
1540  }
1541
1542  # Package ANGLE libraries for normal use on Android
1543  angle_apk("angle_chromium_apk") {
1544    package_name = "org.chromium.angle"
1545    apk_name = "AngleLibraries"
1546    version_name = "ANGLE Developer Build"
1547    version_code = apk_version_code
1548  }
1549
1550  # Package ANGLE libraries for AGI use on Android
1551  angle_apk("angle_agi_chromium_apk") {
1552    package_name = "org.chromium.angle.agi"
1553    apk_name = "AngleAgiLibraries"
1554    version_name = "ANGLE AGI Build"
1555    version_code = apk_version_code
1556  }
1557
1558  group("angle_apks") {
1559    deps = [
1560      ":angle_agi_chromium_apk",
1561      ":angle_chromium_apk",
1562    ]
1563  }
1564}
1565
1566group("angle") {
1567  data_deps = [
1568    ":libEGL",
1569    ":libGLESv1_CM",
1570    ":libGLESv2",
1571  ]
1572}
1573