blob: ee9bd397a65ede02953d5ec8cca0a7b6a5a0059d [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.
22 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
Ethan Leed22b8be2019-11-15 12:26:39 -050023 (angle_use_x11 || use_ozone)
Frank Henigmane42ec182017-12-11 23:58:53 -050024
25 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
26 angle_link_glx = false
Jamie Madilleb1b1642019-07-30 17:22:17 -040027
28 # Defaults to capture building to $root_out_dir/angle_libs/with_capture.
29 # Switch on to build capture to $root_out_dir.
30 angle_with_capture_by_default = false
Austin Kinross11dc1632019-09-18 14:46:23 -070031
32 # Don't build extra (test, samples etc) for Windows UWP. We don't have
33 # infrastructure (e.g. windowing helper functions) in place to run them.
Jamie Madille3c25712019-12-03 14:08:36 -050034 angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build
Geoff Lange8883562020-03-06 09:32:18 -050035
36 # Enable generating current commit information using git
37 angle_enable_commit_id = true
Corentin Wallez16d4e472017-03-20 13:06:19 -040038}
39
Jamie Madille3c25712019-12-03 14:08:36 -050040if (angle_build_all) {
Frank Henigmand0ef13a2017-08-28 22:53:24 -040041 group("all") {
42 testonly = true
43 deps = [
Jamie Madille3c25712019-12-03 14:08:36 -050044 ":angle",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040045 ":angle_shader_translator",
46 ":translator_fuzzer",
Jamie Madill238c19e2019-02-07 09:09:41 -050047 ":xxhash_fuzzer",
Jamie Madille3c25712019-12-03 14:08:36 -050048 "$angle_root/samples:angle_samples",
49 "$angle_root/src/tests:angle_tests",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040050 ]
51 }
52}
53
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040054if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040055 pkg_config("libdrm") {
56 packages = [ "libdrm" ]
57 }
Frank Henigman77df6762016-06-13 16:39:01 -040058}
59
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000060import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060061import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070062
Brett Wilson2f5469c2014-07-22 17:00:17 -070063# This config is exported to dependent targets (and also applied to internal
64# ones).
65config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050066 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070067}
68
Jamie Madill4638dc92018-12-17 13:13:49 -050069# Prevent the GL headers from redeclaring ANGLE entry points.
70config("no_gl_prototypes") {
71 defines = [
72 "GL_GLES_PROTOTYPES=0",
73 "EGL_EGL_PROTOTYPES=0",
74 ]
75}
76
77config("gl_prototypes") {
78 defines = [
79 "GL_GLES_PROTOTYPES=1",
80 "EGL_EGL_PROTOTYPES=1",
81 "GL_GLEXT_PROTOTYPES",
82 "EGL_EGLEXT_PROTOTYPES",
83 ]
84}
85
Jamie Madill72f5b5e2014-06-23 15:13:02 -040086# This config is applied to internal Angle targets (not pushed to dependents).
87config("internal_config") {
88 include_dirs = [
89 "include",
90 "src",
91 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050092
Jamie Madill4638dc92018-12-17 13:13:49 -050093 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -040094
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060095 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040096 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060097 } else {
98 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -040099 }
Geoff Langb02fc662018-08-21 09:48:01 -0400100
Tobin Ehlis573f76b2018-05-03 11:10:44 -0600101 if (angle_enable_trace) {
102 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
103 }
Tobin Ehlis93121f32019-10-17 08:18:16 -0600104
105 if (is_chromeos) {
106 defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
107 }
Ethan Leefcef6dc2020-01-24 22:41:35 -0500108
109 if (is_ggp) {
110 defines += [ "__ggp__" ]
111 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400112}
113
Jamie Madilla9f11bf2019-10-21 08:39:14 -0400114config("constructor_and_destructor_warnings") {
115 if (is_clang) {
116 cflags = [
117 "-Wexit-time-destructors",
118 "-Wglobal-constructors",
119 ]
120 }
121}
122
Jamie Madill509a1d42016-07-18 10:10:29 -0400123config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -0400124 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400125
Jamie Madill509a1d42016-07-18 10:10:29 -0400126 # Enable more default warnings on Windows.
127 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -0400128 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -0400129 "/we4244", # Conversion: possible loss of data.
130 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -0400131 "/we4458", # declaration hides class member.
Ben Wagner1e064012019-04-12 14:10:17 -0400132 "/we4715", # not all control paths return a value
Geoff Langb9440532017-11-28 13:26:34 -0500133 "/we4800", # forcing value to bool.
134 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400135 ]
136 }
Ben Wagner211bff32017-10-10 23:53:20 -0400137 if (is_clang) {
Michael Spang229fc832019-01-21 18:09:15 -0500138 cflags += [
Jamie Madill155947f2019-10-24 12:55:11 -0400139 "-Wconditional-uninitialized",
Jamie Madill44a0e732019-09-02 13:55:59 -0400140 "-Wextra-semi-stmt",
Jiacheng Lu73e5e9b2019-07-22 15:26:17 -0600141 "-Wfloat-conversion",
Jamie Madill16370a62019-10-24 12:55:11 -0400142 "-Winconsistent-missing-destructor-override",
Jamie Madilla6206852019-10-24 12:55:09 -0400143 "-Wmissing-field-initializers",
Olli Etuaho8073a952018-05-09 16:41:39 +0300144 "-Wnon-virtual-dtor",
Jamie Madill68945f12019-10-24 12:55:09 -0400145 "-Wredundant-parens",
Jamie Madill859ca032019-10-24 12:55:08 -0400146 "-Wshadow-field",
Jamie Madillfd58d222019-10-24 12:55:07 -0400147 "-Wtautological-type-limit-compare",
Jamie Madillc017cee2019-10-24 12:55:10 -0400148 "-Wundefined-reinterpret-cast",
Jamie Madillc09ae152019-02-01 14:16:32 -0500149 "-Wunneeded-internal-declaration",
James Darpinianefa898a2019-08-07 17:05:35 -0700150
151 # The below warnings are used by WebKit. We enable them to make rolling
152 # ANGLE in WebKit easier.
153 "-Wparentheses",
154 "-Wrange-loop-analysis",
155 "-Wstrict-prototypes",
156 "-Wunreachable-code",
James Darpinian7e48c9e2019-08-06 17:17:19 -0700157 "-Wshorten-64-to-32",
Nico Weber79de62c2018-01-31 10:47:14 -0500158 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400159 }
Austin Kinross11dc1632019-09-18 14:46:23 -0700160
161 if (angle_is_winuwp) {
162 cflags += [ "/wd4447" ] # 'main' signature found without threading model.
163 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400164}
165
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600166# This config adds build-ids to the associated library.
167# -Wl is a special option that indicates that clang should pass the associated
168# option --build-id to the linker. This will cause a build-id section to be added
169# to the associated library. The build-id makes it possible for a debugger to
170# find the right symbol file to use.
171config("build_id_config") {
172 ldflags = [ "-Wl,--build-id" ]
173}
174
Jamie Madill20d380f2019-06-03 15:21:47 -0400175# Useful for more informative stack traces.
176config("better_linux_stack_traces") {
177 if (angle_better_stack_traces) {
178 ldflags = [ "-Wl,--export-dynamic" ]
179 }
180}
181
Jamie Madill1ba72542019-10-04 15:17:49 -0400182_use_copy_compiler_dll = angle_has_build && is_win && target_cpu != "arm64"
183
Tom Tan5c317532018-11-30 17:01:01 -0800184# Windows ARM64 is available since 10.0.16299 so no need to copy
185# d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400186if (_use_copy_compiler_dll) {
Jamie Madilld09546e2019-02-22 10:24:44 -0500187 # We also ship an older DLL for compatiblity with Windows 7 machines without
188 # the UCRT. This DLL isn't available in the standard SDK distribution.
189 _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
190 _has_old_compiler =
191 exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
192
Daniel Bratell73941de2015-02-25 14:34:49 +0100193 copy("copy_compiler_dll") {
Julien Isorce5641d192020-02-04 21:31:47 -0800194 sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
Jamie Madilld09546e2019-02-22 10:24:44 -0500195
196 if (_has_old_compiler) {
197 sources += [ _old_compiler ]
198 }
199
Julien Isorce5641d192020-02-04 21:31:47 -0800200 outputs = [ "$root_out_dir/{{source_file_part}}" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100201 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100202}
203
Jamie Madill55959b02019-03-05 10:07:41 -0500204# Holds the shared includes so we only need to list them once.
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500205config("includes_config") {
206 include_dirs = [ "include" ]
207}
208
Jamie Madill7098cff2019-01-15 18:33:42 -0500209angle_source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400210 sources = libangle_includes
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500211 public_configs = [ ":includes_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400212}
213
Jamie Madill7098cff2019-01-15 18:33:42 -0500214angle_static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400215 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400216
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400217 public_deps = [
218 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400219 ":angle_translator_headers",
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400220 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400221}
222
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500223config("angle_disable_pool_alloc") {
224 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400225}
226
Cooper Partin75da1972015-06-16 15:03:14 -0700227config("debug_annotations_config") {
Corentin Wallez105bc9d2019-03-06 16:32:40 +0000228 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500229 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700230 }
231}
232
Jamie Madille31fd872016-05-27 08:35:36 -0400233config("angle_release_asserts_config") {
234 if (dcheck_always_on) {
235 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
236 }
237}
238
Jamie Madille2e406c2016-06-02 13:04:10 -0400239config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400240 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500241 if (is_android) {
242 libs = [ "log" ]
243 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400244}
245
Jamie Madill7098cff2019-01-15 18:33:42 -0500246angle_source_set("angle_system_utils") {
Jamie Madill4638dc92018-12-17 13:13:49 -0500247 sources = angle_system_utils_sources
Jamie Madill4638dc92018-12-17 13:13:49 -0500248}
249
Jamie Madillc09ae152019-02-01 14:16:32 -0500250angle_source_set("xxhash") {
251 sources = xxhash_sources
Jamie Madillc09ae152019-02-01 14:16:32 -0500252}
253
Jamie Madill1ba72542019-10-04 15:17:49 -0400254if (angle_has_build) {
255 fuzzer_test("xxhash_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800256 sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
257 deps = [ ":xxhash" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400258 }
Jamie Madill238c19e2019-02-07 09:09:41 -0500259}
260
Jamie Madill7098cff2019-01-15 18:33:42 -0500261angle_static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400262 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700263
Jamie Madill562e81b2015-01-14 14:31:02 -0500264 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400265 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700266 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500267 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400268
Julien Isorce5641d192020-02-04 21:31:47 -0800269 deps = [ ":xxhash" ]
Jamie Madillc09ae152019-02-01 14:16:32 -0500270
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400271 public_deps = [
Jamie Madill4638dc92018-12-17 13:13:49 -0500272 ":angle_system_utils",
273 ":angle_version",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500274 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400275 ]
Jamie Madill7098cff2019-01-15 18:33:42 -0500276 public_configs += [ ":angle_common_config" ]
Jamie Madill1ba72542019-10-04 15:17:49 -0400277 if (angle_has_build && use_fuzzing_engine) {
Jamie Madill48aa52f2019-10-17 07:56:53 -0400278 all_dependent_configs = [ ":angle_disable_pool_alloc" ]
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500279 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500280}
281
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400282config("angle_image_util_config") {
283 include_dirs = [
284 "include",
285 "src",
286 ]
287}
288
Jamie Madill1f08ab22019-10-03 16:22:52 -0400289angle_source_set("angle_image_util_headers") {
290 sources = libangle_image_util_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800291 public_deps = [ ":angle_common" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400292}
293
Jamie Madill7098cff2019-01-15 18:33:42 -0500294angle_static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400295 sources = libangle_image_util_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500296 public_configs += [ ":angle_image_util_config" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800297 public_deps = [ ":angle_image_util_headers" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400298}
299
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600300config("angle_gl_visibility_config") {
301 if (is_win) {
302 defines = [
303 "GL_APICALL=",
304 "GL_API=",
305 ]
306 } else {
307 defines = [
308 "GL_APICALL=__attribute__((visibility(\"default\")))",
309 "GL_API=__attribute__((visibility(\"default\")))",
310 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600311 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600312}
313
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500314config("angle_gpu_info_util_config") {
315 include_dirs = [
316 "include",
317 "src",
318 ]
319}
320
Jamie Madill7098cff2019-01-15 18:33:42 -0500321angle_static_library("angle_gpu_info_util") {
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400322 public_configs += [
323 ":angle_gpu_info_util_config",
324 ":angle_backend_config",
325 ]
Julien Isorce5641d192020-02-04 21:31:47 -0800326 public_deps = [ ":angle_common" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400327 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500328 deps = []
329 libs = []
330 defines = []
331
Michael Spangb630bf92020-01-24 17:27:01 -0500332 if (is_android || is_fuchsia) {
333 sources += libangle_gpu_info_util_vulkan_sources
Geoff Langdd90f5a2020-04-07 12:59:23 -0400334 deps += [ "$angle_root/third_party/vulkan-headers/src:vulkan_headers" ]
Michael Spangb630bf92020-01-24 17:27:01 -0500335 }
336
Ian Elliottd07c52e2018-06-22 15:42:09 -0600337 if (is_android) {
Michael Spangb630bf92020-01-24 17:27:01 -0500338 sources += libangle_gpu_info_util_android_sources
339 }
340
341 if (is_fuchsia) {
342 sources += libangle_gpu_info_util_fuchsia_sources
343 deps +=
344 [ "$angle_root/src/libANGLE/renderer/vulkan:angle_vulkan_entry_points" ]
Ian Elliottd07c52e2018-06-22 15:42:09 -0600345 }
346
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700347 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400348 sources += libangle_gpu_info_util_win_sources
Austin Kinross11dc1632019-09-18 14:46:23 -0700349 if (!angle_is_winuwp) {
350 libs += [ "setupapi.lib" ]
351 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400352 libs += [ "dxgi.lib" ]
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700353 }
354
Michael Spangb630bf92020-01-24 17:27:01 -0500355 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400356 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500357
Ethan Leed22b8be2019-11-15 12:26:39 -0500358 if (angle_use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400359 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500360 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
361 defines += [ "GPU_INFO_USE_X11" ]
362 libs += [
363 "X11",
364 "Xi",
365 "Xext",
366 ]
367 }
368 }
369
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500370 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400371 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500372 defines += [ "GPU_INFO_USE_LIBPCI" ]
373 libs += [ "pci" ]
374 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500375
376 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400377 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500378 libs += [
379 "IOKit.framework",
380 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400381 "CoreGraphics.framework",
Daksh Idnani5ec04882019-08-22 21:12:08 +0000382 "OpenGL.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500383 ]
384 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500385}
386
Jamie Madill1f08ab22019-10-03 16:22:52 -0400387angle_source_set("angle_translator_headers") {
388 sources = angle_translator_exported_headers
Julien Isorce5641d192020-02-04 21:31:47 -0800389 public_deps = [ ":includes" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400390}
391
Jamie Madill7098cff2019-01-15 18:33:42 -0500392angle_static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400393 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800394 defines = []
395
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700396 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400397 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800398 defines += [ "ANGLE_ENABLE_ESSL" ]
399 }
400
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700401 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400402 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800403 defines += [ "ANGLE_ENABLE_GLSL" ]
404 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400405
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700406 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400407 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800408 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100409 }
Jamie Madille794cd82017-01-13 17:29:51 -0500410
Le Quyend200a772019-10-10 00:44:01 +0800411 if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
412 # This translator is needed by metal backend also.
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400413 sources += angle_translator_lib_vulkan_sources
Le Quyend200a772019-10-10 00:44:01 +0800414 }
415
416 if (angle_enable_vulkan || use_fuzzing_engine) {
Jamie Madille794cd82017-01-13 17:29:51 -0500417 defines += [ "ANGLE_ENABLE_VULKAN" ]
418 }
419
Le Quyend200a772019-10-10 00:44:01 +0800420 if (angle_enable_metal) {
421 sources += angle_translator_lib_metal_sources
422 defines += [ "ANGLE_ENABLE_METAL" ]
423 }
424
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600425 if (angle_enable_swiftshader) {
426 defines += [ "ANGLE_ENABLE_SWIFTSHADER" ]
427 }
428
Jamie Madill7098cff2019-01-15 18:33:42 -0500429 public_configs += [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400430
431 deps = [
432 ":includes",
433 ":preprocessor",
434 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500435
436 public_deps = [
437 ":angle_common",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400438 ":angle_translator_headers",
Jamie Madill562e81b2015-01-14 14:31:02 -0500439 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400440
441 if (is_win) {
442 # Necessary to suppress some system header xtree warnigns in Release.
443 # For some reason this warning doesn't get triggered in Chromium
444 cflags = [ "/wd4718" ]
445 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400446}
447
Jamie Madill7098cff2019-01-15 18:33:42 -0500448angle_source_set("translator_fuzzer") {
Julien Isorce5641d192020-02-04 21:31:47 -0800449 sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700450
451 include_dirs = [
452 "include",
453 "src",
454 ]
455
Julien Isorce5641d192020-02-04 21:31:47 -0800456 deps = [ ":translator" ]
Corentin Wallez28b65282016-06-16 07:24:50 -0700457}
458
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400459config("commit_id_config") {
460 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500461 visibility = [ ":commit_id" ]
462}
463
Geoff Langba8ef682020-02-24 14:13:40 -0500464commit_id_output_file = "$root_gen_dir/angle/commit.h"
465action("commit_id") {
466 script = "src/commit_id.py"
467 outputs = [ commit_id_output_file ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400468
Geoff Langba8ef682020-02-24 14:13:40 -0500469 # Add git as a dependency if it is available.
Geoff Lang20c69732020-03-06 11:02:31 -0500470 if (angle_enable_commit_id &&
471 exec_script("src/commit_id.py", [ "check" ], "value") == 1) {
Geoff Langdd19d552020-03-02 09:41:22 -0500472 # commit id should depend on angle's HEAD revision
473 inputs = [ ".git/HEAD" ]
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200474 }
Geoff Langba8ef682020-02-24 14:13:40 -0500475
476 args = [
477 "gen",
478 rebase_path(commit_id_output_file, root_build_dir),
479 ]
480
481 public_configs = [ ":commit_id_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400482}
483
Jamie Madill7098cff2019-01-15 18:33:42 -0500484angle_source_set("angle_version") {
Julien Isorce5641d192020-02-04 21:31:47 -0800485 sources = [ "src/common/version.h" ]
486 public_deps = [ ":commit_id" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500487}
488
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400489config("angle_backend_config") {
Jamie Madill562e81b2015-01-14 14:31:02 -0500490 defines = []
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400491
Jamie Madill562e81b2015-01-14 14:31:02 -0500492 if (angle_enable_d3d9) {
493 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500494 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500495 if (angle_enable_d3d11) {
496 defines += [ "ANGLE_ENABLE_D3D11" ]
497 }
Geoff Langc588ac72015-02-13 15:41:41 -0500498 if (angle_enable_gl) {
499 defines += [ "ANGLE_ENABLE_OPENGL" ]
Jamie Madill6d94f062017-10-21 22:19:40 -0400500 if (angle_enable_gl_null) {
501 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
502 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400503 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400504 if (angle_enable_null) {
505 defines += [ "ANGLE_ENABLE_NULL" ]
506 }
Jamie Madill1f08ab22019-10-03 16:22:52 -0400507
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600508 configs = []
509
Le Quyend200a772019-10-10 00:44:01 +0800510 if (angle_enable_metal) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600511 configs += [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
Le Quyend200a772019-10-10 00:44:01 +0800512 }
513
Jamie Madill1f08ab22019-10-03 16:22:52 -0400514 if (angle_enable_vulkan) {
Jonah Ryan-Davis5afd5ec2019-10-25 10:53:40 -0600515 configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
Jamie Madill1f08ab22019-10-03 16:22:52 -0400516 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400517}
518
519config("libANGLE_config") {
520 cflags = []
521 defines = []
522 libs = []
523 ldflags = []
524 if (angle_enable_d3d9) {
525 ldflags += [ "/DELAYLOAD:d3d9.dll" ]
526 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500527 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400528
529 if (is_win) {
Julien Isorce5641d192020-02-04 21:31:47 -0800530 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
531 # are not enabled.
Austin Kinross40853472015-02-12 10:39:56 -0800532 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500533
534 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
Yuly Novikov8edc68e2019-02-12 12:41:01 -0500535 # In API level 26 ANativeWindow APIs were moved from libandroid.so
536 # into a separate library, libnativewindow.so
537 if (ndk_api_level_at_least_26) {
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500538 libs += [ "nativewindow" ]
539 } else {
540 libs += [ "android" ]
541 }
542 }
Michael Spang7cd5f642019-08-21 20:03:49 -0400543
Ethan Leed22b8be2019-11-15 12:26:39 -0500544 if (angle_use_x11) {
Michael Spang7cd5f642019-08-21 20:03:49 -0400545 defines += [ "ANGLE_USE_X11" ]
546 }
Jamie Madillaf5e3822020-01-28 10:05:36 -0500547
548 if (angle_enable_overlay) {
549 defines += [ "ANGLE_ENABLE_OVERLAY=1" ]
550 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500551}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500552
Jamie Madill1f08ab22019-10-03 16:22:52 -0400553angle_source_set("libANGLE_headers") {
554 sources = libangle_headers
555 public_deps = [
556 ":angle_common",
557 ":angle_translator_headers",
558 ]
Jamie Madillaf5e3822020-01-28 10:05:36 -0500559 public_configs += [ ":libANGLE_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500560}
561
Jamie Madill2f718022019-10-28 11:48:46 -0400562# Don't even try to build glslang if Metal and Vulkan are disabled.
563if (angle_enable_vulkan || angle_enable_metal) {
564 angle_source_set("angle_glslang_wrapper") {
565 sources = [
566 "src/libANGLE/renderer/glslang_wrapper_utils.cpp",
567 "src/libANGLE/renderer/glslang_wrapper_utils.h",
568 ]
569 deps = [
570 ":libANGLE_headers",
571 "${angle_glslang_dir}:glslang_default_resource_limits_sources",
572 "${angle_glslang_dir}:glslang_sources",
Shahbaz Youssefi71e6afb2020-01-14 14:12:31 -0500573 "${angle_spirv_headers_dir}:spv_headers",
574 "${angle_spirv_tools_dir}:spvtools_headers",
Jamie Madill2f718022019-10-28 11:48:46 -0400575 ]
576 }
Le Quyena48f95a2019-10-14 14:49:49 +0800577}
578
Jamie Madilleb1b1642019-07-30 17:22:17 -0400579angle_source_set("libANGLE_base") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400580 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500581
Jamie Madill5ea762a2017-06-07 14:59:51 -0400582 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500583 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500584 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500585 if (angle_link_glx) {
586 libs += [ "GL" ]
587 defines += [ "ANGLE_LINK_GLX" ]
588 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400589 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500590 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500591 ":angle_gpu_info_util",
Jamie Madill4638dc92018-12-17 13:13:49 -0500592 ":angle_version",
Jamie Madill1f08ab22019-10-03 16:22:52 -0400593 ":libANGLE_headers",
Jamie Madill720ca442018-12-17 14:04:10 -0500594 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400595 ]
596 deps = [
Corentin Wallez878baf92017-02-15 13:57:16 -0500597 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500598 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500599 ]
600
Jamie Madille55374f2019-10-24 12:55:12 -0400601 if (is_win) {
Ethan Leed83dc172019-11-20 01:50:36 -0500602 if (angle_enable_d3d9) {
603 libs += [ "delayimp.lib" ]
604 }
Jamie Madille55374f2019-10-24 12:55:12 -0400605 libs += [
Jamie Madille55374f2019-10-24 12:55:12 -0400606 "gdi32.lib",
607 "user32.lib",
608 ]
609 }
610
Jamie Madill1f08ab22019-10-03 16:22:52 -0400611 if (angle_enable_vulkan) {
612 public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
613 }
614
Le Quyend200a772019-10-10 00:44:01 +0800615 if (angle_enable_metal) {
616 public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
617 }
618
Jamie Madillab2bfa82019-01-15 19:06:47 -0500619 # Enable extra Chromium style warnings for libANGLE.
Jamie Madill299b1ba2019-10-24 09:29:18 -0400620 if (is_clang && angle_has_build) {
Jamie Madillab2bfa82019-01-15 19:06:47 -0500621 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
622 }
623
Jamie Madill562e81b2015-01-14 14:31:02 -0500624 # Shared D3D sources.
625 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400626 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400627
Jamie Madilledbc2442016-01-04 11:25:00 -0500628 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500629 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500630
Jamie Madill562e81b2015-01-14 14:31:02 -0500631 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400632 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500633 libs += [ "d3d9.lib" ]
634 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400635
Jamie Madill562e81b2015-01-14 14:31:02 -0500636 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400637 sources += libangle_d3d11_sources
Austin Kinross11dc1632019-09-18 14:46:23 -0700638
639 if (angle_is_winuwp) {
640 sources += libangle_d3d11_winuwp_sources
641 } else {
642 sources += libangle_d3d11_win32_sources
643 }
644
Austin Kinross91e71ed2016-08-23 09:29:22 -0700645 libs += [ "dxguid.lib" ]
Brandon Jonesb77884b2018-10-10 09:07:12 -0700646 import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni")
647 sources += libangle_d3d11_blit_shaders
Jamie Madill562e81b2015-01-14 14:31:02 -0500648 }
649
Geoff Langc588ac72015-02-13 15:41:41 -0500650 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400651 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500652 include_dirs += [ "src/third_party/khronos" ]
653
Jamie Madill6d94f062017-10-21 22:19:40 -0400654 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400655 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400656 }
Geoff Langc588ac72015-02-13 15:41:41 -0500657 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400658 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500659 }
Ethan Leed22b8be2019-11-15 12:26:39 -0500660 if (angle_use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400661 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400662 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500663 libs += [
664 "X11",
665 "Xi",
666 "Xext",
667 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400668 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400669 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400670 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400671 libs += [
672 "Cocoa.framework",
673 "IOSurface.framework",
674 "OpenGL.framework",
675 "QuartzCore.framework",
676 ]
677 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400678 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400679 sources += libangle_gl_egl_sources
680 sources += libangle_gl_egl_dl_sources
681 sources += libangle_gl_egl_android_sources
Yuly Novikova6426d62016-06-03 00:18:38 -0400682 }
Julien Isorce5641d192020-02-04 21:31:47 -0800683 if (is_linux) {
684 sources += libangle_gl_egl_sources
685 sources += libangle_gl_egl_dl_sources
686 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400687 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400688 configs += [ ":libdrm" ]
689 defines += [ "ANGLE_USE_OZONE" ]
690 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400691 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400692 }
Geoff Langc588ac72015-02-13 15:41:41 -0500693 }
694
Geoff Langd08f3b32016-09-23 15:56:30 -0400695 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400696 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400697 }
698
Geoff Langecd2e3b2019-07-09 15:39:39 -0400699 if (is_mac) {
700 sources += libangle_mac_sources
701 }
702
Jamie Madill562e81b2015-01-14 14:31:02 -0500703 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500704 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400705 }
706
Jamie Madill7098cff2019-01-15 18:33:42 -0500707 configs += [ ":debug_annotations_config" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400708 public_configs += [
709 ":libANGLE_config",
710 ":angle_backend_config",
711 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500712
Tom Tan5c317532018-11-30 17:01:01 -0800713 # Windows ARM64 is available since 10.0.16299 so no need to copy
714 # d3dcompiler_47.dll because this file is available as inbox.
Jamie Madill1ba72542019-10-04 15:17:49 -0400715 if (_use_copy_compiler_dll) {
Julien Isorce5641d192020-02-04 21:31:47 -0800716 data_deps = [ ":copy_compiler_dll" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500717 }
718}
719
Jamie Madilleb1b1642019-07-30 17:22:17 -0400720config("angle_frame_capture_disabled") {
721 defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
722}
723
724config("angle_frame_capture_enabled") {
725 defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
726}
727
728angle_source_set("libANGLE") {
Julien Isorce5641d192020-02-04 21:31:47 -0800729 public_deps = [ ":libANGLE_base" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400730 public_configs = [ ":angle_frame_capture_disabled" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800731 sources = [ "src/libANGLE/FrameCapture_mock.cpp" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600732
733 # gl_enum_utils defaults included in with_capture build
Brandon Schade5cfab192019-10-28 09:12:53 -0700734 deps = []
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600735 if (angle_enable_trace || is_debug) {
Brandon Schade5cfab192019-10-28 09:12:53 -0700736 deps += [ ":angle_gl_enum_utils" ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600737 }
Jamie Madilleb1b1642019-07-30 17:22:17 -0400738}
739
Brandon Schade5cfab192019-10-28 09:12:53 -0700740angle_source_set("angle_gl_enum_utils") {
Julien Isorce5641d192020-02-04 21:31:47 -0800741 public_deps = [ ":libANGLE_base" ]
Brandon Schade5cfab192019-10-28 09:12:53 -0700742 sources = [
743 "src/libANGLE/gl_enum_utils.cpp",
744 "src/libANGLE/gl_enum_utils_autogen.cpp",
745 ]
746}
747
Jamie Madill7e453a22020-03-15 22:11:03 -0400748config("angle_compression_config") {
749 include_dirs = [ "//third_party/zlib/google" ]
750}
751
752group("angle_compression") {
753 public_configs = [
754 ":angle_compression_config",
755 "//third_party/zlib:zlib_config",
756 ]
757 public_deps = [ "//third_party/zlib/google:compression_utils_portable" ]
758}
759
Jamie Madill612b7412019-07-05 11:13:30 -0400760angle_source_set("libANGLE_with_capture") {
Julien Isorce5641d192020-02-04 21:31:47 -0800761 public_deps = [ ":libANGLE_base" ]
Jamie Madill7e453a22020-03-15 22:11:03 -0400762 deps = [ ":angle_compression" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400763 public_configs = [ ":angle_frame_capture_enabled" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400764 sources = libangle_capture_sources
765}
766
Robert Sesekdb8ae832016-06-21 11:47:03 -0400767config("shared_library_public_config") {
768 if (is_mac && !is_component_build) {
769 # Executable targets that depend on the shared libraries below need to have
770 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400771 ldflags = [
772 "-rpath",
773 "@executable_path/",
774 ]
Jonah Ryan-Davis90a8af32020-03-05 13:48:47 -0500775 if (build_with_chromium) {
776 ldflags += [
777 # Path for loading shared libraries for unbundled binaries.
778 # From //build/config/mac/BUILD.gn, this is only added for
779 # component builds. However, since ANGLE always dynamically
780 # links to libvulkan, it should be re-added for non-component
781 # builds. (anglebug.com/4455)
782 "-Wl,-rpath,@loader_path/.",
783 ]
784 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400785 }
Josh Matthews732c9d02019-11-29 13:59:03 -0500786
787 if (angle_is_winuwp) {
788 ldflags = [
789 "/APPCONTAINER",
790
791 # Disable warning about invalid subsystem number.
792 # A default appropriate subsystem is selected automatically.
793 "/IGNORE:4010",
794 ]
795 }
Robert Sesekdb8ae832016-06-21 11:47:03 -0400796}
797
Jamie Madill4638dc92018-12-17 13:13:49 -0500798config("library_name_config") {
Yuly Novikov8b8dc562020-02-26 19:09:31 -0500799 if (is_component_build && is_android) {
800 defines = [
801 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"",
802 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"",
803 ]
804 } else {
805 defines = [
806 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
807 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
808 ]
809 }
Jamie Madill4638dc92018-12-17 13:13:49 -0500810}
811
Jamie Madill80ab03c2017-01-03 11:03:23 -0500812# This config controls export definitions on ANGLE API calls.
813config("angle_static") {
814 defines = [
815 "ANGLE_EXPORT=",
Jamie Madillba319ba2018-12-29 10:29:33 -0500816 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500817 "EGLAPI=",
818 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500819 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500820 ]
821}
822
Jamie Madilleb1b1642019-07-30 17:22:17 -0400823set_defaults("angle_libGLESv2") {
824 sources = []
825 output_name = "libGLESv2"
826}
827
Jamie Madill612b7412019-07-05 11:13:30 -0400828template("angle_libGLESv2") {
829 angle_shared_library(target_name) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400830 sources = libglesv2_sources + invoker.sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500831
Jamie Madill612b7412019-07-05 11:13:30 -0400832 if (is_win) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400833 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400834 }
835
Jamie Madilleb1b1642019-07-30 17:22:17 -0400836 output_name = "${invoker.output_name}${angle_libs_suffix}"
837
Jamie Madill612b7412019-07-05 11:13:30 -0400838 configs += [
839 ":angle_gl_visibility_config",
840 ":debug_annotations_config",
841 ":gl_prototypes",
842 ]
843
Jamie Madilleb1b1642019-07-30 17:22:17 -0400844 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400845
Jamie Madilleb1b1642019-07-30 17:22:17 -0400846 deps = invoker.deps + [ ":includes" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400847
Julien Isorce5641d192020-02-04 21:31:47 -0800848 public_deps = [ ":angle_version" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500849 }
Jamie Madill612b7412019-07-05 11:13:30 -0400850}
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800851
Jamie Madill612b7412019-07-05 11:13:30 -0400852angle_libGLESv2("libGLESv2") {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400853 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800854 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600855 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800856 deps = [ ":libANGLE" ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400857 }
Jamie Madill612b7412019-07-05 11:13:30 -0400858}
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400859
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600860# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
861angle_libGLESv2("libGLESv2_capture_complement") {
862 if (angle_with_capture_by_default) {
Julien Isorce5641d192020-02-04 21:31:47 -0800863 deps = [ ":libANGLE" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600864 output_name += "_no_capture"
865 } else {
Julien Isorce5641d192020-02-04 21:31:47 -0800866 deps = [ ":libANGLE_with_capture" ]
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600867 output_name += "_with_capture"
Jamie Madilleb1b1642019-07-30 17:22:17 -0400868 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500869}
870
Austin Kinross11dc1632019-09-18 14:46:23 -0700871if (is_win && !angle_is_winuwp) {
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400872 angle_shared_library("libGL") {
873 sources = libgl_sources
Clemen Deng663b0482019-07-11 12:37:35 -0400874
Clemen Deng6e7dd1e2019-07-16 13:41:59 -0400875 output_name = "openGL32"
876 output_dir = "$root_out_dir/angle_libs"
Clemen Deng7558e832019-06-18 13:02:03 -0400877
878 configs += [
879 ":angle_gl_visibility_config",
880 ":debug_annotations_config",
881 ":gl_prototypes",
882 ]
883
Jamie Madill612b7412019-07-05 11:13:30 -0400884 defines = [
885 "ANGLE_CAPTURE_ENABLED=0",
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400886 "LIBGL_IMPLEMENTATION",
Jamie Madill612b7412019-07-05 11:13:30 -0400887 ]
Clemen Deng7558e832019-06-18 13:02:03 -0400888
889 deps = [
890 ":includes",
891 ":libANGLE",
892 ]
893
Julien Isorce5641d192020-02-04 21:31:47 -0800894 public_deps = [ ":angle_version" ]
Clemen Deng7558e832019-06-18 13:02:03 -0400895 }
896}
897
Jamie Madill7098cff2019-01-15 18:33:42 -0500898angle_static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400899 sources = libglesv2_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500900 configs += [ ":debug_annotations_config" ]
901 public_configs += [ ":angle_static" ]
Julien Isorce5641d192020-02-04 21:31:47 -0800902 deps = [ ":includes" ]
903 public_deps = [ ":libANGLE" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500904}
905
Jamie Madill77c84962019-06-28 11:24:27 -0400906angle_shared_library("libGLESv1_CM") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400907 sources = libglesv1_cm_sources
Jamie Madill77c84962019-06-28 11:24:27 -0400908 output_name = "libGLESv1_CM${angle_libs_suffix}"
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500909
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500910 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600911 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500912 ":debug_annotations_config",
Jamie Madillba319ba2018-12-29 10:29:33 -0500913 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500914 ]
915
916 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500917
918 deps = [
919 ":includes",
Jamie Madill77c84962019-06-28 11:24:27 -0400920 ":libGLESv2",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500921 ]
922}
923
Jamie Madill7098cff2019-01-15 18:33:42 -0500924angle_static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400925 sources = libglesv1_cm_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500926 configs += [ ":debug_annotations_config" ]
927 public_configs += [ ":angle_static" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500928 deps = [
929 ":includes",
930 ":libGLESv2_static",
931 ]
932}
933
Jamie Madill4638dc92018-12-17 13:13:49 -0500934config("libEGL_egl_loader_config") {
935 defines = [ "ANGLE_USE_EGL_LOADER" ]
936}
937
Jamie Madill7098cff2019-01-15 18:33:42 -0500938angle_source_set("libEGL_egl_loader") {
Jamie Madill4638dc92018-12-17 13:13:49 -0500939 sources = [
940 "src/libEGL/egl_loader_autogen.cpp",
941 "src/libEGL/egl_loader_autogen.h",
942 ]
943
Jamie Madill7098cff2019-01-15 18:33:42 -0500944 public_configs += [
Jamie Madill4638dc92018-12-17 13:13:49 -0500945 ":libEGL_egl_loader_config",
946 ":gl_prototypes",
Jamie Madill4638dc92018-12-17 13:13:49 -0500947 ]
948
Julien Isorce5641d192020-02-04 21:31:47 -0800949 deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500950}
951
Jamie Madill77c84962019-06-28 11:24:27 -0400952angle_shared_library("libEGL") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400953 sources = libegl_sources
Jamie Madill77c84962019-06-28 11:24:27 -0400954 output_name = "libEGL${angle_libs_suffix}"
Jamie Madill562e81b2015-01-14 14:31:02 -0500955
Jamie Madill562e81b2015-01-14 14:31:02 -0500956 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -0400957 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500958 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500959 ]
960
Jamie Madilledbc2442016-01-04 11:25:00 -0500961 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500962 if (is_win) {
963 defines += [ "EGLAPI=" ]
964 } else {
965 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
966 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500967
Jamie Madill80ab03c2017-01-03 11:03:23 -0500968 if (is_win) {
Nico Weber9db8df42019-01-04 14:47:27 -0500969 sources += [ "src/libEGL/libEGL.def" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500970 }
971
Jamie Madill562e81b2015-01-14 14:31:02 -0500972 deps = [
James Darpinian22ec7dc2019-08-06 10:10:52 -0700973 ":angle_common",
Jamie Madill4638dc92018-12-17 13:13:49 -0500974 ":angle_system_utils",
975 ":angle_version",
976 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -0500977 ]
Jamie Madill720ca442018-12-17 14:04:10 -0500978
Julien Isorce5641d192020-02-04 21:31:47 -0800979 public_deps = [ ":includes" ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500980
Julien Isorce5641d192020-02-04 21:31:47 -0800981 data_deps = [ ":libGLESv2" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500982}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400983
Jamie Madill7098cff2019-01-15 18:33:42 -0500984angle_static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400985 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500986
Jamie Madill80ab03c2017-01-03 11:03:23 -0500987 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500988 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500989 ":library_name_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500990 ]
991
Jamie Madill7098cff2019-01-15 18:33:42 -0500992 public_configs += [ ":angle_static" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500993
994 deps = [
995 ":includes",
996 ":libGLESv2_static",
997 ]
998}
999
Ken Russellfcadd082017-06-28 14:01:15 -07001000# Convenience targets for some of the samples so they can be built
1001# with Chromium's toolchain.
Jamie Madill7098cff2019-01-15 18:33:42 -05001002angle_executable("angle_shader_translator") {
Ken Russellfcadd082017-06-28 14:01:15 -07001003 testonly = true
1004
Julien Isorce5641d192020-02-04 21:31:47 -08001005 sources = [ "samples/shader_translator/shader_translator.cpp" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001006
Julien Isorce5641d192020-02-04 21:31:47 -08001007 deps = [ ":translator" ]
Ken Russellfcadd082017-06-28 14:01:15 -07001008}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001009
Jamie Madill1ba72542019-10-04 15:17:49 -04001010if (angle_has_build) {
1011 config("angle_feature_support_config") {
1012 include_dirs = [
1013 "include",
1014 "src",
1015 ]
1016 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1017 if (is_debug) {
1018 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
1019 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001020 }
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001021
Jamie Madill1ba72542019-10-04 15:17:49 -04001022 angle_shared_library("libfeature_support") {
1023 output_name = "libfeature_support${angle_libs_suffix}"
Ian Elliotta9d579e2018-11-28 11:44:48 -07001024
Jamie Madill1ba72542019-10-04 15:17:49 -04001025 if (is_android) {
1026 libs = [ "log" ]
1027 }
1028
1029 public_configs += [
1030 ":angle_feature_support_config",
1031 "${angle_jsoncpp_dir}:jsoncpp_config",
1032 ]
1033
1034 if (is_mac && !is_component_build) {
1035 ldflags = [
1036 "-install_name",
1037 "@rpath/${target_name}.dylib",
1038 ]
1039 }
1040
1041 sources = [
1042 "src/feature_support_util/feature_support_util.cpp",
1043 "src/feature_support_util/feature_support_util.h",
1044 ]
1045
1046 deps = [
1047 ":angle_gpu_info_util",
1048 "${angle_jsoncpp_dir}:jsoncpp",
Cezary Kulakowski4fb738f2019-02-01 10:53:44 +01001049 ]
1050 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001051}
1052
Jamie Madill1f56ed22019-01-03 15:24:22 -05001053if (!is_component_build && is_android && symbol_level != 0) {
1054 action_foreach("compressed_symbols") {
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001055 sources = []
1056 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001057 sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001058 }
1059 if (angle_enable_vulkan_validation_layers) {
1060 foreach(_layer, vulkan_validation_layers) {
Jamie Madill77c84962019-06-28 11:24:27 -04001061 sources += [ "$root_out_dir/lib${_layer}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001062 }
1063 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001064
1065 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1066 root_build_dir)
1067
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001068 deps = []
1069 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001070 deps += [ ":$_library" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001071 }
1072
1073 if (angle_enable_vulkan_validation_layers) {
1074 foreach(_layer, vulkan_validation_layers) {
Tobin Ehlisf22f16d2019-07-18 15:10:49 -06001075 deps += [
1076 "${angle_root}/third_party/vulkan-validation-layers/src:${_layer}",
1077 ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001078 }
1079 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001080
Julien Isorce5641d192020-02-04 21:31:47 -08001081 outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
Jamie Madill1f56ed22019-01-03 15:24:22 -05001082
1083 android_nm = "${android_tool_prefix}nm"
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001084 android_strip = "${android_tool_prefix}strip"
Jamie Madill1f56ed22019-01-03 15:24:22 -05001085
1086 args = [
1087 "--objcopy",
1088 rebase_path(android_objcopy, root_build_dir),
1089 "--nm",
1090 rebase_path(android_nm, root_build_dir),
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001091 "--strip",
1092 rebase_path(android_strip, root_build_dir),
Jamie Madill1f56ed22019-01-03 15:24:22 -05001093 "--unstrippedsofile",
1094 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1095 "--output",
1096 "{{source_dir}}/lib.compressed/{{source_file_part}}",
1097 ]
1098 }
1099}
1100
Geoff Lang6e687af2019-10-17 14:36:41 -04001101if (build_with_chromium && !is_component_build && is_android &&
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -07001102 current_toolchain == default_toolchain) {
Cody Northrop8cbd3212019-04-23 13:25:20 -06001103 # Package ANGLE libraries
1104 angle_apk("angle_chromium_apk") {
1105 package_name = "com.chromium.angle"
Tim Van Pattenee4fa072019-02-21 19:21:09 +00001106 apk_name = "AngleLibraries"
Cody Northrop8e636442018-11-30 16:24:11 -07001107 }
1108
1109 group("angle_apks") {
Julien Isorce5641d192020-02-04 21:31:47 -08001110 deps = [ ":angle_chromium_apk" ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001111 }
1112}
Jamie Madill1ba72542019-10-04 15:17:49 -04001113
Jamie Madill1ba72542019-10-04 15:17:49 -04001114group("angle") {
1115 data_deps = [
Julien Isorce5641d192020-02-04 21:31:47 -08001116 ":libEGL",
Jamie Madille3c25712019-12-03 14:08:36 -05001117 ":libGLESv1_CM",
Jamie Madill1ba72542019-10-04 15:17:49 -04001118 ":libGLESv2",
Jamie Madill1ba72542019-10-04 15:17:49 -04001119 ]
1120}