blob: 3aafec8f3801c3510c8e341404ba524935d03ee1 [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
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040013if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040014 pkg_config("libdrm") {
15 packages = [ "libdrm" ]
16 }
Frank Henigman77df6762016-06-13 16:39:01 -040017}
18
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020019angle_git_is_present = exec_script("src/commit_id.py",
20 [
21 "check",
22 rebase_path(".", root_build_dir),
23 ],
24 "value")
25
26angle_use_commit_id = angle_git_is_present == 1
27
Jamie Madilledbc2442016-01-04 11:25:00 -050028gles_gypi = exec_script("//build/gypi_to_gn.py",
29 [ rebase_path("src/libGLESv2.gypi") ],
30 "scope",
31 [ "src/libGLESv2.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070032
Jamie Madilledbc2442016-01-04 11:25:00 -050033compiler_gypi = exec_script("//build/gypi_to_gn.py",
34 [ rebase_path("src/compiler.gypi") ],
35 "scope",
36 [ "src/compiler.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070037
Brett Wilson2f5469c2014-07-22 17:00:17 -070038# This config is exported to dependent targets (and also applied to internal
39# ones).
40config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050041 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070042}
43
Jamie Madill72f5b5e2014-06-23 15:13:02 -040044# This config is applied to internal Angle targets (not pushed to dependents).
45config("internal_config") {
46 include_dirs = [
47 "include",
48 "src",
49 ]
50}
51
Jamie Madill509a1d42016-07-18 10:10:29 -040052config("extra_warnings") {
53 # Enable more default warnings on Windows.
54 if (is_win) {
55 cflags = [
56 "/we4244", # Conversion: possible loss of data.
57 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040058 "/we4458", # declaration hides class member.
Jamie Madill509a1d42016-07-18 10:10:29 -040059 ]
60 }
61}
62
Daniel Bratell73941de2015-02-25 14:34:49 +010063if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +010064 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -050065 sources = [
66 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
67 ]
68 outputs = [
69 "$root_out_dir/d3dcompiler_47.dll",
70 ]
Daniel Bratell73941de2015-02-25 14:34:49 +010071 }
Daniel Bratell73941de2015-02-25 14:34:49 +010072}
73
Jamie Madilla8503ce2016-07-18 13:47:12 -040074angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -040075
Jamie Madill72f5b5e2014-06-23 15:13:02 -040076# Holds the shared includes so we only need to list them once.
77source_set("includes") {
78 sources = [
79 "include/EGL/egl.h",
80 "include/EGL/eglext.h",
81 "include/EGL/eglplatform.h",
82 "include/GLES2/gl2.h",
83 "include/GLES2/gl2ext.h",
84 "include/GLES2/gl2platform.h",
85 "include/GLES3/gl3.h",
Geoff Langee483762015-09-15 13:12:07 -040086 "include/GLES3/gl31.h",
87 "include/GLES3/gl32.h",
Jamie Madilledbc2442016-01-04 11:25:00 -050088 "include/GLES3/gl3platform.h",
Jamie Madill72f5b5e2014-06-23 15:13:02 -040089 "include/GLSLANG/ShaderLang.h",
90 "include/KHR/khrplatform.h",
91 ]
92}
93
94static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -070095 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -040096
Jamie Madille2e406c2016-06-02 13:04:10 -040097 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -040098 configs += [ ":internal_config" ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -040099
100 public_deps = [
101 ":angle_common",
102 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400103}
104
Corentin Walleza5615c62016-09-19 09:54:44 -0400105config("translator_disable_pool_alloc") {
106 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400107}
108
Cooper Partin75da1972015-06-16 15:03:14 -0700109config("debug_annotations_config") {
110 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500111 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700112 }
113}
114
Jamie Madille31fd872016-05-27 08:35:36 -0400115config("angle_release_asserts_config") {
116 if (dcheck_always_on) {
117 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
118 }
119}
120
Jamie Madille2e406c2016-06-02 13:04:10 -0400121config("angle_common_config") {
122 include_dirs = [ "src/common/third_party/numerics" ]
123}
124
Jamie Madill562e81b2015-01-14 14:31:02 -0500125static_library("angle_common") {
126 sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
Cooper Partin75da1972015-06-16 15:03:14 -0700127
Jamie Madille2e406c2016-06-02 13:04:10 -0400128 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500129 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400130 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700131 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400132 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400133 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500134 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400135
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400136 public_deps = [
137 ":commit_id",
138 ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400139 public_configs = [
140 ":angle_release_asserts_config",
141 ":angle_common_config",
142 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500143}
144
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400145config("angle_image_util_config") {
146 include_dirs = [
147 "include",
148 "src",
149 ]
150}
151
Dirk Pranke313d9442016-07-13 18:01:55 -0700152static_library("angle_image_util") {
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400153 sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
154
155 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400156 configs += [ ":internal_config" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400157
158 public_configs = [ ":angle_image_util_config" ]
159
160 public_deps = [
161 ":angle_common",
162 ]
163}
164
Yuly Novikovea586542016-11-10 17:33:43 -0500165static_library("translator") {
Brett Wilson04bac602014-07-16 14:19:18 -0700166 sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800167 defines = []
168
Corentin Wallez28b65282016-06-16 07:24:50 -0700169 if (angle_enable_essl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500170 sources +=
171 rebase_path(compiler_gypi.angle_translator_lib_essl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800172 defines += [ "ANGLE_ENABLE_ESSL" ]
173 }
174
Corentin Wallez28b65282016-06-16 07:24:50 -0700175 if (angle_enable_glsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500176 sources +=
177 rebase_path(compiler_gypi.angle_translator_lib_glsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800178 defines += [ "ANGLE_ENABLE_GLSL" ]
179 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400180
Corentin Wallez28b65282016-06-16 07:24:50 -0700181 if (angle_enable_hlsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500182 sources +=
183 rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800184 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100185 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400186 configs -= angle_undefine_configs
Yuly Novikovea586542016-11-10 17:33:43 -0500187 configs += [ ":internal_config" ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700188 public_configs = [ ":external_config" ]
Corentin Walleza5615c62016-09-19 09:54:44 -0400189 if (use_libfuzzer) {
190 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
191 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400192
193 deps = [
194 ":includes",
195 ":preprocessor",
196 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500197
198 public_deps = [
199 ":angle_common",
200 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400201
202 if (is_win) {
203 # Necessary to suppress some system header xtree warnigns in Release.
204 # For some reason this warning doesn't get triggered in Chromium
205 cflags = [ "/wd4718" ]
206 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400207}
208
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400209source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700210 sources = [
211 "src/compiler/fuzz/translator_fuzzer.cpp",
212 ]
213
214 include_dirs = [
215 "include",
216 "src",
217 ]
218
219 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400220 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700221 ]
222}
223
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400224config("commit_id_config") {
225 include_dirs = [ "$root_gen_dir/angle" ]
226}
227
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200228commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
229if (angle_use_commit_id) {
230 action("commit_id") {
231 script = "src/commit_id.py"
232 outputs = [
233 commit_id_output_file,
234 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400235
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200236 args = [
237 "gen",
238 rebase_path(".", root_build_dir),
239 rebase_path(commit_id_output_file, root_build_dir),
240 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400241
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200242 public_configs = [ ":commit_id_config" ]
243 }
244} else {
245 copy("commit_id") {
246 sources = [
247 "src/commit.h",
248 ]
249 outputs = [
250 commit_id_output_file,
251 ]
252 public_configs = [ ":commit_id_config" ]
253 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400254}
255
Jamie Madill562e81b2015-01-14 14:31:02 -0500256config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800257 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500258 defines = []
259 if (angle_enable_d3d9) {
260 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500261 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500262 if (angle_enable_d3d11) {
263 defines += [ "ANGLE_ENABLE_D3D11" ]
264 }
Geoff Langc588ac72015-02-13 15:41:41 -0500265 if (angle_enable_gl) {
266 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700267 if (use_x11) {
268 defines += [ "ANGLE_USE_X11" ]
269 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400270 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400271 if (angle_enable_vulkan) {
272 defines += [ "ANGLE_ENABLE_VULKAN" ]
273 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400274 if (angle_enable_null) {
275 defines += [ "ANGLE_ENABLE_NULL" ]
276 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500277 defines += [
Geoff Langee483762015-09-15 13:12:07 -0400278 "GL_GLEXT_PROTOTYPES",
Austin Kinross502f3df2015-12-02 12:33:18 -0800279 "EGL_EGLEXT_PROTOTYPES",
Jamie Madill562e81b2015-01-14 14:31:02 -0500280 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400281
282 if (is_win) {
283 defines += [
284 "GL_APICALL=",
285 "EGLAPI=",
286 ]
287 } else {
288 defines += [
289 "GL_APICALL=__attribute__((visibility(\"default\")))",
290 "EGLAPI=__attribute__((visibility(\"default\")))",
291 ]
292 }
Austin Kinross40853472015-02-12 10:39:56 -0800293 if (is_win) {
294 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
295 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500296}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500297
Jamie Madill562e81b2015-01-14 14:31:02 -0500298static_library("libANGLE") {
299 sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
Geoff Lang2b5420c2014-11-19 14:20:15 -0500300
Geoff Langc588ac72015-02-13 15:41:41 -0500301 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500302 libs = []
Jamie Madilledbc2442016-01-04 11:25:00 -0500303 defines = [ "LIBANGLE_IMPLEMENTATION" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400304 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500305 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400306 ]
307 deps = [
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400308 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500309 ":commit_id",
310 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400311 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500312 ]
313
Jamie Madill562e81b2015-01-14 14:31:02 -0500314 # Shared D3D sources.
315 if (angle_enable_d3d9 || angle_enable_d3d11) {
316 sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400317
Jamie Madilledbc2442016-01-04 11:25:00 -0500318 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500319 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500320
Jamie Madill562e81b2015-01-14 14:31:02 -0500321 if (angle_enable_d3d9) {
322 sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
323 libs += [ "d3d9.lib" ]
324 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400325
Jamie Madill562e81b2015-01-14 14:31:02 -0500326 if (angle_enable_d3d11) {
327 sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
328 sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
Austin Kinross91e71ed2016-08-23 09:29:22 -0700329 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500330 }
331
Geoff Langc588ac72015-02-13 15:41:41 -0500332 if (angle_enable_gl) {
333 sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src")
334 include_dirs += [ "src/third_party/khronos" ]
335
336 if (is_win) {
337 sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src")
338 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400339 if (use_x11) {
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400340 sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400341 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500342 libs += [
343 "X11",
344 "Xi",
345 "Xext",
346 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400347 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400348 if (is_mac) {
349 sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src")
350 libs += [
351 "Cocoa.framework",
352 "IOSurface.framework",
353 "OpenGL.framework",
354 "QuartzCore.framework",
355 ]
356 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400357 if (is_android) {
358 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
359 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
360 sources +=
361 rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
362 libs += [
363 "android",
364 "log",
365 ]
366 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400367 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400368 configs += [ ":libdrm" ]
369 defines += [ "ANGLE_USE_OZONE" ]
370 deps += [ "//third_party/minigbm" ]
371 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
372 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
373 sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
374 }
Geoff Langc588ac72015-02-13 15:41:41 -0500375 }
376
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400377 if (angle_enable_vulkan) {
378 sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src")
379 }
380
Geoff Langd08f3b32016-09-23 15:56:30 -0400381 if (angle_enable_null) {
382 sources += rebase_path(gles_gypi.libangle_null_sources, ".", "src")
383 }
384
Jamie Madill562e81b2015-01-14 14:31:02 -0500385 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500386 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400387 }
388
Jamie Madille2e406c2016-06-02 13:04:10 -0400389 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400390
Jamie Madill562e81b2015-01-14 14:31:02 -0500391 configs += [
392 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700393 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400394 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500395 ":libANGLE_config",
396 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500397 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400398
Jamie Madill562e81b2015-01-14 14:31:02 -0500399 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400400 data_deps = [
401 ":copy_compiler_dll",
402 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500403 }
404}
405
Robert Sesekdb8ae832016-06-21 11:47:03 -0400406config("shared_library_public_config") {
407 if (is_mac && !is_component_build) {
408 # Executable targets that depend on the shared libraries below need to have
409 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400410 ldflags = [
411 "-rpath",
412 "@executable_path/",
413 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400414 }
415}
416
Jamie Madill562e81b2015-01-14 14:31:02 -0500417shared_library("libGLESv2") {
418 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
419
420 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500421 ldflags =
422 [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500423 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800424
Robert Sesekdb8ae832016-06-21 11:47:03 -0400425 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400426 ldflags = [
427 "-install_name",
428 "@rpath/${target_name}.dylib",
429 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400430 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",
Jamie Madill562e81b2015-01-14 14:31:02 -0500439 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400440
Jamie Madilledbc2442016-01-04 11:25:00 -0500441 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500442
443 deps = [
444 ":includes",
445 ":libANGLE",
446 ]
447}
448
449shared_library("libEGL") {
450 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
451
452 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500453 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400454 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500455
Robert Sesekdb8ae832016-06-21 11:47:03 -0400456 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400457 ldflags = [
458 "-install_name",
459 "@rpath/${target_name}.dylib",
460 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400461 public_configs = [ ":shared_library_public_config" ]
462 }
463
Jamie Madille2e406c2016-06-02 13:04:10 -0400464 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500465 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500466 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400467 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400468 ":extra_warnings",
469 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500470 ":libANGLE_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500471 ]
472
Jamie Madilledbc2442016-01-04 11:25:00 -0500473 defines = [ "LIBEGL_IMPLEMENTATION" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500474
475 deps = [
476 ":includes",
477 ":libGLESv2",
478 ]
479}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400480
Jamie Madilledbc2442016-01-04 11:25:00 -0500481util_gypi = exec_script("//build/gypi_to_gn.py",
482 [ rebase_path("util/util.gyp") ],
483 "scope",
484 [ "util/util.gyp" ])
485
486config("angle_util_config") {
487 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400488 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500489 libs = [ "X11" ]
490 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500491}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400492
Yuly Novikove3352f92016-08-12 20:40:14 -0400493shared_library("angle_util") {
Corentin Wallezbeb81582015-09-02 10:30:55 -0400494 sources = rebase_path(util_gypi.util_sources, ".", "util")
495
496 if (is_win) {
497 sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
498 }
499
500 if (is_linux) {
501 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400502 libs = [
503 "rt",
504 "dl",
505 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400506 }
507
508 if (is_mac) {
509 sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
Yuly Novikove3352f92016-08-12 20:40:14 -0400510 libs = [
511 "AppKit.framework",
512 "QuartzCore.framework",
513 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400514 }
515
516 if (use_x11) {
517 sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
518 }
519
Yuly Novikova6426d62016-06-03 00:18:38 -0400520 if (is_android) {
521 # To prevent linux sources filtering on android
522 set_sources_assignment_filter([])
523 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
524 sources += rebase_path(util_gypi.util_android_sources, ".", "util")
525 libs = [
526 "android",
527 "log",
528 ]
529 }
530
Frank Henigman77df6762016-06-13 16:39:01 -0400531 if (use_ozone) {
532 sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
533 }
534
Geoff Langee483762015-09-15 13:12:07 -0400535 defines = [
536 "GL_GLEXT_PROTOTYPES",
537 "EGL_EGLEXT_PROTOTYPES",
Yuly Novikove3352f92016-08-12 20:40:14 -0400538 "LIBANGLE_UTIL_IMPLEMENTATION",
Geoff Langee483762015-09-15 13:12:07 -0400539 ]
540
Jamie Madill509a1d42016-07-18 10:10:29 -0400541 configs += [
542 ":debug_annotations_config",
543 ":extra_warnings",
544 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400545
Jamie Madilledbc2442016-01-04 11:25:00 -0500546 public_configs = [
547 ":angle_util_config",
548 ":internal_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400549 ]
Yuly Novikove3352f92016-08-12 20:40:14 -0400550 if (is_mac && !is_component_build) {
551 ldflags = [
552 "-install_name",
553 "@rpath/lib${target_name}.dylib",
554 ]
555 public_configs += [ ":shared_library_public_config" ]
556 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400557
558 deps = [
Jamie Madill1fae3552016-01-07 14:33:48 -0500559 ":angle_common",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400560 ":libEGL",
561 ":libGLESv2",
562 ]
563}