blob: 0849236331d6888a4b37cd7d6b388501c1b25601 [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 Henigman77df6762016-06-13 16:39:01 -04006import("//build/config/linux/pkg_config.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -04007import("//build/config/ui.gni")
Corentin Wallez28b65282016-06-16 07:24:50 -07008import("//testing/libfuzzer/fuzzer_test.gni")
Frank Henigmand0ef13a2017-08-28 22:53:24 -04009import("gni/angle.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060010if (is_android) {
11 # android/rules.gni can only be imported for Android targets
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -070012 import("//build/config/android/config.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060013 import("//build/config/android/rules.gni")
Cody Northrop8e636442018-11-30 16:24:11 -070014 import("android/angle_apk.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060015}
Corentin Wallez51e2ad12015-05-26 11:32:58 -040016
Corentin Wallez16d4e472017-03-20 13:06:19 -040017declare_args() {
18 # Use the PCI lib to collect GPU information on Linux.
19 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
20 (use_x11 || use_ozone)
Frank Henigmane42ec182017-12-11 23:58:53 -050021
22 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
23 angle_link_glx = false
Jamie Madilleb1b1642019-07-30 17:22:17 -040024
25 # Defaults to capture building to $root_out_dir/angle_libs/with_capture.
26 # Switch on to build capture to $root_out_dir.
27 angle_with_capture_by_default = false
Corentin Wallez16d4e472017-03-20 13:06:19 -040028}
29
Frank Henigmand0ef13a2017-08-28 22:53:24 -040030if (!build_with_chromium) {
31 group("all") {
32 testonly = true
33 deps = [
34 ":angle_shader_translator",
35 ":translator_fuzzer",
Jamie Madill238c19e2019-02-07 09:09:41 -050036 ":xxhash_fuzzer",
Frank Henigmand0ef13a2017-08-28 22:53:24 -040037 "//samples:all",
38 "//src/tests:all",
39 ]
40 }
41}
42
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040043if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040044 pkg_config("libdrm") {
45 packages = [ "libdrm" ]
46 }
Frank Henigman77df6762016-06-13 16:39:01 -040047}
48
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020049angle_git_is_present = exec_script("src/commit_id.py",
50 [
51 "check",
52 rebase_path(".", root_build_dir),
53 ],
54 "value")
55
56angle_use_commit_id = angle_git_is_present == 1
57
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000058import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060059import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070060
Brett Wilson2f5469c2014-07-22 17:00:17 -070061# This config is exported to dependent targets (and also applied to internal
62# ones).
63config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050064 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070065}
66
Jamie Madill4638dc92018-12-17 13:13:49 -050067# Prevent the GL headers from redeclaring ANGLE entry points.
68config("no_gl_prototypes") {
69 defines = [
70 "GL_GLES_PROTOTYPES=0",
71 "EGL_EGL_PROTOTYPES=0",
72 ]
73}
74
75config("gl_prototypes") {
76 defines = [
77 "GL_GLES_PROTOTYPES=1",
78 "EGL_EGL_PROTOTYPES=1",
79 "GL_GLEXT_PROTOTYPES",
80 "EGL_EGLEXT_PROTOTYPES",
81 ]
82}
83
Jamie Madill72f5b5e2014-06-23 15:13:02 -040084# This config is applied to internal Angle targets (not pushed to dependents).
85config("internal_config") {
86 include_dirs = [
87 "include",
88 "src",
89 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050090
Jamie Madill4638dc92018-12-17 13:13:49 -050091 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -040092
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060093 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040094 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060095 } else {
96 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -040097 }
Geoff Langb02fc662018-08-21 09:48:01 -040098
Shahbaz Youssefi25224e72018-10-22 11:56:02 -040099 if (angle_enable_vulkan) {
100 if (angle_enable_vulkan_gpu_trace_events) {
101 defines += [ "ANGLE_ENABLE_VULKAN_GPU_TRACE_EVENTS=1" ]
102 }
103 }
Tobin Ehlis573f76b2018-05-03 11:10:44 -0600104
105 if (angle_enable_trace) {
106 defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
107 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400108}
109
Jamie Madill509a1d42016-07-18 10:10:29 -0400110config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -0400111 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400112
Jamie Madill509a1d42016-07-18 10:10:29 -0400113 # Enable more default warnings on Windows.
114 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -0400115 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -0400116 "/we4244", # Conversion: possible loss of data.
117 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -0400118 "/we4458", # declaration hides class member.
Ben Wagner1e064012019-04-12 14:10:17 -0400119 "/we4715", # not all control paths return a value
Geoff Langb9440532017-11-28 13:26:34 -0500120 "/we4800", # forcing value to bool.
121 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400122 ]
123 }
Ben Wagner211bff32017-10-10 23:53:20 -0400124 if (is_clang) {
Michael Spang229fc832019-01-21 18:09:15 -0500125 cflags += [
Shahbaz Youssefi52d861b2019-02-02 00:30:58 -0500126 # Enable after anglebug.com/3128 is fixed.
127 # "-Wextra-semi-stmt",
Jamie Madillc09ae152019-02-01 14:16:32 -0500128
Jiacheng Lu73e5e9b2019-07-22 15:26:17 -0600129 "-Wfloat-conversion",
Olli Etuaho8073a952018-05-09 16:41:39 +0300130 "-Wnon-virtual-dtor",
Jamie Madillc09ae152019-02-01 14:16:32 -0500131 "-Wunneeded-internal-declaration",
James Darpinian22ec7dc2019-08-06 10:10:52 -0700132 "-Wglobal-constructors",
133 "-Wexit-time-destructors",
James Darpinianefa898a2019-08-07 17:05:35 -0700134
135 # The below warnings are used by WebKit. We enable them to make rolling
136 # ANGLE in WebKit easier.
137 "-Wparentheses",
138 "-Wrange-loop-analysis",
139 "-Wstrict-prototypes",
140 "-Wunreachable-code",
James Darpinian7e48c9e2019-08-06 17:17:19 -0700141 "-Wshorten-64-to-32",
Nico Weber79de62c2018-01-31 10:47:14 -0500142 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400143 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400144}
145
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600146# This config adds build-ids to the associated library.
147# -Wl is a special option that indicates that clang should pass the associated
148# option --build-id to the linker. This will cause a build-id section to be added
149# to the associated library. The build-id makes it possible for a debugger to
150# find the right symbol file to use.
151config("build_id_config") {
152 ldflags = [ "-Wl,--build-id" ]
153}
154
Jamie Madill20d380f2019-06-03 15:21:47 -0400155# Useful for more informative stack traces.
156config("better_linux_stack_traces") {
157 if (angle_better_stack_traces) {
158 ldflags = [ "-Wl,--export-dynamic" ]
159 }
160}
161
Tom Tan5c317532018-11-30 17:01:01 -0800162# Windows ARM64 is available since 10.0.16299 so no need to copy
163# d3dcompiler_47.dll because this file is available as inbox.
164if (is_win && target_cpu != "arm64") {
Jamie Madilld09546e2019-02-22 10:24:44 -0500165 # We also ship an older DLL for compatiblity with Windows 7 machines without
166 # the UCRT. This DLL isn't available in the standard SDK distribution.
167 _old_compiler = "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_old.dll"
168 _has_old_compiler =
169 exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
170
Daniel Bratell73941de2015-02-25 14:34:49 +0100171 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -0500172 sources = [
173 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
174 ]
Jamie Madilld09546e2019-02-22 10:24:44 -0500175
176 if (_has_old_compiler) {
177 sources += [ _old_compiler ]
178 }
179
Jamie Madilledbc2442016-01-04 11:25:00 -0500180 outputs = [
Jamie Madilld09546e2019-02-22 10:24:44 -0500181 "$root_out_dir/{{source_file_part}}",
Jamie Madilledbc2442016-01-04 11:25:00 -0500182 ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100183 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100184}
185
Jamie Madill55959b02019-03-05 10:07:41 -0500186# Holds the shared includes so we only need to list them once.
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500187config("includes_config") {
188 include_dirs = [ "include" ]
189}
190
Jamie Madill7098cff2019-01-15 18:33:42 -0500191angle_source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400192 sources = libangle_includes
Jamie Madillcd4f1fb2019-02-07 15:26:10 -0500193 public_configs = [ ":includes_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400194}
195
Jamie Madill7098cff2019-01-15 18:33:42 -0500196angle_static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400197 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400198
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400199 public_deps = [
200 ":angle_common",
201 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400202}
203
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500204config("angle_disable_pool_alloc") {
205 defines = [ "ANGLE_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400206}
207
Cooper Partin75da1972015-06-16 15:03:14 -0700208config("debug_annotations_config") {
Corentin Wallez105bc9d2019-03-06 16:32:40 +0000209 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500210 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700211 }
212}
213
Jamie Madille31fd872016-05-27 08:35:36 -0400214config("angle_release_asserts_config") {
215 if (dcheck_always_on) {
216 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
217 }
218}
219
Jamie Madille2e406c2016-06-02 13:04:10 -0400220config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400221 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500222 if (is_android) {
223 libs = [ "log" ]
224 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400225}
226
Jamie Madill20d380f2019-06-03 15:21:47 -0400227if (is_win) {
228 angle_source_set("angle_stack_walker") {
229 sources = [
230 "util/windows/third_party/StackWalker/src/StackWalker.cpp",
231 "util/windows/third_party/StackWalker/src/StackWalker.h",
232 ]
233
234 if (is_clang) {
235 cflags_cc = [
236 "-Wno-c++98-compat-extra-semi",
237 "-Wno-missing-declarations",
238 "-Wno-switch",
239 ]
240 } else {
241 cflags_cc = [ "/wd4740" ]
242 }
243 }
244}
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
252 configs -= [ "${angle_root}:extra_warnings" ]
253}
254
Jamie Madill238c19e2019-02-07 09:09:41 -0500255fuzzer_test("xxhash_fuzzer") {
256 sources = [
257 "src/common/third_party/xxhash/xxhash_fuzzer.cpp",
258 ]
259 deps = [
260 ":xxhash",
261 ]
262}
263
Jamie Madill7098cff2019-01-15 18:33:42 -0500264angle_static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400265 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700266
Jamie Madill562e81b2015-01-14 14:31:02 -0500267 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400268 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700269 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500270 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400271
Jamie Madillc09ae152019-02-01 14:16:32 -0500272 deps = [
273 ":xxhash",
274 ]
275
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400276 public_deps = [
Jamie Madill4638dc92018-12-17 13:13:49 -0500277 ":angle_system_utils",
278 ":angle_version",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500279 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400280 ]
Jamie Madill7098cff2019-01-15 18:33:42 -0500281 public_configs += [ ":angle_common_config" ]
Jamie Madille1fd4752017-04-26 16:46:48 -0400282 all_dependent_configs = [ ":angle_release_asserts_config" ]
Tobin Ehlis5546fb42019-01-17 12:25:54 -0500283 if (use_fuzzing_engine) {
284 all_dependent_configs += [ ":angle_disable_pool_alloc" ]
285 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500286}
287
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400288config("angle_image_util_config") {
289 include_dirs = [
290 "include",
291 "src",
292 ]
293}
294
Jamie Madill7098cff2019-01-15 18:33:42 -0500295angle_static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400296 sources = libangle_image_util_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500297 public_configs += [ ":angle_image_util_config" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400298 public_deps = [
299 ":angle_common",
300 ]
301}
302
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600303config("angle_gl_visibility_config") {
304 if (is_win) {
305 defines = [
306 "GL_APICALL=",
307 "GL_API=",
308 ]
309 } else {
310 defines = [
311 "GL_APICALL=__attribute__((visibility(\"default\")))",
312 "GL_API=__attribute__((visibility(\"default\")))",
313 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600314 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600315}
316
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500317config("angle_gpu_info_util_config") {
318 include_dirs = [
319 "include",
320 "src",
321 ]
322}
323
Jamie Madill7098cff2019-01-15 18:33:42 -0500324angle_static_library("angle_gpu_info_util") {
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400325 public_configs += [
326 ":angle_gpu_info_util_config",
327 ":angle_backend_config",
328 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500329 public_deps = [
330 ":angle_common",
331 ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400332 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500333 deps = []
334 libs = []
335 defines = []
336
Ian Elliottd07c52e2018-06-22 15:42:09 -0600337 if (is_android) {
338 sources += [ "src/gpu_info_util/SystemInfo_android.cpp" ]
339 }
340
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700341 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400342 sources += libangle_gpu_info_util_win_sources
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700343 libs += [ "setupapi.lib" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400344 libs += [ "dxgi.lib" ]
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700345 }
346
Jamie Madillc10a0232018-12-03 10:13:36 -0500347 if (is_linux || is_fuchsia) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400348 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500349
350 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400351 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500352 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
353 defines += [ "GPU_INFO_USE_X11" ]
354 libs += [
355 "X11",
356 "Xi",
357 "Xext",
358 ]
359 }
360 }
361
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500362 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400363 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500364 defines += [ "GPU_INFO_USE_LIBPCI" ]
365 libs += [ "pci" ]
366 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500367
368 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400369 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500370 libs += [
371 "IOKit.framework",
372 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400373 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500374 ]
375 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500376}
377
Jamie Madill7098cff2019-01-15 18:33:42 -0500378angle_static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400379 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800380 defines = []
381
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700382 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400383 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800384 defines += [ "ANGLE_ENABLE_ESSL" ]
385 }
386
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700387 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400388 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800389 defines += [ "ANGLE_ENABLE_GLSL" ]
390 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400391
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700392 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400393 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800394 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100395 }
Jamie Madille794cd82017-01-13 17:29:51 -0500396
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700397 if (angle_enable_vulkan || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400398 sources += angle_translator_lib_vulkan_sources
Jamie Madille794cd82017-01-13 17:29:51 -0500399 defines += [ "ANGLE_ENABLE_VULKAN" ]
400 }
401
Jamie Madill7098cff2019-01-15 18:33:42 -0500402 public_configs += [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400403
404 deps = [
405 ":includes",
406 ":preprocessor",
407 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500408
409 public_deps = [
410 ":angle_common",
411 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400412
413 if (is_win) {
414 # Necessary to suppress some system header xtree warnigns in Release.
415 # For some reason this warning doesn't get triggered in Chromium
416 cflags = [ "/wd4718" ]
417 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400418}
419
Jamie Madill7098cff2019-01-15 18:33:42 -0500420angle_source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700421 sources = [
422 "src/compiler/fuzz/translator_fuzzer.cpp",
423 ]
424
425 include_dirs = [
426 "include",
427 "src",
428 ]
429
430 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400431 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700432 ]
433}
434
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400435config("commit_id_config") {
436 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500437 visibility = [ ":commit_id" ]
438}
439
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200440commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
441if (angle_use_commit_id) {
442 action("commit_id") {
443 script = "src/commit_id.py"
444 outputs = [
445 commit_id_output_file,
446 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400447
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900448 # commit id should depend on angle's HEAD revision
Frank Henigmana7f97a22018-08-21 00:04:05 -0400449 inputs = [
450 ".git/HEAD",
451 ]
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900452
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200453 args = [
454 "gen",
455 rebase_path(".", root_build_dir),
456 rebase_path(commit_id_output_file, root_build_dir),
457 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400458
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200459 public_configs = [ ":commit_id_config" ]
460 }
461} else {
462 copy("commit_id") {
463 sources = [
464 "src/commit.h",
465 ]
466 outputs = [
467 commit_id_output_file,
468 ]
469 public_configs = [ ":commit_id_config" ]
470 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400471}
472
Jamie Madill7098cff2019-01-15 18:33:42 -0500473angle_source_set("angle_version") {
Jamie Madill4638dc92018-12-17 13:13:49 -0500474 sources = [
475 "src/common/version.h",
476 ]
477 public_deps = [
478 ":commit_id",
479 ]
480}
481
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400482config("angle_backend_config") {
Jamie Madill562e81b2015-01-14 14:31:02 -0500483 defines = []
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400484
Jamie Madill562e81b2015-01-14 14:31:02 -0500485 if (angle_enable_d3d9) {
486 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500487 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500488 if (angle_enable_d3d11) {
489 defines += [ "ANGLE_ENABLE_D3D11" ]
490 }
Geoff Langc588ac72015-02-13 15:41:41 -0500491 if (angle_enable_gl) {
492 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700493 if (use_x11) {
494 defines += [ "ANGLE_USE_X11" ]
495 }
Jamie Madill6d94f062017-10-21 22:19:40 -0400496 if (angle_enable_gl_null) {
497 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
498 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400499 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400500 if (angle_enable_vulkan) {
501 defines += [ "ANGLE_ENABLE_VULKAN" ]
Tobin Ehlis134425c2019-03-15 17:02:17 -0600502 if (angle_enable_custom_vulkan_cmd_buffers) {
503 defines += [ "ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1" ]
504 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400505 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400506 if (angle_enable_null) {
507 defines += [ "ANGLE_ENABLE_NULL" ]
508 }
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400509}
510
511config("libANGLE_config") {
512 cflags = []
513 defines = []
514 libs = []
515 ldflags = []
516 if (angle_enable_d3d9) {
517 ldflags += [ "/DELAYLOAD:d3d9.dll" ]
518 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500519 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400520
521 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800522 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
523 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500524
525 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
Yuly Novikov8edc68e2019-02-12 12:41:01 -0500526 # In API level 26 ANativeWindow APIs were moved from libandroid.so
527 # into a separate library, libnativewindow.so
528 if (ndk_api_level_at_least_26) {
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500529 libs += [ "nativewindow" ]
530 } else {
531 libs += [ "android" ]
532 }
533 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500534}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500535
Jamie Madillb62a1c22018-02-06 09:54:02 -0500536if (angle_enable_vulkan) {
Michael Spang35218632019-02-06 13:05:21 -0500537 config("vulkan_config") {
Michael Spang35218632019-02-06 13:05:21 -0500538 if (is_android) {
Michael Spang35218632019-02-06 13:05:21 -0500539 libs = [ "vulkan" ]
540 }
541 }
542
Jamie Madillb62a1c22018-02-06 09:54:02 -0500543 # Use this target to include everything ANGLE needs for Vulkan.
544 group("angle_vulkan") {
Jamie Madillb62a1c22018-02-06 09:54:02 -0500545 public_deps = [
Tobin Ehlisb971f492018-05-24 10:56:17 -0600546 "$angle_root/third_party/vulkan-headers:vulkan_headers",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500547 ]
Michael Spang35218632019-02-06 13:05:21 -0500548 public_configs = [ ":vulkan_config" ]
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600549 data_deps = []
Michael Spang229fc832019-01-21 18:09:15 -0500550 if (!is_android && !is_fuchsia) {
Jamie Madill0cb3b0f2019-01-28 09:55:20 -0500551 deps = [
552 "$angle_root/third_party/vulkan-loader:libvulkan",
553 ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600554 data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
555 public_configs +=
556 [ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500557 }
Michael Spang229fc832019-01-21 18:09:15 -0500558 if (is_fuchsia) {
559 public_deps += [
560 "$angle_root/src/common/fuchsia_egl",
561 "//third_party/fuchsia-sdk:vulkan_base",
562 "//third_party/fuchsia-sdk/sdk:vulkan",
563 ]
564 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600565
566 if (angle_enable_vulkan_validation_layers) {
Michael Spang229fc832019-01-21 18:09:15 -0500567 if (is_fuchsia) {
568 deps = [
569 "//third_party/fuchsia-sdk:vulkan_validation",
570 ]
571 } else {
572 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
573 if (!is_android) {
574 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
575 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600576 }
577 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500578 }
579}
580
Jamie Madilleb1b1642019-07-30 17:22:17 -0400581angle_source_set("libANGLE_base") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400582 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500583
Jamie Madill5ea762a2017-06-07 14:59:51 -0400584 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500585 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500586 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500587 if (angle_link_glx) {
588 libs += [ "GL" ]
589 defines += [ "ANGLE_LINK_GLX" ]
590 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400591 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500592 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500593 ":angle_gpu_info_util",
Jamie Madill4638dc92018-12-17 13:13:49 -0500594 ":angle_version",
Jamie Madill720ca442018-12-17 14:04:10 -0500595 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400596 ]
597 deps = [
Corentin Wallez878baf92017-02-15 13:57:16 -0500598 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500599 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500600 ]
601
Jamie Madillab2bfa82019-01-15 19:06:47 -0500602 # Enable extra Chromium style warnings for libANGLE.
603 if (is_clang) {
604 suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
605 }
606
Jamie Madill562e81b2015-01-14 14:31:02 -0500607 # Shared D3D sources.
608 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400609 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400610
Jamie Madilledbc2442016-01-04 11:25:00 -0500611 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500612 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500613
Jamie Madill562e81b2015-01-14 14:31:02 -0500614 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400615 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500616 libs += [ "d3d9.lib" ]
617 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400618
Jamie Madill562e81b2015-01-14 14:31:02 -0500619 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400620 sources += libangle_d3d11_sources
621 sources += libangle_d3d11_win32_sources
Austin Kinross91e71ed2016-08-23 09:29:22 -0700622 libs += [ "dxguid.lib" ]
Brandon Jonesb77884b2018-10-10 09:07:12 -0700623 import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni")
624 sources += libangle_d3d11_blit_shaders
Jamie Madill562e81b2015-01-14 14:31:02 -0500625 }
626
Geoff Langc588ac72015-02-13 15:41:41 -0500627 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400628 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500629 include_dirs += [ "src/third_party/khronos" ]
630
Jamie Madill6d94f062017-10-21 22:19:40 -0400631 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400632 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400633 }
Geoff Langc588ac72015-02-13 15:41:41 -0500634 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400635 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500636 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400637 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400638 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400639 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500640 libs += [
641 "X11",
642 "Xi",
643 "Xext",
644 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400645 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400646 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400647 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400648 libs += [
649 "Cocoa.framework",
650 "IOSurface.framework",
651 "OpenGL.framework",
652 "QuartzCore.framework",
653 ]
654 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400655 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400656 sources += libangle_gl_egl_sources
657 sources += libangle_gl_egl_dl_sources
658 sources += libangle_gl_egl_android_sources
Yuly Novikova6426d62016-06-03 00:18:38 -0400659 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400660 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400661 configs += [ ":libdrm" ]
662 defines += [ "ANGLE_USE_OZONE" ]
663 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400664 sources += libangle_gl_egl_sources
665 sources += libangle_gl_egl_dl_sources
666 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400667 }
Geoff Langc588ac72015-02-13 15:41:41 -0500668 }
669
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400670 if (angle_enable_vulkan) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400671 sources += libangle_vulkan_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500672 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400673 sources += libangle_vulkan_win32_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500674 }
675 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400676 sources += libangle_vulkan_xcb_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500677 }
Michael Spang229fc832019-01-21 18:09:15 -0500678 if (is_fuchsia) {
679 sources += libangle_vulkan_fuchsia_sources
680 deps += [
681 "$angle_root/src/common/fuchsia_egl",
682 "$angle_root/src/common/fuchsia_egl:backend",
683 ]
684 }
Yuly Novikov199f4292018-01-19 19:04:05 -0500685 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400686 sources += libangle_vulkan_android_sources
Shahbaz Youssefi749589f2018-10-25 12:48:49 -0400687 libs += [ "vulkan" ]
Yuly Novikov199f4292018-01-19 19:04:05 -0500688 }
Jamie Madill0cb3b0f2019-01-28 09:55:20 -0500689 deps += [
690 ":angle_vulkan",
691 "${angle_glslang_dir}:glslang_default_resource_limits_sources",
692 "${angle_glslang_dir}:glslang_sources",
693 "${angle_spirv_tools_dir}:spvtools_val",
694 ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600695 public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
Jamie Madilld47044a2018-04-27 11:45:03 -0400696
697 # Include generated shaders.
698 import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
699 sources += angle_vulkan_internal_shaders
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400700 }
701
Geoff Langd08f3b32016-09-23 15:56:30 -0400702 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400703 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400704 }
705
Geoff Langecd2e3b2019-07-09 15:39:39 -0400706 if (is_mac) {
707 sources += libangle_mac_sources
708 }
709
Jamie Madill562e81b2015-01-14 14:31:02 -0500710 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500711 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400712 }
713
Jamie Madill7098cff2019-01-15 18:33:42 -0500714 configs += [ ":debug_annotations_config" ]
Jonah Ryan-Davis66e48502019-04-25 10:49:05 -0400715 public_configs += [
716 ":libANGLE_config",
717 ":angle_backend_config",
718 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500719
Tom Tan5c317532018-11-30 17:01:01 -0800720 # Windows ARM64 is available since 10.0.16299 so no need to copy
721 # d3dcompiler_47.dll because this file is available as inbox.
722 if (is_win && target_cpu != "arm64") {
Jamie Madille2e406c2016-06-02 13:04:10 -0400723 data_deps = [
724 ":copy_compiler_dll",
725 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500726 }
727}
728
Jamie Madilleb1b1642019-07-30 17:22:17 -0400729config("angle_frame_capture_disabled") {
730 defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
731}
732
733config("angle_frame_capture_enabled") {
734 defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
735}
736
737angle_source_set("libANGLE") {
738 public_deps = [
739 ":libANGLE_base",
740 ]
741 public_configs = [ ":angle_frame_capture_disabled" ]
742 sources = [
743 "src/libANGLE/FrameCapture.cpp",
744 ]
Jiacheng Lu9e14a192019-08-09 10:03:24 -0600745
746 # gl_enum_utils defaults included in with_capture build
747 if (angle_enable_trace || is_debug) {
748 sources += [ "src/libANGLE/gl_enum_utils_autogen.cpp" ]
749 }
Jamie Madilleb1b1642019-07-30 17:22:17 -0400750}
751
Jamie Madill612b7412019-07-05 11:13:30 -0400752angle_source_set("libANGLE_with_capture") {
753 public_deps = [
Jamie Madilleb1b1642019-07-30 17:22:17 -0400754 ":libANGLE_base",
Jamie Madill612b7412019-07-05 11:13:30 -0400755 ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400756 public_configs = [ ":angle_frame_capture_enabled" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400757 sources = libangle_capture_sources
758}
759
Robert Sesekdb8ae832016-06-21 11:47:03 -0400760config("shared_library_public_config") {
761 if (is_mac && !is_component_build) {
762 # Executable targets that depend on the shared libraries below need to have
763 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400764 ldflags = [
765 "-rpath",
766 "@executable_path/",
767 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400768 }
769}
770
Jamie Madill4638dc92018-12-17 13:13:49 -0500771config("library_name_config") {
772 defines = [
773 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
774 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
775 ]
776}
777
Jamie Madill80ab03c2017-01-03 11:03:23 -0500778# This config controls export definitions on ANGLE API calls.
779config("angle_static") {
780 defines = [
781 "ANGLE_EXPORT=",
Jamie Madillba319ba2018-12-29 10:29:33 -0500782 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500783 "EGLAPI=",
784 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500785 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500786 ]
787}
788
Jamie Madilleb1b1642019-07-30 17:22:17 -0400789set_defaults("angle_libGLESv2") {
790 sources = []
791 output_name = "libGLESv2"
792}
793
Jamie Madill612b7412019-07-05 11:13:30 -0400794template("angle_libGLESv2") {
795 angle_shared_library(target_name) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400796 sources = libglesv2_sources + invoker.sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500797
Jamie Madill612b7412019-07-05 11:13:30 -0400798 if (is_win) {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400799 sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400800 }
801
Jamie Madilleb1b1642019-07-30 17:22:17 -0400802 output_name = "${invoker.output_name}${angle_libs_suffix}"
803
Jamie Madill612b7412019-07-05 11:13:30 -0400804 configs += [
805 ":angle_gl_visibility_config",
806 ":debug_annotations_config",
807 ":gl_prototypes",
808 ]
809
Jamie Madilleb1b1642019-07-30 17:22:17 -0400810 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400811
Jamie Madilleb1b1642019-07-30 17:22:17 -0400812 deps = invoker.deps + [ ":includes" ]
Jamie Madill612b7412019-07-05 11:13:30 -0400813
814 public_deps = [
815 ":angle_version",
816 ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500817 }
Jamie Madill612b7412019-07-05 11:13:30 -0400818}
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800819
Jamie Madill612b7412019-07-05 11:13:30 -0400820angle_libGLESv2("libGLESv2") {
Jamie Madilleb1b1642019-07-30 17:22:17 -0400821 if (angle_with_capture_by_default) {
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600822 deps = [
823 ":libANGLE_with_capture",
824 ]
825 } else {
826 deps = [
827 ":libANGLE",
828 ]
Jamie Madilleb1b1642019-07-30 17:22:17 -0400829 }
Jamie Madill612b7412019-07-05 11:13:30 -0400830}
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400831
Jiacheng Lu617f23d2019-08-12 10:11:53 -0600832# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
833angle_libGLESv2("libGLESv2_capture_complement") {
834 if (angle_with_capture_by_default) {
835 deps = [
836 ":libANGLE",
837 ]
838 output_name += "_no_capture"
839 } else {
840 deps = [
841 ":libANGLE_with_capture",
842 ]
843 output_name += "_with_capture"
Jamie Madilleb1b1642019-07-30 17:22:17 -0400844 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500845}
846
Clemen Deng7558e832019-06-18 13:02:03 -0400847if (is_win) {
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400848 angle_shared_library("libGL") {
849 sources = libgl_sources
Clemen Deng663b0482019-07-11 12:37:35 -0400850
Clemen Deng6e7dd1e2019-07-16 13:41:59 -0400851 output_name = "openGL32"
852 output_dir = "$root_out_dir/angle_libs"
Clemen Deng7558e832019-06-18 13:02:03 -0400853
854 configs += [
855 ":angle_gl_visibility_config",
856 ":debug_annotations_config",
857 ":gl_prototypes",
858 ]
859
Jamie Madill612b7412019-07-05 11:13:30 -0400860 defines = [
861 "ANGLE_CAPTURE_ENABLED=0",
Clemen Dengcb8b4a52019-07-04 16:05:25 -0400862 "LIBGL_IMPLEMENTATION",
Jamie Madill612b7412019-07-05 11:13:30 -0400863 ]
Clemen Deng7558e832019-06-18 13:02:03 -0400864
865 deps = [
866 ":includes",
867 ":libANGLE",
868 ]
869
870 public_deps = [
871 ":angle_version",
872 ]
873 }
874}
875
Jamie Madill7098cff2019-01-15 18:33:42 -0500876angle_static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400877 sources = libglesv2_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500878 configs += [ ":debug_annotations_config" ]
879 public_configs += [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500880 deps = [
881 ":includes",
Jamie Madill720ca442018-12-17 14:04:10 -0500882 ]
Jamie Madill720ca442018-12-17 14:04:10 -0500883 public_deps = [
Jamie Madill562e81b2015-01-14 14:31:02 -0500884 ":libANGLE",
885 ]
886}
887
Jamie Madill77c84962019-06-28 11:24:27 -0400888angle_shared_library("libGLESv1_CM") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400889 sources = libglesv1_cm_sources
Jamie Madill77c84962019-06-28 11:24:27 -0400890 output_name = "libGLESv1_CM${angle_libs_suffix}"
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500891
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500892 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600893 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500894 ":debug_annotations_config",
Jamie Madillba319ba2018-12-29 10:29:33 -0500895 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500896 ]
897
898 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500899
900 deps = [
901 ":includes",
Jamie Madill77c84962019-06-28 11:24:27 -0400902 ":libGLESv2",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500903 ]
904}
905
Jamie Madill7098cff2019-01-15 18:33:42 -0500906angle_static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400907 sources = libglesv1_cm_sources
Jamie Madill7098cff2019-01-15 18:33:42 -0500908 configs += [ ":debug_annotations_config" ]
909 public_configs += [ ":angle_static" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500910 deps = [
911 ":includes",
912 ":libGLESv2_static",
913 ]
914}
915
Jamie Madill4638dc92018-12-17 13:13:49 -0500916config("libEGL_egl_loader_config") {
917 defines = [ "ANGLE_USE_EGL_LOADER" ]
918}
919
Jamie Madill7098cff2019-01-15 18:33:42 -0500920angle_source_set("libEGL_egl_loader") {
Jamie Madill4638dc92018-12-17 13:13:49 -0500921 sources = [
922 "src/libEGL/egl_loader_autogen.cpp",
923 "src/libEGL/egl_loader_autogen.h",
924 ]
925
Jamie Madill7098cff2019-01-15 18:33:42 -0500926 public_configs += [
Jamie Madill4638dc92018-12-17 13:13:49 -0500927 ":libEGL_egl_loader_config",
928 ":gl_prototypes",
Jamie Madill4638dc92018-12-17 13:13:49 -0500929 ]
930
931 deps = [
932 ":includes",
933 ]
934}
935
Jamie Madill77c84962019-06-28 11:24:27 -0400936angle_shared_library("libEGL") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400937 sources = libegl_sources
Jamie Madill77c84962019-06-28 11:24:27 -0400938 output_name = "libEGL${angle_libs_suffix}"
Jamie Madill562e81b2015-01-14 14:31:02 -0500939
Jamie Madill562e81b2015-01-14 14:31:02 -0500940 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -0400941 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500942 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500943 ]
944
Jamie Madilledbc2442016-01-04 11:25:00 -0500945 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500946 if (is_win) {
947 defines += [ "EGLAPI=" ]
948 } else {
949 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
950 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500951
Jamie Madill80ab03c2017-01-03 11:03:23 -0500952 if (is_win) {
Nico Weber9db8df42019-01-04 14:47:27 -0500953 sources += [ "src/libEGL/libEGL.def" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500954 }
955
Jamie Madill562e81b2015-01-14 14:31:02 -0500956 deps = [
James Darpinian22ec7dc2019-08-06 10:10:52 -0700957 ":angle_common",
Jamie Madill4638dc92018-12-17 13:13:49 -0500958 ":angle_system_utils",
959 ":angle_version",
960 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -0500961 ]
Jamie Madill720ca442018-12-17 14:04:10 -0500962
963 public_deps = [
964 ":includes",
965 ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500966
967 data_deps = [
Jamie Madill77c84962019-06-28 11:24:27 -0400968 ":libGLESv2",
Jamie Madill4638dc92018-12-17 13:13:49 -0500969 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500970}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400971
Jamie Madill7098cff2019-01-15 18:33:42 -0500972angle_static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400973 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500974
Jamie Madill80ab03c2017-01-03 11:03:23 -0500975 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500976 ":debug_annotations_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500977 ":library_name_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500978 ]
979
Jamie Madill7098cff2019-01-15 18:33:42 -0500980 public_configs += [ ":angle_static" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500981
982 deps = [
983 ":includes",
984 ":libGLESv2_static",
985 ]
986}
987
Frank Henigmanddc41202018-08-23 22:11:55 -0400988import("util/util.gni")
Jamie Madilledbc2442016-01-04 11:25:00 -0500989
Jamie Madillba319ba2018-12-29 10:29:33 -0500990config("angle_util_loader_config") {
991 defines = [ "ANGLE_USE_UTIL_LOADER" ]
992}
993
Jamie Madill7098cff2019-01-15 18:33:42 -0500994angle_source_set("angle_util_loader_headers") {
Jamie Madillba319ba2018-12-29 10:29:33 -0500995 sources = [
996 "util/egl_loader_autogen.h",
997 "util/gles_loader_autogen.h",
998 "util/util_export.h",
999 ]
1000
Jamie Madill624ce6a2019-01-04 14:17:24 -05001001 if (is_win) {
1002 sources += [ "util/windows/wgl_loader_autogen.h" ]
1003 }
Jamie Madillba319ba2018-12-29 10:29:33 -05001004
1005 public_deps = [
1006 ":includes",
1007 ]
1008}
1009
Jamie Madill7098cff2019-01-15 18:33:42 -05001010angle_source_set("angle_util_loader") {
Jamie Madillba319ba2018-12-29 10:29:33 -05001011 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
1012
1013 sources = [
1014 "util/egl_loader_autogen.cpp",
1015 "util/gles_loader_autogen.cpp",
1016 ]
1017
Jamie Madill1f56ed22019-01-03 15:24:22 -05001018 if (is_win) {
Jamie Madill624ce6a2019-01-04 14:17:24 -05001019 sources += [ "util/windows/wgl_loader_autogen.cpp" ]
Jamie Madill1f56ed22019-01-03 15:24:22 -05001020 }
1021
Jamie Madill624ce6a2019-01-04 14:17:24 -05001022 deps = [
Jamie Madillba319ba2018-12-29 10:29:33 -05001023 ":angle_util_loader_headers",
1024 ]
Jamie Madill624ce6a2019-01-04 14:17:24 -05001025
Jamie Madill7098cff2019-01-15 18:33:42 -05001026 public_configs += [
Jamie Madill624ce6a2019-01-04 14:17:24 -05001027 ":angle_util_config",
1028 ":angle_util_loader_config",
Jamie Madill624ce6a2019-01-04 14:17:24 -05001029 ":no_gl_prototypes",
1030 ]
Jamie Madillba319ba2018-12-29 10:29:33 -05001031}
1032
Jamie Madilledbc2442016-01-04 11:25:00 -05001033config("angle_util_config") {
Jamie Madillba319ba2018-12-29 10:29:33 -05001034 include_dirs = [ "." ]
Frank Henigman77df6762016-06-13 16:39:01 -04001035 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -05001036 libs = [ "X11" ]
1037 }
Jamie Madilledbc2442016-01-04 11:25:00 -05001038}
Corentin Wallezbeb81582015-09-02 10:30:55 -04001039
Jamie Madill80ab03c2017-01-03 11:03:23 -05001040foreach(is_shared_library,
1041 [
1042 true,
1043 false,
1044 ]) {
1045 if (is_shared_library) {
Jamie Madill7098cff2019-01-15 18:33:42 -05001046 library_type = "angle_shared_library"
Jamie Madill80ab03c2017-01-03 11:03:23 -05001047 library_name = "angle_util"
Yuly Novikovad4f9642018-02-08 17:58:46 -05001048 dep_suffix = "${angle_libs_suffix}"
Jamie Madill80ab03c2017-01-03 11:03:23 -05001049 } else {
Jamie Madill7098cff2019-01-15 18:33:42 -05001050 library_type = "angle_static_library"
Jamie Madill80ab03c2017-01-03 11:03:23 -05001051 library_name = "angle_util_static"
1052 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -04001053 }
1054
Jamie Madill80ab03c2017-01-03 11:03:23 -05001055 target(library_type, library_name) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001056 sources = util_sources
Jamie Madill20d380f2019-06-03 15:21:47 -04001057 deps = [
1058 ":angle_common",
1059 ":angle_util_loader_headers",
1060 ]
1061 public_deps = []
1062 libs = []
Jamie Madill80ab03c2017-01-03 11:03:23 -05001063
1064 if (is_win) {
Jamie Madill624ce6a2019-01-04 14:17:24 -05001065 sources += util_win_sources
Jamie Madill20d380f2019-06-03 15:21:47 -04001066 deps += [ ":angle_stack_walker" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001067 }
1068
1069 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001070 sources += util_linux_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -06001071 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -05001072 "rt",
1073 "dl",
1074 ]
1075 }
1076
1077 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001078 sources += util_osx_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -06001079 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -05001080 "AppKit.framework",
1081 "QuartzCore.framework",
1082 ]
1083 }
1084
1085 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001086 sources += util_x11_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -05001087 }
1088
1089 if (is_android) {
1090 # To prevent linux sources filtering on android
1091 set_sources_assignment_filter([])
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001092 sources += util_android_sources
Yuly Novikovcd70aa42018-06-20 17:05:32 -04001093 libs += [
1094 "android",
1095 "log",
1096 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001097 }
1098
Jamie Madill7098cff2019-01-15 18:33:42 -05001099 configs += [ ":debug_annotations_config" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -04001100
Jamie Madill7098cff2019-01-15 18:33:42 -05001101 public_configs += [ ":angle_util_config" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -04001102
Michael Spang229fc832019-01-21 18:09:15 -05001103 if (is_fuchsia) {
1104 sources += util_fuchsia_sources
1105 public_deps += [
1106 "$angle_root/src/common/fuchsia_egl",
1107 "//third_party/fuchsia-sdk/sdk:async_loop_cpp",
1108 "//third_party/fuchsia-sdk/sdk:fdio",
1109 "//third_party/fuchsia-sdk/sdk:images",
1110 "//third_party/fuchsia-sdk/sdk:scenic_cpp",
Michael Spang229fc832019-01-21 18:09:15 -05001111 "//third_party/fuchsia-sdk/sdk:ui_policy",
1112 "//third_party/fuchsia-sdk/sdk:ui_scenic",
David Worsham62e274e2019-04-23 09:17:03 -07001113 "//third_party/fuchsia-sdk/sdk:ui_views",
Michael Spang229fc832019-01-21 18:09:15 -05001114 ]
1115 } else if (use_ozone) {
1116 sources += util_ozone_sources
1117 }
1118
Jamie Madill80ab03c2017-01-03 11:03:23 -05001119 if (is_shared_library) {
1120 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
1121
Jamie Madill624ce6a2019-01-04 14:17:24 -05001122 if (is_win) {
1123 sources += util_win_shared_sources
1124 }
1125
Michael Spang229fc832019-01-21 18:09:15 -05001126 public_deps += [ ":angle_util_loader" ]
Jamie Madill7098cff2019-01-15 18:33:42 -05001127
1128 if (is_mac && !is_component_build) {
1129 ldflags = [
1130 "-install_name",
1131 "@rpath/libangle_util.dylib",
1132 ]
1133 }
Jamie Madillba319ba2018-12-29 10:29:33 -05001134 } else {
1135 public_configs += [
1136 ":angle_static",
1137 ":gl_prototypes",
1138 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001139 }
Yuly Novikova6426d62016-06-03 00:18:38 -04001140 }
Corentin Wallezbeb81582015-09-02 10:30:55 -04001141}
Ken Russellfcadd082017-06-28 14:01:15 -07001142
1143# Convenience targets for some of the samples so they can be built
1144# with Chromium's toolchain.
1145
Jamie Madill7098cff2019-01-15 18:33:42 -05001146angle_executable("angle_shader_translator") {
Ken Russellfcadd082017-06-28 14:01:15 -07001147 testonly = true
1148
1149 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -04001150 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -07001151 ]
1152
1153 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -04001154 ":translator",
Ken Russellfcadd082017-06-28 14:01:15 -07001155 ]
1156}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001157
Ian Elliotta9d579e2018-11-28 11:44:48 -07001158config("angle_feature_support_config") {
1159 include_dirs = [
1160 "include",
1161 "src",
1162 ]
1163 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1164 if (is_debug) {
1165 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001166 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001167}
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001168
Jamie Madill77c84962019-06-28 11:24:27 -04001169angle_shared_library("libfeature_support") {
1170 output_name = "libfeature_support${angle_libs_suffix}"
1171
Ian Elliotta9d579e2018-11-28 11:44:48 -07001172 if (is_android) {
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001173 libs = [ "log" ]
Ian Elliotta9d579e2018-11-28 11:44:48 -07001174 }
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001175
Jamie Madill7098cff2019-01-15 18:33:42 -05001176 public_configs += [
Ian Elliotta9d579e2018-11-28 11:44:48 -07001177 ":angle_feature_support_config",
Jamie Madill0cb3b0f2019-01-28 09:55:20 -05001178 "${angle_jsoncpp_dir}:jsoncpp_config",
Ian Elliotta9d579e2018-11-28 11:44:48 -07001179 ]
1180
Cezary Kulakowski4fb738f2019-02-01 10:53:44 +01001181 if (is_mac && !is_component_build) {
1182 ldflags = [
1183 "-install_name",
1184 "@rpath/${target_name}.dylib",
1185 ]
1186 }
1187
Ian Elliotta9d579e2018-11-28 11:44:48 -07001188 sources = [
1189 "src/feature_support_util/feature_support_util.cpp",
1190 "src/feature_support_util/feature_support_util.h",
1191 ]
Jamie Madill7098cff2019-01-15 18:33:42 -05001192
Ian Elliotta9d579e2018-11-28 11:44:48 -07001193 deps = [
1194 ":angle_gpu_info_util",
Jamie Madill0cb3b0f2019-01-28 09:55:20 -05001195 "${angle_jsoncpp_dir}:jsoncpp",
Ian Elliotta9d579e2018-11-28 11:44:48 -07001196 ]
1197}
1198
Jamie Madill1f56ed22019-01-03 15:24:22 -05001199if (!is_component_build && is_android && symbol_level != 0) {
1200 action_foreach("compressed_symbols") {
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001201 sources = []
1202 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001203 sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001204 }
1205 if (angle_enable_vulkan_validation_layers) {
1206 foreach(_layer, vulkan_validation_layers) {
Jamie Madill77c84962019-06-28 11:24:27 -04001207 sources += [ "$root_out_dir/lib${_layer}.so" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001208 }
1209 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001210
1211 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
1212 root_build_dir)
1213
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001214 deps = []
1215 foreach(_library, angle_libraries) {
Jamie Madill77c84962019-06-28 11:24:27 -04001216 deps += [ ":$_library" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001217 }
1218
1219 if (angle_enable_vulkan_validation_layers) {
1220 foreach(_layer, vulkan_validation_layers) {
Jamie Madill7098cff2019-01-15 18:33:42 -05001221 deps +=
1222 [ "${angle_root}/third_party/vulkan-validation-layers:${_layer}" ]
Courtney Goeltzenleuchterc05c1412019-01-03 12:40:13 -07001223 }
1224 }
Jamie Madill1f56ed22019-01-03 15:24:22 -05001225
1226 outputs = [
1227 "$root_out_dir/lib.compressed/{{source_file_part}}",
1228 ]
1229
1230 android_nm = "${android_tool_prefix}nm"
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001231 android_strip = "${android_tool_prefix}strip"
Jamie Madill1f56ed22019-01-03 15:24:22 -05001232
1233 args = [
1234 "--objcopy",
1235 rebase_path(android_objcopy, root_build_dir),
1236 "--nm",
1237 rebase_path(android_nm, root_build_dir),
Tim Van Patten73e17bf2019-05-14 10:42:25 -06001238 "--strip",
1239 rebase_path(android_strip, root_build_dir),
Jamie Madill1f56ed22019-01-03 15:24:22 -05001240 "--unstrippedsofile",
1241 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
1242 "--output",
1243 "{{source_dir}}/lib.compressed/{{source_file_part}}",
1244 ]
1245 }
1246}
1247
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -07001248if (!is_component_build && is_android &&
1249 current_toolchain == default_toolchain) {
Cody Northrop8cbd3212019-04-23 13:25:20 -06001250 # Package ANGLE libraries
1251 angle_apk("angle_chromium_apk") {
1252 package_name = "com.chromium.angle"
Tim Van Pattenee4fa072019-02-21 19:21:09 +00001253 apk_name = "AngleLibraries"
Cody Northrop8e636442018-11-30 16:24:11 -07001254 }
1255
1256 group("angle_apks") {
1257 deps = [
Cody Northrop8cbd3212019-04-23 13:25:20 -06001258 ":angle_chromium_apk",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001259 ]
1260 }
1261}