blob: 50d58d00912b414b70d9a846415604a0a38c225a [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")
Corentin Wallez7f07caa2016-10-25 07:43:33 -040010import("//third_party/angle/gni/angle.gni")
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040011import("//ui/ozone/ozone.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -040012
Corentin Wallez16d4e472017-03-20 13:06:19 -040013declare_args() {
14 # Use the PCI lib to collect GPU information on Linux.
15 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
16 (use_x11 || use_ozone)
17}
18
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040019if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040020 pkg_config("libdrm") {
21 packages = [ "libdrm" ]
22 }
Frank Henigman77df6762016-06-13 16:39:01 -040023}
24
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020025angle_git_is_present = exec_script("src/commit_id.py",
26 [
27 "check",
28 rebase_path(".", root_build_dir),
29 ],
30 "value")
31
32angle_use_commit_id = angle_git_is_present == 1
33
Jamie Madilledbc2442016-01-04 11:25:00 -050034gles_gypi = exec_script("//build/gypi_to_gn.py",
35 [ rebase_path("src/libGLESv2.gypi") ],
36 "scope",
37 [ "src/libGLESv2.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070038
Jamie Madilledbc2442016-01-04 11:25:00 -050039compiler_gypi = exec_script("//build/gypi_to_gn.py",
40 [ rebase_path("src/compiler.gypi") ],
41 "scope",
42 [ "src/compiler.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070043
Brett Wilson2f5469c2014-07-22 17:00:17 -070044# This config is exported to dependent targets (and also applied to internal
45# ones).
46config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050047 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070048}
49
Jamie Madill72f5b5e2014-06-23 15:13:02 -040050# This config is applied to internal Angle targets (not pushed to dependents).
51config("internal_config") {
52 include_dirs = [
53 "include",
54 "src",
55 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050056
57 # Prevent the GL headers from redeclaring ANGLE entry points.
58 defines = [
59 "GL_GLEXT_PROTOTYPES",
60 "EGL_EGLEXT_PROTOTYPES",
61 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040062}
63
Jamie Madill509a1d42016-07-18 10:10:29 -040064config("extra_warnings") {
65 # Enable more default warnings on Windows.
66 if (is_win) {
67 cflags = [
68 "/we4244", # Conversion: possible loss of data.
69 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040070 "/we4458", # declaration hides class member.
Jamie Madill509a1d42016-07-18 10:10:29 -040071 ]
72 }
73}
74
Daniel Bratell73941de2015-02-25 14:34:49 +010075if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +010076 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -050077 sources = [
78 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
79 ]
80 outputs = [
81 "$root_out_dir/d3dcompiler_47.dll",
82 ]
Daniel Bratell73941de2015-02-25 14:34:49 +010083 }
Daniel Bratell73941de2015-02-25 14:34:49 +010084}
85
Jamie Madilla8503ce2016-07-18 13:47:12 -040086angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -040087
Jamie Madill72f5b5e2014-06-23 15:13:02 -040088# Holds the shared includes so we only need to list them once.
89source_set("includes") {
90 sources = [
91 "include/EGL/egl.h",
92 "include/EGL/eglext.h",
93 "include/EGL/eglplatform.h",
94 "include/GLES2/gl2.h",
95 "include/GLES2/gl2ext.h",
96 "include/GLES2/gl2platform.h",
97 "include/GLES3/gl3.h",
Geoff Langee483762015-09-15 13:12:07 -040098 "include/GLES3/gl31.h",
99 "include/GLES3/gl32.h",
Jamie Madilledbc2442016-01-04 11:25:00 -0500100 "include/GLES3/gl3platform.h",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400101 "include/GLSLANG/ShaderLang.h",
102 "include/KHR/khrplatform.h",
103 ]
104}
105
106static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -0700107 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400108
Jamie Madille2e406c2016-06-02 13:04:10 -0400109 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400110 configs += [ ":internal_config" ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400111
112 public_deps = [
113 ":angle_common",
114 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400115}
116
Corentin Walleza5615c62016-09-19 09:54:44 -0400117config("translator_disable_pool_alloc") {
118 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400119}
120
Cooper Partin75da1972015-06-16 15:03:14 -0700121config("debug_annotations_config") {
122 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500123 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700124 }
125}
126
Jamie Madille31fd872016-05-27 08:35:36 -0400127config("angle_release_asserts_config") {
128 if (dcheck_always_on) {
129 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
130 }
131}
132
Jamie Madille2e406c2016-06-02 13:04:10 -0400133config("angle_common_config") {
134 include_dirs = [ "src/common/third_party/numerics" ]
135}
136
Jamie Madill562e81b2015-01-14 14:31:02 -0500137static_library("angle_common") {
138 sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
Cooper Partin75da1972015-06-16 15:03:14 -0700139
Jamie Madilldcab56a2017-01-05 14:47:34 -0500140 if (is_linux || is_android) {
141 sources += rebase_path(gles_gypi.libangle_common_linux_sources, ".", "src")
142 }
143
144 if (is_mac) {
145 sources += rebase_path(gles_gypi.libangle_common_mac_sources, ".", "src")
146 }
147
148 if (is_win) {
149 sources += rebase_path(gles_gypi.libangle_common_win_sources, ".", "src")
150 }
151
Jamie Madille2e406c2016-06-02 13:04:10 -0400152 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500153 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400154 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700155 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400156 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400157 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500158 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400159
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400160 public_deps = [
161 ":commit_id",
162 ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400163 public_configs = [
164 ":angle_release_asserts_config",
165 ":angle_common_config",
166 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500167}
168
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400169config("angle_image_util_config") {
170 include_dirs = [
171 "include",
172 "src",
173 ]
174}
175
Dirk Pranke313d9442016-07-13 18:01:55 -0700176static_library("angle_image_util") {
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400177 sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
178
179 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500180 configs += [
181 ":internal_config",
182 ":extra_warnings",
183 ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400184
185 public_configs = [ ":angle_image_util_config" ]
186
187 public_deps = [
188 ":angle_common",
189 ]
190}
191
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500192config("angle_gpu_info_util_config") {
193 include_dirs = [
194 "include",
195 "src",
196 ]
197}
198
199static_library("angle_gpu_info_util") {
200 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500201 configs += [
202 ":internal_config",
203 ":extra_warnings",
204 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500205
206 public_configs = [ ":angle_gpu_info_util_config" ]
207
208 public_deps = [
209 ":angle_common",
210 ]
211
212 sources = rebase_path(gles_gypi.libangle_gpu_info_util_sources, ".", "src")
213 deps = []
214 libs = []
215 defines = []
216
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700217 if (is_win) {
218 sources +=
219 rebase_path(gles_gypi.libangle_gpu_info_util_win_sources, ".", "src")
220 libs += [ "setupapi.lib" ]
221 defines += [ "GPU_INFO_USE_SETUPAPI" ]
222 }
223
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500224 if (is_linux) {
225 sources +=
226 rebase_path(gles_gypi.libangle_gpu_info_util_linux_sources, ".", "src")
227
228 if (use_x11) {
Corentin Wallez878baf92017-02-15 13:57:16 -0500229 sources +=
230 rebase_path(gles_gypi.libangle_gpu_info_util_x11_sources, ".", "src")
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500231 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
232 defines += [ "GPU_INFO_USE_X11" ]
233 libs += [
234 "X11",
235 "Xi",
236 "Xext",
237 ]
238 }
239 }
240
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500241 if (use_libpci) {
242 sources +=
243 rebase_path(gles_gypi.libangle_gpu_info_util_libpci_sources, ".", "src")
244 defines += [ "GPU_INFO_USE_LIBPCI" ]
245 libs += [ "pci" ]
246 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500247
248 if (is_mac) {
249 sources +=
250 rebase_path(gles_gypi.libangle_gpu_info_util_mac_sources, ".", "src")
251 libs += [
252 "IOKit.framework",
253 "CoreFoundation.framework",
254 ]
255 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500256}
257
Yuly Novikovea586542016-11-10 17:33:43 -0500258static_library("translator") {
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500259 sources = rebase_path(compiler_gypi.angle_translator_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800260 defines = []
261
Corentin Wallez28b65282016-06-16 07:24:50 -0700262 if (angle_enable_essl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500263 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500264 rebase_path(compiler_gypi.angle_translator_essl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800265 defines += [ "ANGLE_ENABLE_ESSL" ]
266 }
267
Corentin Wallez28b65282016-06-16 07:24:50 -0700268 if (angle_enable_glsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500269 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500270 rebase_path(compiler_gypi.angle_translator_glsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800271 defines += [ "ANGLE_ENABLE_GLSL" ]
272 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400273
Corentin Wallez28b65282016-06-16 07:24:50 -0700274 if (angle_enable_hlsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500275 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500276 rebase_path(compiler_gypi.angle_translator_hlsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800277 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100278 }
Jamie Madille794cd82017-01-13 17:29:51 -0500279
280 if (angle_enable_vulkan || use_libfuzzer) {
281 sources += rebase_path(compiler_gypi.angle_translator_lib_vulkan_sources,
282 ".",
283 "src")
284 defines += [ "ANGLE_ENABLE_VULKAN" ]
285 }
286
Jamie Madille2e406c2016-06-02 13:04:10 -0400287 configs -= angle_undefine_configs
Yuly Novikovea586542016-11-10 17:33:43 -0500288 configs += [ ":internal_config" ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700289 public_configs = [ ":external_config" ]
Corentin Walleza5615c62016-09-19 09:54:44 -0400290 if (use_libfuzzer) {
291 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
292 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400293
294 deps = [
295 ":includes",
296 ":preprocessor",
297 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500298
299 public_deps = [
300 ":angle_common",
301 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400302
303 if (is_win) {
304 # Necessary to suppress some system header xtree warnigns in Release.
305 # For some reason this warning doesn't get triggered in Chromium
306 cflags = [ "/wd4718" ]
307 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400308}
309
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400310source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700311 sources = [
312 "src/compiler/fuzz/translator_fuzzer.cpp",
313 ]
314
315 include_dirs = [
316 "include",
317 "src",
318 ]
319
320 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400321 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700322 ]
323}
324
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400325config("commit_id_config") {
326 include_dirs = [ "$root_gen_dir/angle" ]
327}
328
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200329commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
330if (angle_use_commit_id) {
331 action("commit_id") {
332 script = "src/commit_id.py"
333 outputs = [
334 commit_id_output_file,
335 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400336
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200337 args = [
338 "gen",
339 rebase_path(".", root_build_dir),
340 rebase_path(commit_id_output_file, root_build_dir),
341 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400342
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200343 public_configs = [ ":commit_id_config" ]
344 }
345} else {
346 copy("commit_id") {
347 sources = [
348 "src/commit.h",
349 ]
350 outputs = [
351 commit_id_output_file,
352 ]
353 public_configs = [ ":commit_id_config" ]
354 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400355}
356
Jamie Madill562e81b2015-01-14 14:31:02 -0500357config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800358 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500359 defines = []
360 if (angle_enable_d3d9) {
361 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500362 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500363 if (angle_enable_d3d11) {
364 defines += [ "ANGLE_ENABLE_D3D11" ]
365 }
Geoff Langc588ac72015-02-13 15:41:41 -0500366 if (angle_enable_gl) {
367 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700368 if (use_x11) {
369 defines += [ "ANGLE_USE_X11" ]
370 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400371 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400372 if (angle_enable_vulkan) {
373 defines += [ "ANGLE_ENABLE_VULKAN" ]
374 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400375 if (angle_enable_null) {
376 defines += [ "ANGLE_ENABLE_NULL" ]
377 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500378 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400379
380 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800381 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
382 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500383}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500384
Jamie Madill562e81b2015-01-14 14:31:02 -0500385static_library("libANGLE") {
386 sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
Geoff Lang2b5420c2014-11-19 14:20:15 -0500387
Geoff Langc588ac72015-02-13 15:41:41 -0500388 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500389 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500390 defines = []
Jamie Madille2e406c2016-06-02 13:04:10 -0400391 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500392 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400393 ]
394 deps = [
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500395 ":angle_gpu_info_util",
Corentin Wallez878baf92017-02-15 13:57:16 -0500396 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500397 ":commit_id",
398 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400399 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500400 ]
401
Jamie Madill562e81b2015-01-14 14:31:02 -0500402 # Shared D3D sources.
403 if (angle_enable_d3d9 || angle_enable_d3d11) {
404 sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400405
Jamie Madilledbc2442016-01-04 11:25:00 -0500406 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500407 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500408
Jamie Madill562e81b2015-01-14 14:31:02 -0500409 if (angle_enable_d3d9) {
410 sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
411 libs += [ "d3d9.lib" ]
412 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400413
Jamie Madill562e81b2015-01-14 14:31:02 -0500414 if (angle_enable_d3d11) {
415 sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
416 sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
Austin Kinross91e71ed2016-08-23 09:29:22 -0700417 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500418 }
419
Geoff Langc588ac72015-02-13 15:41:41 -0500420 if (angle_enable_gl) {
421 sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src")
422 include_dirs += [ "src/third_party/khronos" ]
423
424 if (is_win) {
425 sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src")
426 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400427 if (use_x11) {
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400428 sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400429 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500430 libs += [
431 "X11",
432 "Xi",
433 "Xext",
434 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400435 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400436 if (is_mac) {
437 sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src")
438 libs += [
439 "Cocoa.framework",
440 "IOSurface.framework",
441 "OpenGL.framework",
442 "QuartzCore.framework",
443 ]
444 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400445 if (is_android) {
446 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
447 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
448 sources +=
449 rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
450 libs += [
451 "android",
452 "log",
453 ]
454 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400455 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400456 configs += [ ":libdrm" ]
457 defines += [ "ANGLE_USE_OZONE" ]
458 deps += [ "//third_party/minigbm" ]
459 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
460 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
461 sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
462 }
Geoff Langc588ac72015-02-13 15:41:41 -0500463 }
464
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400465 if (angle_enable_vulkan) {
466 sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src")
Jamie Madill327ba852016-11-30 12:38:28 -0500467 deps += [ "//third_party/angle/src/vulkan_support:angle_vulkan" ]
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400468 }
469
Geoff Langd08f3b32016-09-23 15:56:30 -0400470 if (angle_enable_null) {
471 sources += rebase_path(gles_gypi.libangle_null_sources, ".", "src")
472 }
473
Jamie Madill562e81b2015-01-14 14:31:02 -0500474 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500475 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400476 }
477
Jamie Madille2e406c2016-06-02 13:04:10 -0400478 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400479
Jamie Madill562e81b2015-01-14 14:31:02 -0500480 configs += [
481 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700482 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400483 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500484 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500485 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400486
Jamie Madill80ab03c2017-01-03 11:03:23 -0500487 public_configs = [ ":libANGLE_config" ]
488
Jamie Madill562e81b2015-01-14 14:31:02 -0500489 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400490 data_deps = [
491 ":copy_compiler_dll",
492 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500493 }
494}
495
Robert Sesekdb8ae832016-06-21 11:47:03 -0400496config("shared_library_public_config") {
497 if (is_mac && !is_component_build) {
498 # Executable targets that depend on the shared libraries below need to have
499 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400500 ldflags = [
501 "-rpath",
502 "@executable_path/",
503 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400504 }
505}
506
Jamie Madill80ab03c2017-01-03 11:03:23 -0500507# This config controls export definitions on ANGLE API calls.
508config("angle_static") {
509 defines = [
510 "ANGLE_EXPORT=",
511 "EGLAPI=",
512 "GL_APICALL=",
513 ]
514}
515
Jamie Madill562e81b2015-01-14 14:31:02 -0500516shared_library("libGLESv2") {
517 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
518
Andrew Grieve949e0702017-01-16 09:44:49 -0500519 if (is_android) {
520 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
521 }
522
Jamie Madill562e81b2015-01-14 14:31:02 -0500523 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500524 ldflags =
525 [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500526 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800527
Robert Sesekdb8ae832016-06-21 11:47:03 -0400528 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400529 ldflags = [
530 "-install_name",
531 "@rpath/${target_name}.dylib",
532 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400533 public_configs = [ ":shared_library_public_config" ]
534 }
535
Jamie Madille2e406c2016-06-02 13:04:10 -0400536 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500537 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500538 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700539 ":debug_annotations_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500540 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500541 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400542
Jamie Madilledbc2442016-01-04 11:25:00 -0500543 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500544 if (is_win) {
545 defines += [ "GL_APICALL=" ]
546 } else {
547 defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
548 }
549
550 deps = [
551 ":includes",
552 ":libANGLE",
553 ]
554}
555
556static_library("libGLESv2_static") {
557 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
558
559 configs -= angle_undefine_configs
560 configs += [
561 ":commit_id_config",
562 ":debug_annotations_config",
563 ":internal_config",
564 ]
565
566 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500567
568 deps = [
569 ":includes",
570 ":libANGLE",
571 ]
572}
573
574shared_library("libEGL") {
575 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
576
Andrew Grieve949e0702017-01-16 09:44:49 -0500577 if (is_android) {
578 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
579 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400580 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500581 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500582 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400583 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400584 ":extra_warnings",
585 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500586 ]
587
Jamie Madilledbc2442016-01-04 11:25:00 -0500588 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500589 if (is_win) {
590 defines += [ "EGLAPI=" ]
591 } else {
592 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
593 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500594
Jamie Madill80ab03c2017-01-03 11:03:23 -0500595 if (is_win) {
596 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
597 }
598
599 if (is_mac && !is_component_build) {
600 ldflags = [
601 "-install_name",
602 "@rpath/${target_name}.dylib",
603 ]
604 public_configs = [ ":shared_library_public_config" ]
605 }
606
Jamie Madill562e81b2015-01-14 14:31:02 -0500607 deps = [
608 ":includes",
609 ":libGLESv2",
610 ]
611}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400612
Jamie Madill80ab03c2017-01-03 11:03:23 -0500613static_library("libEGL_static") {
614 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
615
616 configs -= angle_undefine_configs
617 configs += [
618 ":commit_id_config",
619 ":debug_annotations_config",
620 ":extra_warnings",
621 ":internal_config",
622 ]
623
624 public_configs = [ ":angle_static" ]
625
626 deps = [
627 ":includes",
628 ":libGLESv2_static",
629 ]
630}
631
Jamie Madilledbc2442016-01-04 11:25:00 -0500632util_gypi = exec_script("//build/gypi_to_gn.py",
633 [ rebase_path("util/util.gyp") ],
634 "scope",
635 [ "util/util.gyp" ])
636
637config("angle_util_config") {
638 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400639 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500640 libs = [ "X11" ]
641 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500642}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400643
Jamie Madill80ab03c2017-01-03 11:03:23 -0500644foreach(is_shared_library,
645 [
646 true,
647 false,
648 ]) {
649 if (is_shared_library) {
650 library_type = "shared_library"
651 library_name = "angle_util"
652 dep_suffix = ""
653 } else {
654 library_type = "static_library"
655 library_name = "angle_util_static"
656 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400657 }
658
Jamie Madill80ab03c2017-01-03 11:03:23 -0500659 target(library_type, library_name) {
660 sources = rebase_path(util_gypi.util_sources, ".", "util")
661
662 if (is_win) {
663 sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
664 }
665
666 if (is_linux) {
667 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
668 libs = [
669 "rt",
670 "dl",
671 ]
672 }
673
674 if (is_mac) {
675 sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
676 libs = [
677 "AppKit.framework",
678 "QuartzCore.framework",
679 ]
680 }
681
682 if (use_x11) {
683 sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
684 }
685
686 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -0500687 if (is_shared_library) {
688 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
689 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500690
Jamie Madill80ab03c2017-01-03 11:03:23 -0500691 # To prevent linux sources filtering on android
692 set_sources_assignment_filter([])
693 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
694 sources += rebase_path(util_gypi.util_android_sources, ".", "util")
695 libs = [
696 "android",
697 "log",
698 ]
699 }
700
701 if (use_ozone) {
702 sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
703 }
704
705 configs += [
706 ":debug_annotations_config",
707 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400708 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400709
Jamie Madill80ab03c2017-01-03 11:03:23 -0500710 public_configs = [
711 ":angle_util_config",
712 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400713 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400714
Jamie Madill80ab03c2017-01-03 11:03:23 -0500715 deps = [
716 ":angle_common",
717 ":libEGL${dep_suffix}",
718 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400719 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500720
721 if (is_shared_library) {
722 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
723
724 if (is_mac && !is_component_build) {
725 ldflags = [
726 "-install_name",
727 "@rpath/lib${target_name}.dylib",
728 ]
729 public_configs += [ ":shared_library_public_config" ]
730 }
731 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400732 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400733}