blob: f7a36a930b1decef8972a97ac4e7c9e49bbdfb08 [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 Wallezd4bcfa22015-09-01 10:32:30 -04009import("//third_party/angle/build/angle_common.gni")
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040010import("//ui/ozone/ozone.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -040011
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040012if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040013 pkg_config("libdrm") {
14 packages = [ "libdrm" ]
15 }
Frank Henigman77df6762016-06-13 16:39:01 -040016}
17
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020018angle_git_is_present = exec_script("src/commit_id.py",
19 [
20 "check",
21 rebase_path(".", root_build_dir),
22 ],
23 "value")
24
25angle_use_commit_id = angle_git_is_present == 1
26
Jamie Madilledbc2442016-01-04 11:25:00 -050027gles_gypi = exec_script("//build/gypi_to_gn.py",
28 [ rebase_path("src/libGLESv2.gypi") ],
29 "scope",
30 [ "src/libGLESv2.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070031
Jamie Madilledbc2442016-01-04 11:25:00 -050032compiler_gypi = exec_script("//build/gypi_to_gn.py",
33 [ rebase_path("src/compiler.gypi") ],
34 "scope",
35 [ "src/compiler.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070036
Brett Wilson2f5469c2014-07-22 17:00:17 -070037# This config is exported to dependent targets (and also applied to internal
38# ones).
39config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050040 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070041}
42
Jamie Madill72f5b5e2014-06-23 15:13:02 -040043# This config is applied to internal Angle targets (not pushed to dependents).
44config("internal_config") {
45 include_dirs = [
46 "include",
47 "src",
48 ]
49}
50
Daniel Bratell73941de2015-02-25 14:34:49 +010051if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +010052 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -050053 sources = [
54 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
55 ]
56 outputs = [
57 "$root_out_dir/d3dcompiler_47.dll",
58 ]
Daniel Bratell73941de2015-02-25 14:34:49 +010059 }
Daniel Bratell73941de2015-02-25 14:34:49 +010060}
61
Jamie Madille2e406c2016-06-02 13:04:10 -040062angle_undefine_configs = [
63 "//build/config/compiler:chromium_code",
64 "//build/config/compiler:default_include_dirs",
65]
66
Jamie Madill72f5b5e2014-06-23 15:13:02 -040067component("translator") {
68 sources = [
69 "src/compiler/translator/ShaderLang.cpp",
Jamie Madille5c97ab2014-08-07 12:31:38 -040070 "src/compiler/translator/ShaderVars.cpp",
Jamie Madill72f5b5e2014-06-23 15:13:02 -040071 ]
72
73 defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ]
74
Jamie Madille2e406c2016-06-02 13:04:10 -040075 configs -= angle_undefine_configs
Jamie Madill72f5b5e2014-06-23 15:13:02 -040076 configs += [
77 ":internal_config",
78 "//build/config/compiler:no_chromium_code",
79 ]
80
Brett Wilson10ac4042014-09-24 10:20:56 -070081 public_deps = [
Jamie Madill72f5b5e2014-06-23 15:13:02 -040082 ":translator_lib",
83 ]
84}
85
86# Holds the shared includes so we only need to list them once.
87source_set("includes") {
88 sources = [
89 "include/EGL/egl.h",
90 "include/EGL/eglext.h",
91 "include/EGL/eglplatform.h",
92 "include/GLES2/gl2.h",
93 "include/GLES2/gl2ext.h",
94 "include/GLES2/gl2platform.h",
95 "include/GLES3/gl3.h",
Geoff Langee483762015-09-15 13:12:07 -040096 "include/GLES3/gl31.h",
97 "include/GLES3/gl32.h",
Jamie Madilledbc2442016-01-04 11:25:00 -050098 "include/GLES3/gl3platform.h",
Jamie Madill72f5b5e2014-06-23 15:13:02 -040099 "include/GLSLANG/ShaderLang.h",
100 "include/KHR/khrplatform.h",
101 ]
102}
103
104static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -0700105 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400106
Jamie Madille2e406c2016-06-02 13:04:10 -0400107 configs -= angle_undefine_configs
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400108 configs += [
109 ":internal_config",
110 "//build/config/compiler:no_chromium_code",
111 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400112}
113
Jamie Madille5c97ab2014-08-07 12:31:38 -0400114config("translator_static_config") {
115 defines = [ "ANGLE_TRANSLATOR_STATIC" ]
116}
117
Cooper Partin75da1972015-06-16 15:03:14 -0700118config("debug_annotations_config") {
119 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500120 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700121 }
122}
123
Jamie Madille31fd872016-05-27 08:35:36 -0400124config("angle_release_asserts_config") {
125 if (dcheck_always_on) {
126 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
127 }
128}
129
Jamie Madille2e406c2016-06-02 13:04:10 -0400130config("angle_common_config") {
131 include_dirs = [ "src/common/third_party/numerics" ]
132}
133
Jamie Madill562e81b2015-01-14 14:31:02 -0500134static_library("angle_common") {
135 sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
Cooper Partin75da1972015-06-16 15:03:14 -0700136
Jamie Madille2e406c2016-06-02 13:04:10 -0400137 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500138 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400139 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700140 ":debug_annotations_config",
Jamie Madille2e406c2016-06-02 13:04:10 -0400141 ":internal_config",
Nico Weber47b53c02015-06-04 12:58:22 -0700142 "//build/config/compiler:no_chromium_code",
Jamie Madill562e81b2015-01-14 14:31:02 -0500143 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400144
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400145 public_deps = [
146 ":commit_id",
147 ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400148 public_configs = [
149 ":angle_release_asserts_config",
150 ":angle_common_config",
151 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500152}
153
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400154config("angle_image_util_config") {
155 include_dirs = [
156 "include",
157 "src",
158 ]
159}
160
Dirk Pranke313d9442016-07-13 18:01:55 -0700161static_library("angle_image_util") {
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400162 sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
163
164 configs -= angle_undefine_configs
165 configs += [
166 ":internal_config",
167 "//build/config/compiler:no_chromium_code",
168 ]
169
170 public_configs = [ ":angle_image_util_config" ]
171
172 public_deps = [
173 ":angle_common",
174 ]
175}
176
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400177static_library("translator_lib") {
Brett Wilson04bac602014-07-16 14:19:18 -0700178 sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800179 defines = []
180
181 if (angle_enable_essl) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500182 sources +=
183 rebase_path(compiler_gypi.angle_translator_lib_essl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800184 defines += [ "ANGLE_ENABLE_ESSL" ]
185 }
186
187 if (angle_enable_glsl) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500188 sources +=
189 rebase_path(compiler_gypi.angle_translator_lib_glsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800190 defines += [ "ANGLE_ENABLE_GLSL" ]
191 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400192
Daniel Bratell73941de2015-02-25 14:34:49 +0100193 if (angle_enable_hlsl) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500194 sources +=
195 rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800196 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100197 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400198 configs -= angle_undefine_configs
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400199 configs += [
200 ":internal_config",
Jamie Madille5c97ab2014-08-07 12:31:38 -0400201 ":translator_static_config",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400202 "//build/config/compiler:no_chromium_code",
203 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700204 public_configs = [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400205
206 deps = [
207 ":includes",
208 ":preprocessor",
209 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500210
211 public_deps = [
212 ":angle_common",
213 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400214}
215
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400216static_library("translator_static") {
217 sources = [
218 "src/compiler/translator/ShaderLang.cpp",
Jamie Madilla2ad4e82014-07-17 14:16:32 -0400219 "src/compiler/translator/ShaderVars.cpp",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400220 ]
221
Daniel Bratell73941de2015-02-25 14:34:49 +0100222 if (angle_enable_hlsl) {
223 defines = [ "ANGLE_ENABLE_HLSL" ]
224 }
225
Jamie Madille2e406c2016-06-02 13:04:10 -0400226 configs -= angle_undefine_configs
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400227 configs += [
228 ":internal_config",
229 "//build/config/compiler:no_chromium_code",
230 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700231 public_configs = [ ":translator_static_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400232
Brett Wilson10ac4042014-09-24 10:20:56 -0700233 public_deps = [
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400234 ":translator_lib",
235 ]
236}
237
238config("commit_id_config") {
239 include_dirs = [ "$root_gen_dir/angle" ]
240}
241
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200242commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
243if (angle_use_commit_id) {
244 action("commit_id") {
245 script = "src/commit_id.py"
246 outputs = [
247 commit_id_output_file,
248 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400249
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200250 args = [
251 "gen",
252 rebase_path(".", root_build_dir),
253 rebase_path(commit_id_output_file, root_build_dir),
254 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400255
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200256 public_configs = [ ":commit_id_config" ]
257 }
258} else {
259 copy("commit_id") {
260 sources = [
261 "src/commit.h",
262 ]
263 outputs = [
264 commit_id_output_file,
265 ]
266 public_configs = [ ":commit_id_config" ]
267 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400268}
269
Jamie Madill562e81b2015-01-14 14:31:02 -0500270config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800271 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500272 defines = []
273 if (angle_enable_d3d9) {
274 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500275 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500276 if (angle_enable_d3d11) {
277 defines += [ "ANGLE_ENABLE_D3D11" ]
278 }
Geoff Langc588ac72015-02-13 15:41:41 -0500279 if (angle_enable_gl) {
280 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700281 if (use_x11) {
282 defines += [ "ANGLE_USE_X11" ]
283 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400284 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400285 if (angle_enable_vulkan) {
286 defines += [ "ANGLE_ENABLE_VULKAN" ]
287 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500288 defines += [
Geoff Langee483762015-09-15 13:12:07 -0400289 "GL_GLEXT_PROTOTYPES",
Austin Kinross502f3df2015-12-02 12:33:18 -0800290 "EGL_EGLEXT_PROTOTYPES",
Jamie Madill562e81b2015-01-14 14:31:02 -0500291 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400292
293 if (is_win) {
294 defines += [
295 "GL_APICALL=",
296 "EGLAPI=",
297 ]
298 } else {
299 defines += [
300 "GL_APICALL=__attribute__((visibility(\"default\")))",
301 "EGLAPI=__attribute__((visibility(\"default\")))",
302 ]
303 }
Austin Kinross40853472015-02-12 10:39:56 -0800304 if (is_win) {
305 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
306 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500307}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500308
Jamie Madill562e81b2015-01-14 14:31:02 -0500309static_library("libANGLE") {
310 sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
Geoff Lang2b5420c2014-11-19 14:20:15 -0500311
Geoff Langc588ac72015-02-13 15:41:41 -0500312 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500313 libs = []
Jamie Madilledbc2442016-01-04 11:25:00 -0500314 defines = [ "LIBANGLE_IMPLEMENTATION" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400315 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500316 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400317 ]
318 deps = [
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400319 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500320 ":commit_id",
321 ":includes",
322 ":translator_static",
323 ]
324
Jamie Madill562e81b2015-01-14 14:31:02 -0500325 # Shared D3D sources.
326 if (angle_enable_d3d9 || angle_enable_d3d11) {
327 sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400328
Jamie Madilledbc2442016-01-04 11:25:00 -0500329 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500330 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500331
Jamie Madill562e81b2015-01-14 14:31:02 -0500332 if (angle_enable_d3d9) {
333 sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
334 libs += [ "d3d9.lib" ]
335 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400336
Jamie Madill562e81b2015-01-14 14:31:02 -0500337 if (angle_enable_d3d11) {
338 sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
339 sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
340 libs += [ "dxguid.lib" ]
341 }
342
Geoff Langc588ac72015-02-13 15:41:41 -0500343 if (angle_enable_gl) {
344 sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src")
345 include_dirs += [ "src/third_party/khronos" ]
346
347 if (is_win) {
348 sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src")
349 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400350 if (use_x11) {
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400351 sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400352 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500353 libs += [
354 "X11",
355 "Xi",
356 "Xext",
357 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400358 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400359 if (is_mac) {
360 sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src")
361 libs += [
362 "Cocoa.framework",
363 "IOSurface.framework",
364 "OpenGL.framework",
365 "QuartzCore.framework",
366 ]
367 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400368 if (is_android) {
369 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
370 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
371 sources +=
372 rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
373 libs += [
374 "android",
375 "log",
376 ]
377 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400378 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400379 configs += [ ":libdrm" ]
380 defines += [ "ANGLE_USE_OZONE" ]
381 deps += [ "//third_party/minigbm" ]
382 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
383 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
384 sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
385 }
Geoff Langc588ac72015-02-13 15:41:41 -0500386 }
387
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400388 if (angle_enable_vulkan) {
389 sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src")
390 }
391
Jamie Madill562e81b2015-01-14 14:31:02 -0500392 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500393 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400394 }
395
Jamie Madille2e406c2016-06-02 13:04:10 -0400396 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500397 configs += [
398 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700399 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500400 ":libANGLE_config",
401 ":internal_config",
402 "//build/config/compiler:no_chromium_code",
403 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400404
Jamie Madill562e81b2015-01-14 14:31:02 -0500405 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400406 data_deps = [
407 ":copy_compiler_dll",
408 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500409 }
410}
411
Robert Sesekdb8ae832016-06-21 11:47:03 -0400412config("shared_library_public_config") {
413 if (is_mac && !is_component_build) {
414 # Executable targets that depend on the shared libraries below need to have
415 # the rpath setup in non-component build configurations.
416 ldflags = [ "-rpath", "@executable_path/" ]
417 }
418}
419
Jamie Madill562e81b2015-01-14 14:31:02 -0500420shared_library("libGLESv2") {
421 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
422
423 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500424 ldflags =
425 [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500426 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800427
Robert Sesekdb8ae832016-06-21 11:47:03 -0400428 if (is_mac && !is_component_build) {
429 ldflags = [ "-install_name", "@rpath/${target_name}.dylib" ]
430 public_configs = [ ":shared_library_public_config" ]
431 }
432
Jamie Madille2e406c2016-06-02 13:04:10 -0400433 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500434 configs += [
435 ":internal_config",
436 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700437 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500438 ":libANGLE_config",
439 "//build/config/compiler:no_chromium_code",
440 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400441
Jamie Madilledbc2442016-01-04 11:25:00 -0500442 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500443
444 deps = [
445 ":includes",
446 ":libANGLE",
447 ]
448}
449
450shared_library("libEGL") {
451 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
452
453 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500454 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400455 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500456
Robert Sesekdb8ae832016-06-21 11:47:03 -0400457 if (is_mac && !is_component_build) {
458 ldflags = [ "-install_name", "@rpath/${target_name}.dylib" ]
459 public_configs = [ ":shared_library_public_config" ]
460 }
461
Jamie Madille2e406c2016-06-02 13:04:10 -0400462 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500463 configs += [
464 ":internal_config",
465 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400466 ":debug_annotations_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500467 ":libANGLE_config",
468 "//build/config/compiler:no_chromium_code",
469 ]
470
Jamie Madilledbc2442016-01-04 11:25:00 -0500471 defines = [ "LIBEGL_IMPLEMENTATION" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500472
473 deps = [
474 ":includes",
475 ":libGLESv2",
476 ]
477}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400478
Jamie Madilledbc2442016-01-04 11:25:00 -0500479util_gypi = exec_script("//build/gypi_to_gn.py",
480 [ rebase_path("util/util.gyp") ],
481 "scope",
482 [ "util/util.gyp" ])
483
484config("angle_util_config") {
485 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400486 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500487 libs = [ "X11" ]
488 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500489}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400490
491static_library("angle_util") {
492 sources = rebase_path(util_gypi.util_sources, ".", "util")
493
494 if (is_win) {
495 sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
496 }
497
498 if (is_linux) {
499 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400500 libs = [
501 "rt",
502 "dl",
503 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400504 }
505
506 if (is_mac) {
507 sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
508 }
509
510 if (use_x11) {
511 sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
512 }
513
Yuly Novikova6426d62016-06-03 00:18:38 -0400514 if (is_android) {
515 # To prevent linux sources filtering on android
516 set_sources_assignment_filter([])
517 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
518 sources += rebase_path(util_gypi.util_android_sources, ".", "util")
519 libs = [
520 "android",
521 "log",
522 ]
523 }
524
Frank Henigman77df6762016-06-13 16:39:01 -0400525 if (use_ozone) {
526 sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
527 }
528
Geoff Langee483762015-09-15 13:12:07 -0400529 defines = [
530 "GL_GLEXT_PROTOTYPES",
531 "EGL_EGLEXT_PROTOTYPES",
532 ]
533
Jamie Madilledbc2442016-01-04 11:25:00 -0500534 configs += [ ":debug_annotations_config" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400535
Jamie Madilledbc2442016-01-04 11:25:00 -0500536 public_configs = [
537 ":angle_util_config",
538 ":internal_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400539 ]
540
541 deps = [
Jamie Madill1fae3552016-01-07 14:33:48 -0500542 ":angle_common",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400543 ":libEGL",
544 ":libGLESv2",
545 ]
546}