blob: 25850896a9ce42717030b5a3155f9ed0a15c1b93 [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
Ian Elliottabcb2b32018-08-29 17:04:15 -0600226config("angle_feature_support_util_config") {
227 include_dirs = [
228 "include",
229 "src",
230 ]
231 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
232}
233
234static_library("angle_feature_support_util") {
Ian Elliottabcb2b32018-08-29 17:04:15 -0600235 configs -= angle_undefine_configs
236 configs += [
237 ":internal_config",
238 ":extra_warnings",
239 ]
240
Ian Elliott4d42ef32018-09-06 10:38:50 -0400241 public_configs = [
242 ":angle_feature_support_util_config",
243 "third_party/jsoncpp:jsoncpp_config",
244 ]
Ian Elliottabcb2b32018-08-29 17:04:15 -0600245
246 public_deps = [
247 ":angle_common",
248 ]
Ian Elliott4d42ef32018-09-06 10:38:50 -0400249
250 sources = [
251 "src/feature_support_util/feature_support_util.cpp",
252 "src/feature_support_util/feature_support_util.h",
253 ]
254 deps = [
255 "third_party/jsoncpp:jsoncpp",
256 ]
Ian Elliottabcb2b32018-08-29 17:04:15 -0600257}
258
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500259config("angle_gpu_info_util_config") {
260 include_dirs = [
261 "include",
262 "src",
263 ]
264}
265
266static_library("angle_gpu_info_util") {
267 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500268 configs += [
269 ":internal_config",
270 ":extra_warnings",
271 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500272
273 public_configs = [ ":angle_gpu_info_util_config" ]
274
275 public_deps = [
276 ":angle_common",
277 ]
278
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400279 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500280 deps = []
281 libs = []
282 defines = []
283
Ian Elliottd07c52e2018-06-22 15:42:09 -0600284 if (is_android) {
285 sources += [ "src/gpu_info_util/SystemInfo_android.cpp" ]
286 }
287
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700288 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400289 sources += libangle_gpu_info_util_win_sources
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700290 libs += [ "setupapi.lib" ]
291 defines += [ "GPU_INFO_USE_SETUPAPI" ]
292 }
293
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500294 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400295 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500296
297 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400298 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500299 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
300 defines += [ "GPU_INFO_USE_X11" ]
301 libs += [
302 "X11",
303 "Xi",
304 "Xext",
305 ]
306 }
307 }
308
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500309 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400310 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500311 defines += [ "GPU_INFO_USE_LIBPCI" ]
312 libs += [ "pci" ]
313 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500314
315 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400316 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500317 libs += [
318 "IOKit.framework",
319 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400320 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500321 ]
322 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500323}
324
Yuly Novikovea586542016-11-10 17:33:43 -0500325static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400326 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800327 defines = []
328
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700329 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400330 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800331 defines += [ "ANGLE_ENABLE_ESSL" ]
332 }
333
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700334 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400335 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800336 defines += [ "ANGLE_ENABLE_GLSL" ]
337 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400338
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700339 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400340 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800341 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100342 }
Jamie Madille794cd82017-01-13 17:29:51 -0500343
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700344 if (angle_enable_vulkan || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400345 sources += angle_translator_lib_vulkan_sources
Jamie Madille794cd82017-01-13 17:29:51 -0500346 defines += [ "ANGLE_ENABLE_VULKAN" ]
347 }
348
Jamie Madille2e406c2016-06-02 13:04:10 -0400349 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400350 configs += [
351 ":internal_config",
352 ":extra_warnings",
353 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700354 public_configs = [ ":external_config" ]
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700355 if (use_fuzzing_engine) {
Corentin Walleza5615c62016-09-19 09:54:44 -0400356 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
357 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400358
359 deps = [
360 ":includes",
361 ":preprocessor",
362 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500363
364 public_deps = [
365 ":angle_common",
366 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400367
368 if (is_win) {
369 # Necessary to suppress some system header xtree warnigns in Release.
370 # For some reason this warning doesn't get triggered in Chromium
371 cflags = [ "/wd4718" ]
372 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400373}
374
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400375source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700376 sources = [
377 "src/compiler/fuzz/translator_fuzzer.cpp",
378 ]
379
380 include_dirs = [
381 "include",
382 "src",
383 ]
384
385 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400386 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700387 ]
388}
389
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400390config("commit_id_config") {
391 include_dirs = [ "$root_gen_dir/angle" ]
392}
393
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200394commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
395if (angle_use_commit_id) {
396 action("commit_id") {
397 script = "src/commit_id.py"
398 outputs = [
399 commit_id_output_file,
400 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400401
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900402 # commit id should depend on angle's HEAD revision
Frank Henigmana7f97a22018-08-21 00:04:05 -0400403 inputs = [
404 ".git/HEAD",
405 ]
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900406
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200407 args = [
408 "gen",
409 rebase_path(".", root_build_dir),
410 rebase_path(commit_id_output_file, root_build_dir),
411 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400412
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200413 public_configs = [ ":commit_id_config" ]
414 }
415} else {
416 copy("commit_id") {
417 sources = [
418 "src/commit.h",
419 ]
420 outputs = [
421 commit_id_output_file,
422 ]
423 public_configs = [ ":commit_id_config" ]
424 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400425}
426
Jamie Madill562e81b2015-01-14 14:31:02 -0500427config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800428 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500429 defines = []
430 if (angle_enable_d3d9) {
431 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500432 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500433 if (angle_enable_d3d11) {
434 defines += [ "ANGLE_ENABLE_D3D11" ]
435 }
Geoff Langc588ac72015-02-13 15:41:41 -0500436 if (angle_enable_gl) {
437 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700438 if (use_x11) {
439 defines += [ "ANGLE_USE_X11" ]
440 }
Jamie Madill6d94f062017-10-21 22:19:40 -0400441 if (angle_enable_gl_null) {
442 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
443 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400444 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400445 if (angle_enable_vulkan) {
446 defines += [ "ANGLE_ENABLE_VULKAN" ]
447 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400448 if (angle_enable_null) {
449 defines += [ "ANGLE_ENABLE_NULL" ]
450 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500451 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400452
453 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800454 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
455 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500456}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500457
Jamie Madillb62a1c22018-02-06 09:54:02 -0500458if (angle_enable_vulkan) {
459 # Use this target to include everything ANGLE needs for Vulkan.
460 group("angle_vulkan") {
461 deps = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500462 "$angle_root/third_party/glslang:glslang",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500463 ]
464 public_deps = [
Tobin Ehlisb971f492018-05-24 10:56:17 -0600465 "$angle_root/third_party/vulkan-headers:vulkan_headers",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500466 ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500467 public_configs = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500468 "$angle_root/third_party/glslang:glslang_config",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500469 "$angle_root/third_party/vulkan-validation-layers:vulkan_config",
470 ]
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600471 data_deps = []
Jamie Madillb62a1c22018-02-06 09:54:02 -0500472 if (!is_android) {
Tobin Ehlisb971f492018-05-24 10:56:17 -0600473 deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
474 data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
475 public_configs +=
476 [ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500477 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600478
479 if (angle_enable_vulkan_validation_layers) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600480 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600481 if (!is_android) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600482 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600483 }
484 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500485 }
486}
487
Jamie Madill562e81b2015-01-14 14:31:02 -0500488static_library("libANGLE") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400489 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500490
Jamie Madill5ea762a2017-06-07 14:59:51 -0400491 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500492 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500493 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500494 if (angle_link_glx) {
495 libs += [ "GL" ]
496 defines += [ "ANGLE_LINK_GLX" ]
497 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400498 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500499 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400500 ]
501 deps = [
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500502 ":angle_gpu_info_util",
Corentin Wallez878baf92017-02-15 13:57:16 -0500503 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500504 ":commit_id",
505 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400506 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500507 ]
Ian Elliott4d42ef32018-09-06 10:38:50 -0400508 if (is_android) {
509 deps += [ ":angle_feature_support_util" ]
510 }
Corentin Wallezcc068e92016-02-29 16:37:04 -0500511
Jamie Madill562e81b2015-01-14 14:31:02 -0500512 # Shared D3D sources.
513 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400514 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400515
Jamie Madilledbc2442016-01-04 11:25:00 -0500516 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500517 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500518
Jamie Madill562e81b2015-01-14 14:31:02 -0500519 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400520 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500521 libs += [ "d3d9.lib" ]
522 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400523
Jamie Madill562e81b2015-01-14 14:31:02 -0500524 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400525 sources += libangle_d3d11_sources
526 sources += libangle_d3d11_win32_sources
Austin Kinross91e71ed2016-08-23 09:29:22 -0700527 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500528 }
529
Geoff Langc588ac72015-02-13 15:41:41 -0500530 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400531 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500532 include_dirs += [ "src/third_party/khronos" ]
533
Jamie Madill6d94f062017-10-21 22:19:40 -0400534 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400535 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400536 }
Geoff Langc588ac72015-02-13 15:41:41 -0500537 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400538 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500539 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400540 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400541 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400542 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500543 libs += [
544 "X11",
545 "Xi",
546 "Xext",
547 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400548 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400549 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400550 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400551 libs += [
552 "Cocoa.framework",
553 "IOSurface.framework",
554 "OpenGL.framework",
555 "QuartzCore.framework",
556 ]
557 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400558 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400559 sources += libangle_gl_egl_sources
560 sources += libangle_gl_egl_dl_sources
561 sources += libangle_gl_egl_android_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600562 if (ndk_supports_nativewindow) {
563 libs += [ "nativewindow" ]
564 } else {
565 libs += [ "android" ]
566 }
567 libs += [ "log" ]
Yuly Novikova6426d62016-06-03 00:18:38 -0400568 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400569 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400570 configs += [ ":libdrm" ]
571 defines += [ "ANGLE_USE_OZONE" ]
572 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400573 sources += libangle_gl_egl_sources
574 sources += libangle_gl_egl_dl_sources
575 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400576 }
Geoff Langc588ac72015-02-13 15:41:41 -0500577 }
578
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400579 if (angle_enable_vulkan) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400580 sources += libangle_vulkan_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500581 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400582 sources += libangle_vulkan_win32_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500583 }
584 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400585 sources += libangle_vulkan_xcb_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500586 }
Yuly Novikov199f4292018-01-19 19:04:05 -0500587 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400588 sources += libangle_vulkan_android_sources
Yuly Novikov199f4292018-01-19 19:04:05 -0500589 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500590 deps += [ ":angle_vulkan" ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600591 public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
Jamie Madilld47044a2018-04-27 11:45:03 -0400592
593 # Include generated shaders.
594 import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
595 sources += angle_vulkan_internal_shaders
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400596 }
597
Geoff Langd08f3b32016-09-23 15:56:30 -0400598 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400599 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400600 }
601
Jamie Madill562e81b2015-01-14 14:31:02 -0500602 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500603 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400604 }
605
Jamie Madille2e406c2016-06-02 13:04:10 -0400606 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400607
Jamie Madill562e81b2015-01-14 14:31:02 -0500608 configs += [
609 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700610 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400611 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500612 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500613 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400614
Jamie Madill80ab03c2017-01-03 11:03:23 -0500615 public_configs = [ ":libANGLE_config" ]
616
Jamie Madill562e81b2015-01-14 14:31:02 -0500617 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400618 data_deps = [
619 ":copy_compiler_dll",
620 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500621 }
622}
623
Robert Sesekdb8ae832016-06-21 11:47:03 -0400624config("shared_library_public_config") {
625 if (is_mac && !is_component_build) {
626 # Executable targets that depend on the shared libraries below need to have
627 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400628 ldflags = [
629 "-rpath",
630 "@executable_path/",
631 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400632 }
633}
634
Jamie Madill80ab03c2017-01-03 11:03:23 -0500635# This config controls export definitions on ANGLE API calls.
636config("angle_static") {
637 defines = [
638 "ANGLE_EXPORT=",
639 "EGLAPI=",
640 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500641 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500642 ]
643}
644
Yuly Novikovad4f9642018-02-08 17:58:46 -0500645shared_library("libGLESv2${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400646 sources = libglesv2_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500647
Andrew Grieve949e0702017-01-16 09:44:49 -0500648 if (is_android) {
649 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600650 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500651 }
652
Jamie Madill562e81b2015-01-14 14:31:02 -0500653 if (is_win) {
Jamie Madill74a76322018-05-14 09:11:51 -0400654 ldflags = [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2_autogen.def",
655 root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500656 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800657
Robert Sesekdb8ae832016-06-21 11:47:03 -0400658 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400659 ldflags = [
660 "-install_name",
661 "@rpath/${target_name}.dylib",
662 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400663 public_configs = [ ":shared_library_public_config" ]
664 }
665
Jamie Madille2e406c2016-06-02 13:04:10 -0400666 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500667 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500668 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700669 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400670 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500671 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500672 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400673
Jamie Madilledbc2442016-01-04 11:25:00 -0500674 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500675 if (is_win) {
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500676 defines += [
677 "GL_APICALL=",
678 "GL_API=",
679 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500680 } else {
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500681 defines += [
682 "GL_APICALL=__attribute__((visibility(\"default\")))",
683 "GL_API=__attribute__((visibility(\"default\")))",
684 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500685 }
686
687 deps = [
688 ":includes",
689 ":libANGLE",
690 ]
691}
692
693static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400694 sources = libglesv2_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500695
696 configs -= angle_undefine_configs
697 configs += [
698 ":commit_id_config",
699 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400700 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500701 ":internal_config",
702 ]
703
704 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500705
706 deps = [
707 ":includes",
708 ":libANGLE",
709 ]
710}
711
Yuly Novikovad4f9642018-02-08 17:58:46 -0500712shared_library("libGLESv1_CM${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400713 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500714
715 if (is_android) {
716 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600717 configs += [ ":build_id_config" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500718 }
Lingfeng Yang4edce332018-02-14 19:01:31 -0800719
720 if (is_mac && !is_component_build) {
721 ldflags = [
722 "-install_name",
723 "@rpath/${target_name}.dylib",
724 ]
725 public_configs = [ ":shared_library_public_config" ]
726 }
727
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500728 configs -= angle_undefine_configs
729 configs += [
730 ":commit_id_config",
731 ":debug_annotations_config",
732 ":extra_warnings",
733 ":internal_config",
734 ]
735
736 defines = []
737 if (is_win) {
738 defines += [
739 "GL_APICALL=",
740 "GL_API=",
741 ]
742 } else {
743 defines += [
744 "GL_APICALL=__attribute__((visibility(\"default\")))",
745 "GL_API=__attribute__((visibility(\"default\")))",
746 ]
747 }
748
749 deps = [
750 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500751 ":libGLESv2${angle_libs_suffix}",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500752 ]
753}
754
755static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400756 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500757
758 configs -= angle_undefine_configs
759 configs += [
760 ":commit_id_config",
761 ":debug_annotations_config",
762 ":extra_warnings",
763 ":internal_config",
764 ]
765
766 public_configs = [ ":angle_static" ]
767
768 deps = [
769 ":includes",
770 ":libGLESv2_static",
771 ]
772}
773
Yuly Novikovad4f9642018-02-08 17:58:46 -0500774shared_library("libEGL${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400775 sources = libegl_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500776
Andrew Grieve949e0702017-01-16 09:44:49 -0500777 if (is_android) {
778 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600779 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500780 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400781 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500782 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500783 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400784 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400785 ":extra_warnings",
786 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500787 ]
788
Jamie Madilledbc2442016-01-04 11:25:00 -0500789 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500790 if (is_win) {
791 defines += [ "EGLAPI=" ]
792 } else {
793 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
794 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500795
Jamie Madill80ab03c2017-01-03 11:03:23 -0500796 if (is_win) {
797 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
798 }
799
800 if (is_mac && !is_component_build) {
801 ldflags = [
802 "-install_name",
803 "@rpath/${target_name}.dylib",
804 ]
805 public_configs = [ ":shared_library_public_config" ]
806 }
807
Jamie Madill562e81b2015-01-14 14:31:02 -0500808 deps = [
809 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500810 ":libGLESv2${angle_libs_suffix}",
Jamie Madill562e81b2015-01-14 14:31:02 -0500811 ]
812}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400813
Jamie Madill80ab03c2017-01-03 11:03:23 -0500814static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400815 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500816
817 configs -= angle_undefine_configs
818 configs += [
819 ":commit_id_config",
820 ":debug_annotations_config",
821 ":extra_warnings",
822 ":internal_config",
823 ]
824
825 public_configs = [ ":angle_static" ]
826
827 deps = [
828 ":includes",
829 ":libGLESv2_static",
830 ]
831}
832
Frank Henigmanddc41202018-08-23 22:11:55 -0400833import("util/util.gni")
Jamie Madilledbc2442016-01-04 11:25:00 -0500834
835config("angle_util_config") {
836 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400837 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500838 libs = [ "X11" ]
839 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500840}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400841
Jamie Madill80ab03c2017-01-03 11:03:23 -0500842foreach(is_shared_library,
843 [
844 true,
845 false,
846 ]) {
847 if (is_shared_library) {
848 library_type = "shared_library"
849 library_name = "angle_util"
Yuly Novikovad4f9642018-02-08 17:58:46 -0500850 dep_suffix = "${angle_libs_suffix}"
Jamie Madill80ab03c2017-01-03 11:03:23 -0500851 } else {
852 library_type = "static_library"
853 library_name = "angle_util_static"
854 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400855 }
856
Jamie Madill80ab03c2017-01-03 11:03:23 -0500857 target(library_type, library_name) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400858 sources = util_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500859
860 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400861 sources += util_win32_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500862 }
863
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600864 libs = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500865 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400866 sources += util_linux_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600867 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500868 "rt",
869 "dl",
870 ]
871 }
872
873 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400874 sources += util_osx_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600875 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500876 "AppKit.framework",
877 "QuartzCore.framework",
878 ]
879 }
880
881 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400882 sources += util_x11_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500883 }
884
885 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -0500886 if (is_shared_library) {
887 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
888 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500889
Jamie Madill80ab03c2017-01-03 11:03:23 -0500890 # To prevent linux sources filtering on android
891 set_sources_assignment_filter([])
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400892 sources += util_linux_sources
893 sources += util_android_sources
Yuly Novikovcd70aa42018-06-20 17:05:32 -0400894 libs += [
895 "android",
896 "log",
897 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500898 }
899
900 if (use_ozone) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400901 sources += util_ozone_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500902 }
903
904 configs += [
905 ":debug_annotations_config",
906 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400907 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400908
Jamie Madill80ab03c2017-01-03 11:03:23 -0500909 public_configs = [
910 ":angle_util_config",
911 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400912 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400913
Jamie Madill80ab03c2017-01-03 11:03:23 -0500914 deps = [
915 ":angle_common",
916 ":libEGL${dep_suffix}",
917 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400918 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500919
920 if (is_shared_library) {
921 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
922
923 if (is_mac && !is_component_build) {
924 ldflags = [
925 "-install_name",
926 "@rpath/lib${target_name}.dylib",
927 ]
928 public_configs += [ ":shared_library_public_config" ]
929 }
930 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400931 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400932}
Ken Russellfcadd082017-06-28 14:01:15 -0700933
934# Convenience targets for some of the samples so they can be built
935# with Chromium's toolchain.
936
937executable("angle_shader_translator") {
938 testonly = true
939
940 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400941 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -0700942 ]
943
944 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400945 ":translator",
Ken Russellfcadd082017-06-28 14:01:15 -0700946 ]
947}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600948
949if (is_android) {
950 # Package ANGLE libraries for pre-installed system image
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600951 android_assets("angle_apk_assets") {
952 disable_compression = true
953 sources = [
954 "src/feature_support_util/a4a_rules.json",
955 ]
956 }
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600957 android_apk("angle_apk") {
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600958 deps = [
Shahbaz Youssefi996628a2018-09-24 16:39:26 -0400959 ":angle_apk_assets",
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600960 ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600961 if (build_apk_secondary_abi && android_64bit_target_cpu) {
962 secondary_abi_shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600963 "//third_party/angle:libEGL${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600964 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600965 "//third_party/angle:libGLESv2${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600966 ]
967 }
968
969 android_manifest = "AndroidManifest.xml"
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600970
Courtney Goeltzenleuchter8c1508b2018-07-30 09:46:27 -0600971 apk_name = "ANGLEPrebuilt"
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600972 uncompress_shared_libraries = true
973 shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600974 "//third_party/angle:libEGL${angle_libs_suffix}",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600975 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600976 "//third_party/angle:libGLESv2${angle_libs_suffix}",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600977 ]
978 }
979}