blob: 5b45331d66d0f95a816cd4979146a545ae6f7662 [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 }
Shahbaz Youssefi25224e72018-10-22 11:56:02 -040083
84 if (angle_enable_vulkan) {
85 if (angle_enable_vulkan_gpu_trace_events) {
86 defines += [ "ANGLE_ENABLE_VULKAN_GPU_TRACE_EVENTS=1" ]
87 }
88 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -040089}
90
Jamie Madill509a1d42016-07-18 10:10:29 -040091config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -040092 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -040093
Jamie Madill509a1d42016-07-18 10:10:29 -040094 # Enable more default warnings on Windows.
95 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -040096 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -040097 "/we4244", # Conversion: possible loss of data.
98 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040099 "/we4458", # declaration hides class member.
Geoff Langb9440532017-11-28 13:26:34 -0500100 "/we4800", # forcing value to bool.
101 "/we4838", # narrowing conversion.
Jamie Madill509a1d42016-07-18 10:10:29 -0400102 ]
103 }
Ben Wagner211bff32017-10-10 23:53:20 -0400104 if (is_clang) {
Nico Weber79de62c2018-01-31 10:47:14 -0500105 cflags += [
106 # Remove when crbug.com/428099 is resolved.
107 "-Winconsistent-missing-override",
Courtney Goeltzenleuchter15215262018-04-11 12:14:55 -0600108 "-Wunneeded-internal-declaration",
Olli Etuaho8073a952018-05-09 16:41:39 +0300109 "-Wnon-virtual-dtor",
Nico Weber79de62c2018-01-31 10:47:14 -0500110 ]
Ben Wagner211bff32017-10-10 23:53:20 -0400111 }
Jamie Madill509a1d42016-07-18 10:10:29 -0400112}
113
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600114# This config adds build-ids to the associated library.
115# -Wl is a special option that indicates that clang should pass the associated
116# option --build-id to the linker. This will cause a build-id section to be added
117# to the associated library. The build-id makes it possible for a debugger to
118# find the right symbol file to use.
119config("build_id_config") {
120 ldflags = [ "-Wl,--build-id" ]
121}
122
Daniel Bratell73941de2015-02-25 14:34:49 +0100123if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +0100124 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -0500125 sources = [
126 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
127 ]
128 outputs = [
129 "$root_out_dir/d3dcompiler_47.dll",
130 ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100131 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100132}
133
Jamie Madilla8503ce2016-07-18 13:47:12 -0400134angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400135
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400136# Holds the shared includes so we only need to list them once.
137source_set("includes") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400138 sources = libangle_includes
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400139}
140
141static_library("preprocessor") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400142 sources = angle_preprocessor_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400143
Jamie Madille2e406c2016-06-02 13:04:10 -0400144 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400145 configs += [
146 ":extra_warnings",
147 ":internal_config",
148 ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400149
150 public_deps = [
151 ":angle_common",
152 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400153}
154
Corentin Walleza5615c62016-09-19 09:54:44 -0400155config("translator_disable_pool_alloc") {
156 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400157}
158
Cooper Partin75da1972015-06-16 15:03:14 -0700159config("debug_annotations_config") {
160 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500161 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700162 }
163}
164
Jamie Madille31fd872016-05-27 08:35:36 -0400165config("angle_release_asserts_config") {
166 if (dcheck_always_on) {
167 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
168 }
169}
170
Jamie Madille2e406c2016-06-02 13:04:10 -0400171config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400172 include_dirs = [ "src/common/third_party/base" ]
Yuly Novikove7624002018-01-27 18:27:07 -0500173 if (is_android) {
174 libs = [ "log" ]
175 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400176}
177
Jamie Madill562e81b2015-01-14 14:31:02 -0500178static_library("angle_common") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400179 sources = libangle_common_sources
Cooper Partin75da1972015-06-16 15:03:14 -0700180
Jamie Madilld7ebfb92018-02-15 16:34:29 -0500181 if (is_linux || is_android || is_fuchsia) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400182 sources += libangle_common_linux_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500183 }
184
185 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400186 sources += libangle_common_mac_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500187 }
188
189 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400190 sources += libangle_common_win_sources
Jamie Madilldcab56a2017-01-05 14:47:34 -0500191 }
192
Jamie Madille2e406c2016-06-02 13:04:10 -0400193 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500194 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400195 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700196 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400197 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400198 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500199 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400200
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400201 public_deps = [
202 ":commit_id",
Jamie Madill8d986bf2018-02-21 08:28:01 -0500203 ":includes",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400204 ]
Jamie Madille1fd4752017-04-26 16:46:48 -0400205 public_configs = [ ":angle_common_config" ]
206 all_dependent_configs = [ ":angle_release_asserts_config" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500207}
208
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400209config("angle_image_util_config") {
210 include_dirs = [
211 "include",
212 "src",
213 ]
214}
215
Dirk Pranke313d9442016-07-13 18:01:55 -0700216static_library("angle_image_util") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400217 sources = libangle_image_util_sources
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400218
219 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500220 configs += [
221 ":internal_config",
222 ":extra_warnings",
223 ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400224
225 public_configs = [ ":angle_image_util_config" ]
226
227 public_deps = [
228 ":angle_common",
229 ]
230}
231
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600232config("angle_gl_visibility_config") {
233 if (is_win) {
234 defines = [
235 "GL_APICALL=",
236 "GL_API=",
237 ]
238 } else {
239 defines = [
240 "GL_APICALL=__attribute__((visibility(\"default\")))",
241 "GL_API=__attribute__((visibility(\"default\")))",
242 ]
Courtney Goeltzenleuchtere7ece9e2018-10-08 16:43:43 -0600243 }
Ian Elliottabcb2b32018-08-29 17:04:15 -0600244}
245
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500246config("angle_gpu_info_util_config") {
247 include_dirs = [
248 "include",
249 "src",
250 ]
251}
252
253static_library("angle_gpu_info_util") {
254 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500255 configs += [
256 ":internal_config",
257 ":extra_warnings",
258 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500259
260 public_configs = [ ":angle_gpu_info_util_config" ]
261
262 public_deps = [
263 ":angle_common",
264 ]
265
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400266 sources = libangle_gpu_info_util_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500267 deps = []
268 libs = []
269 defines = []
270
Ian Elliottd07c52e2018-06-22 15:42:09 -0600271 if (is_android) {
272 sources += [ "src/gpu_info_util/SystemInfo_android.cpp" ]
273 }
274
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700275 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400276 sources += libangle_gpu_info_util_win_sources
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700277 libs += [ "setupapi.lib" ]
278 defines += [ "GPU_INFO_USE_SETUPAPI" ]
279 }
280
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500281 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400282 sources += libangle_gpu_info_util_linux_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500283
284 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400285 sources += libangle_gpu_info_util_x11_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500286 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
287 defines += [ "GPU_INFO_USE_X11" ]
288 libs += [
289 "X11",
290 "Xi",
291 "Xext",
292 ]
293 }
294 }
295
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500296 if (use_libpci) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400297 sources += libangle_gpu_info_util_libpci_sources
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500298 defines += [ "GPU_INFO_USE_LIBPCI" ]
299 libs += [ "pci" ]
300 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500301
302 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400303 sources += libangle_gpu_info_util_mac_sources
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500304 libs += [
305 "IOKit.framework",
306 "CoreFoundation.framework",
Corentin Wallez163965d2017-10-11 11:38:55 -0400307 "CoreGraphics.framework",
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500308 ]
309 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500310}
311
Yuly Novikovea586542016-11-10 17:33:43 -0500312static_library("translator") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400313 sources = angle_translator_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800314 defines = []
315
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700316 if (angle_enable_essl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400317 sources += angle_translator_essl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800318 defines += [ "ANGLE_ENABLE_ESSL" ]
319 }
320
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700321 if (angle_enable_glsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400322 sources += angle_translator_glsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800323 defines += [ "ANGLE_ENABLE_GLSL" ]
324 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400325
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700326 if (angle_enable_hlsl || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400327 sources += angle_translator_hlsl_sources
Austin Kinross82b5ab62015-12-11 09:30:15 -0800328 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100329 }
Jamie Madille794cd82017-01-13 17:29:51 -0500330
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700331 if (angle_enable_vulkan || use_fuzzing_engine) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400332 sources += angle_translator_lib_vulkan_sources
Jamie Madille794cd82017-01-13 17:29:51 -0500333 defines += [ "ANGLE_ENABLE_VULKAN" ]
334 }
335
Jamie Madille2e406c2016-06-02 13:04:10 -0400336 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400337 configs += [
338 ":internal_config",
339 ":extra_warnings",
340 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700341 public_configs = [ ":external_config" ]
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700342 if (use_fuzzing_engine) {
Corentin Walleza5615c62016-09-19 09:54:44 -0400343 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
344 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400345
346 deps = [
347 ":includes",
348 ":preprocessor",
349 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500350
351 public_deps = [
352 ":angle_common",
353 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400354
355 if (is_win) {
356 # Necessary to suppress some system header xtree warnigns in Release.
357 # For some reason this warning doesn't get triggered in Chromium
358 cflags = [ "/wd4718" ]
359 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400360}
361
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400362source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700363 sources = [
364 "src/compiler/fuzz/translator_fuzzer.cpp",
365 ]
366
367 include_dirs = [
368 "include",
369 "src",
370 ]
371
372 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400373 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700374 ]
375}
376
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400377config("commit_id_config") {
378 include_dirs = [ "$root_gen_dir/angle" ]
379}
380
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200381commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
382if (angle_use_commit_id) {
383 action("commit_id") {
384 script = "src/commit_id.py"
385 outputs = [
386 commit_id_output_file,
387 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400388
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900389 # commit id should depend on angle's HEAD revision
Frank Henigmana7f97a22018-08-21 00:04:05 -0400390 inputs = [
391 ".git/HEAD",
392 ]
Takuto Ikutac93eeaa2018-08-07 16:25:42 +0900393
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200394 args = [
395 "gen",
396 rebase_path(".", root_build_dir),
397 rebase_path(commit_id_output_file, root_build_dir),
398 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400399
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200400 public_configs = [ ":commit_id_config" ]
401 }
402} else {
403 copy("commit_id") {
404 sources = [
405 "src/commit.h",
406 ]
407 outputs = [
408 commit_id_output_file,
409 ]
410 public_configs = [ ":commit_id_config" ]
411 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400412}
413
Jamie Madill562e81b2015-01-14 14:31:02 -0500414config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800415 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500416 defines = []
417 if (angle_enable_d3d9) {
418 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500419 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500420 if (angle_enable_d3d11) {
421 defines += [ "ANGLE_ENABLE_D3D11" ]
422 }
Geoff Langc588ac72015-02-13 15:41:41 -0500423 if (angle_enable_gl) {
424 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700425 if (use_x11) {
426 defines += [ "ANGLE_USE_X11" ]
427 }
Jamie Madill6d94f062017-10-21 22:19:40 -0400428 if (angle_enable_gl_null) {
429 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
430 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400431 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400432 if (angle_enable_vulkan) {
433 defines += [ "ANGLE_ENABLE_VULKAN" ]
434 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400435 if (angle_enable_null) {
436 defines += [ "ANGLE_ENABLE_NULL" ]
437 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500438 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400439
440 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800441 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
442 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500443}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500444
Jamie Madillb62a1c22018-02-06 09:54:02 -0500445if (angle_enable_vulkan) {
446 # Use this target to include everything ANGLE needs for Vulkan.
447 group("angle_vulkan") {
448 deps = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500449 "$angle_root/third_party/glslang:glslang",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500450 ]
451 public_deps = [
Tobin Ehlisb971f492018-05-24 10:56:17 -0600452 "$angle_root/third_party/vulkan-headers:vulkan_headers",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500453 ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500454 public_configs = [
Jamie Madilla1134ba2018-02-07 15:24:47 -0500455 "$angle_root/third_party/glslang:glslang_config",
Jamie Madillb62a1c22018-02-06 09:54:02 -0500456 "$angle_root/third_party/vulkan-validation-layers:vulkan_config",
457 ]
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600458 data_deps = []
Jamie Madillb62a1c22018-02-06 09:54:02 -0500459 if (!is_android) {
Tobin Ehlisb971f492018-05-24 10:56:17 -0600460 deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
461 data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
462 public_configs +=
463 [ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
Jamie Madillb62a1c22018-02-06 09:54:02 -0500464 }
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600465
466 if (angle_enable_vulkan_validation_layers) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600467 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600468 if (!is_android) {
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600469 data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
Courtney Goeltzenleuchterec100962018-04-10 13:43:46 -0600470 }
471 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500472 }
473}
474
Jamie Madill562e81b2015-01-14 14:31:02 -0500475static_library("libANGLE") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400476 sources = libangle_sources
Geoff Lang2b5420c2014-11-19 14:20:15 -0500477
Jamie Madill5ea762a2017-06-07 14:59:51 -0400478 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500479 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500480 defines = []
Frank Henigmane42ec182017-12-11 23:58:53 -0500481 if (angle_link_glx) {
482 libs += [ "GL" ]
483 defines += [ "ANGLE_LINK_GLX" ]
484 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400485 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500486 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400487 ]
488 deps = [
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500489 ":angle_gpu_info_util",
Corentin Wallez878baf92017-02-15 13:57:16 -0500490 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500491 ":commit_id",
492 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400493 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500494 ]
495
Jamie Madill562e81b2015-01-14 14:31:02 -0500496 # Shared D3D sources.
497 if (angle_enable_d3d9 || angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400498 sources += libangle_d3d_shared_sources
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400499
Jamie Madilledbc2442016-01-04 11:25:00 -0500500 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500501 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500502
Jamie Madill562e81b2015-01-14 14:31:02 -0500503 if (angle_enable_d3d9) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400504 sources += libangle_d3d9_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500505 libs += [ "d3d9.lib" ]
506 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400507
Jamie Madill562e81b2015-01-14 14:31:02 -0500508 if (angle_enable_d3d11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400509 sources += libangle_d3d11_sources
510 sources += libangle_d3d11_win32_sources
Austin Kinross91e71ed2016-08-23 09:29:22 -0700511 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500512 }
513
Geoff Langc588ac72015-02-13 15:41:41 -0500514 if (angle_enable_gl) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400515 sources += libangle_gl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500516 include_dirs += [ "src/third_party/khronos" ]
517
Jamie Madill6d94f062017-10-21 22:19:40 -0400518 if (angle_enable_gl_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400519 sources += libangle_gl_null_sources
Jamie Madill6d94f062017-10-21 22:19:40 -0400520 }
Geoff Langc588ac72015-02-13 15:41:41 -0500521 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400522 sources += libangle_gl_wgl_sources
Geoff Langc588ac72015-02-13 15:41:41 -0500523 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400524 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400525 sources += libangle_gl_glx_sources
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400526 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500527 libs += [
528 "X11",
529 "Xi",
530 "Xext",
531 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400532 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400533 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400534 sources += libangle_gl_cgl_sources
Nico Weberde44d3a2016-05-13 17:27:57 -0400535 libs += [
536 "Cocoa.framework",
537 "IOSurface.framework",
538 "OpenGL.framework",
539 "QuartzCore.framework",
540 ]
541 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400542 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400543 sources += libangle_gl_egl_sources
544 sources += libangle_gl_egl_dl_sources
545 sources += libangle_gl_egl_android_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600546 if (ndk_supports_nativewindow) {
547 libs += [ "nativewindow" ]
548 } else {
549 libs += [ "android" ]
550 }
551 libs += [ "log" ]
Yuly Novikova6426d62016-06-03 00:18:38 -0400552 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400553 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400554 configs += [ ":libdrm" ]
555 defines += [ "ANGLE_USE_OZONE" ]
556 deps += [ "//third_party/minigbm" ]
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400557 sources += libangle_gl_egl_sources
558 sources += libangle_gl_egl_dl_sources
559 sources += libangle_gl_ozone_sources
Frank Henigman77df6762016-06-13 16:39:01 -0400560 }
Geoff Langc588ac72015-02-13 15:41:41 -0500561 }
562
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400563 if (angle_enable_vulkan) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400564 sources += libangle_vulkan_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500565 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400566 sources += libangle_vulkan_win32_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500567 }
568 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400569 sources += libangle_vulkan_xcb_sources
Frank Henigman29f148b2016-11-23 21:05:36 -0500570 }
Yuly Novikov199f4292018-01-19 19:04:05 -0500571 if (is_android) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400572 sources += libangle_vulkan_android_sources
Shahbaz Youssefi749589f2018-10-25 12:48:49 -0400573 libs += [ "vulkan" ]
Yuly Novikov199f4292018-01-19 19:04:05 -0500574 }
Jamie Madillb62a1c22018-02-06 09:54:02 -0500575 deps += [ ":angle_vulkan" ]
Tobin Ehlisb971f492018-05-24 10:56:17 -0600576 public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
Jamie Madilld47044a2018-04-27 11:45:03 -0400577
578 # Include generated shaders.
579 import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
580 sources += angle_vulkan_internal_shaders
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400581 }
582
Geoff Langd08f3b32016-09-23 15:56:30 -0400583 if (angle_enable_null) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400584 sources += libangle_null_sources
Geoff Langd08f3b32016-09-23 15:56:30 -0400585 }
586
Jamie Madill562e81b2015-01-14 14:31:02 -0500587 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500588 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400589 }
590
Jamie Madille2e406c2016-06-02 13:04:10 -0400591 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400592
Jamie Madill562e81b2015-01-14 14:31:02 -0500593 configs += [
594 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700595 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400596 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500597 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500598 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400599
Jamie Madill80ab03c2017-01-03 11:03:23 -0500600 public_configs = [ ":libANGLE_config" ]
601
Jamie Madill562e81b2015-01-14 14:31:02 -0500602 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400603 data_deps = [
604 ":copy_compiler_dll",
605 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500606 }
607}
608
Robert Sesekdb8ae832016-06-21 11:47:03 -0400609config("shared_library_public_config") {
610 if (is_mac && !is_component_build) {
611 # Executable targets that depend on the shared libraries below need to have
612 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400613 ldflags = [
614 "-rpath",
615 "@executable_path/",
616 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400617 }
618}
619
Jamie Madill80ab03c2017-01-03 11:03:23 -0500620# This config controls export definitions on ANGLE API calls.
621config("angle_static") {
622 defines = [
623 "ANGLE_EXPORT=",
624 "EGLAPI=",
625 "GL_APICALL=",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500626 "GL_API=",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500627 ]
628}
629
Yuly Novikovad4f9642018-02-08 17:58:46 -0500630shared_library("libGLESv2${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400631 sources = libglesv2_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500632
Andrew Grieve949e0702017-01-16 09:44:49 -0500633 if (is_android) {
634 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600635 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500636 }
637
Jamie Madill562e81b2015-01-14 14:31:02 -0500638 if (is_win) {
Jamie Madill74a76322018-05-14 09:11:51 -0400639 ldflags = [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2_autogen.def",
640 root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500641 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800642
Robert Sesekdb8ae832016-06-21 11:47:03 -0400643 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400644 ldflags = [
645 "-install_name",
646 "@rpath/${target_name}.dylib",
647 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400648 public_configs = [ ":shared_library_public_config" ]
649 }
650
Jamie Madille2e406c2016-06-02 13:04:10 -0400651 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500652 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600653 ":angle_gl_visibility_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500654 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700655 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400656 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500657 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500658 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400659
Jamie Madilledbc2442016-01-04 11:25:00 -0500660 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500661
662 deps = [
663 ":includes",
664 ":libANGLE",
665 ]
666}
667
668static_library("libGLESv2_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400669 sources = libglesv2_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500670
671 configs -= angle_undefine_configs
672 configs += [
673 ":commit_id_config",
674 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400675 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500676 ":internal_config",
677 ]
678
679 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500680
681 deps = [
682 ":includes",
683 ":libANGLE",
684 ]
685}
686
Yuly Novikovad4f9642018-02-08 17:58:46 -0500687shared_library("libGLESv1_CM${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400688 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500689
690 if (is_android) {
691 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600692 configs += [ ":build_id_config" ]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500693 }
Lingfeng Yang4edce332018-02-14 19:01:31 -0800694
695 if (is_mac && !is_component_build) {
696 ldflags = [
697 "-install_name",
698 "@rpath/${target_name}.dylib",
699 ]
700 public_configs = [ ":shared_library_public_config" ]
701 }
702
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500703 configs -= angle_undefine_configs
704 configs += [
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600705 ":angle_gl_visibility_config",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500706 ":commit_id_config",
707 ":debug_annotations_config",
708 ":extra_warnings",
709 ":internal_config",
710 ]
711
712 defines = []
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500713
714 deps = [
715 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500716 ":libGLESv2${angle_libs_suffix}",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500717 ]
718}
719
720static_library("libGLESv1_CM_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400721 sources = libglesv1_cm_sources
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500722
723 configs -= angle_undefine_configs
724 configs += [
725 ":commit_id_config",
726 ":debug_annotations_config",
727 ":extra_warnings",
728 ":internal_config",
729 ]
730
731 public_configs = [ ":angle_static" ]
732
733 deps = [
734 ":includes",
735 ":libGLESv2_static",
736 ]
737}
738
Yuly Novikovad4f9642018-02-08 17:58:46 -0500739shared_library("libEGL${angle_libs_suffix}") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400740 sources = libegl_sources
Jamie Madill562e81b2015-01-14 14:31:02 -0500741
Andrew Grieve949e0702017-01-16 09:44:49 -0500742 if (is_android) {
743 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Courtney Goeltzenleuchter46071482018-05-15 13:35:15 -0600744 configs += [ ":build_id_config" ]
Andrew Grieve949e0702017-01-16 09:44:49 -0500745 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400746 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500747 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500748 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400749 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400750 ":extra_warnings",
751 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500752 ]
753
Jamie Madilledbc2442016-01-04 11:25:00 -0500754 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500755 if (is_win) {
756 defines += [ "EGLAPI=" ]
757 } else {
758 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
759 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500760
Jamie Madill80ab03c2017-01-03 11:03:23 -0500761 if (is_win) {
762 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
763 }
764
765 if (is_mac && !is_component_build) {
766 ldflags = [
767 "-install_name",
768 "@rpath/${target_name}.dylib",
769 ]
770 public_configs = [ ":shared_library_public_config" ]
771 }
772
Jamie Madill562e81b2015-01-14 14:31:02 -0500773 deps = [
774 ":includes",
Yuly Novikovad4f9642018-02-08 17:58:46 -0500775 ":libGLESv2${angle_libs_suffix}",
Jamie Madill562e81b2015-01-14 14:31:02 -0500776 ]
777}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400778
Jamie Madill80ab03c2017-01-03 11:03:23 -0500779static_library("libEGL_static") {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400780 sources = libegl_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500781
782 configs -= angle_undefine_configs
783 configs += [
784 ":commit_id_config",
785 ":debug_annotations_config",
786 ":extra_warnings",
787 ":internal_config",
788 ]
789
790 public_configs = [ ":angle_static" ]
791
792 deps = [
793 ":includes",
794 ":libGLESv2_static",
795 ]
796}
797
Frank Henigmanddc41202018-08-23 22:11:55 -0400798import("util/util.gni")
Jamie Madilledbc2442016-01-04 11:25:00 -0500799
800config("angle_util_config") {
801 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400802 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500803 libs = [ "X11" ]
804 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500805}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400806
Jamie Madill80ab03c2017-01-03 11:03:23 -0500807foreach(is_shared_library,
808 [
809 true,
810 false,
811 ]) {
812 if (is_shared_library) {
813 library_type = "shared_library"
814 library_name = "angle_util"
Yuly Novikovad4f9642018-02-08 17:58:46 -0500815 dep_suffix = "${angle_libs_suffix}"
Jamie Madill80ab03c2017-01-03 11:03:23 -0500816 } else {
817 library_type = "static_library"
818 library_name = "angle_util_static"
819 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400820 }
821
Jamie Madill80ab03c2017-01-03 11:03:23 -0500822 target(library_type, library_name) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400823 sources = util_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500824
825 if (is_win) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400826 sources += util_win32_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500827 }
828
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600829 libs = []
Jamie Madill80ab03c2017-01-03 11:03:23 -0500830 if (is_linux) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400831 sources += util_linux_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600832 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500833 "rt",
834 "dl",
835 ]
836 }
837
838 if (is_mac) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400839 sources += util_osx_sources
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600840 libs += [
Jamie Madill80ab03c2017-01-03 11:03:23 -0500841 "AppKit.framework",
842 "QuartzCore.framework",
843 ]
844 }
845
846 if (use_x11) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400847 sources += util_x11_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500848 }
849
850 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -0500851 if (is_shared_library) {
852 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
853 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500854
Jamie Madill80ab03c2017-01-03 11:03:23 -0500855 # To prevent linux sources filtering on android
856 set_sources_assignment_filter([])
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400857 sources += util_linux_sources
858 sources += util_android_sources
Yuly Novikovcd70aa42018-06-20 17:05:32 -0400859 libs += [
860 "android",
861 "log",
862 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500863 }
864
865 if (use_ozone) {
Frank Henigman44b2c0b2018-08-29 17:31:27 -0400866 sources += util_ozone_sources
Jamie Madill80ab03c2017-01-03 11:03:23 -0500867 }
868
869 configs += [
870 ":debug_annotations_config",
871 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400872 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400873
Jamie Madill80ab03c2017-01-03 11:03:23 -0500874 public_configs = [
875 ":angle_util_config",
876 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400877 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400878
Jamie Madill80ab03c2017-01-03 11:03:23 -0500879 deps = [
880 ":angle_common",
881 ":libEGL${dep_suffix}",
882 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400883 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500884
885 if (is_shared_library) {
886 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
887
888 if (is_mac && !is_component_build) {
889 ldflags = [
890 "-install_name",
891 "@rpath/lib${target_name}.dylib",
892 ]
893 public_configs += [ ":shared_library_public_config" ]
894 }
895 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400896 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400897}
Ken Russellfcadd082017-06-28 14:01:15 -0700898
899# Convenience targets for some of the samples so they can be built
900# with Chromium's toolchain.
901
902executable("angle_shader_translator") {
903 testonly = true
904
905 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400906 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -0700907 ]
908
909 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400910 ":translator",
Ken Russellfcadd082017-06-28 14:01:15 -0700911 ]
912}
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600913
914if (is_android) {
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600915 config("angle_feature_support_config") {
916 include_dirs = [
917 "include",
918 "src",
919 ]
920 defines = [ "LIBFEATURE_SUPPORT_IMPLEMENTATION" ]
921 if (is_debug) {
922 defines += [ "ANGLE_FEATURE_UTIL_LOG_VERBOSE" ]
923 }
924 }
925
926 shared_library("libfeature_support${angle_libs_suffix}") {
927 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
928 configs += [ ":build_id_config" ]
929 configs -= angle_undefine_configs
930 configs += [
931 ":internal_config",
932 ":extra_warnings",
933 ]
934
935 public_configs = [
936 ":angle_feature_support_config",
937 "third_party/jsoncpp:jsoncpp_config",
938 ]
939
940 libs = [ "log" ]
941
942 sources = [
Ian Elliotte4c64c32018-10-17 14:53:39 -0600943 "src/feature_support_util/angle_feature_support_util.h",
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600944 "src/feature_support_util/feature_support_util.cpp",
945 "src/feature_support_util/feature_support_util.h",
946 ]
947 deps = [
948 "third_party/jsoncpp:jsoncpp",
949 ]
950 }
951
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600952 # Package ANGLE libraries for pre-installed system image
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600953 android_assets("angle_apk_assets") {
954 disable_compression = true
955 sources = [
956 "src/feature_support_util/a4a_rules.json",
957 ]
958 }
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600959 android_apk("angle_apk") {
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600960 deps = [
Shahbaz Youssefi996628a2018-09-24 16:39:26 -0400961 ":angle_apk_assets",
Courtney Goeltzenleuchter80171922018-09-05 13:50:35 -0600962 ]
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600963 if (build_apk_secondary_abi && android_64bit_target_cpu) {
964 secondary_abi_shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600965 "//third_party/angle:libEGL${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600966 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600967 "//third_party/angle:libGLESv2${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600968 "//third_party/angle:libfeature_support${angle_libs_suffix}($android_secondary_abi_toolchain)",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600969 ]
970 }
971
972 android_manifest = "AndroidManifest.xml"
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600973
Courtney Goeltzenleuchter8c1508b2018-07-30 09:46:27 -0600974 apk_name = "ANGLEPrebuilt"
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600975 uncompress_shared_libraries = true
976 shared_libraries = [
Courtney Goeltzenleuchtere5db6282018-04-26 08:05:18 -0600977 "//third_party/angle:libEGL${angle_libs_suffix}",
Courtney Goeltzenleuchterddd77242018-04-30 10:31:18 -0600978 "//third_party/angle:libGLESv1_CM${angle_libs_suffix}",
Courtney Goeltzenleuchterb0015282018-05-18 16:48:50 -0600979 "//third_party/angle:libGLESv2${angle_libs_suffix}",
Courtney Goeltzenleuchter7d81ae72018-10-08 19:25:19 -0600980 "//third_party/angle:libfeature_support${angle_libs_suffix}",
Courtney Goeltzenleuchter2565d482018-04-12 17:06:48 -0600981 ]
982 }
983}