blob: 8e35dc5276c39d555d63c505279bfafa6e7303f5 [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
Corentin Wallez16d4e472017-03-20 13:06:19 -040043}
44
Jamie Madille3c25712019-12-03 14:08:36 -050045if (angle_build_all) {
Frank Henigmand0ef13a2017-08-28 22:53:24 -040046 group("all") {
47 testonly = true
48 deps = [
Jamie Madille3c25712019-12-03 14:08:36 -050049 ":angle",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040050 ":angle_shader_translator",
51 ":translator_fuzzer",
Jamie Madill238c19e2019-02-07 09:09:41 -050052 ":xxhash_fuzzer",
Jamie Madille3c25712019-12-03 14:08:36 -050053 "$angle_root/samples:angle_samples",
54 "$angle_root/src/tests:angle_tests",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040055 ]
56 }
57}
58
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000059import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060060import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070061
Brett Wilson2f5469c2014-07-22 17:00:17 -070062# This config is exported to dependent targets (and also applied to internal
63# ones).
64config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050065 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070066}
67
Jamie Madill4638dc92018-12-17 13:13:49 -050068# Prevent the GL headers from redeclaring ANGLE entry points.
69config("no_gl_prototypes") {
70 defines = [
71 "GL_GLES_PROTOTYPES=0",
72 "EGL_EGL_PROTOTYPES=0",
73 ]
74}
75
76config("gl_prototypes") {
77 defines = [
78 "GL_GLES_PROTOTYPES=1",
79 "EGL_EGL_PROTOTYPES=1",
80 "GL_GLEXT_PROTOTYPES",
81 "EGL_EGLEXT_PROTOTYPES",
82 ]
83}
84
Jamie Madill72f5b5e2014-06-23 15:13:02 -040085# This config is applied to internal Angle targets (not pushed to dependents).
86config("internal_config") {
87 include_dirs = [
88 "include",
89 "src",
90 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050091
Jamie Madill4638dc92018-12-17 13:13:49 -050092 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -040093
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060094 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040095 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060096 } else {
97 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -040098 }
Geoff Langb02fc662018-08-21 09:48:01 -040099
Manh Nguyendce37b72020-06-21 22:27:06 -0400100 if (is_win) {
101 defines += [ "ANGLE_IS_WIN" ]
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900102 } else if (is_linux || is_chromeos) {
Manh Nguyendce37b72020-06-21 22:27:06 -0400103 defines += [ "ANGLE_IS_LINUX" ]
104 }
105
Tobin Ehlis573f76b2018-05-03 11:10:44 -0600106 if (angle_enable_trace) {
107 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
108 }
Tobin Ehlis93121f32019-10-17 08:18:16 -0600109
110 if (is_chromeos) {
111 defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
112 }
Ethan Leefcef6dc2020-01-24 22:41:35 -0500113
114 if (is_ggp) {
115 defines += [ "__ggp__" ]
116 }
Xiaoxuan Liu61180d02020-10-12 16:40:13 +0800117
118 if (angle_use_vulkan_display) {
119 defines += [ "ANGLE_USE_VULKAN_DISPLAY" ]
120 if (angle_vulkan_display_mode == "simple") {
121 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ]
122 } else if (angle_vulkan_display_mode == "headless") {
123 defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ]
124 }
125 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400126}
127
Jamie Madilla9f11bf2019-10-21 08:39:14 -0400128config("constructor_and_destructor_warnings") {
129 if (is_clang) {
130 cflags = [
131 "-Wexit-time-destructors",
132 "-Wglobal-constructors",
133 ]
134 }
135}
136
Jamie Madill509a1d42016-07-18 10:10:29 -0400137config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -0400138 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400139
Jamie Madill509a1d42016-07-18 10:10:29 -0400140 # Enable more default warnings on Windows.
141 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -0400142 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -0400143 "/we4244", # Conversion: possible loss of data.
Jamie Madill330c8672020-08-28 17:44:13 -0400144 "/we4312", # Conversion: greater size.
Jamie Madill509a1d42016-07-18 10:10:29 -0400145 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -0400146 "/we4458", # declaration hides class member.
Ben Wagner1e064012019-04-12 14:10:17 -0400147 "/we4715", # not all control paths return a value
Geoff Langb9440532017-11-28 13:26:34 -0500148 "/we4800", # forcing value to bool.
149 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400150 ]
151 }
Ben Wagner211bff32017-10-10 23:53:20 -0400152 if (is_clang) {
Michael Spang229fc832019-01-21 18:09:15 -0500153 cflags += [
Jamie Madillc7217aa2020-08-28 14:45:14 -0400154 "-Wbad-function-cast",
Jamie Madill155947f2019-10-24 12:55:11 -0400155 "-Wconditional-uninitialized",
Jamie Madillb4efc052020-08-28 14:45:18 -0400156 "-Wdeprecated-copy",
Jamie Madill44a0e732019-09-02 13:55:59 -0400157 "-Wextra-semi-stmt",
Jiacheng Lu73e5e9b2019-07-22 15:26:17 -0600158 "-Wfloat-conversion",
Jamie Madill16370a62019-10-24 12:55:11 -0400159 "-Winconsistent-missing-destructor-override",
Jamie Madilla6206852019-10-24 12:55:09 -0400160 "-Wmissing-field-initializers",
Stuart Morgan5dba7232020-06-16 09:29:16 -0700161 "-Wnewline-eof",
Olli Etuaho8073a952018-05-09 16:41:39 +0300162 "-Wnon-virtual-dtor",
Jamie Madill68945f12019-10-24 12:55:09 -0400163 "-Wredundant-parens",
Jamie Madill1ab8b752020-08-28 14:45:15 -0400164 "-Wreturn-std-move-in-c++11",
Jamie Madill859ca032019-10-24 12:55:08 -0400165 "-Wshadow-field",
Jamie Madill5c56f222020-08-28 14:45:14 -0400166 "-Wsuggest-destructor-override",
167 "-Wsuggest-override",
Jamie Madillfd58d222019-10-24 12:55:07 -0400168 "-Wtautological-type-limit-compare",
Jamie Madillc017cee2019-10-24 12:55:10 -0400169 "-Wundefined-reinterpret-cast",
Jamie Madillc09ae152019-02-01 14:16:32 -0500170 "-Wunneeded-internal-declaration",
Jamie Madill3486ec92020-09-10 17:55:28 -0400171 "-Wweak-template-vtables",
James Darpinianefa898a2019-08-07 17:05:35 -0700172
173 # The below warnings are used by WebKit. We enable them to make rolling
174 # ANGLE in WebKit easier.
175 "-Wparentheses",
176 "-Wrange-loop-analysis",
177 "-Wstrict-prototypes",
178 "-Wunreachable-code",
James Darpinian7e48c9e2019-08-06 17:17:19 -0700179 "-Wshorten-64-to-32",
Nico Weber79de62c2018-01-31 10:47:14 -0500180 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400181 }
Austin Kinross11dc1632019-09-18 14:46:23 -0700182
183 if (angle_is_winuwp) {
184 cflags += [ "/wd4447" ] # 'main' signature found without threading model.
185 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400186}
187
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600188# This config adds build-ids to the associated library.
189# -Wl is a special option that indicates that clang should pass the associated
190# option --build-id to the linker. This will cause a build-id section to be added
191# to the associated library. The build-id makes it possible for a debugger to
192# find the right symbol file to use.
193config("build_id_config") {
194 ldflags = [ "-Wl,--build-id" ]
195}
196
Jamie Madill20d380f2019-06-03 15:21:47 -0400197# Useful for more informative stack traces.
198config("better_linux_stack_traces") {
199 if (angle_better_stack_traces) {
200 ldflags = [ "-Wl,--export-dynamic" ]
201 }
202}
203
Jamie Madill1ba72542019-10-04 15:17:49 -0400204_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
205
Tom Tan5c317532018-11-30 17:01:01 -0800206# Windows ARM64 is available since 10.0.16299 so no need to copy
207# d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400208if (_use_copy_compiler_dll) {
Jamie Madilld09546e2019-02-22 10:24:44 -0500209 # We also ship an older DLL for compatiblity with Windows 7 machines without
210 # the UCRT. This DLL isn't available in the standard SDK distribution.
211 _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
212 _has_old_compiler =
213 exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
214
Daniel Bratell73941de2015-02-25 14:34:49 +0100215 copy("copy_compiler_dll") {
Julien Isorce5641d192020-02-04 21:31:47 -0800216 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
Jamie Madilld09546e2019-02-22 10:24:44 -0500217
218 if (_has_old_compiler) {
219 sources += [ _old_compiler ]
220 }
221
Julien Isorce5641d192020-02-04 21:31:47 -0800222 outputs = [ "$root_out_dir/{{source_file_part}}" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100223 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100224}
225
Jamie Madill55959b02019-03-05 10:07:41 -0500226# Holds the shared includes so we only need to list them once.
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500227config("includes_config") {
228 include_dirs = [ "include" ]
229}
230
Jamie Madill7098cff2019-01-15 18:33:42 -0500231angle_source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400232 sources = libangle_includes
Jamie Madill8d412db2020-08-29 22:25:18 +0000233 public_configs = [ ":includes_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400234}
235
Jamie Madill7098cff2019-01-15 18:33:42 -0500236angle_static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400237 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400238
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400239 public_deps = [
240 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400241 ":angle_translator_headers",
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400242 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400243}
244
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500245config("angle_disable_pool_alloc") {
246 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400247}
248
Cooper Partin75da1972015-06-16 15:03:14 -0700249config("debug_annotations_config") {
Corentin Wallez105bc9d2019-03-06 16:32:40 +0000250 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500251 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700252 }
253}
254
Jamie Madille31fd872016-05-27 08:35:36 -0400255config("angle_release_asserts_config") {
256 if (dcheck_always_on) {
257 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
258 }
259}
260
Jamie Madille2e406c2016-06-02 13:04:10 -0400261config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400262 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500263 if (is_android) {
264 libs = [ "log" ]
265 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400266}
267
Alexis Hetua20f5b12020-08-18 11:26:50 -0400268# Silences the "indirect call of a function with wrong dynamic type" cfi error
269config("angle_no_cfi_icall") {
270 if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
271 cflags = [ "-fno-sanitize=cfi-icall" ]
272 }
273}
274
275# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
276config("angle_no_cfi_unrelated_cast") {
277 if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
278 cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
279 }
280}
281
Jamie Madill7098cff2019-01-15 18:33:42 -0500282angle_source_set("angle_system_utils") {
Jamie Madill4638dc92018-12-17 13:13:49 -0500283 sources = angle_system_utils_sources
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900284 if (is_linux || is_chromeos) {
Jamie Madill8970ad32020-08-26 12:59:19 -0400285 libs = [ "dl" ]
286 }
Jamie Madill4638dc92018-12-17 13:13:49 -0500287}
288
Jamie Madillc09ae152019-02-01 14:16:32 -0500289angle_source_set("xxhash") {
290 sources = xxhash_sources
Jamie Madill5fde6322020-08-28 14:45:17 -0400291 if (is_clang) {
292 cflags_c = [ "-Wno-implicit-fallthrough" ]
293 }
Jamie Madillc09ae152019-02-01 14:16:32 -0500294}
295
Jamie Madill1ba72542019-10-04 15:17:49 -0400296if (angle_has_build) {
297 fuzzer_test("xxhash_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800298 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
299 deps = [ ":xxhash" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400300 }
Jamie Madill238c19e2019-02-07 09:09:41 -0500301}
302
Jamie Madill7098cff2019-01-15 18:33:42 -0500303angle_static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400304 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700305
Jamie Madill562e81b2015-01-14 14:31:02 -0500306 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400307 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700308 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500309 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400310
Julien Isorce5641d192020-02-04 21:31:47 -0800311 deps = [ ":xxhash" ]
Jamie Madillc09ae152019-02-01 14:16:32 -0500312
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400313 public_deps = [
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600314 ":angle_abseil",
Jamie Madill4638dc92018-12-17 13:13:49 -0500315 ":angle_system_utils",
316 ":angle_version",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500317 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400318 ]
Jamie Madill7098cff2019-01-15 18:33:42 -0500319 public_configs += [ ":angle_common_config" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400320 if (angle_has_build && use_fuzzing_engine) {
Jamie Madill48aa52f2019-10-17 07:56:53 -0400321 all_dependent_configs = [ ":angle_disable_pool_alloc" ]
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500322 }
Tim Van Pattene99b8bc2020-10-23 18:50:33 -0600323
324 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
325 # In API level 26 ANativeWindow APIs were moved from libandroid.so
326 # into a separate library, libnativewindow.so
327 if (ndk_api_level_at_least_26) {
328 libs = [ "nativewindow" ]
329 } else {
330 libs = [ "android" ]
331 }
332 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500333}
334
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400335config("angle_image_util_config") {
336 include_dirs = [
337 "include",
338 "src",
339 ]
340}
341
Jamie Madill1f08ab22019-10-03 16:22:52 -0400342angle_source_set("angle_image_util_headers") {
343 sources = libangle_image_util_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800344 public_deps = [ ":angle_common" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400345}
346
Jamie Madill7098cff2019-01-15 18:33:42 -0500347angle_static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400348 sources = libangle_image_util_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500349 public_configs += [ ":angle_image_util_config" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800350 public_deps = [ ":angle_image_util_headers" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400351}
352
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600353config("angle_gl_visibility_config") {
354 if (is_win) {
355 defines = [
356 "GL_APICALL=",
357 "GL_API=",
358 ]
359 } else {
360 defines = [
361 "GL_APICALL=__attribute__((visibility(\"default\")))",
362 "GL_API=__attribute__((visibility(\"default\")))",
363 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600364 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600365}
366
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500367config("angle_gpu_info_util_config") {
368 include_dirs = [
369 "include",
370 "src",
371 ]
372}
373
Jamie Madill7098cff2019-01-15 18:33:42 -0500374angle_static_library("angle_gpu_info_util") {
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400375 public_configs += [
376 ":angle_gpu_info_util_config",
377 ":angle_backend_config",
378 ]
Julien Isorce5641d192020-02-04 21:31:47 -0800379 public_deps = [ ":angle_common" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400380 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500381 deps = []
382 libs = []
383 defines = []
384
Jamie Madillb09f16e2020-10-01 10:02:07 -0400385 if (!is_chromeos && angle_has_build) {
Michael Spangb630bf92020-01-24 17:27:01 -0500386 sources += libangle_gpu_info_util_vulkan_sources
Geoff Langdd90f5a2020-04-07 12:59:23 -0400387 deps += [ "$angle_root/third_party/vulkan-headers/src:vulkan_headers" ]
Michael Spangb630bf92020-01-24 17:27:01 -0500388 }
389
Ian Elliottd07c52e2018-06-22 15:42:09 -0600390 if (is_android) {
Michael Spangb630bf92020-01-24 17:27:01 -0500391 sources += libangle_gpu_info_util_android_sources
392 }
393
394 if (is_fuchsia) {
395 sources += libangle_gpu_info_util_fuchsia_sources
Antonio Maiorano13816d22020-06-16 14:27:04 -0400396 deps += [ "$angle_root/src/common/vulkan:angle_vulkan_entry_points" ]
Ian Elliottd07c52e2018-06-22 15:42:09 -0600397 }
398
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700399 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400400 sources += libangle_gpu_info_util_win_sources
Austin Kinross11dc1632019-09-18 14:46:23 -0700401 if (!angle_is_winuwp) {
402 libs += [ "setupapi.lib" ]
403 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400404 libs += [ "dxgi.lib" ]
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700405 }
406
Hidehiko Abe90a9cf92020-09-11 02:40:34 +0900407 if (is_linux || is_chromeos) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400408 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500409
Jamie Madill8970ad32020-08-26 12:59:19 -0400410 if (angle_use_x11 && angle_has_build) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400411 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500412 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
413 defines += [ "GPU_INFO_USE_X11" ]
414 libs += [
415 "X11",
416 "Xi",
417 "Xext",
418 ]
419 }
420 }
421
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500422 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400423 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500424 defines += [ "GPU_INFO_USE_LIBPCI" ]
425 libs += [ "pci" ]
426 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500427
428 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400429 sources += libangle_gpu_info_util_mac_sources
Sylvain Defresnebae95f82020-07-02 17:19:14 +0200430 frameworks = [
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500431 "IOKit.framework",
432 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400433 "CoreGraphics.framework",
Daksh Idnani5ec04882019-08-22 21:12:08 +0000434 "OpenGL.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500435 ]
436 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500437}
438
Jamie Madill1f08ab22019-10-03 16:22:52 -0400439angle_source_set("angle_translator_headers") {
440 sources = angle_translator_exported_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800441 public_deps = [ ":includes" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400442}
443
Jamie Madill7098cff2019-01-15 18:33:42 -0500444angle_static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400445 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800446 defines = []
447
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700448 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400449 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800450 defines += [ "ANGLE_ENABLE_ESSL" ]
451 }
452
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700453 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400454 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800455 defines += [ "ANGLE_ENABLE_GLSL" ]
456 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400457
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700458 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400459 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800460 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100461 }
Jamie Madille794cd82017-01-13 17:29:51 -0500462
Le Quyend200a772019-10-10 00:44:01 +0800463 if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
464 # This translator is needed by metal backend also.
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400465 sources += angle_translator_lib_vulkan_sources
Le Quyend200a772019-10-10 00:44:01 +0800466 }
467
468 if (angle_enable_vulkan || use_fuzzing_engine) {
Jamie Madille794cd82017-01-13 17:29:51 -0500469 defines += [ "ANGLE_ENABLE_VULKAN" ]
470 }
471
Le Quyend200a772019-10-10 00:44:01 +0800472 if (angle_enable_metal) {
473 sources += angle_translator_lib_metal_sources
474 defines += [ "ANGLE_ENABLE_METAL" ]
475 }
476
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600477 if (angle_enable_swiftshader) {
478 defines += [ "ANGLE_ENABLE_SWIFTSHADER" ]
479 }
480
Jamie Madill7098cff2019-01-15 18:33:42 -0500481 public_configs += [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400482
483 deps = [
484 ":includes",
485 ":preprocessor",
486 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500487
488 public_deps = [
489 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400490 ":angle_translator_headers",
Jamie Madill562e81b2015-01-14 14:31:02 -0500491 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400492
493 if (is_win) {
494 # Necessary to suppress some system header xtree warnigns in Release.
495 # For some reason this warning doesn't get triggered in Chromium
496 cflags = [ "/wd4718" ]
497 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400498}
499
Jamie Madill7098cff2019-01-15 18:33:42 -0500500angle_source_set("translator_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800501 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700502
503 include_dirs = [
504 "include",
505 "src",
506 ]
507
Julien Isorce5641d192020-02-04 21:31:47 -0800508 deps = [ ":translator" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700509}
510
Jamie Madill62778cb2020-09-22 23:10:04 -0400511config("angle_commit_id_config") {
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400512 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill62778cb2020-09-22 23:10:04 -0400513 visibility = [ ":angle_commit_id" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500514}
515
Jamie Madill62778cb2020-09-22 23:10:04 -0400516_commit_id_output_file = "$root_gen_dir/angle/angle_commit.h"
517action("angle_commit_id") {
Geoff Langba8ef682020-02-24 14:13:40 -0500518 script = "src/commit_id.py"
Jamie Madill62778cb2020-09-22 23:10:04 -0400519 outputs = [ _commit_id_output_file ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400520
Geoff Langba8ef682020-02-24 14:13:40 -0500521 # Add git as a dependency if it is available.
Geoff Lang20c69732020-03-06 11:02:31 -0500522 if (angle_enable_commit_id &&
523 exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
Geoff Langdd19d552020-03-02 09:41:22 -0500524 # commit id should depend on angle's HEAD revision
525 inputs = [ ".git/HEAD" ]
Jamie Madill5f2ba632020-08-15 23:50:59 -0400526 branch = read_file(".git/HEAD", "string")
527 result = string_split(branch)
528 if (result[0] == "ref:") {
529 inputs += [ ".git/" + result[1] ]
530 }
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200531 }
Geoff Langba8ef682020-02-24 14:13:40 -0500532
533 args = [
534 "gen",
Jamie Madill62778cb2020-09-22 23:10:04 -0400535 rebase_path(_commit_id_output_file, root_build_dir),
Geoff Langba8ef682020-02-24 14:13:40 -0500536 ]
537
Jamie Madill62778cb2020-09-22 23:10:04 -0400538 public_configs = [ ":angle_commit_id_config" ]
539}
540
541# TODO(jmadill): Remove this. http://b/168736059
542group("commit_id") {
543 data_deps = [ ":angle_commit_id" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400544}
545
Jamie Madill7098cff2019-01-15 18:33:42 -0500546angle_source_set("angle_version") {
Jamie Madill62778cb2020-09-22 23:10:04 -0400547 # TODO(jmadill): Remove version.h. http://b/168736059
548 sources = [
549 "src/common/angle_version.h",
550 "src/common/version.h",
551 ]
552 public_deps = [ ":angle_commit_id" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500553}
554
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400555config("angle_backend_config") {
Jamie Madill562e81b2015-01-14 14:31:02 -0500556 defines = []
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400557
Etienne Bergeron9e83c152020-06-04 19:53:36 -0400558 if (angle_delegate_workers) {
559 defines += [ "ANGLE_DELEGATE_WORKERS" ]
560 }
Jamie Madill1f08ab22019-10-03 16:22:52 -0400561
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600562 configs = []
563
Jamie Madillbb96aef2020-09-11 13:50:09 -0400564 if (angle_enable_d3d11) {
565 configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ]
566 }
567
568 if (angle_enable_d3d9) {
569 configs += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend_config" ]
570 }
571
Jamie Madill2d741702020-09-11 12:30:04 -0400572 if (angle_enable_gl) {
573 configs += [ "src/libANGLE/renderer/gl:angle_gl_backend_config" ]
574 }
575
Jamie Madill852f61f2020-09-11 11:54:35 -0400576 if (angle_enable_null) {
577 configs += [ "src/libANGLE/renderer/null:angle_null_backend_config" ]
578 }
579
Le Quyend200a772019-10-10 00:44:01 +0800580 if (angle_enable_metal) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600581 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
Le Quyend200a772019-10-10 00:44:01 +0800582 }
583
Jamie Madill1f08ab22019-10-03 16:22:52 -0400584 if (angle_enable_vulkan) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600585 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400586 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400587}
588
589config("libANGLE_config") {
590 cflags = []
591 defines = []
592 libs = []
593 ldflags = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500594 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400595
596 if (is_win) {
Julien Isorce5641d192020-02-04 21:31:47 -0800597 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
598 # are not enabled.
Austin Kinross40853472015-02-12 10:39:56 -0800599 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500600
601 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
Yuly Novikov8edc68e2019-02-12 12:41:01 -0500602 # In API level 26 ANativeWindow APIs were moved from libandroid.so
603 # into a separate library, libnativewindow.so
604 if (ndk_api_level_at_least_26) {
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500605 libs += [ "nativewindow" ]
606 } else {
607 libs += [ "android" ]
608 }
609 }
Michael Spang7cd5f642019-08-21 20:03:49 -0400610
Ethan Leed22b8be2019-11-15 12:26:39 -0500611 if (angle_use_x11) {
Michael Spang7cd5f642019-08-21 20:03:49 -0400612 defines += [ "ANGLE_USE_X11" ]
613 }
Jamie Madillaf5e3822020-01-28 10:05:36 -0500614
615 if (angle_enable_overlay) {
616 defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
617 }
Tim Van Pattenee4e0862020-09-24 11:39:49 -0600618 if (angle_enable_perf_counter_output) {
619 defines += [ "ANGLE_ENABLE_PERF_COUNTER_OUTPUT=1" ]
620 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500621}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500622
Jamie Madill1f08ab22019-10-03 16:22:52 -0400623angle_source_set("libANGLE_headers") {
624 sources = libangle_headers
625 public_deps = [
626 ":angle_common",
627 ":angle_translator_headers",
628 ]
Jamie Madillaf5e3822020-01-28 10:05:36 -0500629 public_configs += [ ":libANGLE_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500630}
631
Jamie Madill2f718022019-10-28 11:48:46 -0400632# Don't even try to build glslang if Metal and Vulkan are disabled.
633if (angle_enable_vulkan || angle_enable_metal) {
634 angle_source_set("angle_glslang_wrapper") {
635 sources = [
636 "src/libANGLE/renderer/glslang_wrapper_utils.cpp",
637 "src/libANGLE/renderer/glslang_wrapper_utils.h",
638 ]
639 deps = [
640 ":libANGLE_headers",
641 "${angle_glslang_dir}:glslang_default_resource_limits_sources",
Shahbaz Youssefib291ad02020-07-03 23:53:10 -0400642 "${angle_glslang_dir}:glslang_lib_sources",
Shahbaz Youssefi71e6afb2020-01-14 14:12:31 -0500643 "${angle_spirv_headers_dir}:spv_headers",
644 "${angle_spirv_tools_dir}:spvtools_headers",
Jamie Madill2f718022019-10-28 11:48:46 -0400645 ]
646 }
Le Quyena48f95a2019-10-14 14:49:49 +0800647}
648
Jamie Madill4d3a0f62020-09-11 12:36:05 -0400649if (is_win) {
650 angle_source_set("angle_d3d_format_tables") {
651 sources = [
652 "src/libANGLE/renderer/dxgi_format_map.h",
653 "src/libANGLE/renderer/dxgi_format_map_autogen.cpp",
654 "src/libANGLE/renderer/dxgi_support_table.h",
655 "src/libANGLE/renderer/dxgi_support_table_autogen.cpp",
656 ]
657
658 if (!angle_is_winuwp) {
659 sources += [
660 "src/libANGLE/renderer/d3d_format.cpp",
661 "src/libANGLE/renderer/d3d_format.h",
662 ]
663 }
664
665 public_deps = [ ":libANGLE_headers" ]
666 configs += [ ":angle_backend_config" ]
667 }
668}
669
Jamie Madilleb1b1642019-07-30 17:22:17 -0400670angle_source_set("libANGLE_base") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400671 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500672
Jamie Madill5ea762a2017-06-07 14:59:51 -0400673 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500674 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500675 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500676 if (angle_link_glx) {
677 libs += [ "GL" ]
678 defines += [ "ANGLE_LINK_GLX" ]
679 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400680 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500681 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500682 ":angle_gpu_info_util",
Jamie Madill4638dc92018-12-17 13:13:49 -0500683 ":angle_version",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400684 ":libANGLE_headers",
Jamie Madill720ca442018-12-17 14:04:10 -0500685 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400686 ]
687 deps = [
Tim Van Pattenb55f0f72020-06-02 18:01:24 -0600688 ":angle_compression",
Corentin Wallez878baf92017-02-15 13:57:16 -0500689 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500690 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500691 ]
692
Jamie Madille55374f2019-10-24 12:55:12 -0400693 if (is_win) {
694 libs += [
Jamie Madille55374f2019-10-24 12:55:12 -0400695 "gdi32.lib",
696 "user32.lib",
697 ]
698 }
699
Jamie Madillbb96aef2020-09-11 13:50:09 -0400700 if (angle_enable_d3d11) {
701 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend" ]
702 }
703
704 if (angle_enable_d3d9) {
705 public_deps += [ "src/libANGLE/renderer/d3d:angle_d3d9_backend" ]
706 }
707
Jamie Madill2d741702020-09-11 12:30:04 -0400708 if (angle_enable_gl) {
709 public_deps += [ "src/libANGLE/renderer/gl:angle_gl_backend" ]
710 }
711
Jamie Madill852f61f2020-09-11 11:54:35 -0400712 if (angle_enable_null) {
713 public_deps += [ "src/libANGLE/renderer/null:angle_null_backend" ]
714 }
715
Jamie Madill1f08ab22019-10-03 16:22:52 -0400716 if (angle_enable_vulkan) {
717 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
718 }
719
Le Quyend200a772019-10-10 00:44:01 +0800720 if (angle_enable_metal) {
721 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
722 }
723
Jamie Madillab2bfa82019-01-15 19:06:47 -0500724 # Enable extra Chromium style warnings for libANGLE.
Jamie Madill299b1ba2019-10-24 09:29:18 -0400725 if (is_clang && angle_has_build) {
Jamie Madillab2bfa82019-01-15 19:06:47 -0500726 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
727 }
728
Geoff Langecd2e3b2019-07-09 15:39:39 -0400729 if (is_mac) {
730 sources += libangle_mac_sources
731 }
732
Jamie Madill562e81b2015-01-14 14:31:02 -0500733 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500734 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400735 }
736
Jamie Madill7098cff2019-01-15 18:33:42 -0500737 configs += [ ":debug_annotations_config" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400738 public_configs += [
739 ":libANGLE_config",
740 ":angle_backend_config",
741 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500742
Tom Tan5c317532018-11-30 17:01:01 -0800743 # Windows ARM64 is available since 10.0.16299 so no need to copy
744 # d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400745 if (_use_copy_compiler_dll) {
Julien Isorce5641d192020-02-04 21:31:47 -0800746 data_deps = [ ":copy_compiler_dll" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500747 }
748}
749
Jamie Madilleb1b1642019-07-30 17:22:17 -0400750config("angle_frame_capture_disabled") {
751 defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
752}
753
754config("angle_frame_capture_enabled") {
755 defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
756}
757
758angle_source_set("libANGLE") {
Julien Isorce5641d192020-02-04 21:31:47 -0800759 public_deps = [ ":libANGLE_base" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400760 public_configs = [ ":angle_frame_capture_disabled" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800761 sources = [ "src/libANGLE/FrameCapture_mock.cpp" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600762
763 # gl_enum_utils defaults included in with_capture build
Jamie Madill8d412db2020-08-29 22:25:18 +0000764 deps = []
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600765 if (angle_enable_trace || is_debug) {
Brandon Schade5cfab192019-10-28 09:12:53 -0700766 deps += [ ":angle_gl_enum_utils" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600767 }
Jamie Madilleb1b1642019-07-30 17:22:17 -0400768}
769
Brandon Schade5cfab192019-10-28 09:12:53 -0700770angle_source_set("angle_gl_enum_utils") {
Julien Isorce5641d192020-02-04 21:31:47 -0800771 public_deps = [ ":libANGLE_base" ]
Brandon Schade5cfab192019-10-28 09:12:53 -0700772 sources = [
773 "src/libANGLE/gl_enum_utils.cpp",
774 "src/libANGLE/gl_enum_utils_autogen.cpp",
775 ]
776}
777
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600778if (!defined(angle_abseil_cpp_dir)) {
779 angle_abseil_cpp_dir = "//third_party/abseil-cpp"
780}
781
782config("angle_abseil_config") {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600783 if (angle_enable_abseil) {
784 defines = [ "ANGLE_USE_ABSEIL" ]
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600785
Tim Van Pattenec42b142020-09-28 10:15:46 -0600786 configs = [
787 "$angle_abseil_cpp_dir:absl_define_config",
788 "$angle_abseil_cpp_dir:absl_include_config",
789 ]
790 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600791}
792
793group("angle_abseil") {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600794 if (angle_enable_abseil) {
795 # When build_with_chromium=true we need to include "//third_party/abseil-cpp:absl" while
796 # we can be more specific when building standalone ANGLE.
Tim Van Patten36f04642020-10-08 14:45:51 -0600797 if (build_with_chromium || is_component_build) {
Tim Van Pattenec42b142020-09-28 10:15:46 -0600798 public_deps = [ "$angle_abseil_cpp_dir:absl" ]
799 } else {
800 public_deps = [ "$angle_abseil_cpp_dir/absl/container:flat_hash_map" ]
801 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600802
Tim Van Pattenec42b142020-09-28 10:15:46 -0600803 public_configs = [ ":angle_abseil_config" ]
804 }
Tim Van Pattene78d9a62020-07-24 11:58:45 -0600805}
806
Jamie Madill7e453a22020-03-15 22:11:03 -0400807config("angle_compression_config") {
808 include_dirs = [ "//third_party/zlib/google" ]
809}
810
811group("angle_compression") {
812 public_configs = [
813 ":angle_compression_config",
814 "//third_party/zlib:zlib_config",
815 ]
Jamie Madill35d3c412020-08-26 12:59:18 -0400816 public_deps =
817 [ "$angle_zlib_compression_utils_dir:compression_utils_portable" ]
Jamie Madill7e453a22020-03-15 22:11:03 -0400818}
819
Jamie Madill612b7412019-07-05 11:13:30 -0400820angle_source_set("libANGLE_with_capture") {
Julien Isorce5641d192020-02-04 21:31:47 -0800821 public_deps = [ ":libANGLE_base" ]
Jamie Madill7e453a22020-03-15 22:11:03 -0400822 deps = [ ":angle_compression" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400823 public_configs = [ ":angle_frame_capture_enabled" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400824 sources = libangle_capture_sources
825}
826
Robert Sesekdb8ae832016-06-21 11:47:03 -0400827config("shared_library_public_config") {
828 if (is_mac && !is_component_build) {
829 # Executable targets that depend on the shared libraries below need to have
830 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400831 ldflags = [
832 "-rpath",
833 "@executable_path/",
834 ]
Jonah Ryan-Davis90a8af32020-03-05 13:48:47 -0500835 if (build_with_chromium) {
836 ldflags += [
837 # Path for loading shared libraries for unbundled binaries.
838 # From //build/config/mac/BUILD.gn, this is only added for
839 # component builds. However, since ANGLE always dynamically
840 # links to libvulkan, it should be re-added for non-component
841 # builds. (anglebug.com/4455)
842 "-Wl,-rpath,@loader_path/.",
843 ]
844 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400845 }
Josh Matthews732c9d02019-11-29 13:59:03 -0500846
847 if (angle_is_winuwp) {
848 ldflags = [
849 "/APPCONTAINER",
850
851 # Disable warning about invalid subsystem number.
852 # A default appropriate subsystem is selected automatically.
853 "/IGNORE:4010",
854 ]
855 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400856}
857
Jamie Madill4638dc92018-12-17 13:13:49 -0500858config("library_name_config") {
Yuly Novikov8b8dc562020-02-26 19:09:31 -0500859 if (is_component_build && is_android) {
860 defines = [
861 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"",
862 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"",
863 ]
864 } else {
865 defines = [
866 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
867 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
868 ]
869 }
Jamie Madill4638dc92018-12-17 13:13:49 -0500870}
871
Jamie Madill80ab03c2017-01-03 11:03:23 -0500872# This config controls export definitions on ANGLE API calls.
873config("angle_static") {
874 defines = [
875 "ANGLE_EXPORT=",
Jamie Madillba319ba2018-12-29 10:29:33 -0500876 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500877 "EGLAPI=",
878 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500879 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500880 ]
881}
882
Jamie Madilleb1b1642019-07-30 17:22:17 -0400883set_defaults("angle_libGLESv2") {
884 sources = []
885 output_name = "libGLESv2"
886}
887
Jamie Madill612b7412019-07-05 11:13:30 -0400888template("angle_libGLESv2") {
889 angle_shared_library(target_name) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400890 sources = libglesv2_sources + invoker.sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500891
Jamie Madill612b7412019-07-05 11:13:30 -0400892 if (is_win) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400893 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400894 }
895
Jamie Madilleb1b1642019-07-30 17:22:17 -0400896 output_name = "${invoker.output_name}${angle_libs_suffix}"
897
Jamie Madill612b7412019-07-05 11:13:30 -0400898 configs += [
899 ":angle_gl_visibility_config",
900 ":debug_annotations_config",
901 ":gl_prototypes",
902 ]
903
Jamie Madilleb1b1642019-07-30 17:22:17 -0400904 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400905
Jamie Madilleb1b1642019-07-30 17:22:17 -0400906 deps = invoker.deps + [ ":includes" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400907
Julien Isorce5641d192020-02-04 21:31:47 -0800908 public_deps = [ ":angle_version" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500909 }
Jamie Madill612b7412019-07-05 11:13:30 -0400910}
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800911
Jamie Madill612b7412019-07-05 11:13:30 -0400912angle_libGLESv2("libGLESv2") {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400913 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800914 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600915 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800916 deps = [ ":libANGLE" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400917 }
Jamie Madill612b7412019-07-05 11:13:30 -0400918}
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400919
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600920# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
921angle_libGLESv2("libGLESv2_capture_complement") {
922 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800923 deps = [ ":libANGLE" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600924 output_name += "_no_capture"
925 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800926 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600927 output_name += "_with_capture"
Jamie Madilleb1b1642019-07-30 17:22:17 -0400928 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500929}
930
Austin Kinross11dc1632019-09-18 14:46:23 -0700931if (is_win && !angle_is_winuwp) {
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400932 angle_shared_library("libGL") {
933 sources = libgl_sources
Clemen Deng663b0482019-07-11 12:37:35 -0400934
Clemen Deng6e7dd1e2019-07-16 13:41:59 -0400935 output_name = "openGL32"
936 output_dir = "$root_out_dir/angle_libs"
Clemen Deng7558e832019-06-18 13:02:03 -0400937
938 configs += [
939 ":angle_gl_visibility_config",
940 ":debug_annotations_config",
941 ":gl_prototypes",
942 ]
943
Jamie Madill612b7412019-07-05 11:13:30 -0400944 defines = [
945 "ANGLE_CAPTURE_ENABLED=0",
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400946 "LIBGL_IMPLEMENTATION",
Jamie Madill612b7412019-07-05 11:13:30 -0400947 ]
Clemen Deng7558e832019-06-18 13:02:03 -0400948
949 deps = [
950 ":includes",
951 ":libANGLE",
952 ]
953
Julien Isorce5641d192020-02-04 21:31:47 -0800954 public_deps = [ ":angle_version" ]
Clemen Deng7558e832019-06-18 13:02:03 -0400955 }
956}
957
Jamie Madill7098cff2019-01-15 18:33:42 -0500958angle_static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400959 sources = libglesv2_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500960 configs += [ ":debug_annotations_config" ]
961 public_configs += [ ":angle_static" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800962 deps = [ ":includes" ]
963 public_deps = [ ":libANGLE" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500964}
965
Manh Nguyendce37b72020-06-21 22:27:06 -0400966angle_static_library("libGLESv2_with_capture_static") {
967 sources = libglesv2_sources
968 configs += [ ":debug_annotations_config" ]
969 public_configs += [ ":angle_static" ]
970 deps = [ ":includes" ]
971 public_deps = [ ":libANGLE_with_capture" ]
972}
973
Jamie Madill77c84962019-06-28 11:24:27 -0400974angle_shared_library("libGLESv1_CM") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400975 sources = libglesv1_cm_sources
Jamie Madill77c84962019-06-28 11:24:27 -0400976 output_name = "libGLESv1_CM${angle_libs_suffix}"
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500977
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500978 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600979 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500980 ":debug_annotations_config",
Jamie Madillba319ba2018-12-29 10:29:33 -0500981 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500982 ]
983
984 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500985
986 deps = [
987 ":includes",
Jamie Madill77c84962019-06-28 11:24:27 -0400988 ":libGLESv2",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500989 ]
Jamie Madill8970ad32020-08-26 12:59:19 -0400990
991 if (is_win) {
992 sources += [ "src/libGLESv1_CM/libGLESv1_CM.def" ]
993 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500994}
995
Jamie Madill7098cff2019-01-15 18:33:42 -0500996angle_static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400997 sources = libglesv1_cm_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500998 configs += [ ":debug_annotations_config" ]
999 public_configs += [ ":angle_static" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001000 deps = [
1001 ":includes",
1002 ":libGLESv2_static",
1003 ]
1004}
1005
Jamie Madill4638dc92018-12-17 13:13:49 -05001006config("libEGL_egl_loader_config") {
1007 defines = [ "ANGLE_USE_EGL_LOADER" ]
1008}
1009
Jamie Madill7098cff2019-01-15 18:33:42 -05001010angle_source_set("libEGL_egl_loader") {
Jamie Madill4638dc92018-12-17 13:13:49 -05001011 sources = [
1012 "src/libEGL/egl_loader_autogen.cpp",
1013 "src/libEGL/egl_loader_autogen.h",
1014 ]
1015
Jamie Madill7098cff2019-01-15 18:33:42 -05001016 public_configs += [
Jamie Madill4638dc92018-12-17 13:13:49 -05001017 ":libEGL_egl_loader_config",
1018 ":gl_prototypes",
Jamie Madill4638dc92018-12-17 13:13:49 -05001019 ]
1020
Julien Isorce5641d192020-02-04 21:31:47 -08001021 deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001022}
1023
Jamie Madill77c84962019-06-28 11:24:27 -04001024angle_shared_library("libEGL") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001025 sources = libegl_sources
Jamie Madill77c84962019-06-28 11:24:27 -04001026 output_name = "libEGL${angle_libs_suffix}"
Jamie Madill562e81b2015-01-14 14:31:02 -05001027
Jamie Madill562e81b2015-01-14 14:31:02 -05001028 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -04001029 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -05001030 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -05001031 ]
1032
Jamie Madilledbc2442016-01-04 11:25:00 -05001033 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -05001034 if (is_win) {
1035 defines += [ "EGLAPI=" ]
1036 } else {
1037 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
1038 }
Jamie Madill562e81b2015-01-14 14:31:02 -05001039
Jamie Madill80ab03c2017-01-03 11:03:23 -05001040 if (is_win) {
Nico Weber9db8df42019-01-04 14:47:27 -05001041 sources += [ "src/libEGL/libEGL.def" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001042 }
1043
Jamie Madill562e81b2015-01-14 14:31:02 -05001044 deps = [
James Darpinian22ec7dc2019-08-06 10:10:52 -07001045 ":angle_common",
Jamie Madill4638dc92018-12-17 13:13:49 -05001046 ":angle_system_utils",
1047 ":angle_version",
1048 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -05001049 ]
Jamie Madill720ca442018-12-17 14:04:10 -05001050
Julien Isorce5641d192020-02-04 21:31:47 -08001051 public_deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -05001052
Julien Isorce5641d192020-02-04 21:31:47 -08001053 data_deps = [ ":libGLESv2" ]
Jamie Madill562e81b2015-01-14 14:31:02 -05001054}
Corentin Wallezbeb81582015-09-02 10:30:55 -04001055
Jamie Madill7098cff2019-01-15 18:33:42 -05001056angle_static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001057 sources = libegl_sources
Manh Nguyendce37b72020-06-21 22:27:06 -04001058 configs += [
1059 ":debug_annotations_config",
1060 ":library_name_config",
1061 ]
1062 public_configs += [ ":angle_static" ]
1063 deps = [
1064 ":includes",
1065 ":libGLESv2_static",
1066 ]
1067}
1068
1069angle_static_library("libEGL_with_capture_static") {
1070 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -05001071
Jamie Madill80ab03c2017-01-03 11:03:23 -05001072 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -05001073 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -05001074 ":library_name_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001075 ]
1076
Jamie Madill7098cff2019-01-15 18:33:42 -05001077 public_configs += [ ":angle_static" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001078
1079 deps = [
1080 ":includes",
Manh Nguyendce37b72020-06-21 22:27:06 -04001081 ":libGLESv2_with_capture_static",
Jamie Madill80ab03c2017-01-03 11:03:23 -05001082 ]
1083}
1084
Ken Russellfcadd082017-06-28 14:01:15 -07001085# Convenience targets for some of the samples so they can be built
1086# with Chromium's toolchain.
Jamie Madill7098cff2019-01-15 18:33:42 -05001087angle_executable("angle_shader_translator") {
Ken Russellfcadd082017-06-28 14:01:15 -07001088 testonly = true
1089
Julien Isorce5641d192020-02-04 21:31:47 -08001090 sources = [ "samples/shader_translator/shader_translator.cpp" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001091
Julien Isorce5641d192020-02-04 21:31:47 -08001092 deps = [ ":translator" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001093}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001094
Jamie Madill1ba72542019-10-04 15:17:49 -04001095if (angle_has_build) {
1096 config("angle_feature_support_config") {
1097 include_dirs = [
1098 "include",
1099 "src",
1100 ]
1101 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1102 if (is_debug) {
1103 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
1104 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001105 }
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001106
Jamie Madill1ba72542019-10-04 15:17:49 -04001107 angle_shared_library("libfeature_support") {
1108 output_name = "libfeature_support${angle_libs_suffix}"
Ian Elliotta9d579e2018-11-28 11:44:48 -07001109
Jamie Madill1ba72542019-10-04 15:17:49 -04001110 if (is_android) {
1111 libs = [ "log" ]
1112 }
1113
1114 public_configs += [
1115 ":angle_feature_support_config",
1116 "${angle_jsoncpp_dir}:jsoncpp_config",
1117 ]
1118
1119 if (is_mac && !is_component_build) {
1120 ldflags = [
1121 "-install_name",
1122 "@rpath/${target_name}.dylib",
1123 ]
1124 }
1125
1126 sources = [
1127 "src/feature_support_util/feature_support_util.cpp",
1128 "src/feature_support_util/feature_support_util.h",
1129 ]
1130
1131 deps = [
1132 ":angle_gpu_info_util",
1133 "${angle_jsoncpp_dir}:jsoncpp",
Cezary Kulakowski4fb738f2019-02-01 10:53:44 +01001134 ]
1135 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001136}
1137
Jamie Madill1f56ed22019-01-03 15:24:22 -05001138if (!is_component_build && is_android && symbol_level != 0) {
1139 action_foreach("compressed_symbols") {
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001140 sources = []
1141 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001142 sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001143 }
1144 if (angle_enable_vulkan_validation_layers) {
1145 foreach(_layer, vulkan_validation_layers) {
Jamie Madill77c84962019-06-28 11:24:27 -04001146 sources += [ "$root_out_dir/lib${_layer}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001147 }
1148 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001149
1150 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1151 root_build_dir)
1152
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001153 deps = []
1154 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001155 deps += [ ":$_library" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001156 }
1157
1158 if (angle_enable_vulkan_validation_layers) {
1159 foreach(_layer, vulkan_validation_layers) {
Tobin Ehlisf22f16d2019-07-18 15:10:49 -06001160 deps += [
1161 "${angle_root}/third_party/vulkan-validation-layers/src:${_layer}",
1162 ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001163 }
1164 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001165
Julien Isorce5641d192020-02-04 21:31:47 -08001166 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
Jamie Madill1f56ed22019-01-03 15:24:22 -05001167
1168 android_nm = "${android_tool_prefix}nm"
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001169 android_strip = "${android_tool_prefix}strip"
Jamie Madill1f56ed22019-01-03 15:24:22 -05001170
1171 args = [
1172 "--objcopy",
1173 rebase_path(android_objcopy, root_build_dir),
1174 "--nm",
1175 rebase_path(android_nm, root_build_dir),
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001176 "--strip",
1177 rebase_path(android_strip, root_build_dir),
Jamie Madill1f56ed22019-01-03 15:24:22 -05001178 "--unstrippedsofile",
1179 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1180 "--output",
1181 "{{source_dir}}/lib.compressed/{{source_file_part}}",
1182 ]
1183 }
1184}
1185
Geoff Lang6e687af2019-10-17 14:36:41 -04001186if (build_with_chromium && !is_component_build && is_android &&
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -07001187 current_toolchain == default_toolchain) {
Cody Northrop8cbd3212019-04-23 13:25:20 -06001188 # Package ANGLE libraries
1189 angle_apk("angle_chromium_apk") {
Tobin Ehlis736c43a2020-08-31 10:23:27 -06001190 package_name = "org.chromium.angle"
Tim Van Pattenee4fa072019-02-21 19:21:09 +00001191 apk_name = "AngleLibraries"
Jamie Madill7bed2a52020-09-22 23:37:54 -04001192 version_name = "ANGLE Developer Build"
1193
1194 if (angle_enable_commit_id) {
1195 version_code =
1196 exec_script("src/commit_id.py", [ "position" ], "trim string")
1197 } else {
1198 version_code = "0"
1199 }
Cody Northrop8e636442018-11-30 16:24:11 -07001200 }
1201
1202 group("angle_apks") {
Julien Isorce5641d192020-02-04 21:31:47 -08001203 deps = [ ":angle_chromium_apk" ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001204 }
1205}
Jamie Madill1ba72542019-10-04 15:17:49 -04001206
Jamie Madill1ba72542019-10-04 15:17:49 -04001207group("angle") {
1208 data_deps = [
Julien Isorce5641d192020-02-04 21:31:47 -08001209 ":libEGL",
Jamie Madille3c25712019-12-03 14:08:36 -05001210 ":libGLESv1_CM",
Jamie Madill1ba72542019-10-04 15:17:49 -04001211 ":libGLESv2",
Jamie Madill1ba72542019-10-04 15:17:49 -04001212 ]
1213}