blob: ca4445b246feb8cbb55c261a85d24055631d3a80 [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
13 import("//build/config/android/rules.gni")
14}
Corentin Wallez51e2ad12015-05-26 11:32:58 -040015
Corentin Wallez16d4e472017-03-20 13:06:19 -040016declare_args() {
17 # Use the PCI lib to collect GPU information on Linux.
18 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
19 (use_x11 || use_ozone)
Frank Henigmane42ec182017-12-11 23:58:53 -050020
21 # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
22 angle_link_glx = false
Corentin Wallez16d4e472017-03-20 13:06:19 -040023}
24
Frank Henigmand0ef13a2017-08-28 22:53:24 -040025if (!build_with_chromium) {
26 group("all") {
27 testonly = true
28 deps = [
29 ":angle_shader_translator",
30 ":translator_fuzzer",
31 "//samples:all",
32 "//src/tests:all",
33 ]
34 }
35}
36
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040037if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040038 pkg_config("libdrm") {
39 packages = [ "libdrm" ]
40 }
Frank Henigman77df6762016-06-13 16:39:01 -040041}
42
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020043angle_git_is_present = exec_script("src/commit_id.py",
44 [
45 "check",
46 rebase_path(".", root_build_dir),
47 ],
48 "value")
49
50angle_use_commit_id = angle_git_is_present == 1
51
Frank Henigmanddc41202018-08-23 22:11:55 -040052import("src/libGLESv2.gni")
53import("src/compiler.gni")
Brett Wilson04bac602014-07-16 14:19:18 -070054
Brett Wilson2f5469c2014-07-22 17:00:17 -070055# This config is exported to dependent targets (and also applied to internal
56# ones).
57config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050058 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070059}
60
Jamie Madill72f5b5e2014-06-23 15:13:02 -040061# This config is applied to internal Angle targets (not pushed to dependents).
62config("internal_config") {
63 include_dirs = [
64 "include",
65 "src",
66 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050067
68 # Prevent the GL headers from redeclaring ANGLE entry points.
69 defines = [
70 "GL_GLEXT_PROTOTYPES",
71 "EGL_EGLEXT_PROTOTYPES",
72 ]
Jamie Madill6de51852017-04-12 09:53:01 -040073
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060074 if (angle_64bit_current_cpu) {
Yuly Novikovc4f1dd82017-10-25 17:02:29 -040075 defines += [ "ANGLE_IS_64_BIT_CPU" ]
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -060076 } else {
77 defines += [ "ANGLE_IS_32_BIT_CPU" ]
Jamie Madill6de51852017-04-12 09:53:01 -040078 }
Geoff Langb02fc662018-08-21 09:48:01 -040079
80 if (angle_force_thread_safety) {
81 defines += [ "ANGLE_FORCE_THREAD_SAFETY=1" ]
82 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -040083}
84
Jamie Madill509a1d42016-07-18 10:10:29 -040085config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -040086 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -040087
Jamie Madill509a1d42016-07-18 10:10:29 -040088 # Enable more default warnings on Windows.
89 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -040090 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -040091 "/we4244", # Conversion: possible loss of data.
92 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040093 "/we4458", # declaration hides class member.
Geoff Langb9440532017-11-28 13:26:34 -050094 "/we4800", # forcing value to bool.
95 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -040096 ]
97 }
Ben Wagner211bff32017-10-10 23:53:20 -040098 if (is_clang) {
Nico Weber79de62c2018-01-31 10:47:14 -050099 cflags += [
100 # Remove when crbug.com/428099 is resolved.
101 "-Winconsistent-missing-override",
Courtney Goeltzenleuchter15215262018-04-11 12:14:55 -0600102 "-Wunneeded-internal-declaration",
Olli Etuaho8073a952018-05-09 16:41:39 +0300103 "-Wnon-virtual-dtor",
Nico Weber79de62c2018-01-31 10:47:14 -0500104 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400105 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400106}
107
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600108# This config adds build-ids to the associated library.
109# -Wl is a special option that indicates that clang should pass the associated
110# option --build-id to the linker. This will cause a build-id section to be added
111# to the associated library. The build-id makes it possible for a debugger to
112# find the right symbol file to use.
113config("build_id_config") {
114 ldflags = [ "-Wl,--build-id" ]
115}
116
Daniel Bratell73941de2015-02-25 14:34:49 +0100117if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +0100118 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -0500119 sources = [
120 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
121 ]
122 outputs = [
123 "$root_out_dir/d3dcompiler_47.dll",
124 ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100125 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100126}
127
Jamie Madilla8503ce2016-07-18 13:47:12 -0400128angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400129
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400130# Holds the shared includes so we only need to list them once.
131source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400132 sources = libangle_includes
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400133}
134
135static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400136 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400137
Jamie Madille2e406c2016-06-02 13:04:10 -0400138 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400139 configs += [
140 ":extra_warnings",
141 ":internal_config",
142 ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400143
144 public_deps = [
145 ":angle_common",
146 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400147}
148
Corentin Walleza5615c62016-09-19 09:54:44 -0400149config("translator_disable_pool_alloc") {
150 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400151}
152
Cooper Partin75da1972015-06-16 15:03:14 -0700153config("debug_annotations_config") {
154 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500155 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700156 }
157}
158
Jamie Madille31fd872016-05-27 08:35:36 -0400159config("angle_release_asserts_config") {
160 if (dcheck_always_on) {
161 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
162 }
163}
164
Jamie Madille2e406c2016-06-02 13:04:10 -0400165config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400166 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500167 if (is_android) {
168 libs = [ "log" ]
169 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400170}
171
Jamie Madill562e81b2015-01-14 14:31:02 -0500172static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400173 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700174
Jamie Madilld7ebfb92018-02-15 16:34:29 -0500175 if (is_linux || is_android || is_fuchsia) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400176 sources += libangle_common_linux_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500177 }
178
179 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400180 sources += libangle_common_mac_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500181 }
182
183 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400184 sources += libangle_common_win_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500185 }
186
Jamie Madille2e406c2016-06-02 13:04:10 -0400187 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500188 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400189 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700190 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400191 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400192 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500193 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400194
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400195 public_deps = [
196 ":commit_id",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500197 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400198 ]
Jamie Madille1fd4752017-04-26 16:46:48 -0400199 public_configs = [ ":angle_common_config" ]
200 all_dependent_configs = [ ":angle_release_asserts_config" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500201}
202
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400203config("angle_image_util_config") {
204 include_dirs = [
205 "include",
206 "src",
207 ]
208}
209
Dirk Pranke313d9442016-07-13 18:01:55 -0700210static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400211 sources = libangle_image_util_sources
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400212
213 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500214 configs += [
215 ":internal_config",
216 ":extra_warnings",
217 ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400218
219 public_configs = [ ":angle_image_util_config" ]
220
221 public_deps = [
222 ":angle_common",
223 ]
224}
225
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500226config("angle_gpu_info_util_config") {
227 include_dirs = [
228 "include",
229 "src",
230 ]
231}
232
233static_library("angle_gpu_info_util") {
234 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500235 configs += [
236 ":internal_config",
237 ":extra_warnings",
238 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500239
240 public_configs = [ ":angle_gpu_info_util_config" ]
241
242 public_deps = [
243 ":angle_common",
244 ]
245
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400246 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500247 deps = []
248 libs = []
249 defines = []
250
Ian Elliottd07c52e2018-06-22 15:42:09 -0600251 if (is_android) {
252 sources += [ "src/gpu_info_util/SystemInfo_android.cpp" ]
253 }
254
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700255 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400256 sources += libangle_gpu_info_util_win_sources
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700257 libs += [ "setupapi.lib" ]
258 defines += [ "GPU_INFO_USE_SETUPAPI" ]
259 }
260
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500261 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400262 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500263
264 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400265 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500266 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
267 defines += [ "GPU_INFO_USE_X11" ]
268 libs += [
269 "X11",
270 "Xi",
271 "Xext",
272 ]
273 }
274 }
275
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500276 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400277 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500278 defines += [ "GPU_INFO_USE_LIBPCI" ]
279 libs += [ "pci" ]
280 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500281
282 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400283 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500284 libs += [
285 "IOKit.framework",
286 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400287 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500288 ]
289 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500290}
291
Yuly Novikovea586542016-11-10 17:33:43 -0500292static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400293 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800294 defines = []
295
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700296 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400297 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800298 defines += [ "ANGLE_ENABLE_ESSL" ]
299 }
300
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700301 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400302 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800303 defines += [ "ANGLE_ENABLE_GLSL" ]
304 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400305
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700306 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400307 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800308 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100309 }
Jamie Madille794cd82017-01-13 17:29:51 -0500310
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700311 if (angle_enable_vulkan || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400312 sources += angle_translator_lib_vulkan_sources
Jamie Madille794cd82017-01-13 17:29:51 -0500313 defines += [ "ANGLE_ENABLE_VULKAN" ]
314 }
315
Jamie Madille2e406c2016-06-02 13:04:10 -0400316 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400317 configs += [
318 ":internal_config",
319 ":extra_warnings",
320 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700321 public_configs = [ ":external_config" ]
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700322 if (use_fuzzing_engine) {
Corentin Walleza5615c62016-09-19 09:54:44 -0400323 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
324 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400325
326 deps = [
327 ":includes",
328 ":preprocessor",
329 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500330
331 public_deps = [
332 ":angle_common",
333 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400334
335 if (is_win) {
336 # Necessary to suppress some system header xtree warnigns in Release.
337 # For some reason this warning doesn't get triggered in Chromium
338 cflags = [ "/wd4718" ]
339 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400340}
341
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400342source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700343 sources = [
344 "src/compiler/fuzz/translator_fuzzer.cpp",
345 ]
346
347 include_dirs = [
348 "include",
349 "src",
350 ]
351
352 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400353 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700354 ]
355}
356
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400357config("commit_id_config") {
358 include_dirs = [ "$root_gen_dir/angle" ]
359}
360
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200361commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
362if (angle_use_commit_id) {
363 action("commit_id") {
364 script = "src/commit_id.py"
365 outputs = [
366 commit_id_output_file,
367 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400368
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900369 # commit id should depend on angle's HEAD revision
Frank Henigmana7f97a22018-08-21 00:04:05 -0400370 inputs = [
371 ".git/HEAD",
372 ]
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900373
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200374 args = [
375 "gen",
376 rebase_path(".", root_build_dir),
377 rebase_path(commit_id_output_file, root_build_dir),
378 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400379
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200380 public_configs = [ ":commit_id_config" ]
381 }
382} else {
383 copy("commit_id") {
384 sources = [
385 "src/commit.h",
386 ]
387 outputs = [
388 commit_id_output_file,
389 ]
390 public_configs = [ ":commit_id_config" ]
391 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400392}
393
Jamie Madill562e81b2015-01-14 14:31:02 -0500394config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800395 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500396 defines = []
397 if (angle_enable_d3d9) {
398 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500399 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500400 if (angle_enable_d3d11) {
401 defines += [ "ANGLE_ENABLE_D3D11" ]
402 }
Geoff Langc588ac72015-02-13 15:41:41 -0500403 if (angle_enable_gl) {
404 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700405 if (use_x11) {
406 defines += [ "ANGLE_USE_X11" ]
407 }
Jamie Madill6d94f062017-10-21 22:19:40 -0400408 if (angle_enable_gl_null) {
409 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
410 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400411 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400412 if (angle_enable_vulkan) {
413 defines += [ "ANGLE_ENABLE_VULKAN" ]
414 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400415 if (angle_enable_null) {
416 defines += [ "ANGLE_ENABLE_NULL" ]
417 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500418 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400419
420 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800421 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
422 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500423}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500424
Jamie Madillb62a1c22018-02-06 09:54:02 -0500425if (angle_enable_vulkan) {
426 # Use this target to include everything ANGLE needs for Vulkan.
427 group("angle_vulkan") {
428 deps = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500429 "$angle_root/third_party/glslang:glslang",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500430 ]
431 public_deps = [
Tobin Ehlisb971f492018-05-24 10:56:17 -0600432 "$angle_root/third_party/vulkan-headers:vulkan_headers",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500433 ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500434 public_configs = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500435 "$angle_root/third_party/glslang:glslang_config",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500436 "$angle_root/third_party/vulkan-validation-layers:vulkan_config",
437 ]
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600438 data_deps = []
Jamie Madillb62a1c22018-02-06 09:54:02 -0500439 if (!is_android) {
Tobin Ehlisb971f492018-05-24 10:56:17 -0600440 deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
441 data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
442 public_configs +=
443 [ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500444 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600445
446 if (angle_enable_vulkan_validation_layers) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600447 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600448 if (!is_android) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600449 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600450 }
451 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500452 }
453}
454
Jamie Madill562e81b2015-01-14 14:31:02 -0500455static_library("libANGLE") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400456 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500457
Jamie Madill5ea762a2017-06-07 14:59:51 -0400458 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500459 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500460 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500461 if (angle_link_glx) {
462 libs += [ "GL" ]
463 defines += [ "ANGLE_LINK_GLX" ]
464 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400465 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500466 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400467 ]
468 deps = [
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500469 ":angle_gpu_info_util",
Corentin Wallez878baf92017-02-15 13:57:16 -0500470 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500471 ":commit_id",
472 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400473 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500474 ]
475
Jamie Madill562e81b2015-01-14 14:31:02 -0500476 # Shared D3D sources.
477 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400478 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400479
Jamie Madilledbc2442016-01-04 11:25:00 -0500480 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500481 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500482
Jamie Madill562e81b2015-01-14 14:31:02 -0500483 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400484 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500485 libs += [ "d3d9.lib" ]
486 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400487
Jamie Madill562e81b2015-01-14 14:31:02 -0500488 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400489 sources += libangle_d3d11_sources
490 sources += libangle_d3d11_win32_sources
Austin Kinross91e71ed2016-08-23 09:29:22 -0700491 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500492 }
493
Geoff Langc588ac72015-02-13 15:41:41 -0500494 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400495 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500496 include_dirs += [ "src/third_party/khronos" ]
497
Jamie Madill6d94f062017-10-21 22:19:40 -0400498 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400499 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400500 }
Geoff Langc588ac72015-02-13 15:41:41 -0500501 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400502 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500503 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400504 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400505 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400506 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500507 libs += [
508 "X11",
509 "Xi",
510 "Xext",
511 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400512 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400513 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400514 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400515 libs += [
516 "Cocoa.framework",
517 "IOSurface.framework",
518 "OpenGL.framework",
519 "QuartzCore.framework",
520 ]
521 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400522 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400523 sources += libangle_gl_egl_sources
524 sources += libangle_gl_egl_dl_sources
525 sources += libangle_gl_egl_android_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600526 if (ndk_supports_nativewindow) {
527 libs += [ "nativewindow" ]
528 } else {
529 libs += [ "android" ]
530 }
531 libs += [ "log" ]
Yuly Novikova6426d62016-06-03 00:18:38 -0400532 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400533 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400534 configs += [ ":libdrm" ]
535 defines += [ "ANGLE_USE_OZONE" ]
536 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400537 sources += libangle_gl_egl_sources
538 sources += libangle_gl_egl_dl_sources
539 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400540 }
Geoff Langc588ac72015-02-13 15:41:41 -0500541 }
542
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400543 if (angle_enable_vulkan) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400544 sources += libangle_vulkan_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500545 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400546 sources += libangle_vulkan_win32_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500547 }
548 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400549 sources += libangle_vulkan_xcb_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500550 }
Yuly Novikov199f4292018-01-19 19:04:05 -0500551 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400552 sources += libangle_vulkan_android_sources
Yuly Novikov199f4292018-01-19 19:04:05 -0500553 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500554 deps += [ ":angle_vulkan" ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600555 public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
Jamie Madilld47044a2018-04-27 11:45:03 -0400556
557 # Include generated shaders.
558 import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
559 sources += angle_vulkan_internal_shaders
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400560 }
561
Geoff Langd08f3b32016-09-23 15:56:30 -0400562 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400563 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400564 }
565
Jamie Madill562e81b2015-01-14 14:31:02 -0500566 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500567 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400568 }
569
Jamie Madille2e406c2016-06-02 13:04:10 -0400570 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400571
Jamie Madill562e81b2015-01-14 14:31:02 -0500572 configs += [
573 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700574 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400575 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500576 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500577 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400578
Jamie Madill80ab03c2017-01-03 11:03:23 -0500579 public_configs = [ ":libANGLE_config" ]
580
Jamie Madill562e81b2015-01-14 14:31:02 -0500581 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400582 data_deps = [
583 ":copy_compiler_dll",
584 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500585 }
586}
587
Robert Sesekdb8ae832016-06-21 11:47:03 -0400588config("shared_library_public_config") {
589 if (is_mac && !is_component_build) {
590 # Executable targets that depend on the shared libraries below need to have
591 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400592 ldflags = [
593 "-rpath",
594 "@executable_path/",
595 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400596 }
597}
598
Jamie Madill80ab03c2017-01-03 11:03:23 -0500599# This config controls export definitions on ANGLE API calls.
600config("angle_static") {
601 defines = [
602 "ANGLE_EXPORT=",
603 "EGLAPI=",
604 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500605 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500606 ]
607}
608
Yuly Novikovad4f9642018-02-08 17:58:46 -0500609shared_library("libGLESv2${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400610 sources = libglesv2_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500611
Andrew Grieve949e0702017-01-16 09:44:49 -0500612 if (is_android) {
613 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600614 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500615 }
616
Jamie Madill562e81b2015-01-14 14:31:02 -0500617 if (is_win) {
Jamie Madill74a76322018-05-14 09:11:51 -0400618 ldflags = [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2_autogen.def",
619 root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500620 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800621
Robert Sesekdb8ae832016-06-21 11:47:03 -0400622 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400623 ldflags = [
624 "-install_name",
625 "@rpath/${target_name}.dylib",
626 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400627 public_configs = [ ":shared_library_public_config" ]
628 }
629
Jamie Madille2e406c2016-06-02 13:04:10 -0400630 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500631 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500632 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700633 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400634 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500635 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500636 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400637
Jamie Madilledbc2442016-01-04 11:25:00 -0500638 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500639 if (is_win) {
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500640 defines += [
641 "GL_APICALL=",
642 "GL_API=",
643 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500644 } else {
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500645 defines += [
646 "GL_APICALL=__attribute__((visibility(\"default\")))",
647 "GL_API=__attribute__((visibility(\"default\")))",
648 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500649 }
650
651 deps = [
652 ":includes",
653 ":libANGLE",
654 ]
655}
656
657static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400658 sources = libglesv2_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500659
660 configs -= angle_undefine_configs
661 configs += [
662 ":commit_id_config",
663 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400664 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500665 ":internal_config",
666 ]
667
668 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500669
670 deps = [
671 ":includes",
672 ":libANGLE",
673 ]
674}
675
Yuly Novikovad4f9642018-02-08 17:58:46 -0500676shared_library("libGLESv1_CM${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400677 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500678
679 if (is_android) {
680 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600681 configs += [ ":build_id_config" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500682 }
Lingfeng Yang4edce332018-02-14 19:01:31 -0800683
684 if (is_mac && !is_component_build) {
685 ldflags = [
686 "-install_name",
687 "@rpath/${target_name}.dylib",
688 ]
689 public_configs = [ ":shared_library_public_config" ]
690 }
691
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500692 configs -= angle_undefine_configs
693 configs += [
694 ":commit_id_config",
695 ":debug_annotations_config",
696 ":extra_warnings",
697 ":internal_config",
698 ]
699
700 defines = []
701 if (is_win) {
702 defines += [
703 "GL_APICALL=",
704 "GL_API=",
705 ]
706 } else {
707 defines += [
708 "GL_APICALL=__attribute__((visibility(\"default\")))",
709 "GL_API=__attribute__((visibility(\"default\")))",
710 ]
711 }
712
713 deps = [
714 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500715 ":libGLESv2${angle_libs_suffix}",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500716 ]
717}
718
719static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400720 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500721
722 configs -= angle_undefine_configs
723 configs += [
724 ":commit_id_config",
725 ":debug_annotations_config",
726 ":extra_warnings",
727 ":internal_config",
728 ]
729
730 public_configs = [ ":angle_static" ]
731
732 deps = [
733 ":includes",
734 ":libGLESv2_static",
735 ]
736}
737
Yuly Novikovad4f9642018-02-08 17:58:46 -0500738shared_library("libEGL${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400739 sources = libegl_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500740
Andrew Grieve949e0702017-01-16 09:44:49 -0500741 if (is_android) {
742 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600743 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500744 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400745 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500746 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500747 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400748 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400749 ":extra_warnings",
750 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500751 ]
752
Jamie Madilledbc2442016-01-04 11:25:00 -0500753 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500754 if (is_win) {
755 defines += [ "EGLAPI=" ]
756 } else {
757 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
758 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500759
Jamie Madill80ab03c2017-01-03 11:03:23 -0500760 if (is_win) {
761 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
762 }
763
764 if (is_mac && !is_component_build) {
765 ldflags = [
766 "-install_name",
767 "@rpath/${target_name}.dylib",
768 ]
769 public_configs = [ ":shared_library_public_config" ]
770 }
771
Jamie Madill562e81b2015-01-14 14:31:02 -0500772 deps = [
773 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500774 ":libGLESv2${angle_libs_suffix}",
Jamie Madill562e81b2015-01-14 14:31:02 -0500775 ]
776}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400777
Jamie Madill80ab03c2017-01-03 11:03:23 -0500778static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400779 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500780
781 configs -= angle_undefine_configs
782 configs += [
783 ":commit_id_config",
784 ":debug_annotations_config",
785 ":extra_warnings",
786 ":internal_config",
787 ]
788
789 public_configs = [ ":angle_static" ]
790
791 deps = [
792 ":includes",
793 ":libGLESv2_static",
794 ]
795}
796
Frank Henigmanddc41202018-08-23 22:11:55 -0400797import("util/util.gni")
Jamie Madilledbc2442016-01-04 11:25:00 -0500798
799config("angle_util_config") {
800 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400801 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500802 libs = [ "X11" ]
803 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500804}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400805
Jamie Madill80ab03c2017-01-03 11:03:23 -0500806foreach(is_shared_library,
807 [
808 true,
809 false,
810 ]) {
811 if (is_shared_library) {
812 library_type = "shared_library"
813 library_name = "angle_util"
Yuly Novikovad4f9642018-02-08 17:58:46 -0500814 dep_suffix = "${angle_libs_suffix}"
Jamie Madill80ab03c2017-01-03 11:03:23 -0500815 } else {
816 library_type = "static_library"
817 library_name = "angle_util_static"
818 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400819 }
820
Jamie Madill80ab03c2017-01-03 11:03:23 -0500821 target(library_type, library_name) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400822 sources = util_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500823
824 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400825 sources += util_win32_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500826 }
827
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600828 libs = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500829 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400830 sources += util_linux_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600831 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500832 "rt",
833 "dl",
834 ]
835 }
836
837 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400838 sources += util_osx_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600839 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500840 "AppKit.framework",
841 "QuartzCore.framework",
842 ]
843 }
844
845 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400846 sources += util_x11_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500847 }
848
849 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -0500850 if (is_shared_library) {
851 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
852 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500853
Jamie Madill80ab03c2017-01-03 11:03:23 -0500854 # To prevent linux sources filtering on android
855 set_sources_assignment_filter([])
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400856 sources += util_linux_sources
857 sources += util_android_sources
Yuly Novikovcd70aa42018-06-20 17:05:32 -0400858 libs += [
859 "android",
860 "log",
861 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500862 }
863
864 if (use_ozone) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400865 sources += util_ozone_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500866 }
867
868 configs += [
869 ":debug_annotations_config",
870 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400871 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400872
Jamie Madill80ab03c2017-01-03 11:03:23 -0500873 public_configs = [
874 ":angle_util_config",
875 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400876 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400877
Jamie Madill80ab03c2017-01-03 11:03:23 -0500878 deps = [
879 ":angle_common",
880 ":libEGL${dep_suffix}",
881 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400882 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500883
884 if (is_shared_library) {
885 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
886
887 if (is_mac && !is_component_build) {
888 ldflags = [
889 "-install_name",
890 "@rpath/lib${target_name}.dylib",
891 ]
892 public_configs += [ ":shared_library_public_config" ]
893 }
894 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400895 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400896}
Ken Russellfcadd082017-06-28 14:01:15 -0700897
898# Convenience targets for some of the samples so they can be built
899# with Chromium's toolchain.
900
901executable("angle_shader_translator") {
902 testonly = true
903
904 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400905 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -0700906 ]
907
908 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400909 ":translator",
Ken Russellfcadd082017-06-28 14:01:15 -0700910 ]
911}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600912
913if (is_android) {
914 # Package ANGLE libraries for pre-installed system image
915 android_apk("angle_apk") {
916 if (build_apk_secondary_abi && android_64bit_target_cpu) {
917 secondary_abi_shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600918 "//third_party/angle:libEGL${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600919 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600920 "//third_party/angle:libGLESv2${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600921 ]
922 }
923
924 android_manifest = "AndroidManifest.xml"
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600925
926 # requires_sdk_api_level_23 tells the apk tool that this apk is only
927 # supported on M or later releases (which is true for Vulkan).
928 # Allows tool to optimize for that.
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600929 requires_sdk_api_level_23 = true
Courtney Goeltzenleuchter8c1508b2018-07-30 09:46:27 -0600930 apk_name = "ANGLEPrebuilt"
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600931 uncompress_shared_libraries = true
932 shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600933 "//third_party/angle:libEGL${angle_libs_suffix}",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600934 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600935 "//third_party/angle:libGLESv2${angle_libs_suffix}",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600936 ]
937 }
938}