blob: 220ea4cf2f501ee075b84612dcb9c290993c487c [file] [log] [blame]
Corentin Wallezd4bcfa22015-09-01 10:32:30 -04001# Copyright 2014-2015 The Chromium 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
Jamie Madille31fd872016-05-27 08:35:36 -04006import("//build/config/dcheck_always_on.gni")
Frank Henigman77df6762016-06-13 16:39:01 -04007import("//build/config/linux/pkg_config.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -04008import("//build/config/ui.gni")
Corentin Wallez28b65282016-06-16 07:24:50 -07009import("//testing/libfuzzer/fuzzer_test.gni")
Frank Henigmand0ef13a2017-08-28 22:53:24 -040010import("gni/angle.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060011if (is_android) {
12 # android/rules.gni can only be imported for Android targets
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -070013 import("//build/config/android/config.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060014 import("//build/config/android/rules.gni")
Cody Northrop8e636442018-11-30 16:24:11 -070015 import("android/angle_apk.gni")
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -060016}
Corentin Wallez51e2ad12015-05-26 11:32:58 -040017
Corentin Wallez16d4e472017-03-20 13:06:19 -040018declare_args() {
19 # Use the PCI lib to collect GPU information on Linux.
20 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
21 (use_x11 || use_ozone)
Frank Henigmane42ec182017-12-11 23:58:53 -050022
23 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
24 angle_link_glx = false
Corentin Wallez16d4e472017-03-20 13:06:19 -040025}
26
Frank Henigmand0ef13a2017-08-28 22:53:24 -040027if (!build_with_chromium) {
28 group("all") {
29 testonly = true
30 deps = [
31 ":angle_shader_translator",
32 ":translator_fuzzer",
33 "//samples:all",
34 "//src/tests:all",
35 ]
36 }
37}
38
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040039if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040040 pkg_config("libdrm") {
41 packages = [ "libdrm" ]
42 }
Frank Henigman77df6762016-06-13 16:39:01 -040043}
44
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020045angle_git_is_present = exec_script("src/commit_id.py",
46 [
47 "check",
48 rebase_path(".", root_build_dir),
49 ],
50 "value")
51
52angle_use_commit_id = angle_git_is_present == 1
53
Tim Van Pattenc4e0a1e2018-11-28 16:08:11 +000054import("src/compiler.gni")
Tim Van Pattenfdccaa32018-11-01 17:47:10 -060055import("src/libGLESv2.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070056
Brett Wilson2f5469c2014-07-22 17:00:17 -070057# This config is exported to dependent targets (and also applied to internal
58# ones).
59config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050060 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070061}
62
Jamie Madill4638dc92018-12-17 13:13:49 -050063# Prevent the GL headers from redeclaring ANGLE entry points.
64config("no_gl_prototypes") {
65 defines = [
66 "GL_GLES_PROTOTYPES=0",
67 "EGL_EGL_PROTOTYPES=0",
68 ]
69}
70
71config("gl_prototypes") {
72 defines = [
73 "GL_GLES_PROTOTYPES=1",
74 "EGL_EGL_PROTOTYPES=1",
75 "GL_GLEXT_PROTOTYPES",
76 "EGL_EGLEXT_PROTOTYPES",
77 ]
78}
79
Jamie Madill72f5b5e2014-06-23 15:13:02 -040080# This config is applied to internal Angle targets (not pushed to dependents).
81config("internal_config") {
82 include_dirs = [
83 "include",
84 "src",
85 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050086
Jamie Madill4638dc92018-12-17 13:13:49 -050087 defines = []
Jamie Madill6de51852017-04-12 09:53:01 -040088
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060089 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040090 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060091 } else {
92 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -040093 }
Geoff Langb02fc662018-08-21 09:48:01 -040094
95 if (angle_force_thread_safety) {
96 defines += [ "ANGLE_FORCE_THREAD_SAFETY=1" ]
97 }
Shahbaz Youssefi25224e72018-10-22 11:56:02 -040098
99 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.
Geoff Langb9440532017-11-28 13:26:34 -0500119 "/we4800", # forcing value to bool.
120 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400121 ]
122 }
Ben Wagner211bff32017-10-10 23:53:20 -0400123 if (is_clang) {
Nico Weber79de62c2018-01-31 10:47:14 -0500124 cflags += [
125 # Remove when crbug.com/428099 is resolved.
126 "-Winconsistent-missing-override",
Courtney Goeltzenleuchter15215262018-04-11 12:14:55 -0600127 "-Wunneeded-internal-declaration",
Olli Etuaho8073a952018-05-09 16:41:39 +0300128 "-Wnon-virtual-dtor",
Nico Weber79de62c2018-01-31 10:47:14 -0500129 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400130 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400131}
132
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600133# This config adds build-ids to the associated library.
134# -Wl is a special option that indicates that clang should pass the associated
135# option --build-id to the linker. This will cause a build-id section to be added
136# to the associated library. The build-id makes it possible for a debugger to
137# find the right symbol file to use.
138config("build_id_config") {
139 ldflags = [ "-Wl,--build-id" ]
140}
141
Tom Tan5c317532018-11-30 17:01:01 -0800142# Windows ARM64 is available since 10.0.16299 so no need to copy
143# d3dcompiler_47.dll because this file is available as inbox.
144if (is_win && target_cpu != "arm64") {
Daniel Bratell73941de2015-02-25 14:34:49 +0100145 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -0500146 sources = [
147 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
148 ]
149 outputs = [
150 "$root_out_dir/d3dcompiler_47.dll",
151 ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100152 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100153}
154
Jamie Madilla8503ce2016-07-18 13:47:12 -0400155angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400156
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400157# Holds the shared includes so we only need to list them once.
158source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400159 sources = libangle_includes
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400160}
161
162static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400163 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400164
Jamie Madille2e406c2016-06-02 13:04:10 -0400165 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400166 configs += [
167 ":extra_warnings",
168 ":internal_config",
169 ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400170
171 public_deps = [
172 ":angle_common",
173 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400174}
175
Corentin Walleza5615c62016-09-19 09:54:44 -0400176config("translator_disable_pool_alloc") {
177 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400178}
179
Cooper Partin75da1972015-06-16 15:03:14 -0700180config("debug_annotations_config") {
181 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500182 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700183 }
184}
185
Jamie Madille31fd872016-05-27 08:35:36 -0400186config("angle_release_asserts_config") {
187 if (dcheck_always_on) {
188 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
189 }
190}
191
Jamie Madille2e406c2016-06-02 13:04:10 -0400192config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400193 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500194 if (is_android) {
195 libs = [ "log" ]
196 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400197}
198
Jamie Madill4638dc92018-12-17 13:13:49 -0500199source_set("angle_system_utils") {
200 sources = angle_system_utils_sources
201
202 configs -= angle_undefine_configs
203 configs += [
204 ":extra_warnings",
205 ":internal_config",
206 ]
207}
208
Jamie Madill562e81b2015-01-14 14:31:02 -0500209static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400210 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700211
Jamie Madille2e406c2016-06-02 13:04:10 -0400212 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500213 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400214 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700215 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400216 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400217 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500218 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400219
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400220 public_deps = [
Jamie Madill4638dc92018-12-17 13:13:49 -0500221 ":angle_system_utils",
222 ":angle_version",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500223 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400224 ]
Jamie Madille1fd4752017-04-26 16:46:48 -0400225 public_configs = [ ":angle_common_config" ]
226 all_dependent_configs = [ ":angle_release_asserts_config" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500227}
228
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400229config("angle_image_util_config") {
230 include_dirs = [
231 "include",
232 "src",
233 ]
234}
235
Dirk Pranke313d9442016-07-13 18:01:55 -0700236static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400237 sources = libangle_image_util_sources
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400238
239 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500240 configs += [
241 ":internal_config",
242 ":extra_warnings",
243 ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400244
245 public_configs = [ ":angle_image_util_config" ]
246
247 public_deps = [
248 ":angle_common",
249 ]
250}
251
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600252config("angle_gl_visibility_config") {
253 if (is_win) {
254 defines = [
255 "GL_APICALL=",
256 "GL_API=",
257 ]
258 } else {
259 defines = [
260 "GL_APICALL=__attribute__((visibility(\"default\")))",
261 "GL_API=__attribute__((visibility(\"default\")))",
262 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600263 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600264}
265
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500266config("angle_gpu_info_util_config") {
267 include_dirs = [
268 "include",
269 "src",
270 ]
271}
272
273static_library("angle_gpu_info_util") {
274 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500275 configs += [
276 ":internal_config",
277 ":extra_warnings",
278 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500279
280 public_configs = [ ":angle_gpu_info_util_config" ]
281
282 public_deps = [
283 ":angle_common",
284 ]
285
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400286 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500287 deps = []
288 libs = []
289 defines = []
290
Ian Elliottd07c52e2018-06-22 15:42:09 -0600291 if (is_android) {
292 sources += [ "src/gpu_info_util/SystemInfo_android.cpp" ]
293 }
294
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700295 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400296 sources += libangle_gpu_info_util_win_sources
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700297 libs += [ "setupapi.lib" ]
298 defines += [ "GPU_INFO_USE_SETUPAPI" ]
299 }
300
Jamie Madillc10a0232018-12-03 10:13:36 -0500301 if (is_linux || is_fuchsia) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400302 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500303
304 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400305 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500306 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
307 defines += [ "GPU_INFO_USE_X11" ]
308 libs += [
309 "X11",
310 "Xi",
311 "Xext",
312 ]
313 }
314 }
315
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500316 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400317 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500318 defines += [ "GPU_INFO_USE_LIBPCI" ]
319 libs += [ "pci" ]
320 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500321
322 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400323 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500324 libs += [
325 "IOKit.framework",
326 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400327 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500328 ]
329 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500330}
331
Yuly Novikovea586542016-11-10 17:33:43 -0500332static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400333 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800334 defines = []
335
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700336 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400337 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800338 defines += [ "ANGLE_ENABLE_ESSL" ]
339 }
340
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700341 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400342 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800343 defines += [ "ANGLE_ENABLE_GLSL" ]
344 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400345
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700346 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400347 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800348 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100349 }
Jamie Madille794cd82017-01-13 17:29:51 -0500350
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700351 if (angle_enable_vulkan || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400352 sources += angle_translator_lib_vulkan_sources
Jamie Madille794cd82017-01-13 17:29:51 -0500353 defines += [ "ANGLE_ENABLE_VULKAN" ]
354 }
355
Jamie Madille2e406c2016-06-02 13:04:10 -0400356 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400357 configs += [
358 ":internal_config",
359 ":extra_warnings",
360 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700361 public_configs = [ ":external_config" ]
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700362 if (use_fuzzing_engine) {
Corentin Walleza5615c62016-09-19 09:54:44 -0400363 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
364 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400365
366 deps = [
367 ":includes",
368 ":preprocessor",
369 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500370
371 public_deps = [
372 ":angle_common",
373 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400374
375 if (is_win) {
376 # Necessary to suppress some system header xtree warnigns in Release.
377 # For some reason this warning doesn't get triggered in Chromium
378 cflags = [ "/wd4718" ]
379 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400380}
381
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400382source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700383 sources = [
384 "src/compiler/fuzz/translator_fuzzer.cpp",
385 ]
386
387 include_dirs = [
388 "include",
389 "src",
390 ]
391
392 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400393 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700394 ]
395}
396
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400397config("commit_id_config") {
398 include_dirs = [ "$root_gen_dir/angle" ]
Jamie Madill720ca442018-12-17 14:04:10 -0500399 visibility = [ ":commit_id" ]
400}
401
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200402commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
403if (angle_use_commit_id) {
404 action("commit_id") {
405 script = "src/commit_id.py"
406 outputs = [
407 commit_id_output_file,
408 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400409
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900410 # commit id should depend on angle's HEAD revision
Frank Henigmana7f97a22018-08-21 00:04:05 -0400411 inputs = [
412 ".git/HEAD",
413 ]
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900414
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200415 args = [
416 "gen",
417 rebase_path(".", root_build_dir),
418 rebase_path(commit_id_output_file, root_build_dir),
419 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400420
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200421 public_configs = [ ":commit_id_config" ]
422 }
423} else {
424 copy("commit_id") {
425 sources = [
426 "src/commit.h",
427 ]
428 outputs = [
429 commit_id_output_file,
430 ]
431 public_configs = [ ":commit_id_config" ]
432 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400433}
434
Jamie Madill4638dc92018-12-17 13:13:49 -0500435source_set("angle_version") {
436 sources = [
437 "src/common/version.h",
438 ]
439 public_deps = [
440 ":commit_id",
441 ]
442}
443
Jamie Madill562e81b2015-01-14 14:31:02 -0500444config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800445 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500446 defines = []
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500447 libs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500448 if (angle_enable_d3d9) {
449 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500450 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500451 if (angle_enable_d3d11) {
452 defines += [ "ANGLE_ENABLE_D3D11" ]
453 }
Geoff Langc588ac72015-02-13 15:41:41 -0500454 if (angle_enable_gl) {
455 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700456 if (use_x11) {
457 defines += [ "ANGLE_USE_X11" ]
458 }
Jamie Madill6d94f062017-10-21 22:19:40 -0400459 if (angle_enable_gl_null) {
460 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
461 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400462 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400463 if (angle_enable_vulkan) {
464 defines += [ "ANGLE_ENABLE_VULKAN" ]
465 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400466 if (angle_enable_null) {
467 defines += [ "ANGLE_ENABLE_NULL" ]
468 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500469 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400470
471 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800472 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
473 }
Yuly Novikovb29fccf2018-11-28 10:09:39 -0500474
475 if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
476 if (ndk_supports_nativewindow) {
477 libs += [ "nativewindow" ]
478 } else {
479 libs += [ "android" ]
480 }
481 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500482}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500483
Jamie Madillb62a1c22018-02-06 09:54:02 -0500484if (angle_enable_vulkan) {
485 # Use this target to include everything ANGLE needs for Vulkan.
486 group("angle_vulkan") {
487 deps = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500488 "$angle_root/third_party/glslang:glslang",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500489 ]
490 public_deps = [
Tobin Ehlisb971f492018-05-24 10:56:17 -0600491 "$angle_root/third_party/vulkan-headers:vulkan_headers",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500492 ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500493 public_configs = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500494 "$angle_root/third_party/glslang:glslang_config",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500495 "$angle_root/third_party/vulkan-validation-layers:vulkan_config",
496 ]
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600497 data_deps = []
Jamie Madillb62a1c22018-02-06 09:54:02 -0500498 if (!is_android) {
Tobin Ehlisb971f492018-05-24 10:56:17 -0600499 deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
500 data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
501 public_configs +=
502 [ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500503 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600504
505 if (angle_enable_vulkan_validation_layers) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600506 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600507 if (!is_android) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600508 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600509 }
510 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500511 }
512}
513
Jamie Madill562e81b2015-01-14 14:31:02 -0500514static_library("libANGLE") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400515 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500516
Jamie Madill5ea762a2017-06-07 14:59:51 -0400517 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500518 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500519 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500520 if (angle_link_glx) {
521 libs += [ "GL" ]
522 defines += [ "ANGLE_LINK_GLX" ]
523 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400524 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500525 ":angle_common",
Jamie Madill720ca442018-12-17 14:04:10 -0500526 ":angle_gpu_info_util",
Jamie Madill4638dc92018-12-17 13:13:49 -0500527 ":angle_version",
Jamie Madill720ca442018-12-17 14:04:10 -0500528 ":translator",
Jamie Madille2e406c2016-06-02 13:04:10 -0400529 ]
530 deps = [
Corentin Wallez878baf92017-02-15 13:57:16 -0500531 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500532 ":includes",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500533 ]
534
Jamie Madill562e81b2015-01-14 14:31:02 -0500535 # Shared D3D sources.
536 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400537 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400538
Jamie Madilledbc2442016-01-04 11:25:00 -0500539 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500540 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500541
Jamie Madill562e81b2015-01-14 14:31:02 -0500542 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400543 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500544 libs += [ "d3d9.lib" ]
545 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400546
Jamie Madill562e81b2015-01-14 14:31:02 -0500547 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400548 sources += libangle_d3d11_sources
549 sources += libangle_d3d11_win32_sources
Austin Kinross91e71ed2016-08-23 09:29:22 -0700550 libs += [ "dxguid.lib" ]
Brandon Jonesb77884b2018-10-10 09:07:12 -0700551 import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni")
552 sources += libangle_d3d11_blit_shaders
Jamie Madill562e81b2015-01-14 14:31:02 -0500553 }
554
Geoff Langc588ac72015-02-13 15:41:41 -0500555 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400556 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500557 include_dirs += [ "src/third_party/khronos" ]
558
Jamie Madill6d94f062017-10-21 22:19:40 -0400559 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400560 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400561 }
Geoff Langc588ac72015-02-13 15:41:41 -0500562 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400563 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500564 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400565 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400566 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400567 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500568 libs += [
569 "X11",
570 "Xi",
571 "Xext",
572 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400573 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400574 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400575 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400576 libs += [
577 "Cocoa.framework",
578 "IOSurface.framework",
579 "OpenGL.framework",
580 "QuartzCore.framework",
581 ]
582 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400583 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400584 sources += libangle_gl_egl_sources
585 sources += libangle_gl_egl_dl_sources
586 sources += libangle_gl_egl_android_sources
Yuly Novikova6426d62016-06-03 00:18:38 -0400587 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400588 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400589 configs += [ ":libdrm" ]
590 defines += [ "ANGLE_USE_OZONE" ]
591 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400592 sources += libangle_gl_egl_sources
593 sources += libangle_gl_egl_dl_sources
594 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400595 }
Geoff Langc588ac72015-02-13 15:41:41 -0500596 }
597
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400598 if (angle_enable_vulkan) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400599 sources += libangle_vulkan_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500600 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400601 sources += libangle_vulkan_win32_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500602 }
603 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400604 sources += libangle_vulkan_xcb_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500605 }
Yuly Novikov199f4292018-01-19 19:04:05 -0500606 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400607 sources += libangle_vulkan_android_sources
Shahbaz Youssefi749589f2018-10-25 12:48:49 -0400608 libs += [ "vulkan" ]
Yuly Novikov199f4292018-01-19 19:04:05 -0500609 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500610 deps += [ ":angle_vulkan" ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600611 public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
Jamie Madilld47044a2018-04-27 11:45:03 -0400612
613 # Include generated shaders.
614 import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
615 sources += angle_vulkan_internal_shaders
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400616 }
617
Geoff Langd08f3b32016-09-23 15:56:30 -0400618 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400619 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400620 }
621
Jamie Madill562e81b2015-01-14 14:31:02 -0500622 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500623 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400624 }
625
Jamie Madille2e406c2016-06-02 13:04:10 -0400626 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400627
Jamie Madill562e81b2015-01-14 14:31:02 -0500628 configs += [
Cooper Partin75da1972015-06-16 15:03:14 -0700629 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400630 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500631 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500632 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400633
Jamie Madill80ab03c2017-01-03 11:03:23 -0500634 public_configs = [ ":libANGLE_config" ]
635
Tom Tan5c317532018-11-30 17:01:01 -0800636 # Windows ARM64 is available since 10.0.16299 so no need to copy
637 # d3dcompiler_47.dll because this file is available as inbox.
638 if (is_win && target_cpu != "arm64") {
Jamie Madille2e406c2016-06-02 13:04:10 -0400639 data_deps = [
640 ":copy_compiler_dll",
641 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500642 }
643}
644
Robert Sesekdb8ae832016-06-21 11:47:03 -0400645config("shared_library_public_config") {
646 if (is_mac && !is_component_build) {
647 # Executable targets that depend on the shared libraries below need to have
648 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400649 ldflags = [
650 "-rpath",
651 "@executable_path/",
652 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400653 }
654}
655
Jamie Madill4638dc92018-12-17 13:13:49 -0500656config("library_name_config") {
657 defines = [
658 "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
659 "ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
660 ]
661}
662
Jamie Madill80ab03c2017-01-03 11:03:23 -0500663# This config controls export definitions on ANGLE API calls.
664config("angle_static") {
665 defines = [
666 "ANGLE_EXPORT=",
Jamie Madillba319ba2018-12-29 10:29:33 -0500667 "ANGLE_UTIL_EXPORT=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500668 "EGLAPI=",
669 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500670 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500671 ]
672}
673
Yuly Novikovad4f9642018-02-08 17:58:46 -0500674shared_library("libGLESv2${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400675 sources = libglesv2_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500676
Andrew Grieve949e0702017-01-16 09:44:49 -0500677 if (is_android) {
678 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600679 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500680 }
681
Jamie Madill562e81b2015-01-14 14:31:02 -0500682 if (is_win) {
Jamie Madill74a76322018-05-14 09:11:51 -0400683 ldflags = [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2_autogen.def",
684 root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500685 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800686
Robert Sesekdb8ae832016-06-21 11:47:03 -0400687 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400688 ldflags = [
689 "-install_name",
690 "@rpath/${target_name}.dylib",
691 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400692 public_configs = [ ":shared_library_public_config" ]
693 }
694
Jamie Madille2e406c2016-06-02 13:04:10 -0400695 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500696 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600697 ":angle_gl_visibility_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700698 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400699 ":extra_warnings",
Jamie Madill4638dc92018-12-17 13:13:49 -0500700 ":gl_prototypes",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500701 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500702 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400703
Jamie Madilledbc2442016-01-04 11:25:00 -0500704 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500705
706 deps = [
707 ":includes",
708 ":libANGLE",
709 ]
Jamie Madill720ca442018-12-17 14:04:10 -0500710
711 public_deps = [
Jamie Madill4638dc92018-12-17 13:13:49 -0500712 ":angle_version",
Jamie Madill720ca442018-12-17 14:04:10 -0500713 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500714}
715
716static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400717 sources = libglesv2_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500718
719 configs -= angle_undefine_configs
720 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500721 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400722 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500723 ":internal_config",
724 ]
725
726 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500727
728 deps = [
729 ":includes",
Jamie Madill720ca442018-12-17 14:04:10 -0500730 ]
731
732 public_deps = [
Jamie Madill562e81b2015-01-14 14:31:02 -0500733 ":libANGLE",
734 ]
735}
736
Yuly Novikovad4f9642018-02-08 17:58:46 -0500737shared_library("libGLESv1_CM${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400738 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500739
740 if (is_android) {
741 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600742 configs += [ ":build_id_config" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500743 }
Lingfeng Yang4edce332018-02-14 19:01:31 -0800744
745 if (is_mac && !is_component_build) {
746 ldflags = [
747 "-install_name",
748 "@rpath/${target_name}.dylib",
749 ]
750 public_configs = [ ":shared_library_public_config" ]
751 }
752
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500753 configs -= angle_undefine_configs
754 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600755 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500756 ":debug_annotations_config",
757 ":extra_warnings",
Jamie Madillba319ba2018-12-29 10:29:33 -0500758 ":gl_prototypes",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500759 ":internal_config",
760 ]
761
762 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500763
764 deps = [
765 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500766 ":libGLESv2${angle_libs_suffix}",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500767 ]
768}
769
770static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400771 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500772
773 configs -= angle_undefine_configs
774 configs += [
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500775 ":debug_annotations_config",
776 ":extra_warnings",
777 ":internal_config",
778 ]
779
780 public_configs = [ ":angle_static" ]
781
782 deps = [
783 ":includes",
784 ":libGLESv2_static",
785 ]
786}
787
Jamie Madill4638dc92018-12-17 13:13:49 -0500788config("libEGL_egl_loader_config") {
789 defines = [ "ANGLE_USE_EGL_LOADER" ]
790}
791
792source_set("libEGL_egl_loader") {
793 sources = [
794 "src/libEGL/egl_loader_autogen.cpp",
795 "src/libEGL/egl_loader_autogen.h",
796 ]
797
798 public_configs = [
799 ":libEGL_egl_loader_config",
800 ":gl_prototypes",
801 ":extra_warnings",
802 ":internal_config",
803 ]
804
805 deps = [
806 ":includes",
807 ]
808}
809
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -0700810if (!is_component_build && is_android && symbol_level != 0) {
811 action_foreach("compressed_symbols") {
812 sources = [
813 "${root_out_dir}/libEGL${angle_libs_suffix}.so",
814 "${root_out_dir}/libGLESv1_CM${angle_libs_suffix}.so",
815 "${root_out_dir}/libGLESv2${angle_libs_suffix}.so",
816 "${root_out_dir}/libfeature_support${angle_libs_suffix}.so",
817 ]
818
819 script = rebase_path("${root_build_dir}/android/compress_symbols.py",
820 root_build_dir)
821
822 deps = [
823 "//third_party/angle:libEGL${angle_libs_suffix}",
824 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}",
825 "//third_party/angle:libGLESv2${angle_libs_suffix}",
826 "//third_party/angle:libfeature_support${angle_libs_suffix}",
827 ]
828
829 outputs = [
830 "$root_out_dir/lib.compressed/{{source_file_part}}",
831 ]
832
833 android_nm = "${android_tool_prefix}nm"
834
835 args = [
836 "--objcopy",
837 rebase_path(android_objcopy, root_build_dir),
838 "--nm",
839 rebase_path(android_nm, root_build_dir),
840 "--sofile",
841 "{{source}}",
842 "--unstrippedsofile",
843 "{{source_dir}}/lib.unstripped/{{source_file_part}}",
844 "--output",
845 "{{source_dir}}/lib.compressed/{{source_file_part}}",
846 ]
847 }
848}
849
Yuly Novikovad4f9642018-02-08 17:58:46 -0500850shared_library("libEGL${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400851 sources = libegl_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500852
Andrew Grieve949e0702017-01-16 09:44:49 -0500853 if (is_android) {
854 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600855 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500856 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400857 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500858 configs += [
Corentin Wallezbeb81582015-09-02 10:30:55 -0400859 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400860 ":extra_warnings",
861 ":internal_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500862 ":library_name_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500863 ]
864
Jamie Madilledbc2442016-01-04 11:25:00 -0500865 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500866 if (is_win) {
867 defines += [ "EGLAPI=" ]
868 } else {
869 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
870 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500871
Jamie Madill80ab03c2017-01-03 11:03:23 -0500872 if (is_win) {
873 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
874 }
875
876 if (is_mac && !is_component_build) {
877 ldflags = [
878 "-install_name",
879 "@rpath/${target_name}.dylib",
880 ]
881 public_configs = [ ":shared_library_public_config" ]
882 }
883
Jamie Madill562e81b2015-01-14 14:31:02 -0500884 deps = [
Jamie Madill4638dc92018-12-17 13:13:49 -0500885 ":angle_system_utils",
886 ":angle_version",
887 ":libEGL_egl_loader",
Jamie Madill562e81b2015-01-14 14:31:02 -0500888 ]
Jamie Madill720ca442018-12-17 14:04:10 -0500889
890 public_deps = [
891 ":includes",
892 ]
Jamie Madill4638dc92018-12-17 13:13:49 -0500893
894 data_deps = [
895 ":libGLESv2${angle_libs_suffix}",
896 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500897}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400898
Jamie Madill80ab03c2017-01-03 11:03:23 -0500899static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400900 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500901
902 configs -= angle_undefine_configs
903 configs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500904 ":debug_annotations_config",
905 ":extra_warnings",
906 ":internal_config",
Jamie Madill4638dc92018-12-17 13:13:49 -0500907 ":library_name_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500908 ]
909
910 public_configs = [ ":angle_static" ]
911
912 deps = [
913 ":includes",
914 ":libGLESv2_static",
915 ]
916}
917
Frank Henigmanddc41202018-08-23 22:11:55 -0400918import("util/util.gni")
Jamie Madilledbc2442016-01-04 11:25:00 -0500919
Jamie Madillba319ba2018-12-29 10:29:33 -0500920config("angle_util_loader_config") {
921 defines = [ "ANGLE_USE_UTIL_LOADER" ]
922}
923
924source_set("angle_util_loader_headers") {
925 sources = [
926 "util/egl_loader_autogen.h",
927 "util/gles_loader_autogen.h",
928 "util/util_export.h",
929 ]
930
931 public_configs = [
932 ":angle_util_config",
933 ":angle_util_loader_config",
934 ":extra_warnings",
935 ":internal_config",
936 ":no_gl_prototypes",
937 ]
938
939 public_deps = [
940 ":includes",
941 ]
942}
943
944source_set("angle_util_loader") {
945 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
946
947 sources = [
948 "util/egl_loader_autogen.cpp",
949 "util/gles_loader_autogen.cpp",
950 ]
951
952 public_deps = [
953 ":angle_util_loader_headers",
954 ]
955}
956
Jamie Madilledbc2442016-01-04 11:25:00 -0500957config("angle_util_config") {
Jamie Madillba319ba2018-12-29 10:29:33 -0500958 include_dirs = [ "." ]
Frank Henigman77df6762016-06-13 16:39:01 -0400959 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500960 libs = [ "X11" ]
961 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500962}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400963
Jamie Madill80ab03c2017-01-03 11:03:23 -0500964foreach(is_shared_library,
965 [
966 true,
967 false,
968 ]) {
969 if (is_shared_library) {
970 library_type = "shared_library"
971 library_name = "angle_util"
Yuly Novikovad4f9642018-02-08 17:58:46 -0500972 dep_suffix = "${angle_libs_suffix}"
Jamie Madill80ab03c2017-01-03 11:03:23 -0500973 } else {
974 library_type = "static_library"
975 library_name = "angle_util_static"
976 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400977 }
978
Jamie Madill80ab03c2017-01-03 11:03:23 -0500979 target(library_type, library_name) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400980 sources = util_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500981
982 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400983 sources += util_win32_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500984 }
985
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600986 libs = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500987 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400988 sources += util_linux_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600989 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500990 "rt",
991 "dl",
992 ]
993 }
994
995 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400996 sources += util_osx_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600997 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500998 "AppKit.framework",
999 "QuartzCore.framework",
1000 ]
1001 }
1002
1003 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001004 sources += util_x11_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -05001005 }
1006
1007 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -05001008 if (is_shared_library) {
1009 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
1010 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -05001011
Jamie Madill80ab03c2017-01-03 11:03:23 -05001012 # To prevent linux sources filtering on android
1013 set_sources_assignment_filter([])
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001014 sources += util_linux_sources
1015 sources += util_android_sources
Yuly Novikovcd70aa42018-06-20 17:05:32 -04001016 libs += [
1017 "android",
1018 "log",
1019 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001020 }
1021
1022 if (use_ozone) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -04001023 sources += util_ozone_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -05001024 }
1025
1026 configs += [
1027 ":debug_annotations_config",
1028 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -04001029 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -04001030
Jamie Madill80ab03c2017-01-03 11:03:23 -05001031 public_configs = [
1032 ":angle_util_config",
1033 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -04001034 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -04001035
Jamie Madill80ab03c2017-01-03 11:03:23 -05001036 deps = [
1037 ":angle_common",
Yuly Novikova6426d62016-06-03 00:18:38 -04001038 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001039
1040 if (is_shared_library) {
1041 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
1042
1043 if (is_mac && !is_component_build) {
1044 ldflags = [
1045 "-install_name",
1046 "@rpath/lib${target_name}.dylib",
1047 ]
1048 public_configs += [ ":shared_library_public_config" ]
1049 }
Jamie Madillba319ba2018-12-29 10:29:33 -05001050
1051 deps += [ ":angle_util_loader" ]
1052 public_configs += [ ":no_gl_prototypes" ]
1053 } else {
1054 public_configs += [
1055 ":angle_static",
1056 ":gl_prototypes",
1057 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -05001058 }
Yuly Novikova6426d62016-06-03 00:18:38 -04001059 }
Corentin Wallezbeb81582015-09-02 10:30:55 -04001060}
Ken Russellfcadd082017-06-28 14:01:15 -07001061
1062# Convenience targets for some of the samples so they can be built
1063# with Chromium's toolchain.
1064
1065executable("angle_shader_translator") {
1066 testonly = true
1067
1068 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -04001069 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -07001070 ]
1071
1072 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -04001073 ":translator",
Ken Russellfcadd082017-06-28 14:01:15 -07001074 ]
1075}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001076
Ian Elliotta9d579e2018-11-28 11:44:48 -07001077config("angle_feature_support_config") {
1078 include_dirs = [
1079 "include",
1080 "src",
1081 ]
1082 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
1083 if (is_debug) {
1084 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001085 }
Ian Elliotta9d579e2018-11-28 11:44:48 -07001086}
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001087
Ian Elliotta9d579e2018-11-28 11:44:48 -07001088shared_library("libfeature_support${angle_libs_suffix}") {
1089 if (is_android) {
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001090 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
1091 configs += [ ":build_id_config" ]
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001092 libs = [ "log" ]
Ian Elliotta9d579e2018-11-28 11:44:48 -07001093 }
1094 configs -= angle_undefine_configs
1095 configs += [
1096 ":extra_warnings",
1097 ":internal_config",
1098 ]
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001099
Ian Elliotta9d579e2018-11-28 11:44:48 -07001100 public_configs = [
1101 ":angle_feature_support_config",
1102 "third_party/jsoncpp:jsoncpp_config",
1103 ]
1104
1105 if (is_mac && !is_component_build) {
1106 ldflags = [
1107 "-install_name",
1108 "@rpath/${target_name}.dylib",
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001109 ]
Ian Elliotta9d579e2018-11-28 11:44:48 -07001110 public_configs += [ ":shared_library_public_config" ]
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -06001111 }
1112
Ian Elliotta9d579e2018-11-28 11:44:48 -07001113 sources = [
1114 "src/feature_support_util/feature_support_util.cpp",
1115 "src/feature_support_util/feature_support_util.h",
1116 ]
1117 deps = [
1118 ":angle_gpu_info_util",
1119 "third_party/jsoncpp:jsoncpp",
1120 ]
1121}
1122
Courtney Goeltzenleuchter92b16ea2018-12-12 17:06:47 -07001123if (!is_component_build && is_android &&
1124 current_toolchain == default_toolchain) {
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001125 # Package ANGLE libraries for pre-installed system image
Cody Northrop8e636442018-11-30 16:24:11 -07001126 angle_apk("aosp_apk") {
1127 package_name = "com.android.angle"
1128 apk_name = "AngleAosp"
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -06001129 }
Cody Northrop2c0e06d2018-11-29 09:00:08 -07001130
Cody Northrop8e636442018-11-30 16:24:11 -07001131 angle_apk("google_apk") {
1132 package_name = "com.google.android.angle"
Courtney Goeltzenleuchter8c1508b2018-07-30 09:46:27 -06001133 apk_name = "ANGLEPrebuilt"
Cody Northrop8e636442018-11-30 16:24:11 -07001134 }
1135
1136 group("angle_apks") {
1137 deps = [
1138 ":aosp_apk",
1139 ":google_apk",
1140 ]
1141 }
1142
1143 # Include a temporary target until we update builders to use angle_apks
1144 group("angle_apk") {
1145 deps = [
1146 ":angle_apks",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -06001147 ]
1148 }
1149}