blob: aaf0e77335a7746d477293ba8da675ef82b15628 [file] [log] [blame]
Jamie Madill0cb3b0f2019-01-28 09:55:20 -05001# Copyright 2019 The ANGLE Project Authors. All rights reserved.
Jamie Madill72f5b5e2014-06-23 15:13:02 -04002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Corentin Wallez51e2ad12015-05-26 11:32:58 -04005# import the use_x11 variable
Frank Henigmand0ef13a2017-08-28 22:53:24 -04006import("gni/angle.gni")
Jamie Madill1ba72542019-10-04 15:17:49 -04007if (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 }
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060018}
Corentin Wallez51e2ad12015-05-26 11:32:58 -040019
Corentin Wallez16d4e472017-03-20 13:06:19 -040020declare_args() {
21 # Use the PCI lib to collect GPU information on Linux.
Hidehiko Abe90a9cf92020-09-11 02:40:34 +090022 use_libpci =
23 (is_linux || is_chromeos) && (!is_chromecast || is_cast_desktop_build) &&
24 (angle_use_x11 || use_ozone) && angle_has_build
Frank Henigmane42ec182017-12-11 23:58:53 -050025
26 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
27 angle_link_glx = false
Jamie Madilleb1b1642019-07-30 17:22:17 -040028
29 # Defaults to capture building to $root_out_dir/angle_libs/with_capture.
30 # Switch on to build capture to $root_out_dir.
31 angle_with_capture_by_default = false
Austin Kinross11dc1632019-09-18 14:46:23 -070032
33 # Don't build extra (test, samples etc) for Windows UWP. We don't have
34 # infrastructure (e.g. windowing helper functions) in place to run them.
Jamie Madille3c25712019-12-03 14:08:36 -050035 angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build
Geoff Lange8883562020-03-06 09:32:18 -050036
37 # Enable generating current commit information using git
38 angle_enable_commit_id = true
Tim Van Pattene78d9a62020-07-24 11:58:45 -060039
40 # Abseil has trouble supporting MSVC, particularly regarding component builds.
41 # http://crbug.com/1126524
42 angle_enable_abseil = angle_has_build && is_clang
Jamie Madill06a9d522020-11-04 19:57:27 -050043
44 # Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled.
45 angle_enable_annotator_run_time_checks = false
Corentin Wallez16d4e472017-03-20 13:06:19 -040046}
47
Jamie Madille3c25712019-12-03 14:08:36 -050048if (angle_build_all) {
Frank Henigmand0ef13a2017-08-28 22:53:24 -040049 group("all") {
50 testonly = true
51 deps = [
Jamie Madille3c25712019-12-03 14:08:36 -050052 ":angle",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040053 ":angle_shader_translator",
54 ":translator_fuzzer",
Jamie Madill238c19e2019-02-07 09:09:41 -050055 ":xxhash_fuzzer",
Jamie Madille3c25712019-12-03 14:08:36 -050056 "$angle_root/samples:angle_samples",
57 "$angle_root/src/tests:angle_tests",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040058 ]
59 }
60}
61
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000062import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060063import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070064
Brett Wilson2f5469c2014-07-22 17:00:17 -070065# This config is exported to dependent targets (and also applied to internal
66# ones).
67config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050068 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070069}
70
Jamie Madill4638dc92018-12-17 13:13:49 -050071# Prevent the GL headers from redeclaring ANGLE entry points.
72config("no_gl_prototypes") {
73 defines = [
74 "GL_GLES_PROTOTYPES=0",
75 "EGL_EGL_PROTOTYPES=0",
76 ]
77}
78
79config("gl_prototypes") {
80 defines = [
81 "GL_GLES_PROTOTYPES=1",
82 "EGL_EGL_PROTOTYPES=1",
83 "GL_GLEXT_PROTOTYPES",
84 "EGL_EGLEXT_PROTOTYPES",
85 ]
86}
87
Jamie Madill72f5b5e2014-06-23 15:13:02 -040088# This config is applied to internal Angle targets (not pushed to dependents).
89config("internal_config") {
90 include_dirs = [
91 "include",
92 "src",
93 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050094
Jamie Madill4638dc92018-12-17 13:13:49 -050095 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -040096
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060097 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040098 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060099 } else {
100 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -0400101 }
Geoff Langb02fc662018-08-21 09:48:01 -0400102
Manh Nguyendce37b72020-06-21 22:27:06 -0400103 if (is_win) {
104 defines += [ "ANGLE_IS_WIN" ]
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900105 } else if (is_linux || is_chromeos) {
Manh Nguyendce37b72020-06-21 22:27:06 -0400106 defines += [ "ANGLE_IS_LINUX" ]
107 }
108
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700109 # Enables debug/trace-related functionality, including logging every GLES/EGL API command to the
110 # "angle_debug.txt" file on desktop. Enables debug markers for AGI, but must also set
111 # angle_enable_annotator_run_time_checks to improve performance.
Tobin Ehlis573f76b2018-05-03 11:10:44 -0600112 if (angle_enable_trace) {
113 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
114 }
Tobin Ehlis93121f32019-10-17 08:18:16 -0600115
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700116 # When used with angle_enable_trace, enables logging every GLES/EGL API command to Android logcat
117 # Enables debug markers for AGI regardless of run-time checks.
118 if (angle_enable_trace_android_logcat) {
119 defines += [ "ANGLE_ENABLE_TRACE_ANDROID_LOGCAT=1" ]
120 }
121
Tobin Ehlis93121f32019-10-17 08:18:16 -0600122 if (is_chromeos) {
123 defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
124 }
Ethan Leefcef6dc2020-01-24 22:41:35 -0500125
126 if (is_ggp) {
127 defines += [ "__ggp__" ]
128 }
Xiaoxuan Liu61180d02020-10-12 16:40:13 +0800129
130 if (angle_use_vulkan_display) {
Xiaoxuan Liud0f99d52020-12-03 11:06:56 +0800131 defines += [
132 "ANGLE_USE_VULKAN_DISPLAY",
133 "EGL_NO_X11",
134 ]
Xiaoxuan Liu61180d02020-10-12 16:40:13 +0800135 if (angle_vulkan_display_mode == "simple") {
136 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ]
137 } else if (angle_vulkan_display_mode == "headless") {
138 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ]
139 }
140 }
Alexis Hetuf2a15482020-12-04 14:07:24 -0500141
142 if (is_lsan) {
143 defines += [ "ANGLE_WITH_LSAN" ]
144 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400145}
146
Jamie Madilla9f11bf2019-10-21 08:39:14 -0400147config("constructor_and_destructor_warnings") {
148 if (is_clang) {
149 cflags = [
150 "-Wexit-time-destructors",
151 "-Wglobal-constructors",
152 ]
153 }
154}
155
Jamie Madill509a1d42016-07-18 10:10:29 -0400156config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -0400157 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400158
Brian Salomone7496f52021-01-26 16:13:04 -0500159 # Avoid failing builds for warnings enabled by Skia build.
160 if (defined(is_skia_standalone)) {
161 cflags += [ "-w" ]
162 }
163
Jamie Madill509a1d42016-07-18 10:10:29 -0400164 # Enable more default warnings on Windows.
165 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -0400166 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -0400167 "/we4244", # Conversion: possible loss of data.
Jamie Madill330c8672020-08-28 17:44:13 -0400168 "/we4312", # Conversion: greater size.
Jamie Madill509a1d42016-07-18 10:10:29 -0400169 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -0400170 "/we4458", # declaration hides class member.
Ben Wagner1e064012019-04-12 14:10:17 -0400171 "/we4715", # not all control paths return a value
Geoff Langb9440532017-11-28 13:26:34 -0500172 "/we4800", # forcing value to bool.
173 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400174 ]
175 }
Ben Wagner211bff32017-10-10 23:53:20 -0400176 if (is_clang) {
Michael Spang229fc832019-01-21 18:09:15 -0500177 cflags += [
Jamie Madillc7217aa2020-08-28 14:45:14 -0400178 "-Wbad-function-cast",
Jamie Madill155947f2019-10-24 12:55:11 -0400179 "-Wconditional-uninitialized",
Jamie Madill44a0e732019-09-02 13:55:59 -0400180 "-Wextra-semi-stmt",
Jiacheng Lu73e5e9b2019-07-22 15:26:17 -0600181 "-Wfloat-conversion",
Jamie Madill16370a62019-10-24 12:55:11 -0400182 "-Winconsistent-missing-destructor-override",
Jamie Madilla6206852019-10-24 12:55:09 -0400183 "-Wmissing-field-initializers",
Stuart Morgan5dba7232020-06-16 09:29:16 -0700184 "-Wnewline-eof",
Olli Etuaho8073a952018-05-09 16:41:39 +0300185 "-Wnon-virtual-dtor",
Jamie Madill68945f12019-10-24 12:55:09 -0400186 "-Wredundant-parens",
Jamie Madill1ab8b752020-08-28 14:45:15 -0400187 "-Wreturn-std-move-in-c++11",
Jamie Madill859ca032019-10-24 12:55:08 -0400188 "-Wshadow-field",
Jamie Madillfd58d222019-10-24 12:55:07 -0400189 "-Wtautological-type-limit-compare",
Jamie Madillc017cee2019-10-24 12:55:10 -0400190 "-Wundefined-reinterpret-cast",
Jamie Madillc09ae152019-02-01 14:16:32 -0500191 "-Wunneeded-internal-declaration",
Jamie Madill3486ec92020-09-10 17:55:28 -0400192 "-Wweak-template-vtables",
James Darpinianefa898a2019-08-07 17:05:35 -0700193
194 # The below warnings are used by WebKit. We enable them to make rolling
195 # ANGLE in WebKit easier.
196 "-Wparentheses",
197 "-Wrange-loop-analysis",
198 "-Wstrict-prototypes",
199 "-Wunreachable-code",
James Darpinian7e48c9e2019-08-06 17:17:19 -0700200 "-Wshorten-64-to-32",
Nico Weber79de62c2018-01-31 10:47:14 -0500201 ]
James Darpiniandea86292020-12-02 16:26:03 -0800202 if (!use_xcode_clang) {
203 # Mac catalyst uses a clang version that doesn't have these.
204 cflags += [
205 "-Wdeprecated-copy",
206 "-Wsuggest-destructor-override",
207 "-Wsuggest-override",
208 ]
209 }
Ben Wagner211bff32017-10-10 23:53:20 -0400210 }
Austin Kinross11dc1632019-09-18 14:46:23 -0700211
212 if (angle_is_winuwp) {
213 cflags += [ "/wd4447" ] # 'main' signature found without threading model.
214 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400215}
216
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600217# This config adds build-ids to the associated library.
218# -Wl is a special option that indicates that clang should pass the associated
219# option --build-id to the linker. This will cause a build-id section to be added
220# to the associated library. The build-id makes it possible for a debugger to
221# find the right symbol file to use.
222config("build_id_config") {
223 ldflags = [ "-Wl,--build-id" ]
224}
225
Jamie Madill1ba72542019-10-04 15:17:49 -0400226_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
227
Tom Tan5c317532018-11-30 17:01:01 -0800228# Windows ARM64 is available since 10.0.16299 so no need to copy
229# d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400230if (_use_copy_compiler_dll) {
Jamie Madilld09546e2019-02-22 10:24:44 -0500231 # We also ship an older DLL for compatiblity with Windows 7 machines without
232 # the UCRT. This DLL isn't available in the standard SDK distribution.
233 _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
234 _has_old_compiler =
235 exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
236
Daniel Bratell73941de2015-02-25 14:34:49 +0100237 copy("copy_compiler_dll") {
Julien Isorce5641d192020-02-04 21:31:47 -0800238 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
Jamie Madilld09546e2019-02-22 10:24:44 -0500239
240 if (_has_old_compiler) {
241 sources += [ _old_compiler ]
242 }
243
Julien Isorce5641d192020-02-04 21:31:47 -0800244 outputs = [ "$root_out_dir/{{source_file_part}}" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100245 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100246}
247
Jamie Madill55959b02019-03-05 10:07:41 -0500248# Holds the shared includes so we only need to list them once.
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500249config("includes_config") {
250 include_dirs = [ "include" ]
251}
252
Jamie Madill7098cff2019-01-15 18:33:42 -0500253angle_source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400254 sources = libangle_includes
Jamie Madill8d412db2020-08-29 22:25:18 +0000255 public_configs = [ ":includes_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400256}
257
Jamie Madill7098cff2019-01-15 18:33:42 -0500258angle_static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400259 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400260
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400261 public_deps = [
262 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400263 ":angle_translator_headers",
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400264 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400265}
266
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500267config("angle_disable_pool_alloc") {
268 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400269}
270
Cooper Partin75da1972015-06-16 15:03:14 -0700271config("debug_annotations_config") {
Corentin Wallez105bc9d2019-03-06 16:32:40 +0000272 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500273 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700274 }
Jamie Madill06a9d522020-11-04 19:57:27 -0500275 if (angle_enable_annotator_run_time_checks) {
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700276 # When used with angle_enable_trace, enables debug markers for AGI with run-time checks to
277 # filter out EVENT() messages when the debug annotator is disabled.
Jamie Madill06a9d522020-11-04 19:57:27 -0500278 defines = [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
279 }
Cooper Partin75da1972015-06-16 15:03:14 -0700280}
281
Jamie Madille31fd872016-05-27 08:35:36 -0400282config("angle_release_asserts_config") {
283 if (dcheck_always_on) {
284 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
285 }
286}
287
Jamie Madille2e406c2016-06-02 13:04:10 -0400288config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400289 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500290 if (is_android) {
291 libs = [ "log" ]
292 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400293}
294
Alexis Hetua20f5b12020-08-18 11:26:50 -0400295# Silences the "indirect call of a function with wrong dynamic type" cfi error
296config("angle_no_cfi_icall") {
297 if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
298 cflags = [ "-fno-sanitize=cfi-icall" ]
299 }
300}
301
302# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
303config("angle_no_cfi_unrelated_cast") {
304 if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
305 cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
306 }
307}
308
Jamie Madillc09ae152019-02-01 14:16:32 -0500309angle_source_set("xxhash") {
310 sources = xxhash_sources
Jamie Madill5fde6322020-08-28 14:45:17 -0400311 if (is_clang) {
312 cflags_c = [ "-Wno-implicit-fallthrough" ]
313 }
Jamie Madillc09ae152019-02-01 14:16:32 -0500314}
315
Jamie Madill1ba72542019-10-04 15:17:49 -0400316if (angle_has_build) {
317 fuzzer_test("xxhash_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800318 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
319 deps = [ ":xxhash" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400320 }
Jamie Madill238c19e2019-02-07 09:09:41 -0500321}
322
Jamie Madill7098cff2019-01-15 18:33:42 -0500323angle_static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400324 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700325
Jamie Madill562e81b2015-01-14 14:31:02 -0500326 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400327 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700328 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500329 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400330
Julien Isorce5641d192020-02-04 21:31:47 -0800331 deps = [ ":xxhash" ]
Jamie Madillc09ae152019-02-01 14:16:32 -0500332
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400333 public_deps = [
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600334 ":angle_abseil",
Jamie Madill4638dc92018-12-17 13:13:49 -0500335 ":angle_version",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500336 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400337 ]
Jamie Madill7098cff2019-01-15 18:33:42 -0500338 public_configs += [ ":angle_common_config" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400339 if (angle_has_build && use_fuzzing_engine) {
Jamie Madill48aa52f2019-10-17 07:56:53 -0400340 all_dependent_configs = [ ":angle_disable_pool_alloc" ]
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500341 }
Tim Van Pattene99b8bc2020-10-23 18:50:33 -0600342
Jamie Madill95286412020-11-23 15:47:09 -0500343 if (is_linux || is_chromeos) {
344 libs = [ "dl" ]
345 }
346
Tim Van Pattene99b8bc2020-10-23 18:50:33 -0600347 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
348 # In API level 26 ANativeWindow APIs were moved from libandroid.so
349 # into a separate library, libnativewindow.so
350 if (ndk_api_level_at_least_26) {
351 libs = [ "nativewindow" ]
352 } else {
353 libs = [ "android" ]
354 }
355 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500356}
357
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400358config("angle_image_util_config") {
359 include_dirs = [
360 "include",
361 "src",
362 ]
363}
364
Jamie Madill1f08ab22019-10-03 16:22:52 -0400365angle_source_set("angle_image_util_headers") {
366 sources = libangle_image_util_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800367 public_deps = [ ":angle_common" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400368}
369
Jamie Madill7098cff2019-01-15 18:33:42 -0500370angle_static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400371 sources = libangle_image_util_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500372 public_configs += [ ":angle_image_util_config" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800373 public_deps = [ ":angle_image_util_headers" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400374}
375
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600376config("angle_gl_visibility_config") {
377 if (is_win) {
378 defines = [
379 "GL_APICALL=",
380 "GL_API=",
381 ]
382 } else {
383 defines = [
384 "GL_APICALL=__attribute__((visibility(\"default\")))",
385 "GL_API=__attribute__((visibility(\"default\")))",
386 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600387 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600388}
389
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500390config("angle_gpu_info_util_config") {
391 include_dirs = [
392 "include",
393 "src",
394 ]
395}
396
Jamie Madill7098cff2019-01-15 18:33:42 -0500397angle_static_library("angle_gpu_info_util") {
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400398 public_configs += [
399 ":angle_gpu_info_util_config",
400 ":angle_backend_config",
401 ]
Julien Isorce5641d192020-02-04 21:31:47 -0800402 public_deps = [ ":angle_common" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400403 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500404 deps = []
405 libs = []
406 defines = []
407
Jamie Madillb09f16e2020-10-01 10:02:07 -0400408 if (!is_chromeos && angle_has_build) {
Michael Spangb630bf92020-01-24 17:27:01 -0500409 sources += libangle_gpu_info_util_vulkan_sources
Jamie Madill4798c8c2020-12-14 16:35:27 -0500410 deps += [ "$angle_vulkan_headers_dir:vulkan_headers" ]
Michael Spangb630bf92020-01-24 17:27:01 -0500411 }
412
Ian Elliottd07c52e2018-06-22 15:42:09 -0600413 if (is_android) {
Michael Spangb630bf92020-01-24 17:27:01 -0500414 sources += libangle_gpu_info_util_android_sources
415 }
416
417 if (is_fuchsia) {
418 sources += libangle_gpu_info_util_fuchsia_sources
Antonio Maiorano13816d22020-06-16 14:27:04 -0400419 deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ]
Ian Elliottd07c52e2018-06-22 15:42:09 -0600420 }
421
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700422 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400423 sources += libangle_gpu_info_util_win_sources
Austin Kinross11dc1632019-09-18 14:46:23 -0700424 if (!angle_is_winuwp) {
425 libs += [ "setupapi.lib" ]
426 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400427 libs += [ "dxgi.lib" ]
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700428 }
429
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900430 if (is_linux || is_chromeos) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400431 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500432
Jamie Madill8970ad32020-08-26 12:59:19 -0400433 if (angle_use_x11 && angle_has_build) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400434 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500435 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
436 defines += [ "GPU_INFO_USE_X11" ]
437 libs += [
438 "X11",
439 "Xi",
440 "Xext",
441 ]
442 }
443 }
444
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500445 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400446 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500447 defines += [ "GPU_INFO_USE_LIBPCI" ]
448 libs += [ "pci" ]
449 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500450
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +0000451 if (is_apple) {
Sylvain Defresnebae95f82020-07-02 17:19:14 +0200452 frameworks = [
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500453 "IOKit.framework",
454 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400455 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500456 ]
James Darpiniandea86292020-12-02 16:26:03 -0800457 if (angle_enable_eagl) {
458 frameworks += [ "OpenGLES.framework" ]
459 } else if (angle_enable_cgl) {
460 frameworks += [ "OpenGL.framework" ]
461 }
462 if (is_mac || angle_enable_cgl) {
463 sources += libangle_gpu_info_util_mac_sources
464 }
465 if (is_ios && !angle_enable_cgl) {
466 sources += libangle_gpu_info_util_ios_sources
467 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500468 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500469}
470
Jamie Madill1f08ab22019-10-03 16:22:52 -0400471angle_source_set("angle_translator_headers") {
472 sources = angle_translator_exported_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800473 public_deps = [ ":includes" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400474}
475
Jamie Madill7098cff2019-01-15 18:33:42 -0500476angle_static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400477 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800478 defines = []
479
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500480 _needs_glsl_base = false
481 needs_glsl_and_vulkan_base = false
482
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700483 if (angle_enable_essl || use_fuzzing_engine) {
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500484 _needs_glsl_base = true
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400485 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800486 defines += [ "ANGLE_ENABLE_ESSL" ]
487 }
488
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700489 if (angle_enable_glsl || use_fuzzing_engine) {
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500490 _needs_glsl_base = true
491 needs_glsl_and_vulkan_base = true
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400492 sources += angle_translator_glsl_sources
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +0000493 if (is_apple) {
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500494 sources += angle_translator_glsl_mac_sources
495 }
Austin Kinross82b5ab62015-12-11 09:30:15 -0800496 defines += [ "ANGLE_ENABLE_GLSL" ]
497 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400498
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700499 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400500 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800501 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100502 }
Jamie Madille794cd82017-01-13 17:29:51 -0500503
Le Quyend200a772019-10-10 00:44:01 +0800504 if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500505 _needs_glsl_base = true
506 needs_glsl_and_vulkan_base = true
507
Le Quyend200a772019-10-10 00:44:01 +0800508 # This translator is needed by metal backend also.
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400509 sources += angle_translator_lib_vulkan_sources
Le Quyend200a772019-10-10 00:44:01 +0800510 }
511
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500512 if (_needs_glsl_base) {
513 sources += angle_translator_glsl_base_sources
514 }
515 if (needs_glsl_and_vulkan_base) {
516 sources += angle_translator_glsl_and_vulkan_base_sources
517 }
518
Le Quyend200a772019-10-10 00:44:01 +0800519 if (angle_enable_vulkan || use_fuzzing_engine) {
Jamie Madille794cd82017-01-13 17:29:51 -0500520 defines += [ "ANGLE_ENABLE_VULKAN" ]
521 }
522
Le Quyend200a772019-10-10 00:44:01 +0800523 if (angle_enable_metal) {
524 sources += angle_translator_lib_metal_sources
525 defines += [ "ANGLE_ENABLE_METAL" ]
526 }
527
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600528 if (angle_enable_swiftshader) {
529 defines += [ "ANGLE_ENABLE_SWIFTSHADER" ]
530 }
531
Jamie Madill7098cff2019-01-15 18:33:42 -0500532 public_configs += [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400533
534 deps = [
535 ":includes",
536 ":preprocessor",
537 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500538
539 public_deps = [
540 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400541 ":angle_translator_headers",
Jamie Madill562e81b2015-01-14 14:31:02 -0500542 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400543
544 if (is_win) {
545 # Necessary to suppress some system header xtree warnigns in Release.
546 # For some reason this warning doesn't get triggered in Chromium
547 cflags = [ "/wd4718" ]
548 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400549}
550
Jamie Madill7098cff2019-01-15 18:33:42 -0500551angle_source_set("translator_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800552 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700553
554 include_dirs = [
555 "include",
556 "src",
557 ]
558
Julien Isorce5641d192020-02-04 21:31:47 -0800559 deps = [ ":translator" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700560}
561
Jamie Madill62778cb2020-09-22 23:10:04 -0400562config("angle_commit_id_config") {
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400563 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill62778cb2020-09-22 23:10:04 -0400564 visibility = [ ":angle_commit_id" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500565}
566
Jamie Madill62778cb2020-09-22 23:10:04 -0400567_commit_id_output_file = "$root_gen_dir/angle/angle_commit.h"
568action("angle_commit_id") {
Geoff Langba8ef682020-02-24 14:13:40 -0500569 script = "src/commit_id.py"
Jamie Madill62778cb2020-09-22 23:10:04 -0400570 outputs = [ _commit_id_output_file ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400571
Geoff Langba8ef682020-02-24 14:13:40 -0500572 # Add git as a dependency if it is available.
Geoff Lang20c69732020-03-06 11:02:31 -0500573 if (angle_enable_commit_id &&
574 exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
Geoff Langdd19d552020-03-02 09:41:22 -0500575 # commit id should depend on angle's HEAD revision
576 inputs = [ ".git/HEAD" ]
Jamie Madill5f2ba632020-08-15 23:50:59 -0400577 branch = read_file(".git/HEAD", "string")
578 result = string_split(branch)
579 if (result[0] == "ref:") {
580 inputs += [ ".git/" + result[1] ]
581 }
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200582 }
Geoff Langba8ef682020-02-24 14:13:40 -0500583
584 args = [
585 "gen",
Jamie Madill62778cb2020-09-22 23:10:04 -0400586 rebase_path(_commit_id_output_file, root_build_dir),
Geoff Langba8ef682020-02-24 14:13:40 -0500587 ]
588
Jamie Madill62778cb2020-09-22 23:10:04 -0400589 public_configs = [ ":angle_commit_id_config" ]
590}
591
592# TODO(jmadill): Remove this. http://b/168736059
593group("commit_id") {
594 data_deps = [ ":angle_commit_id" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400595}
596
Jamie Madill7098cff2019-01-15 18:33:42 -0500597angle_source_set("angle_version") {
Jamie Madill62778cb2020-09-22 23:10:04 -0400598 # TODO(jmadill): Remove version.h. http://b/168736059
599 sources = [
600 "src/common/angle_version.h",
601 "src/common/version.h",
602 ]
603 public_deps = [ ":angle_commit_id" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500604}
605
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400606config("angle_backend_config") {
Jamie Madill562e81b2015-01-14 14:31:02 -0500607 defines = []
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400608
Etienne Bergeron9e83c152020-06-04 19:53:36 -0400609 if (angle_delegate_workers) {
610 defines += [ "ANGLE_DELEGATE_WORKERS" ]
611 }
Jamie Madill1f08ab22019-10-03 16:22:52 -0400612
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600613 configs = []
614
Jamie Madillbb96aef2020-09-11 13:50:09 -0400615 if (angle_enable_d3d11) {
616 configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ]
Trevor David Black192a0142020-10-08 16:47:35 -0700617 defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ]
Jamie Madillbb96aef2020-09-11 13:50:09 -0400618 }
619
620 if (angle_enable_d3d9) {
621 configs += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend_config" ]
622 }
623
Jamie Madill2d741702020-09-11 12:30:04 -0400624 if (angle_enable_gl) {
625 configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ]
626 }
627
Jamie Madill852f61f2020-09-11 11:54:35 -0400628 if (angle_enable_null) {
629 configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ]
630 }
631
Le Quyend200a772019-10-10 00:44:01 +0800632 if (angle_enable_metal) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600633 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
Le Quyend200a772019-10-10 00:44:01 +0800634 }
635
Jamie Madill1f08ab22019-10-03 16:22:52 -0400636 if (angle_enable_vulkan) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600637 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400638 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400639}
640
641config("libANGLE_config") {
642 cflags = []
643 defines = []
644 libs = []
645 ldflags = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500646 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400647
648 if (is_win) {
Julien Isorce5641d192020-02-04 21:31:47 -0800649 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
650 # are not enabled.
Austin Kinross40853472015-02-12 10:39:56 -0800651 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500652
653 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
Yuly Novikov8edc68e2019-02-12 12:41:01 -0500654 # In API level 26 ANativeWindow APIs were moved from libandroid.so
655 # into a separate library, libnativewindow.so
656 if (ndk_api_level_at_least_26) {
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500657 libs += [ "nativewindow" ]
658 } else {
659 libs += [ "android" ]
660 }
661 }
Michael Spang7cd5f642019-08-21 20:03:49 -0400662
Ethan Leed22b8be2019-11-15 12:26:39 -0500663 if (angle_use_x11) {
Michael Spang7cd5f642019-08-21 20:03:49 -0400664 defines += [ "ANGLE_USE_X11" ]
665 }
Jamie Madillaf5e3822020-01-28 10:05:36 -0500666
667 if (angle_enable_overlay) {
668 defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
669 }
Tim Van Pattenee4e0862020-09-24 11:39:49 -0600670 if (angle_enable_perf_counter_output) {
671 defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ]
672 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500673}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500674
Jamie Madill1f08ab22019-10-03 16:22:52 -0400675angle_source_set("libANGLE_headers") {
676 sources = libangle_headers
677 public_deps = [
678 ":angle_common",
679 ":angle_translator_headers",
680 ]
Jamie Madillaf5e3822020-01-28 10:05:36 -0500681 public_configs += [ ":libANGLE_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500682}
683
Jamie Madill2f718022019-10-28 11:48:46 -0400684# Don't even try to build glslang if Metal and Vulkan are disabled.
685if (angle_enable_vulkan || angle_enable_metal) {
686 angle_source_set("angle_glslang_wrapper") {
687 sources = [
688 "src/libANGLE/renderer/glslang_wrapper_utils.cpp",
689 "src/libANGLE/renderer/glslang_wrapper_utils.h",
690 ]
691 deps = [
692 ":libANGLE_headers",
Shahbaz Youssefi6689a542021-01-21 00:36:14 -0500693 "$angle_root/src/common/spirv:angle_spirv_builder",
694 "$angle_root/src/common/spirv:angle_spirv_parser",
Jamie Madill2f718022019-10-28 11:48:46 -0400695 "${angle_glslang_dir}:glslang_default_resource_limits_sources",
Shahbaz Youssefib291ad02020-07-03 23:53:10 -0400696 "${angle_glslang_dir}:glslang_lib_sources",
Shahbaz Youssefi71e6afb2020-01-14 14:12:31 -0500697 "${angle_spirv_headers_dir}:spv_headers",
698 "${angle_spirv_tools_dir}:spvtools_headers",
Jamie Madill2f718022019-10-28 11:48:46 -0400699 ]
700 }
Le Quyena48f95a2019-10-14 14:49:49 +0800701}
702
Jamie Madill4d3a0f62020-09-11 12:36:05 -0400703if (is_win) {
704 angle_source_set("angle_d3d_format_tables") {
705 sources = [
706 "src/libANGLE/renderer/dxgi_format_map.h",
707 "src/libANGLE/renderer/dxgi_format_map_autogen.cpp",
708 "src/libANGLE/renderer/dxgi_support_table.h",
709 "src/libANGLE/renderer/dxgi_support_table_autogen.cpp",
710 ]
711
712 if (!angle_is_winuwp) {
713 sources += [
714 "src/libANGLE/renderer/d3d_format.cpp",
715 "src/libANGLE/renderer/d3d_format.h",
716 ]
717 }
718
719 public_deps = [ ":libANGLE_headers" ]
720 configs += [ ":angle_backend_config" ]
721 }
722}
723
Jamie Madilleb1b1642019-07-30 17:22:17 -0400724angle_source_set("libANGLE_base") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400725 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500726
Jamie Madill5ea762a2017-06-07 14:59:51 -0400727 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500728 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500729 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500730 if (angle_link_glx) {
731 libs += [ "GL" ]
732 defines += [ "ANGLE_LINK_GLX" ]
733 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400734 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500735 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500736 ":angle_gpu_info_util",
Jamie Madill4638dc92018-12-17 13:13:49 -0500737 ":angle_version",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400738 ":libANGLE_headers",
Jamie Madill720ca442018-12-17 14:04:10 -0500739 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400740 ]
741 deps = [
Tim Van Pattenb55f0f72020-06-02 18:01:24 -0600742 ":angle_compression",
Corentin Wallez878baf92017-02-15 13:57:16 -0500743 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500744 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500745 ]
746
Austin Eng0739f072021-01-19 23:54:20 +0000747 if (is_win) {
Jamie Madille55374f2019-10-24 12:55:12 -0400748 libs += [
Jamie Madille55374f2019-10-24 12:55:12 -0400749 "gdi32.lib",
750 "user32.lib",
751 ]
752 }
753
Jamie Madillbb96aef2020-09-11 13:50:09 -0400754 if (angle_enable_d3d11) {
755 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend" ]
756 }
757
758 if (angle_enable_d3d9) {
759 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend" ]
760 }
761
Jamie Madill2d741702020-09-11 12:30:04 -0400762 if (angle_enable_gl) {
763 public_deps += [ "src/libANGLE/renderer/gl:angle_gl_backend" ]
764 }
765
Jamie Madill852f61f2020-09-11 11:54:35 -0400766 if (angle_enable_null) {
767 public_deps += [ "src/libANGLE/renderer/null:angle_null_backend" ]
768 }
769
Jamie Madill1f08ab22019-10-03 16:22:52 -0400770 if (angle_enable_vulkan) {
771 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
772 }
773
Le Quyend200a772019-10-10 00:44:01 +0800774 if (angle_enable_metal) {
775 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
776 }
777
Jamie Madillab2bfa82019-01-15 19:06:47 -0500778 # Enable extra Chromium style warnings for libANGLE.
James Darpiniandea86292020-12-02 16:26:03 -0800779 if (is_clang && angle_has_build && !use_xcode_clang) {
Jamie Madillab2bfa82019-01-15 19:06:47 -0500780 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
781 }
782
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +0000783 if (is_apple) {
Geoff Langecd2e3b2019-07-09 15:39:39 -0400784 sources += libangle_mac_sources
785 }
786
Jamie Madill562e81b2015-01-14 14:31:02 -0500787 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500788 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400789 }
790
Jamie Madill7098cff2019-01-15 18:33:42 -0500791 configs += [ ":debug_annotations_config" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400792 public_configs += [
793 ":libANGLE_config",
794 ":angle_backend_config",
795 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500796
Tom Tan5c317532018-11-30 17:01:01 -0800797 # Windows ARM64 is available since 10.0.16299 so no need to copy
798 # d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400799 if (_use_copy_compiler_dll) {
Julien Isorce5641d192020-02-04 21:31:47 -0800800 data_deps = [ ":copy_compiler_dll" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500801 }
802}
803
Jamie Madilleb1b1642019-07-30 17:22:17 -0400804config("angle_frame_capture_disabled") {
805 defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
806}
807
808config("angle_frame_capture_enabled") {
809 defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
810}
811
812angle_source_set("libANGLE") {
Julien Isorce5641d192020-02-04 21:31:47 -0800813 public_deps = [ ":libANGLE_base" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400814 public_configs = [ ":angle_frame_capture_disabled" ]
Jamie Madill6fc10382021-02-10 11:20:16 -0500815 sources = [ "src/libANGLE/capture/FrameCapture_mock.cpp" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600816
817 # gl_enum_utils defaults included in with_capture build
Jamie Madill8d412db2020-08-29 22:25:18 +0000818 deps = []
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600819 if (angle_enable_trace || is_debug) {
Brandon Schade5cfab192019-10-28 09:12:53 -0700820 deps += [ ":angle_gl_enum_utils" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600821 }
Jamie Madilleb1b1642019-07-30 17:22:17 -0400822}
823
Brandon Schade5cfab192019-10-28 09:12:53 -0700824angle_source_set("angle_gl_enum_utils") {
Julien Isorce5641d192020-02-04 21:31:47 -0800825 public_deps = [ ":libANGLE_base" ]
Brandon Schade5cfab192019-10-28 09:12:53 -0700826 sources = [
Jamie Madill6fc10382021-02-10 11:20:16 -0500827 "src/libANGLE/capture/gl_enum_utils.cpp",
828 "src/libANGLE/capture/gl_enum_utils_autogen.cpp",
Brandon Schade5cfab192019-10-28 09:12:53 -0700829 ]
830}
831
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600832if (!defined(angle_abseil_cpp_dir)) {
833 angle_abseil_cpp_dir = "//third_party/abseil-cpp"
834}
835
836config("angle_abseil_config") {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600837 if (angle_enable_abseil) {
838 defines = [ "ANGLE_USE_ABSEIL" ]
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600839
Tim Van Pattenec42b142020-09-28 10:15:46 -0600840 configs = [
841 "$angle_abseil_cpp_dir:absl_define_config",
842 "$angle_abseil_cpp_dir:absl_include_config",
843 ]
844 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600845}
846
847group("angle_abseil") {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600848 if (angle_enable_abseil) {
849 # When build_with_chromium=true we need to include "//third_party/abseil-cpp:absl" while
850 # we can be more specific when building standalone ANGLE.
Tim Van Patten36f04642020-10-08 14:45:51 -0600851 if (build_with_chromium || is_component_build) {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600852 public_deps = [ "$angle_abseil_cpp_dir:absl" ]
853 } else {
854 public_deps = [ "$angle_abseil_cpp_dir/absl/container:flat_hash_map" ]
855 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600856
Tim Van Pattenec42b142020-09-28 10:15:46 -0600857 public_configs = [ ":angle_abseil_config" ]
858 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600859}
860
Jamie Madill7e453a22020-03-15 22:11:03 -0400861config("angle_compression_config") {
862 include_dirs = [ "//third_party/zlib/google" ]
863}
864
865group("angle_compression") {
866 public_configs = [
867 ":angle_compression_config",
868 "//third_party/zlib:zlib_config",
869 ]
Jamie Madill35d3c412020-08-26 12:59:18 -0400870 public_deps =
871 [ "$angle_zlib_compression_utils_dir:compression_utils_portable" ]
Jamie Madill7e453a22020-03-15 22:11:03 -0400872}
873
Jamie Madill612b7412019-07-05 11:13:30 -0400874angle_source_set("libANGLE_with_capture") {
Julien Isorce5641d192020-02-04 21:31:47 -0800875 public_deps = [ ":libANGLE_base" ]
Jamie Madill7e453a22020-03-15 22:11:03 -0400876 deps = [ ":angle_compression" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400877 public_configs = [ ":angle_frame_capture_enabled" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400878 sources = libangle_capture_sources
879}
880
Robert Sesekdb8ae832016-06-21 11:47:03 -0400881config("shared_library_public_config") {
James Darpinian0dbe7cd2020-12-08 12:24:35 -0800882 if (is_mac && !is_component_build) {
Robert Sesekdb8ae832016-06-21 11:47:03 -0400883 # Executable targets that depend on the shared libraries below need to have
884 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400885 ldflags = [
886 "-rpath",
887 "@executable_path/",
888 ]
Jonah Ryan-Davis90a8af32020-03-05 13:48:47 -0500889 if (build_with_chromium) {
890 ldflags += [
891 # Path for loading shared libraries for unbundled binaries.
892 # From //build/config/mac/BUILD.gn, this is only added for
893 # component builds. However, since ANGLE always dynamically
894 # links to libvulkan, it should be re-added for non-component
895 # builds. (anglebug.com/4455)
896 "-Wl,-rpath,@loader_path/.",
897 ]
898 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400899 }
Josh Matthews732c9d02019-11-29 13:59:03 -0500900
901 if (angle_is_winuwp) {
902 ldflags = [
903 "/APPCONTAINER",
904
905 # Disable warning about invalid subsystem number.
906 # A default appropriate subsystem is selected automatically.
907 "/IGNORE:4010",
908 ]
909 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400910}
911
Jamie Madill4638dc92018-12-17 13:13:49 -0500912config("library_name_config") {
Yuly Novikov8b8dc562020-02-26 19:09:31 -0500913 if (is_component_build && is_android) {
914 defines = [
915 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"",
916 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"",
917 ]
918 } else {
919 defines = [
920 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
921 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
922 ]
923 }
Jamie Madill4638dc92018-12-17 13:13:49 -0500924}
925
Jamie Madill80ab03c2017-01-03 11:03:23 -0500926# This config controls export definitions on ANGLE API calls.
927config("angle_static") {
928 defines = [
929 "ANGLE_EXPORT=",
Peng Huange99828e2021-02-16 19:13:44 -0500930 "ANGLE_STATIC=1",
Jamie Madillba319ba2018-12-29 10:29:33 -0500931 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500932 "EGLAPI=",
933 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500934 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500935 ]
936}
937
Jamie Madilleb1b1642019-07-30 17:22:17 -0400938set_defaults("angle_libGLESv2") {
939 sources = []
940 output_name = "libGLESv2"
941}
942
Jamie Madill612b7412019-07-05 11:13:30 -0400943template("angle_libGLESv2") {
944 angle_shared_library(target_name) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400945 sources = libglesv2_sources + invoker.sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500946
Jamie Madill612b7412019-07-05 11:13:30 -0400947 if (is_win) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400948 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400949 }
950
Jamie Madilleb1b1642019-07-30 17:22:17 -0400951 output_name = "${invoker.output_name}${angle_libs_suffix}"
952
Jamie Madill612b7412019-07-05 11:13:30 -0400953 configs += [
954 ":angle_gl_visibility_config",
955 ":debug_annotations_config",
956 ":gl_prototypes",
957 ]
958
Jamie Madilleb1b1642019-07-30 17:22:17 -0400959 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400960
Jamie Madilleb1b1642019-07-30 17:22:17 -0400961 deps = invoker.deps + [ ":includes" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400962
Julien Isorce5641d192020-02-04 21:31:47 -0800963 public_deps = [ ":angle_version" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500964 }
Jamie Madill612b7412019-07-05 11:13:30 -0400965}
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800966
Jamie Madill612b7412019-07-05 11:13:30 -0400967angle_libGLESv2("libGLESv2") {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400968 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800969 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600970 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800971 deps = [ ":libANGLE" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400972 }
Jamie Madill612b7412019-07-05 11:13:30 -0400973}
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400974
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600975# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
976angle_libGLESv2("libGLESv2_capture_complement") {
977 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800978 deps = [ ":libANGLE" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600979 output_name += "_no_capture"
980 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800981 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600982 output_name += "_with_capture"
Jamie Madilleb1b1642019-07-30 17:22:17 -0400983 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500984}
985
Austin Kinross11dc1632019-09-18 14:46:23 -0700986if (is_win && !angle_is_winuwp) {
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400987 angle_shared_library("libGL") {
988 sources = libgl_sources
Clemen Deng663b0482019-07-11 12:37:35 -0400989
Clemen Deng6e7dd1e2019-07-16 13:41:59 -0400990 output_name = "openGL32"
991 output_dir = "$root_out_dir/angle_libs"
Clemen Deng7558e832019-06-18 13:02:03 -0400992
993 configs += [
994 ":angle_gl_visibility_config",
995 ":debug_annotations_config",
996 ":gl_prototypes",
997 ]
998
Jamie Madill612b7412019-07-05 11:13:30 -0400999 defines = [
1000 "ANGLE_CAPTURE_ENABLED=0",
Clemen Dengcb8b4a52019-07-04 16:05:25 -04001001 "LIBGL_IMPLEMENTATION",
Jamie Madill612b7412019-07-05 11:13:30 -04001002 ]
Clemen Deng7558e832019-06-18 13:02:03 -04001003
1004 deps = [
1005 ":includes",
1006 ":libANGLE",
1007 ]
1008
Julien Isorce5641d192020-02-04 21:31:47 -08001009 public_deps = [ ":angle_version" ]
Clemen Deng7558e832019-06-18 13:02:03 -04001010 }
1011}
1012
Jamie Madill7098cff2019-01-15 18:33:42 -05001013angle_static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001014 sources = libglesv2_sources
Jamie Madill7098cff2019-01-15 18:33:42 -05001015 configs += [ ":debug_annotations_config" ]
1016 public_configs += [ ":angle_static" ]
Julien Isorce5641d192020-02-04 21:31:47 -08001017 deps = [ ":includes" ]
1018 public_deps = [ ":libANGLE" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001019}
1020
Manh Nguyendce37b72020-06-21 22:27:06 -04001021angle_static_library("libGLESv2_with_capture_static") {
1022 sources = libglesv2_sources
1023 configs += [ ":debug_annotations_config" ]
1024 public_configs += [ ":angle_static" ]
1025 deps = [ ":includes" ]
1026 public_deps = [ ":libANGLE_with_capture" ]
1027}
1028
Jamie Madill77c84962019-06-28 11:24:27 -04001029angle_shared_library("libGLESv1_CM") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001030 sources = libglesv1_cm_sources
Jamie Madill77c84962019-06-28 11:24:27 -04001031 output_name = "libGLESv1_CM${angle_libs_suffix}"
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001032
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001033 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001034 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001035 ":debug_annotations_config",
Jamie Madillba319ba2018-12-29 10:29:33 -05001036 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001037 ]
1038
1039 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001040
1041 deps = [
1042 ":includes",
Jamie Madill77c84962019-06-28 11:24:27 -04001043 ":libGLESv2",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001044 ]
Jamie Madill8970ad32020-08-26 12:59:19 -04001045
1046 if (is_win) {
1047 sources += [ "src/libGLESv1_CM/libGLESv1_CM.def" ]
1048 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001049}
1050
Jamie Madill7098cff2019-01-15 18:33:42 -05001051angle_static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001052 sources = libglesv1_cm_sources
Jamie Madill7098cff2019-01-15 18:33:42 -05001053 configs += [ ":debug_annotations_config" ]
1054 public_configs += [ ":angle_static" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001055 deps = [
1056 ":includes",
1057 ":libGLESv2_static",
1058 ]
1059}
1060
Jamie Madill4638dc92018-12-17 13:13:49 -05001061config("libEGL_egl_loader_config") {
1062 defines = [ "ANGLE_USE_EGL_LOADER" ]
1063}
1064
Jamie Madill7098cff2019-01-15 18:33:42 -05001065angle_source_set("libEGL_egl_loader") {
Jamie Madill4638dc92018-12-17 13:13:49 -05001066 sources = [
1067 "src/libEGL/egl_loader_autogen.cpp",
1068 "src/libEGL/egl_loader_autogen.h",
1069 ]
1070
Jamie Madill7098cff2019-01-15 18:33:42 -05001071 public_configs += [
Jamie Madill4638dc92018-12-17 13:13:49 -05001072 ":libEGL_egl_loader_config",
1073 ":gl_prototypes",
Jamie Madill4638dc92018-12-17 13:13:49 -05001074 ]
1075
Julien Isorce5641d192020-02-04 21:31:47 -08001076 deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001077}
1078
Jamie Madill77c84962019-06-28 11:24:27 -04001079angle_shared_library("libEGL") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001080 sources = libegl_sources
Jamie Madill77c84962019-06-28 11:24:27 -04001081 output_name = "libEGL${angle_libs_suffix}"
Jamie Madill562e81b2015-01-14 14:31:02 -05001082
Jamie Madill562e81b2015-01-14 14:31:02 -05001083 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -04001084 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -05001085 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -05001086 ]
1087
Jamie Madilledbc2442016-01-04 11:25:00 -05001088 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -05001089 if (is_win) {
1090 defines += [ "EGLAPI=" ]
1091 } else {
1092 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
1093 }
Jamie Madill562e81b2015-01-14 14:31:02 -05001094
Jamie Madill80ab03c2017-01-03 11:03:23 -05001095 if (is_win) {
Jamie Madill23d4b642020-11-22 13:01:36 -05001096 sources += [ "src/libEGL/libEGL_autogen.def" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001097 }
1098
Jamie Madill562e81b2015-01-14 14:31:02 -05001099 deps = [
James Darpinian22ec7dc2019-08-06 10:10:52 -07001100 ":angle_common",
Jamie Madill4638dc92018-12-17 13:13:49 -05001101 ":angle_version",
1102 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -05001103 ]
Jamie Madill720ca442018-12-17 14:04:10 -05001104
Julien Isorce5641d192020-02-04 21:31:47 -08001105 public_deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001106
Julien Isorce5641d192020-02-04 21:31:47 -08001107 data_deps = [ ":libGLESv2" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001108}
Corentin Wallezbeb81582015-09-02 10:30:55 -04001109
Jamie Madill7098cff2019-01-15 18:33:42 -05001110angle_static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001111 sources = libegl_sources
Manh Nguyendce37b72020-06-21 22:27:06 -04001112 configs += [
1113 ":debug_annotations_config",
1114 ":library_name_config",
1115 ]
1116 public_configs += [ ":angle_static" ]
1117 deps = [
1118 ":includes",
1119 ":libGLESv2_static",
1120 ]
1121}
1122
1123angle_static_library("libEGL_with_capture_static") {
1124 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -05001125
Jamie Madill80ab03c2017-01-03 11:03:23 -05001126 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -05001127 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -05001128 ":library_name_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001129 ]
1130
Jamie Madill7098cff2019-01-15 18:33:42 -05001131 public_configs += [ ":angle_static" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001132
1133 deps = [
1134 ":includes",
Manh Nguyendce37b72020-06-21 22:27:06 -04001135 ":libGLESv2_with_capture_static",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001136 ]
1137}
1138
Ken Russellfcadd082017-06-28 14:01:15 -07001139# Convenience targets for some of the samples so they can be built
1140# with Chromium's toolchain.
Jamie Madill7098cff2019-01-15 18:33:42 -05001141angle_executable("angle_shader_translator") {
Ken Russellfcadd082017-06-28 14:01:15 -07001142 testonly = true
1143
Julien Isorce5641d192020-02-04 21:31:47 -08001144 sources = [ "samples/shader_translator/shader_translator.cpp" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001145
Julien Isorce5641d192020-02-04 21:31:47 -08001146 deps = [ ":translator" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001147}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001148
Stephen Whitef4cd1742020-12-21 09:57:58 -05001149if (angle_standalone || build_with_chromium) {
Jamie Madill1ba72542019-10-04 15:17:49 -04001150 config("angle_feature_support_config") {
1151 include_dirs = [
1152 "include",
1153 "src",
1154 ]
1155 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1156 if (is_debug) {
1157 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
1158 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001159 }
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001160
Jamie Madill1ba72542019-10-04 15:17:49 -04001161 angle_shared_library("libfeature_support") {
1162 output_name = "libfeature_support${angle_libs_suffix}"
Ian Elliotta9d579e2018-11-28 11:44:48 -07001163
Jamie Madill1ba72542019-10-04 15:17:49 -04001164 if (is_android) {
1165 libs = [ "log" ]
1166 }
1167
Yuly Novikov52afb6f2021-01-26 22:22:07 -05001168 configs += [
Jamie Madill1ba72542019-10-04 15:17:49 -04001169 ":angle_feature_support_config",
1170 "${angle_jsoncpp_dir}:jsoncpp_config",
1171 ]
1172
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +00001173 if (is_apple && !is_component_build) {
Jamie Madill1ba72542019-10-04 15:17:49 -04001174 ldflags = [
1175 "-install_name",
1176 "@rpath/${target_name}.dylib",
1177 ]
1178 }
1179
1180 sources = [
1181 "src/feature_support_util/feature_support_util.cpp",
1182 "src/feature_support_util/feature_support_util.h",
1183 ]
1184
1185 deps = [
1186 ":angle_gpu_info_util",
1187 "${angle_jsoncpp_dir}:jsoncpp",
Cezary Kulakowski4fb738f2019-02-01 10:53:44 +01001188 ]
1189 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001190}
1191
Jamie Madill1f56ed22019-01-03 15:24:22 -05001192if (!is_component_build && is_android && symbol_level != 0) {
1193 action_foreach("compressed_symbols") {
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001194 sources = []
1195 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001196 sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001197 }
1198 if (angle_enable_vulkan_validation_layers) {
1199 foreach(_layer, vulkan_validation_layers) {
Jamie Madill77c84962019-06-28 11:24:27 -04001200 sources += [ "$root_out_dir/lib${_layer}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001201 }
1202 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001203
1204 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1205 root_build_dir)
1206
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001207 deps = []
1208 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001209 deps += [ ":$_library" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001210 }
1211
1212 if (angle_enable_vulkan_validation_layers) {
1213 foreach(_layer, vulkan_validation_layers) {
Jamie Madill328f72a2020-12-15 19:25:50 -05001214 deps += [ "$angle_vulkan_validation_layers_dir:${_layer}" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001215 }
1216 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001217
Julien Isorce5641d192020-02-04 21:31:47 -08001218 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
Jamie Madill1f56ed22019-01-03 15:24:22 -05001219
1220 android_nm = "${android_tool_prefix}nm"
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001221 android_strip = "${android_tool_prefix}strip"
Jamie Madill1f56ed22019-01-03 15:24:22 -05001222
1223 args = [
1224 "--objcopy",
1225 rebase_path(android_objcopy, root_build_dir),
1226 "--nm",
1227 rebase_path(android_nm, root_build_dir),
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001228 "--strip",
1229 rebase_path(android_strip, root_build_dir),
Jamie Madill1f56ed22019-01-03 15:24:22 -05001230 "--unstrippedsofile",
1231 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1232 "--output",
1233 "{{source_dir}}/lib.compressed/{{source_file_part}}",
1234 ]
1235 }
1236}
1237
Geoff Lang6e687af2019-10-17 14:36:41 -04001238if (build_with_chromium && !is_component_build && is_android &&
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -07001239 current_toolchain == default_toolchain) {
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001240 apk_version_code = "0"
1241 if (angle_enable_commit_id) {
1242 apk_version_code =
1243 exec_script("src/commit_id.py", [ "position" ], "trim string")
1244 }
1245
1246 # Package ANGLE libraries for normal use on Android
Cody Northrop8cbd3212019-04-23 13:25:20 -06001247 angle_apk("angle_chromium_apk") {
Tobin Ehlis736c43a2020-08-31 10:23:27 -06001248 package_name = "org.chromium.angle"
Tim Van Pattenee4fa072019-02-21 19:21:09 +00001249 apk_name = "AngleLibraries"
Jamie Madill7bed2a52020-09-22 23:37:54 -04001250 version_name = "ANGLE Developer Build"
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001251 version_code = apk_version_code
1252 }
Jamie Madill7bed2a52020-09-22 23:37:54 -04001253
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001254 # Package ANGLE libraries for AGI use on Android
1255 angle_apk("angle_agi_chromium_apk") {
1256 package_name = "org.chromium.angle.agi"
1257 apk_name = "AngleAgiLibraries"
1258 version_name = "ANGLE AGI Build"
1259 version_code = apk_version_code
Cody Northrop8e636442018-11-30 16:24:11 -07001260 }
1261
1262 group("angle_apks") {
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001263 deps = [
1264 ":angle_agi_chromium_apk",
1265 ":angle_chromium_apk",
1266 ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001267 }
1268}
Jamie Madill1ba72542019-10-04 15:17:49 -04001269
Jamie Madill1ba72542019-10-04 15:17:49 -04001270group("angle") {
1271 data_deps = [
Julien Isorce5641d192020-02-04 21:31:47 -08001272 ":libEGL",
Jamie Madille3c25712019-12-03 14:08:36 -05001273 ":libGLESv1_CM",
Jamie Madill1ba72542019-10-04 15:17:49 -04001274 ":libGLESv2",
Jamie Madill1ba72542019-10-04 15:17:49 -04001275 ]
1276}