blob: aefda3cc2c0dd7ff35760ae85b808d233c28db1a [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 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050050
51 # Prevent the GL headers from redeclaring ANGLE entry points.
52 defines = [
53 "GL_GLEXT_PROTOTYPES",
54 "EGL_EGLEXT_PROTOTYPES",
55 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040056}
57
Jamie Madill509a1d42016-07-18 10:10:29 -040058config("extra_warnings") {
59 # Enable more default warnings on Windows.
60 if (is_win) {
61 cflags = [
62 "/we4244", # Conversion: possible loss of data.
63 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040064 "/we4458", # declaration hides class member.
Jamie Madill509a1d42016-07-18 10:10:29 -040065 ]
66 }
67}
68
Daniel Bratell73941de2015-02-25 14:34:49 +010069if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +010070 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -050071 sources = [
72 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
73 ]
74 outputs = [
75 "$root_out_dir/d3dcompiler_47.dll",
76 ]
Daniel Bratell73941de2015-02-25 14:34:49 +010077 }
Daniel Bratell73941de2015-02-25 14:34:49 +010078}
79
Jamie Madilla8503ce2016-07-18 13:47:12 -040080angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -040081
Jamie Madill72f5b5e2014-06-23 15:13:02 -040082# Holds the shared includes so we only need to list them once.
83source_set("includes") {
84 sources = [
85 "include/EGL/egl.h",
86 "include/EGL/eglext.h",
87 "include/EGL/eglplatform.h",
88 "include/GLES2/gl2.h",
89 "include/GLES2/gl2ext.h",
90 "include/GLES2/gl2platform.h",
91 "include/GLES3/gl3.h",
Geoff Langee483762015-09-15 13:12:07 -040092 "include/GLES3/gl31.h",
93 "include/GLES3/gl32.h",
Jamie Madilledbc2442016-01-04 11:25:00 -050094 "include/GLES3/gl3platform.h",
Jamie Madill72f5b5e2014-06-23 15:13:02 -040095 "include/GLSLANG/ShaderLang.h",
96 "include/KHR/khrplatform.h",
97 ]
98}
99
100static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -0700101 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400102
Jamie Madille2e406c2016-06-02 13:04:10 -0400103 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400104 configs += [ ":internal_config" ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400105
106 public_deps = [
107 ":angle_common",
108 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400109}
110
Corentin Walleza5615c62016-09-19 09:54:44 -0400111config("translator_disable_pool_alloc") {
112 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400113}
114
Cooper Partin75da1972015-06-16 15:03:14 -0700115config("debug_annotations_config") {
116 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500117 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700118 }
119}
120
Jamie Madille31fd872016-05-27 08:35:36 -0400121config("angle_release_asserts_config") {
122 if (dcheck_always_on) {
123 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
124 }
125}
126
Jamie Madille2e406c2016-06-02 13:04:10 -0400127config("angle_common_config") {
128 include_dirs = [ "src/common/third_party/numerics" ]
129}
130
Jamie Madill562e81b2015-01-14 14:31:02 -0500131static_library("angle_common") {
132 sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
Cooper Partin75da1972015-06-16 15:03:14 -0700133
Jamie Madilldcab56a2017-01-05 14:47:34 -0500134 if (is_linux || is_android) {
135 sources += rebase_path(gles_gypi.libangle_common_linux_sources, ".", "src")
136 }
137
138 if (is_mac) {
139 sources += rebase_path(gles_gypi.libangle_common_mac_sources, ".", "src")
140 }
141
142 if (is_win) {
143 sources += rebase_path(gles_gypi.libangle_common_win_sources, ".", "src")
144 }
145
Jamie Madille2e406c2016-06-02 13:04:10 -0400146 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500147 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400148 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700149 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400150 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400151 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500152 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400153
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400154 public_deps = [
155 ":commit_id",
156 ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400157 public_configs = [
158 ":angle_release_asserts_config",
159 ":angle_common_config",
160 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500161}
162
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400163config("angle_image_util_config") {
164 include_dirs = [
165 "include",
166 "src",
167 ]
168}
169
Dirk Pranke313d9442016-07-13 18:01:55 -0700170static_library("angle_image_util") {
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400171 sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
172
173 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400174 configs += [ ":internal_config" ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400175
176 public_configs = [ ":angle_image_util_config" ]
177
178 public_deps = [
179 ":angle_common",
180 ]
181}
182
Yuly Novikovea586542016-11-10 17:33:43 -0500183static_library("translator") {
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500184 sources = rebase_path(compiler_gypi.angle_translator_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800185 defines = []
186
Corentin Wallez28b65282016-06-16 07:24:50 -0700187 if (angle_enable_essl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500188 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500189 rebase_path(compiler_gypi.angle_translator_essl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800190 defines += [ "ANGLE_ENABLE_ESSL" ]
191 }
192
Corentin Wallez28b65282016-06-16 07:24:50 -0700193 if (angle_enable_glsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500194 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500195 rebase_path(compiler_gypi.angle_translator_glsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800196 defines += [ "ANGLE_ENABLE_GLSL" ]
197 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400198
Corentin Wallez28b65282016-06-16 07:24:50 -0700199 if (angle_enable_hlsl || use_libfuzzer) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500200 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500201 rebase_path(compiler_gypi.angle_translator_hlsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800202 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100203 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400204 configs -= angle_undefine_configs
Yuly Novikovea586542016-11-10 17:33:43 -0500205 configs += [ ":internal_config" ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700206 public_configs = [ ":external_config" ]
Corentin Walleza5615c62016-09-19 09:54:44 -0400207 if (use_libfuzzer) {
208 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
209 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400210
211 deps = [
212 ":includes",
213 ":preprocessor",
214 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500215
216 public_deps = [
217 ":angle_common",
218 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400219
220 if (is_win) {
221 # Necessary to suppress some system header xtree warnigns in Release.
222 # For some reason this warning doesn't get triggered in Chromium
223 cflags = [ "/wd4718" ]
224 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400225}
226
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400227source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700228 sources = [
229 "src/compiler/fuzz/translator_fuzzer.cpp",
230 ]
231
232 include_dirs = [
233 "include",
234 "src",
235 ]
236
237 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400238 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700239 ]
240}
241
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400242config("commit_id_config") {
243 include_dirs = [ "$root_gen_dir/angle" ]
244}
245
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200246commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
247if (angle_use_commit_id) {
248 action("commit_id") {
249 script = "src/commit_id.py"
250 outputs = [
251 commit_id_output_file,
252 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400253
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200254 args = [
255 "gen",
256 rebase_path(".", root_build_dir),
257 rebase_path(commit_id_output_file, root_build_dir),
258 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400259
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200260 public_configs = [ ":commit_id_config" ]
261 }
262} else {
263 copy("commit_id") {
264 sources = [
265 "src/commit.h",
266 ]
267 outputs = [
268 commit_id_output_file,
269 ]
270 public_configs = [ ":commit_id_config" ]
271 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400272}
273
Jamie Madill562e81b2015-01-14 14:31:02 -0500274config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800275 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500276 defines = []
277 if (angle_enable_d3d9) {
278 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500279 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500280 if (angle_enable_d3d11) {
281 defines += [ "ANGLE_ENABLE_D3D11" ]
282 }
Geoff Langc588ac72015-02-13 15:41:41 -0500283 if (angle_enable_gl) {
284 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700285 if (use_x11) {
286 defines += [ "ANGLE_USE_X11" ]
287 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400288 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400289 if (angle_enable_vulkan) {
290 defines += [ "ANGLE_ENABLE_VULKAN" ]
291 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400292 if (angle_enable_null) {
293 defines += [ "ANGLE_ENABLE_NULL" ]
294 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500295 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400296
297 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800298 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
299 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500300}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500301
Jamie Madill562e81b2015-01-14 14:31:02 -0500302static_library("libANGLE") {
303 sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
Geoff Lang2b5420c2014-11-19 14:20:15 -0500304
Geoff Langc588ac72015-02-13 15:41:41 -0500305 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500306 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500307 defines = []
Jamie Madille2e406c2016-06-02 13:04:10 -0400308 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500309 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400310 ]
311 deps = [
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400312 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500313 ":commit_id",
314 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400315 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500316 ]
317
Jamie Madill562e81b2015-01-14 14:31:02 -0500318 # Shared D3D sources.
319 if (angle_enable_d3d9 || angle_enable_d3d11) {
320 sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400321
Jamie Madilledbc2442016-01-04 11:25:00 -0500322 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500323 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500324
Jamie Madill562e81b2015-01-14 14:31:02 -0500325 if (angle_enable_d3d9) {
326 sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
327 libs += [ "d3d9.lib" ]
328 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400329
Jamie Madill562e81b2015-01-14 14:31:02 -0500330 if (angle_enable_d3d11) {
331 sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
332 sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
Austin Kinross91e71ed2016-08-23 09:29:22 -0700333 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500334 }
335
Geoff Langc588ac72015-02-13 15:41:41 -0500336 if (angle_enable_gl) {
337 sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src")
338 include_dirs += [ "src/third_party/khronos" ]
339
340 if (is_win) {
341 sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src")
342 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400343 if (use_x11) {
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400344 sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400345 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500346 libs += [
347 "X11",
348 "Xi",
349 "Xext",
350 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400351 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400352 if (is_mac) {
353 sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src")
354 libs += [
355 "Cocoa.framework",
356 "IOSurface.framework",
357 "OpenGL.framework",
358 "QuartzCore.framework",
359 ]
360 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400361 if (is_android) {
362 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
363 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
364 sources +=
365 rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
366 libs += [
367 "android",
368 "log",
369 ]
370 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400371 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400372 configs += [ ":libdrm" ]
373 defines += [ "ANGLE_USE_OZONE" ]
374 deps += [ "//third_party/minigbm" ]
375 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
376 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
377 sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
378 }
Geoff Langc588ac72015-02-13 15:41:41 -0500379 }
380
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400381 if (angle_enable_vulkan) {
382 sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src")
Jamie Madill327ba852016-11-30 12:38:28 -0500383 deps += [ "//third_party/angle/src/vulkan_support:angle_vulkan" ]
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400384 }
385
Geoff Langd08f3b32016-09-23 15:56:30 -0400386 if (angle_enable_null) {
387 sources += rebase_path(gles_gypi.libangle_null_sources, ".", "src")
388 }
389
Jamie Madill562e81b2015-01-14 14:31:02 -0500390 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500391 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400392 }
393
Jamie Madille2e406c2016-06-02 13:04:10 -0400394 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400395
Jamie Madill562e81b2015-01-14 14:31:02 -0500396 configs += [
397 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700398 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400399 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500400 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500401 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400402
Jamie Madill80ab03c2017-01-03 11:03:23 -0500403 public_configs = [ ":libANGLE_config" ]
404
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.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400416 ldflags = [
417 "-rpath",
418 "@executable_path/",
419 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400420 }
421}
422
Jamie Madill80ab03c2017-01-03 11:03:23 -0500423# This config controls export definitions on ANGLE API calls.
424config("angle_static") {
425 defines = [
426 "ANGLE_EXPORT=",
427 "EGLAPI=",
428 "GL_APICALL=",
429 ]
430}
431
Jamie Madill562e81b2015-01-14 14:31:02 -0500432shared_library("libGLESv2") {
433 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
434
435 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500436 ldflags =
437 [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500438 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800439
Robert Sesekdb8ae832016-06-21 11:47:03 -0400440 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400441 ldflags = [
442 "-install_name",
443 "@rpath/${target_name}.dylib",
444 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400445 public_configs = [ ":shared_library_public_config" ]
446 }
447
Jamie Madille2e406c2016-06-02 13:04:10 -0400448 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500449 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500450 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700451 ":debug_annotations_config",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500452 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500453 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400454
Jamie Madilledbc2442016-01-04 11:25:00 -0500455 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500456 if (is_win) {
457 defines += [ "GL_APICALL=" ]
458 } else {
459 defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
460 }
461
462 deps = [
463 ":includes",
464 ":libANGLE",
465 ]
466}
467
468static_library("libGLESv2_static") {
469 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
470
471 configs -= angle_undefine_configs
472 configs += [
473 ":commit_id_config",
474 ":debug_annotations_config",
475 ":internal_config",
476 ]
477
478 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500479
480 deps = [
481 ":includes",
482 ":libANGLE",
483 ]
484}
485
486shared_library("libEGL") {
487 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
488
Jamie Madille2e406c2016-06-02 13:04:10 -0400489 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500490 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500491 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400492 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400493 ":extra_warnings",
494 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500495 ]
496
Jamie Madilledbc2442016-01-04 11:25:00 -0500497 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500498 if (is_win) {
499 defines += [ "EGLAPI=" ]
500 } else {
501 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
502 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500503
Jamie Madill80ab03c2017-01-03 11:03:23 -0500504 if (is_win) {
505 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
506 }
507
508 if (is_mac && !is_component_build) {
509 ldflags = [
510 "-install_name",
511 "@rpath/${target_name}.dylib",
512 ]
513 public_configs = [ ":shared_library_public_config" ]
514 }
515
Jamie Madill562e81b2015-01-14 14:31:02 -0500516 deps = [
517 ":includes",
518 ":libGLESv2",
519 ]
520}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400521
Jamie Madill80ab03c2017-01-03 11:03:23 -0500522static_library("libEGL_static") {
523 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
524
525 configs -= angle_undefine_configs
526 configs += [
527 ":commit_id_config",
528 ":debug_annotations_config",
529 ":extra_warnings",
530 ":internal_config",
531 ]
532
533 public_configs = [ ":angle_static" ]
534
535 deps = [
536 ":includes",
537 ":libGLESv2_static",
538 ]
539}
540
Jamie Madilledbc2442016-01-04 11:25:00 -0500541util_gypi = exec_script("//build/gypi_to_gn.py",
542 [ rebase_path("util/util.gyp") ],
543 "scope",
544 [ "util/util.gyp" ])
545
546config("angle_util_config") {
547 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400548 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500549 libs = [ "X11" ]
550 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500551}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400552
Jamie Madill80ab03c2017-01-03 11:03:23 -0500553foreach(is_shared_library,
554 [
555 true,
556 false,
557 ]) {
558 if (is_shared_library) {
559 library_type = "shared_library"
560 library_name = "angle_util"
561 dep_suffix = ""
562 } else {
563 library_type = "static_library"
564 library_name = "angle_util_static"
565 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400566 }
567
Jamie Madill80ab03c2017-01-03 11:03:23 -0500568 target(library_type, library_name) {
569 sources = rebase_path(util_gypi.util_sources, ".", "util")
570
571 if (is_win) {
572 sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
573 }
574
575 if (is_linux) {
576 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
577 libs = [
578 "rt",
579 "dl",
580 ]
581 }
582
583 if (is_mac) {
584 sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
585 libs = [
586 "AppKit.framework",
587 "QuartzCore.framework",
588 ]
589 }
590
591 if (use_x11) {
592 sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
593 }
594
595 if (is_android) {
596 # To prevent linux sources filtering on android
597 set_sources_assignment_filter([])
598 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
599 sources += rebase_path(util_gypi.util_android_sources, ".", "util")
600 libs = [
601 "android",
602 "log",
603 ]
604 }
605
606 if (use_ozone) {
607 sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
608 }
609
610 configs += [
611 ":debug_annotations_config",
612 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400613 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400614
Jamie Madill80ab03c2017-01-03 11:03:23 -0500615 public_configs = [
616 ":angle_util_config",
617 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400618 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400619
Jamie Madill80ab03c2017-01-03 11:03:23 -0500620 deps = [
621 ":angle_common",
622 ":libEGL${dep_suffix}",
623 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400624 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500625
626 if (is_shared_library) {
627 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
628
629 if (is_mac && !is_component_build) {
630 ldflags = [
631 "-install_name",
632 "@rpath/lib${target_name}.dylib",
633 ]
634 public_configs += [ ":shared_library_public_config" ]
635 }
636 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400637 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400638}