blob: 9e98b1d556cb327574647c3cc4d2dfbb9c5f31a9 [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
Maksim Sisovfa2e3742021-09-09 15:34:23 +03005# import the ozone_platform_x11 variable
Frank Henigmand0ef13a2017-08-28 22:53:24 -04006import("gni/angle.gni")
Antonio Caggiano7b0f6312022-03-30 14:16:02 +02007if (angle_enable_vulkan) {
8 import("//build_overrides//vulkan_headers.gni")
9}
Jamie Madill1ba72542019-10-04 15:17:49 -040010if (angle_has_build) {
11 import("//build/config/linux/pkg_config.gni")
Jamie Madill89e3de92021-11-11 10:18:36 -050012 import("//build/config/sanitizers/sanitizers.gni")
Jamie Madill1ba72542019-10-04 15:17:49 -040013 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 }
Jamie Madill6a703982021-11-19 09:41:58 -050022} else {
23 using_sanitizer = false
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060024}
Corentin Wallez51e2ad12015-05-26 11:32:58 -040025
Corentin Wallez16d4e472017-03-20 13:06:19 -040026declare_args() {
27 # Use the PCI lib to collect GPU information on Linux.
mark a. foltz5040c4d2022-03-28 14:27:16 -070028 use_libpci = (is_linux || is_chromeos) && (angle_use_x11 || use_ozone) &&
29 angle_has_build
Frank Henigmane42ec182017-12-11 23:58:53 -050030
Geoff Lang48da7e72021-09-07 15:49:07 -040031 # Enable using Vulkan to collect system info as a fallback.
32 angle_enable_vulkan_system_info = false
33
Frank Henigmane42ec182017-12-11 23:58:53 -050034 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
35 angle_link_glx = false
Jamie Madilleb1b1642019-07-30 17:22:17 -040036
Austin Kinross11dc1632019-09-18 14:46:23 -070037 # 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.
Jamie Madille3c25712019-12-03 14:08:36 -050039 angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build
Geoff Lange8883562020-03-06 09:32:18 -050040
41 # Enable generating current commit information using git
42 angle_enable_commit_id = true
Tim Van Pattene78d9a62020-07-24 11:58:45 -060043
44 # Abseil has trouble supporting MSVC, particularly regarding component builds.
45 # http://crbug.com/1126524
46 angle_enable_abseil = angle_has_build && is_clang
Jamie Madill06a9d522020-11-04 19:57:27 -050047
48 # Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled.
49 angle_enable_annotator_run_time_checks = false
Tim Van Pattenbbed8812021-03-05 17:40:27 -070050
51 # Enables non-conformant extensions and features
52 angle_expose_non_conformant_extensions_and_versions = false
Jamie Madill54dfb622021-04-07 12:33:31 -040053
54 # Optional feature that forces dirty state whenever we use a new context regardless of thread.
55 angle_force_context_check_every_call = false
Craig Stout24136212021-11-08 14:01:34 -080056
57 # Allow shared library custom name extensions for setting soname such as libEGL.so.1
58 angle_egl_extension = ""
59 angle_glesv2_extension = ""
Corentin Wallez16d4e472017-03-20 13:06:19 -040060}
61
Jamie Madille3c25712019-12-03 14:08:36 -050062if (angle_build_all) {
Frank Henigmand0ef13a2017-08-28 22:53:24 -040063 group("all") {
64 testonly = true
65 deps = [
Jamie Madille3c25712019-12-03 14:08:36 -050066 ":angle",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040067 ":angle_shader_translator",
68 ":translator_fuzzer",
Jamie Madill238c19e2019-02-07 09:09:41 -050069 ":xxhash_fuzzer",
Jamie Madille3c25712019-12-03 14:08:36 -050070 "$angle_root/samples:angle_samples",
71 "$angle_root/src/tests:angle_tests",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040072 ]
John Platee25f3b12021-04-21 21:43:46 +010073 if (angle_enable_cl) {
74 deps += [ "$angle_root/src/libOpenCL:angle_cl" ]
75 }
Frank Henigmand0ef13a2017-08-28 22:53:24 -040076 }
77}
78
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000079import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060080import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070081
Brett Wilson2f5469c2014-07-22 17:00:17 -070082# This config is exported to dependent targets (and also applied to internal
83# ones).
84config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050085 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070086}
87
Jamie Madill4638dc92018-12-17 13:13:49 -050088# 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
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400105# This config is applied to internal Angle targets (not pushed to dependents).
106config("internal_config") {
107 include_dirs = [
108 "include",
109 "src",
110 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500111
Jamie Madill4638dc92018-12-17 13:13:49 -0500112 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -0400113
Manh Nguyendce37b72020-06-21 22:27:06 -0400114 if (is_win) {
115 defines += [ "ANGLE_IS_WIN" ]
Jonah Ryan-Davise2fc8182021-05-05 11:51:00 -0400116 if (angle_is_winuwp) {
117 defines += [ "ANGLE_IS_WINUWP" ]
118 }
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900119 } else if (is_linux || is_chromeos) {
Manh Nguyendce37b72020-06-21 22:27:06 -0400120 defines += [ "ANGLE_IS_LINUX" ]
121 }
122
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700123 # 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.
Tobin Ehlis573f76b2018-05-03 11:10:44 -0600126 if (angle_enable_trace) {
127 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
128 }
Tobin Ehlis93121f32019-10-17 08:18:16 -0600129
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700130 # 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
Cody Northrope3c44912022-03-24 11:32:10 -0600136 # 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
Tobin Ehlis93121f32019-10-17 08:18:16 -0600141 if (is_chromeos) {
142 defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
143 }
Ethan Leefcef6dc2020-01-24 22:41:35 -0500144
145 if (is_ggp) {
146 defines += [ "__ggp__" ]
147 }
Xiaoxuan Liu61180d02020-10-12 16:40:13 +0800148
Sergey Ulanovb73eee72021-07-07 18:51:35 -0700149 if (angle_use_vulkan_null_display) {
150 defines += [ "ANGLE_USE_VULKAN_NULL_DISPLAY" ]
151 } else if (angle_use_vulkan_display) {
Alexis Hetu729cbcf2021-07-23 11:18:18 -0400152 defines += [ "ANGLE_USE_VULKAN_DISPLAY" ]
153 if (!angle_use_x11) {
154 defines += [ "EGL_NO_X11" ]
155 }
Antonio Caggianof6cdd022021-12-09 16:52:35 +0100156
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
Xiaoxuan Liu61180d02020-10-12 16:40:13 +0800165 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 }
Alexis Hetuf2a15482020-12-04 14:07:24 -0500171
172 if (is_lsan) {
173 defines += [ "ANGLE_WITH_LSAN" ]
174 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400175}
176
Jamie Madilla9f11bf2019-10-21 08:39:14 -0400177config("constructor_and_destructor_warnings") {
178 if (is_clang) {
179 cflags = [
180 "-Wexit-time-destructors",
181 "-Wglobal-constructors",
182 ]
183 }
184}
185
Jamie Madill509a1d42016-07-18 10:10:29 -0400186config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -0400187 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400188
Gert Wollny79f24112021-02-12 09:36:18 +0100189 is_gcc = !is_clang && !is_win
190
Brian Salomone7496f52021-01-26 16:13:04 -0500191 # Avoid failing builds for warnings enabled by Skia build.
192 if (defined(is_skia_standalone)) {
193 cflags += [ "-w" ]
194 }
195
Jamie Madill509a1d42016-07-18 10:10:29 -0400196 # Enable more default warnings on Windows.
197 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -0400198 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -0400199 "/we4244", # Conversion: possible loss of data.
Jamie Madill330c8672020-08-28 17:44:13 -0400200 "/we4312", # Conversion: greater size.
Jamie Madill509a1d42016-07-18 10:10:29 -0400201 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -0400202 "/we4458", # declaration hides class member.
Ben Wagner1e064012019-04-12 14:10:17 -0400203 "/we4715", # not all control paths return a value
Geoff Langb9440532017-11-28 13:26:34 -0500204 "/we4800", # forcing value to bool.
205 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400206 ]
207 }
Ben Wagner211bff32017-10-10 23:53:20 -0400208 if (is_clang) {
Michael Spang229fc832019-01-21 18:09:15 -0500209 cflags += [
Jamie Madillc7217aa2020-08-28 14:45:14 -0400210 "-Wbad-function-cast",
Jamie Madill155947f2019-10-24 12:55:11 -0400211 "-Wconditional-uninitialized",
Jamie Madill44a0e732019-09-02 13:55:59 -0400212 "-Wextra-semi-stmt",
Jiacheng Lu73e5e9b2019-07-22 15:26:17 -0600213 "-Wfloat-conversion",
Jamie Madill16370a62019-10-24 12:55:11 -0400214 "-Winconsistent-missing-destructor-override",
Jamie Madilla6206852019-10-24 12:55:09 -0400215 "-Wmissing-field-initializers",
Stuart Morgan5dba7232020-06-16 09:29:16 -0700216 "-Wnewline-eof",
Olli Etuaho8073a952018-05-09 16:41:39 +0300217 "-Wnon-virtual-dtor",
Jamie Madill68945f12019-10-24 12:55:09 -0400218 "-Wredundant-parens",
Adrian McCarthy462fb1e2021-02-17 13:46:43 -0800219 "-Wreturn-std-move",
Jamie Madillcb87d782021-07-08 08:28:04 -0400220 "-Wshadow",
Jamie Madill859ca032019-10-24 12:55:08 -0400221 "-Wshadow-field",
Jamie Madillfd58d222019-10-24 12:55:07 -0400222 "-Wtautological-type-limit-compare",
Jamie Madillc017cee2019-10-24 12:55:10 -0400223 "-Wundefined-reinterpret-cast",
Jamie Madillc09ae152019-02-01 14:16:32 -0500224 "-Wunneeded-internal-declaration",
Peter Kastingd4d6c232021-07-31 11:41:29 -0700225 "-Wunused-but-set-variable",
Sylvain Defresne30afc252021-11-03 17:59:19 +0100226 "-Wsuggest-destructor-override",
227 "-Wsuggest-override",
James Darpinianefa898a2019-08-07 17:05:35 -0700228
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",
Peter Kastingd4d6c232021-07-31 11:41:29 -0700234 "-Wunreachable-code-aggressive",
James Darpinian7e48c9e2019-08-06 17:17:19 -0700235 "-Wshorten-64-to-32",
Nico Weber79de62c2018-01-31 10:47:14 -0500236 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400237 }
Austin Kinross11dc1632019-09-18 14:46:23 -0700238
Gert Wollny79f24112021-02-12 09:36:18 +0100239 if (is_gcc) {
240 cflags_cc = [ "-Wdeprecated-copy" ]
241 }
242
Austin Kinross11dc1632019-09-18 14:46:23 -0700243 if (angle_is_winuwp) {
angle-autoroll66c89b02021-10-06 16:28:42 +0000244 cflags += [
245 "/wd4091", # keyword ignored on left of type when no variable is declared
246 "/wd4447", # 'main' signature found without threading model.
247 ]
Austin Kinross11dc1632019-09-18 14:46:23 -0700248 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400249}
250
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600251# 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
Jamie Madill1ba72542019-10-04 15:17:49 -0400260_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
261
Tom Tan5c317532018-11-30 17:01:01 -0800262# Windows ARM64 is available since 10.0.16299 so no need to copy
263# d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400264if (_use_copy_compiler_dll) {
Jamie Madilld09546e2019-02-22 10:24:44 -0500265 # 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
Daniel Bratell73941de2015-02-25 14:34:49 +0100271 copy("copy_compiler_dll") {
Julien Isorce5641d192020-02-04 21:31:47 -0800272 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
Jamie Madilld09546e2019-02-22 10:24:44 -0500273
274 if (_has_old_compiler) {
275 sources += [ _old_compiler ]
276 }
277
Julien Isorce5641d192020-02-04 21:31:47 -0800278 outputs = [ "$root_out_dir/{{source_file_part}}" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100279 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100280}
281
Jamie Madill55959b02019-03-05 10:07:41 -0500282# Holds the shared includes so we only need to list them once.
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500283config("includes_config") {
284 include_dirs = [ "include" ]
285}
286
James Clarke06d194e2021-01-10 14:29:44 -0800287config("angle_uwp_env") {
288 if (angle_is_winuwp) {
289 defines = [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
290 }
291}
292
John Platee25f3b12021-04-21 21:43:46 +0100293angle_source_set("cl_includes") {
294 sources = cl_includes
John Platedfe208f2021-04-28 18:26:00 +0100295 public_configs = [ ":external_config" ]
John Platee25f3b12021-04-21 21:43:46 +0100296}
297
Jamie Madill7098cff2019-01-15 18:33:42 -0500298angle_source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400299 sources = libangle_includes
Jamie Madill8d412db2020-08-29 22:25:18 +0000300 public_configs = [ ":includes_config" ]
John Platee25f3b12021-04-21 21:43:46 +0100301 if (angle_enable_cl) {
302 public_deps = [ ":cl_includes" ]
303 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400304}
305
Peter Kasting1bffabe2021-06-29 18:13:39 -0700306config("disable_unreachable_code_break_warning") {
307 if (is_clang) {
308 cflags = [ "-Wno-unreachable-code-break" ]
309 }
310}
311
Jamie Madill7098cff2019-01-15 18:33:42 -0500312angle_static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400313 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400314
Peter Kasting1bffabe2021-06-29 18:13:39 -0700315 # preprocessor_tab_autogen.cpp contains an instance of this.
316 configs += [ ":disable_unreachable_code_break_warning" ]
317
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400318 public_deps = [
319 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400320 ":angle_translator_headers",
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400321 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400322}
323
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500324config("angle_disable_pool_alloc") {
325 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400326}
327
Cooper Partin75da1972015-06-16 15:03:14 -0700328config("debug_annotations_config") {
Jamie Madill786d38a2021-09-10 17:58:39 +0300329 defines = []
Corentin Wallez105bc9d2019-03-06 16:32:40 +0000330 if (is_debug) {
Jamie Madill786d38a2021-09-10 17:58:39 +0300331 defines += [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700332 }
Jamie Madill06a9d522020-11-04 19:57:27 -0500333 if (angle_enable_annotator_run_time_checks) {
Ian Elliotte2ecb2d2020-11-03 19:26:00 -0700334 # 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.
Jamie Madill786d38a2021-09-10 17:58:39 +0300336 defines += [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
Jamie Madill06a9d522020-11-04 19:57:27 -0500337 }
Cooper Partin75da1972015-06-16 15:03:14 -0700338}
339
Jamie Madill2b86e2d2021-07-19 10:30:57 -0400340config("angle_asserts_config") {
341 if (angle_assert_always_on) {
342 defines = [ "ANGLE_ASSERT_ALWAYS_ON" ]
Jamie Madille31fd872016-05-27 08:35:36 -0400343 }
344}
345
Jamie Madille2e406c2016-06-02 13:04:10 -0400346config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400347 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500348 if (is_android) {
349 libs = [ "log" ]
350 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400351}
352
Alexis Hetua20f5b12020-08-18 11:26:50 -0400353# 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
Jamie Madillc09ae152019-02-01 14:16:32 -0500367angle_source_set("xxhash") {
368 sources = xxhash_sources
Jamie Madill5fde6322020-08-28 14:45:17 -0400369 if (is_clang) {
370 cflags_c = [ "-Wno-implicit-fallthrough" ]
371 }
Jamie Madillc09ae152019-02-01 14:16:32 -0500372}
373
Jamie Madill1ba72542019-10-04 15:17:49 -0400374if (angle_has_build) {
375 fuzzer_test("xxhash_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800376 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
377 deps = [ ":xxhash" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400378 }
Jamie Madill238c19e2019-02-07 09:09:41 -0500379}
380
Jamie Madill7098cff2019-01-15 18:33:42 -0500381angle_static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400382 sources = libangle_common_sources
John Plate05fb2272021-04-27 19:31:31 +0100383 if (angle_enable_cl) {
384 sources += libangle_common_cl_sources
385 }
Cooper Partin75da1972015-06-16 15:03:14 -0700386
Jamie Madill562e81b2015-01-14 14:31:02 -0500387 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400388 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700389 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500390 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400391
Julien Isorce5641d192020-02-04 21:31:47 -0800392 deps = [ ":xxhash" ]
Jamie Madillc09ae152019-02-01 14:16:32 -0500393
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400394 public_deps = [
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600395 ":angle_abseil",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500396 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400397 ]
Jamie Madill7098cff2019-01-15 18:33:42 -0500398 public_configs += [ ":angle_common_config" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400399 if (angle_has_build && use_fuzzing_engine) {
Jamie Madill48aa52f2019-10-17 07:56:53 -0400400 all_dependent_configs = [ ":angle_disable_pool_alloc" ]
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500401 }
Tim Van Pattene99b8bc2020-10-23 18:50:33 -0600402
Jamie Madill95286412020-11-23 15:47:09 -0500403 if (is_linux || is_chromeos) {
404 libs = [ "dl" ]
405 }
406
Tim Van Pattene99b8bc2020-10-23 18:50:33 -0600407 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 }
Tim Van Pattenbbed8812021-03-05 17:40:27 -0700416
417 if (angle_expose_non_conformant_extensions_and_versions) {
418 defines = [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
419 }
Jamie Madill89e3de92021-11-11 10:18:36 -0500420
Jamie Madill6a703982021-11-19 09:41:58 -0500421 if (using_sanitizer && !build_with_chromium) {
Jamie Madill89e3de92021-11-11 10:18:36 -0500422 data_deps = [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ]
423 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500424}
425
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400426config("angle_image_util_config") {
427 include_dirs = [
428 "include",
429 "src",
430 ]
431}
432
Jamie Madill1f08ab22019-10-03 16:22:52 -0400433angle_source_set("angle_image_util_headers") {
434 sources = libangle_image_util_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800435 public_deps = [ ":angle_common" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400436}
437
Jamie Madill7098cff2019-01-15 18:33:42 -0500438angle_static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400439 sources = libangle_image_util_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500440 public_configs += [ ":angle_image_util_config" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800441 public_deps = [ ":angle_image_util_headers" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400442}
443
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600444config("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 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600455 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600456}
457
Antonio Caggiano7b0f6312022-03-30 14:16:02 +0200458config("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
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500465config("angle_gpu_info_util_config") {
466 include_dirs = [
467 "include",
468 "src",
469 ]
470}
471
Jamie Madill7098cff2019-01-15 18:33:42 -0500472angle_static_library("angle_gpu_info_util") {
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400473 public_configs += [
474 ":angle_gpu_info_util_config",
475 ":angle_backend_config",
476 ]
Julien Isorce5641d192020-02-04 21:31:47 -0800477 public_deps = [ ":angle_common" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400478 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500479 deps = []
480 libs = []
481 defines = []
482
Jamie Madilld27552f2021-11-11 11:43:30 -0500483 if (angle_build_vulkan_system_info) {
Michael Spangb630bf92020-01-24 17:27:01 -0500484 sources += libangle_gpu_info_util_vulkan_sources
Jamie Madill48da1c32021-07-16 13:24:34 -0400485 deps += [
Jamie Madill48da1c32021-07-16 13:24:34 -0400486 "$angle_vulkan_headers_dir:vulkan_headers",
Jamie Madilld27552f2021-11-11 11:43:30 -0500487 "src/common/vulkan:angle_libvulkan_loader",
488 "src/common/vulkan:angle_vulkan_icd",
Jamie Madill48da1c32021-07-16 13:24:34 -0400489 ]
Geoff Lang48da7e72021-09-07 15:49:07 -0400490 if (angle_enable_vulkan_system_info) {
Jamie Madilld27552f2021-11-11 11:43:30 -0500491 defines += [ "ANGLE_USE_VULKAN_SYSTEM_INFO" ]
Geoff Lang48da7e72021-09-07 15:49:07 -0400492 }
Michael Spangb630bf92020-01-24 17:27:01 -0500493 }
494
Ian Elliottd07c52e2018-06-22 15:42:09 -0600495 if (is_android) {
Michael Spangb630bf92020-01-24 17:27:01 -0500496 sources += libangle_gpu_info_util_android_sources
497 }
498
499 if (is_fuchsia) {
500 sources += libangle_gpu_info_util_fuchsia_sources
Antonio Maiorano13816d22020-06-16 14:27:04 -0400501 deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ]
Ian Elliottd07c52e2018-06-22 15:42:09 -0600502 }
503
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700504 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400505 sources += libangle_gpu_info_util_win_sources
Austin Kinross11dc1632019-09-18 14:46:23 -0700506 if (!angle_is_winuwp) {
507 libs += [ "setupapi.lib" ]
508 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400509 libs += [ "dxgi.lib" ]
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700510 }
511
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900512 if (is_linux || is_chromeos) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400513 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500514
Jamie Madill8970ad32020-08-26 12:59:19 -0400515 if (angle_use_x11 && angle_has_build) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400516 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500517 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
518 defines += [ "GPU_INFO_USE_X11" ]
519 libs += [
520 "X11",
521 "Xi",
522 "Xext",
523 ]
524 }
Antonio Caggianof6cdd022021-12-09 16:52:35 +0100525
526 if (angle_use_wayland && angle_has_build) {
527 public_deps += [ ":angle_wayland" ]
528 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500529 }
530
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500531 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400532 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500533 defines += [ "GPU_INFO_USE_LIBPCI" ]
534 libs += [ "pci" ]
535 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500536
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +0000537 if (is_apple) {
Sylvain Defresnebae95f82020-07-02 17:19:14 +0200538 frameworks = [
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500539 "IOKit.framework",
540 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400541 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500542 ]
James Darpiniandea86292020-12-02 16:26:03 -0800543 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 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500554 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500555}
556
Jamie Madill1f08ab22019-10-03 16:22:52 -0400557angle_source_set("angle_translator_headers") {
558 sources = angle_translator_exported_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800559 public_deps = [ ":includes" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400560}
561
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400562template("translator_lib") {
563 angle_static_library(target_name) {
564 sources = angle_translator_sources
565 defines = []
Austin Kinross82b5ab62015-12-11 09:30:15 -0800566
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400567 _needs_glsl_base = false
568 _needs_glsl_and_vulkan_base = false
569 _uses_spirv = false
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500570
Shahbaz Youssefi58930a72021-08-07 22:05:27 -0400571 # 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:
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400579 if (angle_enable_essl || use_fuzzing_engine) {
580 _needs_glsl_base = true
581 sources += angle_translator_essl_sources
582 defines += [ "ANGLE_ENABLE_ESSL" ]
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500583 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400584
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400585 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
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400589 defines += [ "ANGLE_ENABLE_GLSL" ]
590 }
Jamie Madille794cd82017-01-13 17:29:51 -0500591
Shahbaz Youssefib8d6f8a2021-07-22 22:31:29 -0400592 if (angle_enable_apple_translator_workarounds) {
593 sources += angle_translator_apple_sources
594 defines += [ "ANGLE_ENABLE_APPLE_WORKAROUNDS" ]
595 }
596
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400597 if (angle_enable_hlsl || use_fuzzing_engine) {
598 sources += angle_translator_hlsl_sources
599 defines += [ "ANGLE_ENABLE_HLSL" ]
600 }
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500601
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400602 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
Le Quyend200a772019-10-10 00:44:01 +0800607
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400608 # This translator is needed by metal backend also.
609 sources += angle_translator_lib_vulkan_sources
610 }
Shahbaz Youssefi382bf282020-12-24 23:56:39 -0500611
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400612 if (angle_enable_vulkan || use_fuzzing_engine) {
613 defines += [ "ANGLE_ENABLE_VULKAN" ]
614 }
Jamie Madille794cd82017-01-13 17:29:51 -0500615
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400616 if (angle_enable_metal) {
617 sources += angle_translator_lib_metal_sources
Kyle Piddingtond7aa0132021-04-26 16:56:15 -0700618 defines += [
619 "ANGLE_ENABLE_METAL",
620 "ANGLE_ENABLE_METAL_SPIRV",
621 ]
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400622 }
623 }
Le Quyend200a772019-10-10 00:44:01 +0800624
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400625 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 }
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600631
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400632 public_configs += [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400633
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400634 deps = [
635 ":includes",
636 ":preprocessor",
Shahbaz Youssefi81f03cc2021-04-07 15:23:32 -0400637 "$angle_root/src/common/spirv:angle_spirv_headers",
Shahbaz Youssefi776c6012021-02-26 00:00:57 -0500638 ]
Shahbaz Youssefi776c6012021-02-26 00:00:57 -0500639
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400640 if (_uses_spirv) {
641 deps += [
642 "$angle_root/src/common/spirv:angle_spirv_base",
Shahbaz Youssefi9bc837f2021-04-07 15:24:12 -0400643 "$angle_root/src/common/spirv:angle_spirv_builder",
Shahbaz Youssefi9bc837f2021-04-07 15:24:12 -0400644 "${angle_spirv_headers_dir}:spv_headers",
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400645 "${angle_spirv_tools_dir}:spvtools_headers",
646 "${angle_spirv_tools_dir}:spvtools_val",
647 ]
Shahbaz Youssefif3d5dac2021-08-23 17:25:15 -0400648
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 }
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400657 }
Jamie Madilla8503ce2016-07-18 13:47:12 -0400658
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400659 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 }
Jamie Madilla8503ce2016-07-18 13:47:12 -0400669 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400670}
671
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400672translator_lib("translator") {
673 gl_d3d_only = false
674}
675
Shahbaz Youssefie2c87b42021-05-04 11:46:36 -0400676if (angle_enable_essl || angle_enable_glsl || angle_enable_hlsl) {
677 translator_lib("translator_gl_d3d_only") {
678 gl_d3d_only = true
679 }
Shahbaz Youssefi0973dd62021-03-31 11:11:26 -0400680}
681
Jamie Madill7098cff2019-01-15 18:33:42 -0500682angle_source_set("translator_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800683 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700684
685 include_dirs = [
686 "include",
687 "src",
688 ]
689
Julien Isorce5641d192020-02-04 21:31:47 -0800690 deps = [ ":translator" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700691}
692
Jamie Madill62778cb2020-09-22 23:10:04 -0400693config("angle_commit_id_config") {
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400694 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill62778cb2020-09-22 23:10:04 -0400695 visibility = [ ":angle_commit_id" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500696}
697
Jamie Madill62778cb2020-09-22 23:10:04 -0400698action("angle_commit_id") {
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400699 _commit_id_header = "$root_gen_dir/angle/angle_commit.h"
Geoff Langba8ef682020-02-24 14:13:40 -0500700 script = "src/commit_id.py"
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400701 outputs = [ _commit_id_header ]
702
703 visibility = [ ":angle_version" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400704
Geoff Langba8ef682020-02-24 14:13:40 -0500705 # Add git as a dependency if it is available.
Geoff Lang20c69732020-03-06 11:02:31 -0500706 if (angle_enable_commit_id &&
707 exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
Geoff Langdd19d552020-03-02 09:41:22 -0500708 # commit id should depend on angle's HEAD revision
709 inputs = [ ".git/HEAD" ]
Jamie Madill5f2ba632020-08-15 23:50:59 -0400710 branch = read_file(".git/HEAD", "string")
711 result = string_split(branch)
712 if (result[0] == "ref:") {
Shahbaz Youssefi955b4622021-07-01 22:55:59 -0400713 _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 ]
Jamie Madill5f2ba632020-08-15 23:50:59 -0400724 }
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200725 }
Geoff Langba8ef682020-02-24 14:13:40 -0500726
727 args = [
728 "gen",
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400729 rebase_path(_commit_id_header, root_build_dir),
Geoff Langba8ef682020-02-24 14:13:40 -0500730 ]
731
Jamie Madill62778cb2020-09-22 23:10:04 -0400732 public_configs = [ ":angle_commit_id_config" ]
733}
734
Jamie Madill7098cff2019-01-15 18:33:42 -0500735angle_source_set("angle_version") {
Jamie Madill1b104dd2021-05-26 14:29:01 -0400736 sources = [ "src/common/angle_version.h" ]
Jamie Madill62778cb2020-09-22 23:10:04 -0400737 public_deps = [ ":angle_commit_id" ]
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400738 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 }
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400750}
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" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500758}
759
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400760config("angle_backend_config") {
Jamie Madill562e81b2015-01-14 14:31:02 -0500761 defines = []
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400762
Etienne Bergeron9e83c152020-06-04 19:53:36 -0400763 if (angle_delegate_workers) {
764 defines += [ "ANGLE_DELEGATE_WORKERS" ]
765 }
Jamie Madill1f08ab22019-10-03 16:22:52 -0400766
Jamie Madill54dfb622021-04-07 12:33:31 -0400767 if (angle_force_context_check_every_call) {
768 defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ]
769 }
770
Tim Van Patten085044d2021-04-08 18:49:05 -0600771 if (angle_expose_non_conformant_extensions_and_versions) {
772 defines += [ "ANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS" ]
773 }
774
Brandon Schade1760ce32022-03-03 17:29:12 -0800775 if (angle_use_spirv_gen_through_glslang) {
776 defines += [ "ANGLE_USE_SPIRV_GENERATION_THROUGH_GLSLANG" ]
777 }
778
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600779 configs = []
780
Jamie Madillbb96aef2020-09-11 13:50:09 -0400781 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
Jamie Madill2d741702020-09-11 12:30:04 -0400789 if (angle_enable_gl) {
790 configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ]
791 }
792
Jamie Madill852f61f2020-09-11 11:54:35 -0400793 if (angle_enable_null) {
794 configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ]
795 }
796
Le Quyend200a772019-10-10 00:44:01 +0800797 if (angle_enable_metal) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600798 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
Le Quyend200a772019-10-10 00:44:01 +0800799 }
800
Jamie Madill1f08ab22019-10-03 16:22:52 -0400801 if (angle_enable_vulkan) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600802 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400803 }
James Clarke06d194e2021-01-10 14:29:44 -0800804
John Plate16a919b2021-04-27 11:36:11 +0100805 if (angle_enable_cl_passthrough) {
806 configs += [ "src/libANGLE/renderer/cl:angle_cl_backend_config" ]
807 }
808
James Clarke06d194e2021-01-10 14:29:44 -0800809 if (angle_is_winuwp) {
810 configs += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp_config" ]
811 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400812}
813
814config("libANGLE_config") {
815 cflags = []
816 defines = []
817 libs = []
818 ldflags = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500819 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400820
821 if (is_win) {
Julien Isorce5641d192020-02-04 21:31:47 -0800822 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
823 # are not enabled.
Austin Kinross40853472015-02-12 10:39:56 -0800824 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500825
826 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
Yuly Novikov8edc68e2019-02-12 12:41:01 -0500827 # 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) {
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500830 libs += [ "nativewindow" ]
831 } else {
832 libs += [ "android" ]
833 }
834 }
Michael Spang7cd5f642019-08-21 20:03:49 -0400835
Ethan Leed22b8be2019-11-15 12:26:39 -0500836 if (angle_use_x11) {
Michael Spang7cd5f642019-08-21 20:03:49 -0400837 defines += [ "ANGLE_USE_X11" ]
838 }
Jamie Madillaf5e3822020-01-28 10:05:36 -0500839
Antonio Caggianof6cdd022021-12-09 16:52:35 +0100840 if (angle_use_wayland) {
841 defines += [ "ANGLE_USE_WAYLAND" ]
842 }
843
Jamie Madillaf5e3822020-01-28 10:05:36 -0500844 if (angle_enable_overlay) {
845 defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
846 }
Tim Van Pattenee4e0862020-09-24 11:39:49 -0600847 if (angle_enable_perf_counter_output) {
848 defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ]
849 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500850}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500851
Jamie Madill1f08ab22019-10-03 16:22:52 -0400852angle_source_set("libANGLE_headers") {
853 sources = libangle_headers
John Platee25f3b12021-04-21 21:43:46 +0100854 if (angle_enable_cl) {
855 sources += libangle_cl_headers
856 }
Jamie Madill1f08ab22019-10-03 16:22:52 -0400857 public_deps = [
858 ":angle_common",
859 ":angle_translator_headers",
860 ]
Jamie Madillaf5e3822020-01-28 10:05:36 -0500861 public_configs += [ ":libANGLE_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500862}
863
Jamie Madill2f718022019-10-28 11:48:46 -0400864# 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 = [
Kyle Piddingtonc4a9d412022-01-05 15:28:11 -0800868 "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.cpp",
869 "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.h",
Jamie Madill2f718022019-10-28 11:48:46 -0400870 "src/libANGLE/renderer/glslang_wrapper_utils.cpp",
871 "src/libANGLE/renderer/glslang_wrapper_utils.h",
872 ]
873 deps = [
874 ":libANGLE_headers",
Shahbaz Youssefida4aa8b2021-02-25 16:26:53 -0500875 "$angle_root/src/common/spirv:angle_spirv_base",
Shahbaz Youssefi6689a542021-01-21 00:36:14 -0500876 "$angle_root/src/common/spirv:angle_spirv_builder",
Shahbaz Youssefi81f03cc2021-04-07 15:23:32 -0400877 "$angle_root/src/common/spirv:angle_spirv_headers",
Shahbaz Youssefi6689a542021-01-21 00:36:14 -0500878 "$angle_root/src/common/spirv:angle_spirv_parser",
Shahbaz Youssefi71e6afb2020-01-14 14:12:31 -0500879 "${angle_spirv_headers_dir}:spv_headers",
Jamie Madill2f718022019-10-28 11:48:46 -0400880 ]
881 }
Le Quyena48f95a2019-10-14 14:49:49 +0800882}
883
Jamie Madill23b16742021-09-14 10:29:14 -0400884if ((is_win && angle_enable_gl) || angle_enable_d3d11 || angle_enable_d3d9) {
Jamie Madill4d3a0f62020-09-11 12:36:05 -0400885 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
Jamie Madilleb1b1642019-07-30 17:22:17 -0400905angle_source_set("libANGLE_base") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400906 sources = libangle_sources
John Platee25f3b12021-04-21 21:43:46 +0100907 if (angle_enable_cl) {
908 sources += libangle_cl_sources
909 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500910
Jamie Madill5ea762a2017-06-07 14:59:51 -0400911 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500912 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500913 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500914 if (angle_link_glx) {
915 libs += [ "GL" ]
916 defines += [ "ANGLE_LINK_GLX" ]
917 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400918 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500919 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500920 ":angle_gpu_info_util",
Jamie Madilld8c18ac2021-10-08 13:00:19 -0400921 ":angle_version_info",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400922 ":libANGLE_headers",
Jamie Madill720ca442018-12-17 14:04:10 -0500923 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400924 ]
925 deps = [
Tim Van Pattenb55f0f72020-06-02 18:01:24 -0600926 ":angle_compression",
Corentin Wallez878baf92017-02-15 13:57:16 -0500927 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500928 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500929 ]
930
James Clarke06d194e2021-01-10 14:29:44 -0800931 if (is_win && !angle_is_winuwp) {
Jamie Madille55374f2019-10-24 12:55:12 -0400932 libs += [
Jamie Madille55374f2019-10-24 12:55:12 -0400933 "gdi32.lib",
934 "user32.lib",
935 ]
936 }
937
Jamie Madillbb96aef2020-09-11 13:50:09 -0400938 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
Jamie Madill2d741702020-09-11 12:30:04 -0400946 if (angle_enable_gl) {
947 public_deps += [ "src/libANGLE/renderer/gl:angle_gl_backend" ]
948 }
949
Jamie Madill852f61f2020-09-11 11:54:35 -0400950 if (angle_enable_null) {
951 public_deps += [ "src/libANGLE/renderer/null:angle_null_backend" ]
952 }
953
Jamie Madill1f08ab22019-10-03 16:22:52 -0400954 if (angle_enable_vulkan) {
955 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
956 }
957
James Clarke06d194e2021-01-10 14:29:44 -0800958 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
Le Quyend200a772019-10-10 00:44:01 +0800966 if (angle_enable_metal) {
967 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
968 }
969
John Plate16a919b2021-04-27 11:36:11 +0100970 if (angle_enable_cl_passthrough) {
971 public_deps += [ "src/libANGLE/renderer/cl:angle_cl_backend" ]
972 }
973
Jamie Madillab2bfa82019-01-15 19:06:47 -0500974 # Enable extra Chromium style warnings for libANGLE.
Sylvain Defresne5ae73422021-11-09 16:26:10 +0100975 if (is_clang && angle_has_build) {
Jamie Madillab2bfa82019-01-15 19:06:47 -0500976 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
977 }
978
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +0000979 if (is_apple) {
Geoff Langecd2e3b2019-07-09 15:39:39 -0400980 sources += libangle_mac_sources
981 }
982
Kyle Piddingtond33a2222021-04-26 16:56:15 -0700983 if (is_ios) {
984 sources += [ "src/libANGLE/renderer/driver_utils_ios.mm" ]
985 }
986
Jamie Madill562e81b2015-01-14 14:31:02 -0500987 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500988 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400989 }
990
Tim Van Pattene28083a2021-11-09 18:00:17 -0700991 # 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
Jamie Madill7098cff2019-01-15 18:33:42 -0500996 configs += [ ":debug_annotations_config" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400997 public_configs += [
998 ":libANGLE_config",
999 ":angle_backend_config",
1000 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001001
Tom Tan5c317532018-11-30 17:01:01 -08001002 # Windows ARM64 is available since 10.0.16299 so no need to copy
1003 # d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -04001004 if (_use_copy_compiler_dll) {
Julien Isorce5641d192020-02-04 21:31:47 -08001005 data_deps = [ ":copy_compiler_dll" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001006 }
1007}
1008
Jamie Madilleb1b1642019-07-30 17:22:17 -04001009config("angle_frame_capture_disabled") {
1010 defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
1011}
1012
Jamie Madilleb1b1642019-07-30 17:22:17 -04001013angle_source_set("libANGLE") {
Julien Isorce5641d192020-02-04 21:31:47 -08001014 public_deps = [ ":libANGLE_base" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -04001015 public_configs = [ ":angle_frame_capture_disabled" ]
Jamie Madill67e4aff2021-04-02 13:17:00 -04001016 sources = [
1017 "src/libANGLE/capture/FrameCapture_mock.cpp",
1018 "src/libANGLE/capture/frame_capture_utils_mock.cpp",
1019 ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -06001020
1021 # gl_enum_utils defaults included in with_capture build
Jamie Madill8d412db2020-08-29 22:25:18 +00001022 deps = []
Jiacheng Lu9e14a192019-08-09 10:03:24 -06001023 if (angle_enable_trace || is_debug) {
Brandon Schade5cfab192019-10-28 09:12:53 -07001024 deps += [ ":angle_gl_enum_utils" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -06001025 }
Jamie Madilleb1b1642019-07-30 17:22:17 -04001026}
1027
Brandon Schade5cfab192019-10-28 09:12:53 -07001028angle_source_set("angle_gl_enum_utils") {
Alexey Knyazev47279c72021-08-15 23:20:32 +04001029 deps = [ ":angle_common" ]
Brandon Schade5cfab192019-10-28 09:12:53 -07001030 sources = [
Jamie Madill6fc10382021-02-10 11:20:16 -05001031 "src/libANGLE/capture/gl_enum_utils.cpp",
Alexey Knyazev47279c72021-08-15 23:20:32 +04001032 "src/libANGLE/capture/gl_enum_utils.h",
Jamie Madill6fc10382021-02-10 11:20:16 -05001033 "src/libANGLE/capture/gl_enum_utils_autogen.cpp",
Alexey Knyazev47279c72021-08-15 23:20:32 +04001034 "src/libANGLE/capture/gl_enum_utils_autogen.h",
Brandon Schade5cfab192019-10-28 09:12:53 -07001035 ]
1036}
1037
Antonio Caggianof6cdd022021-12-09 16:52:35 +01001038if (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
Tim Van Pattene78d9a62020-07-24 11:58:45 -06001070if (!defined(angle_abseil_cpp_dir)) {
1071 angle_abseil_cpp_dir = "//third_party/abseil-cpp"
1072}
1073
1074config("angle_abseil_config") {
Tim Van Pattenec42b142020-09-28 10:15:46 -06001075 if (angle_enable_abseil) {
1076 defines = [ "ANGLE_USE_ABSEIL" ]
Tim Van Pattene78d9a62020-07-24 11:58:45 -06001077
Tim Van Pattenec42b142020-09-28 10:15:46 -06001078 configs = [
1079 "$angle_abseil_cpp_dir:absl_define_config",
1080 "$angle_abseil_cpp_dir:absl_include_config",
1081 ]
1082 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -06001083}
1084
1085group("angle_abseil") {
Tim Van Pattenec42b142020-09-28 10:15:46 -06001086 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.
Tim Van Patten36f04642020-10-08 14:45:51 -06001089 if (build_with_chromium || is_component_build) {
Tim Van Pattenec42b142020-09-28 10:15:46 -06001090 public_deps = [ "$angle_abseil_cpp_dir:absl" ]
1091 } else {
Shahbaz Youssefi8f77e0b2021-07-29 15:54:26 -04001092 public_deps = [
1093 "$angle_abseil_cpp_dir/absl/container:flat_hash_map",
1094 "$angle_abseil_cpp_dir/absl/container:flat_hash_set",
1095 ]
Tim Van Pattenec42b142020-09-28 10:15:46 -06001096 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -06001097
Tim Van Pattenec42b142020-09-28 10:15:46 -06001098 public_configs = [ ":angle_abseil_config" ]
1099 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -06001100}
1101
Jamie Madill7e453a22020-03-15 22:11:03 -04001102config("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 ]
Jamie Madill35d3c412020-08-26 12:59:18 -04001111 public_deps =
1112 [ "$angle_zlib_compression_utils_dir:compression_utils_portable" ]
Jamie Madill7e453a22020-03-15 22:11:03 -04001113}
1114
Tim Van Patten7753c832021-06-18 14:25:40 -06001115if (angle_has_rapidjson) {
Jamie Madill67e4aff2021-04-02 13:17:00 -04001116 config("angle_rapidjson_config") {
1117 defines = [ "ANGLE_HAS_RAPIDJSON" ]
Gert Wollnyb3a80332021-03-31 09:34:00 +02001118 }
Jamie Madill67e4aff2021-04-02 13:17:00 -04001119 angle_source_set("angle_json_serializer") {
1120 public_deps = [
Jamie Madill0004ecc2021-09-22 13:39:55 -04001121 ":angle_common",
Jamie Madill67e4aff2021-04-02 13:17:00 -04001122 "$angle_root/third_party/rapidjson",
1123 ]
1124 sources = [
Jamie Madill1af5c462021-09-14 14:40:49 -04001125 "src/common/serializer/JsonSerializer.cpp",
1126 "src/common/serializer/JsonSerializer.h",
Jamie Madill67e4aff2021-04-02 13:17:00 -04001127 ]
1128 public_configs = [ ":angle_rapidjson_config" ]
1129 }
Gert Wollnye0b9d4f2021-03-15 11:25:39 +01001130}
1131
Jamie Madill1a3b17d2021-09-09 17:26:56 -04001132assert(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 }
Jamie Madill67e4aff2021-04-02 13:17:00 -04001137
Jamie Madill1a3b17d2021-09-09 17:26:56 -04001138 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 }
Jamie Madill67e4aff2021-04-02 13:17:00 -04001150 }
Jamie Madill612b7412019-07-05 11:13:30 -04001151}
1152
Robert Sesekdb8ae832016-06-21 11:47:03 -04001153config("shared_library_public_config") {
James Darpinian0dbe7cd2020-12-08 12:24:35 -08001154 if (is_mac && !is_component_build) {
Robert Sesekdb8ae832016-06-21 11:47:03 -04001155 # Executable targets that depend on the shared libraries below need to have
1156 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -04001157 ldflags = [
1158 "-rpath",
1159 "@executable_path/",
1160 ]
Jonah Ryan-Davis90a8af32020-03-05 13:48:47 -05001161 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 }
Robert Sesekdb8ae832016-06-21 11:47:03 -04001171 }
Josh Matthews732c9d02019-11-29 13:59:03 -05001172
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 }
Robert Sesekdb8ae832016-06-21 11:47:03 -04001182}
1183
Jamie Madill4638dc92018-12-17 13:13:49 -05001184config("library_name_config") {
Yuly Novikov8b8dc562020-02-26 19:09:31 -05001185 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 }
Jamie Madill4638dc92018-12-17 13:13:49 -05001196}
1197
Jamie Madill80ab03c2017-01-03 11:03:23 -05001198# This config controls export definitions on ANGLE API calls.
1199config("angle_static") {
1200 defines = [
1201 "ANGLE_EXPORT=",
Peng Huange99828e2021-02-16 19:13:44 -05001202 "ANGLE_STATIC=1",
Jamie Madillba319ba2018-12-29 10:29:33 -05001203 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001204 "EGLAPI=",
1205 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001206 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001207 ]
1208}
1209
Jamie Madilleb1b1642019-07-30 17:22:17 -04001210set_defaults("angle_libGLESv2") {
1211 sources = []
1212 output_name = "libGLESv2"
1213}
1214
Jamie Madill612b7412019-07-05 11:13:30 -04001215template("angle_libGLESv2") {
1216 angle_shared_library(target_name) {
Jamie Madilleb1b1642019-07-30 17:22:17 -04001217 sources = libglesv2_sources + invoker.sources
John Platee25f3b12021-04-21 21:43:46 +01001218 if (angle_enable_cl) {
1219 sources += libglesv2_cl_sources
1220 }
Shahbaz Youssefi7defdb62021-10-19 14:07:07 +00001221
Jamie Madilleb1b1642019-07-30 17:22:17 -04001222 output_name = "${invoker.output_name}${angle_libs_suffix}"
Craig Stout24136212021-11-08 14:01:34 -08001223 if (angle_glesv2_extension != "") {
1224 output_extension = angle_glesv2_extension
1225 }
Jamie Madilleb1b1642019-07-30 17:22:17 -04001226
Jamie Madill612b7412019-07-05 11:13:30 -04001227 configs += [
1228 ":angle_gl_visibility_config",
1229 ":debug_annotations_config",
1230 ":gl_prototypes",
1231 ]
1232
Jamie Madilleb1b1642019-07-30 17:22:17 -04001233 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill612b7412019-07-05 11:13:30 -04001234
Shahbaz Youssefi7defdb62021-10-19 14:07:07 +00001235 deps = invoker.deps + [ ":includes" ]
1236
Jamie Madilld8c18ac2021-10-08 13:00:19 -04001237 if (is_win) {
1238 sources += [
1239 "src/libGLESv2/${invoker.output_name}_autogen.def",
1240 "src/libGLESv2/libGLESv2.rc",
1241 ]
1242 deps += [ ":angle_version" ]
1243 }
Geoff Lang2b5420c2014-11-19 14:20:15 -05001244 }
Jamie Madill612b7412019-07-05 11:13:30 -04001245}
John Abd-El-Malek657cd682014-11-05 14:04:19 -08001246
Jamie Madill612b7412019-07-05 11:13:30 -04001247angle_libGLESv2("libGLESv2") {
Jamie Madilleb1b1642019-07-30 17:22:17 -04001248 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -08001249 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -06001250 } else {
Julien Isorce5641d192020-02-04 21:31:47 -08001251 deps = [ ":libANGLE" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -04001252 }
Jamie Madill612b7412019-07-05 11:13:30 -04001253}
Jamie Madill72f5b5e2014-06-23 15:13:02 -04001254
Jiacheng Lu617f23d2019-08-12 10:11:53 -06001255# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
Jamie Madill1a3b17d2021-09-09 17:26:56 -04001256if (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 }
Jamie Madilleb1b1642019-07-30 17:22:17 -04001265 }
Jamie Madill80ab03c2017-01-03 11:03:23 -05001266}
1267
Austin Kinross11dc1632019-09-18 14:46:23 -07001268if (is_win && !angle_is_winuwp) {
Clemen Dengcb8b4a52019-07-04 16:05:25 -04001269 angle_shared_library("libGL") {
1270 sources = libgl_sources
Clemen Deng663b0482019-07-11 12:37:35 -04001271
Clemen Deng6e7dd1e2019-07-16 13:41:59 -04001272 output_name = "openGL32"
1273 output_dir = "$root_out_dir/angle_libs"
Clemen Deng7558e832019-06-18 13:02:03 -04001274
1275 configs += [
1276 ":angle_gl_visibility_config",
1277 ":debug_annotations_config",
1278 ":gl_prototypes",
1279 ]
1280
Jamie Madill612b7412019-07-05 11:13:30 -04001281 defines = [
1282 "ANGLE_CAPTURE_ENABLED=0",
Clemen Dengcb8b4a52019-07-04 16:05:25 -04001283 "LIBGL_IMPLEMENTATION",
Jamie Madill612b7412019-07-05 11:13:30 -04001284 ]
Clemen Deng7558e832019-06-18 13:02:03 -04001285
1286 deps = [
1287 ":includes",
1288 ":libANGLE",
1289 ]
Shahbaz Youssefi7defdb62021-10-19 14:07:07 +00001290
Jamie Madilld8c18ac2021-10-08 13:00:19 -04001291 if (is_win) {
1292 deps += [ ":angle_version" ]
1293 }
Clemen Deng7558e832019-06-18 13:02:03 -04001294 }
1295}
1296
Jamie Madill7098cff2019-01-15 18:33:42 -05001297angle_static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001298 sources = libglesv2_sources
John Platee25f3b12021-04-21 21:43:46 +01001299 if (angle_enable_cl) {
1300 sources += libglesv2_cl_sources
1301 }
Jamie Madill7098cff2019-01-15 18:33:42 -05001302 configs += [ ":debug_annotations_config" ]
James Clarke06d194e2021-01-10 14:29:44 -08001303
Jamie Madill7098cff2019-01-15 18:33:42 -05001304 public_configs += [ ":angle_static" ]
Julien Isorce5641d192020-02-04 21:31:47 -08001305 deps = [ ":includes" ]
1306 public_deps = [ ":libANGLE" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001307}
1308
Jamie Madill77c84962019-06-28 11:24:27 -04001309angle_shared_library("libGLESv1_CM") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001310 sources = libglesv1_cm_sources
Jamie Madill77c84962019-06-28 11:24:27 -04001311 output_name = "libGLESv1_CM${angle_libs_suffix}"
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001312
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001313 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001314 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001315 ":debug_annotations_config",
Jamie Madillba319ba2018-12-29 10:29:33 -05001316 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001317 ]
1318
1319 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001320
1321 deps = [
1322 ":includes",
Jamie Madill77c84962019-06-28 11:24:27 -04001323 ":libGLESv2",
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001324 ]
Jamie Madill8970ad32020-08-26 12:59:19 -04001325
1326 if (is_win) {
1327 sources += [ "src/libGLESv1_CM/libGLESv1_CM.def" ]
Jamie Madilld8c18ac2021-10-08 13:00:19 -04001328 deps += [ ":angle_version" ]
Jamie Madill8970ad32020-08-26 12:59:19 -04001329 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001330}
1331
Jamie Madill4638dc92018-12-17 13:13:49 -05001332config("libEGL_egl_loader_config") {
1333 defines = [ "ANGLE_USE_EGL_LOADER" ]
1334}
1335
Jamie Madill7098cff2019-01-15 18:33:42 -05001336angle_source_set("libEGL_egl_loader") {
Jamie Madill4638dc92018-12-17 13:13:49 -05001337 sources = [
1338 "src/libEGL/egl_loader_autogen.cpp",
1339 "src/libEGL/egl_loader_autogen.h",
1340 ]
1341
Jamie Madill7098cff2019-01-15 18:33:42 -05001342 public_configs += [
Jamie Madill4638dc92018-12-17 13:13:49 -05001343 ":libEGL_egl_loader_config",
1344 ":gl_prototypes",
Jamie Madill4638dc92018-12-17 13:13:49 -05001345 ]
1346
Julien Isorce5641d192020-02-04 21:31:47 -08001347 deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001348}
1349
Jamie Madill77c84962019-06-28 11:24:27 -04001350angle_shared_library("libEGL") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001351 sources = libegl_sources
Jamie Madilld8c18ac2021-10-08 13:00:19 -04001352 if (is_win) {
1353 sources += [ "src/libEGL/libEGL.rc" ]
1354 }
1355
Jamie Madill77c84962019-06-28 11:24:27 -04001356 output_name = "libEGL${angle_libs_suffix}"
Craig Stout24136212021-11-08 14:01:34 -08001357 if (angle_egl_extension != "") {
1358 output_extension = angle_egl_extension
1359 }
Jamie Madill562e81b2015-01-14 14:31:02 -05001360
Jamie Madill562e81b2015-01-14 14:31:02 -05001361 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -04001362 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -05001363 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -05001364 ]
1365
Jamie Madilledbc2442016-01-04 11:25:00 -05001366 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -05001367 if (is_win) {
1368 defines += [ "EGLAPI=" ]
1369 } else {
1370 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
1371 }
Jamie Madill562e81b2015-01-14 14:31:02 -05001372
1373 deps = [
James Darpinian22ec7dc2019-08-06 10:10:52 -07001374 ":angle_common",
Jamie Madill4638dc92018-12-17 13:13:49 -05001375 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -05001376 ]
Jamie Madill720ca442018-12-17 14:04:10 -05001377
Jamie Madilld8c18ac2021-10-08 13:00:19 -04001378 if (is_win) {
1379 sources += [ "src/libEGL/libEGL_autogen.def" ]
1380 deps += [ ":angle_version" ]
1381 }
1382
Julien Isorce5641d192020-02-04 21:31:47 -08001383 public_deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001384
Julien Isorce5641d192020-02-04 21:31:47 -08001385 data_deps = [ ":libGLESv2" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001386}
Corentin Wallezbeb81582015-09-02 10:30:55 -04001387
Jamie Madill7098cff2019-01-15 18:33:42 -05001388angle_static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001389 sources = libegl_sources
Manh Nguyendce37b72020-06-21 22:27:06 -04001390 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
Ken Russellfcadd082017-06-28 14:01:15 -07001401# Convenience targets for some of the samples so they can be built
1402# with Chromium's toolchain.
Jamie Madill7098cff2019-01-15 18:33:42 -05001403angle_executable("angle_shader_translator") {
Ken Russellfcadd082017-06-28 14:01:15 -07001404 testonly = true
1405
Julien Isorce5641d192020-02-04 21:31:47 -08001406 sources = [ "samples/shader_translator/shader_translator.cpp" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001407
Julien Isorce5641d192020-02-04 21:31:47 -08001408 deps = [ ":translator" ]
Shahbaz Youssefi776c6012021-02-26 00:00:57 -05001409
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 }
Ken Russellfcadd082017-06-28 14:01:15 -07001420}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001421
Stephen Whitef4cd1742020-12-21 09:57:58 -05001422if (angle_standalone || build_with_chromium) {
Jamie Madill1ba72542019-10-04 15:17:49 -04001423 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 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001432 }
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001433
Jamie Madill1ba72542019-10-04 15:17:49 -04001434 angle_shared_library("libfeature_support") {
1435 output_name = "libfeature_support${angle_libs_suffix}"
Ian Elliotta9d579e2018-11-28 11:44:48 -07001436
Jamie Madill1ba72542019-10-04 15:17:49 -04001437 if (is_android) {
1438 libs = [ "log" ]
1439 }
1440
Yuly Novikov52afb6f2021-01-26 22:22:07 -05001441 configs += [
Jamie Madill1ba72542019-10-04 15:17:49 -04001442 ":angle_feature_support_config",
1443 "${angle_jsoncpp_dir}:jsoncpp_config",
1444 ]
1445
Shahbaz Youssefi5b8dec52021-01-12 04:11:56 +00001446 if (is_apple && !is_component_build) {
Jamie Madill1ba72542019-10-04 15:17:49 -04001447 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",
Cezary Kulakowski4fb738f2019-02-01 10:53:44 +01001461 ]
1462 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001463}
1464
Kimmo Kinnunenba04fcf2022-03-11 13:58:52 +02001465if (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
Yuly Novikov3ad3a9a2021-04-01 17:40:26 -04001480if (is_android && symbol_level != 0) {
Jamie Madill1f56ed22019-01-03 15:24:22 -05001481 action_foreach("compressed_symbols") {
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001482 sources = []
1483 foreach(_library, angle_libraries) {
Yuly Novikov3ad3a9a2021-04-01 17:40:26 -04001484 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 }
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001489 }
1490 if (angle_enable_vulkan_validation_layers) {
1491 foreach(_layer, vulkan_validation_layers) {
Yuly Novikov3ad3a9a2021-04-01 17:40:26 -04001492 if (is_component_build) {
1493 sources += [ "$root_out_dir/lib${_layer}.cr.so" ]
1494 } else {
1495 sources += [ "$root_out_dir/lib${_layer}.so" ]
1496 }
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001497 }
1498 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001499
1500 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1501 root_build_dir)
1502
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001503 deps = []
1504 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001505 deps += [ ":$_library" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001506 }
1507
1508 if (angle_enable_vulkan_validation_layers) {
1509 foreach(_layer, vulkan_validation_layers) {
Jamie Madill328f72a2020-12-15 19:25:50 -05001510 deps += [ "$angle_vulkan_validation_layers_dir:${_layer}" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001511 }
1512 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001513
Julien Isorce5641d192020-02-04 21:31:47 -08001514 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
Jamie Madill1f56ed22019-01-03 15:24:22 -05001515
1516 android_nm = "${android_tool_prefix}nm"
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001517 android_strip = "${android_tool_prefix}strip"
Jamie Madill1f56ed22019-01-03 15:24:22 -05001518
1519 args = [
1520 "--objcopy",
1521 rebase_path(android_objcopy, root_build_dir),
1522 "--nm",
1523 rebase_path(android_nm, root_build_dir),
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001524 "--strip",
1525 rebase_path(android_strip, root_build_dir),
Jamie Madill1f56ed22019-01-03 15:24:22 -05001526 "--unstrippedsofile",
1527 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1528 "--output",
1529 "{{source_dir}}/lib.compressed/{{source_file_part}}",
1530 ]
1531 }
1532}
1533
Tim Van Patten57202fb2021-04-30 13:56:11 -06001534if ((angle_standalone || build_with_chromium) && is_android &&
1535 current_toolchain == default_toolchain) {
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001536 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
Cody Northrop8cbd3212019-04-23 13:25:20 -06001543 angle_apk("angle_chromium_apk") {
Tobin Ehlis736c43a2020-08-31 10:23:27 -06001544 package_name = "org.chromium.angle"
Tim Van Pattenee4fa072019-02-21 19:21:09 +00001545 apk_name = "AngleLibraries"
Jamie Madill7bed2a52020-09-22 23:37:54 -04001546 version_name = "ANGLE Developer Build"
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001547 version_code = apk_version_code
1548 }
Jamie Madill7bed2a52020-09-22 23:37:54 -04001549
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001550 # 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
Cody Northrop8e636442018-11-30 16:24:11 -07001556 }
1557
1558 group("angle_apks") {
Ian Elliott7ec4d2d2021-02-09 11:48:32 -07001559 deps = [
1560 ":angle_agi_chromium_apk",
1561 ":angle_chromium_apk",
1562 ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001563 }
1564}
Jamie Madill1ba72542019-10-04 15:17:49 -04001565
Jamie Madill1ba72542019-10-04 15:17:49 -04001566group("angle") {
1567 data_deps = [
Julien Isorce5641d192020-02-04 21:31:47 -08001568 ":libEGL",
Jamie Madille3c25712019-12-03 14:08:36 -05001569 ":libGLESv1_CM",
Jamie Madill1ba72542019-10-04 15:17:49 -04001570 ":libGLESv2",
Jamie Madill1ba72542019-10-04 15:17:49 -04001571 ]
1572}