blob: 3d17599bcd2a3dfdb4403a7cd28c6f70a4a14f07 [file] [log] [blame]
Corentin Wallezd4bcfa22015-09-01 10:32:30 -04001# Copyright 2014-2015 The Chromium Authors. All rights reserved.
Jamie Madill72f5b5e2014-06-23 15:13:02 -04002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Corentin Wallez51e2ad12015-05-26 11:32:58 -04005# import the use_x11 variable
Jamie Madille31fd872016-05-27 08:35:36 -04006import("//build/config/dcheck_always_on.gni")
Frank Henigman77df6762016-06-13 16:39:01 -04007import("//build/config/linux/pkg_config.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -04008import("//build/config/ui.gni")
Corentin Wallez28b65282016-06-16 07:24:50 -07009import("//testing/libfuzzer/fuzzer_test.gni")
Frank Henigmand0ef13a2017-08-28 22:53:24 -040010import("gni/angle.gni")
Corentin Wallez51e2ad12015-05-26 11:32:58 -040011
Corentin Wallez16d4e472017-03-20 13:06:19 -040012declare_args() {
13 # Use the PCI lib to collect GPU information on Linux.
14 use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
15 (use_x11 || use_ozone)
16}
17
Frank Henigmand0ef13a2017-08-28 22:53:24 -040018if (!build_with_chromium) {
19 group("all") {
20 testonly = true
21 deps = [
22 ":angle_shader_translator",
23 ":translator_fuzzer",
24 "//samples:all",
25 "//src/tests:all",
26 ]
27 }
28}
29
Frank Henigmane8d5c5c2016-07-07 13:17:47 -040030if (ozone_platform_gbm) {
Frank Henigman62ba9622016-06-27 17:08:28 -040031 pkg_config("libdrm") {
32 packages = [ "libdrm" ]
33 }
Frank Henigman77df6762016-06-13 16:39:01 -040034}
35
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +020036angle_git_is_present = exec_script("src/commit_id.py",
37 [
38 "check",
39 rebase_path(".", root_build_dir),
40 ],
41 "value")
42
43angle_use_commit_id = angle_git_is_present == 1
44
Jamie Madilledbc2442016-01-04 11:25:00 -050045gles_gypi = exec_script("//build/gypi_to_gn.py",
46 [ rebase_path("src/libGLESv2.gypi") ],
47 "scope",
48 [ "src/libGLESv2.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070049
Jamie Madilledbc2442016-01-04 11:25:00 -050050compiler_gypi = exec_script("//build/gypi_to_gn.py",
51 [ rebase_path("src/compiler.gypi") ],
52 "scope",
53 [ "src/compiler.gypi" ])
Brett Wilson04bac602014-07-16 14:19:18 -070054
Brett Wilson2f5469c2014-07-22 17:00:17 -070055# This config is exported to dependent targets (and also applied to internal
56# ones).
57config("external_config") {
Jamie Madilledbc2442016-01-04 11:25:00 -050058 include_dirs = [ "include" ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070059}
60
Jamie Madill72f5b5e2014-06-23 15:13:02 -040061# This config is applied to internal Angle targets (not pushed to dependents).
62config("internal_config") {
63 include_dirs = [
64 "include",
65 "src",
66 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -050067
68 # Prevent the GL headers from redeclaring ANGLE entry points.
69 defines = [
70 "GL_GLEXT_PROTOTYPES",
71 "EGL_EGLEXT_PROTOTYPES",
72 ]
Jamie Madill6de51852017-04-12 09:53:01 -040073
74 if (target_cpu == "x86") {
75 defines += [ "ANGLE_X86_CPU" ]
76 }
77 if (target_cpu == "x64") {
78 defines += [ "ANGLE_X64_CPU" ]
79 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -040080}
81
Jamie Madill509a1d42016-07-18 10:10:29 -040082config("extra_warnings") {
Ben Wagner211bff32017-10-10 23:53:20 -040083 cflags = []
Frank Henigmand0ef13a2017-08-28 22:53:24 -040084
Jamie Madill509a1d42016-07-18 10:10:29 -040085 # Enable more default warnings on Windows.
86 if (is_win) {
Ben Wagner211bff32017-10-10 23:53:20 -040087 cflags += [
Jamie Madill509a1d42016-07-18 10:10:29 -040088 "/we4244", # Conversion: possible loss of data.
89 "/we4456", # Variable shadowing.
Jamie Madill1db8a262016-09-22 13:53:47 -040090 "/we4458", # declaration hides class member.
Jamie Madill509a1d42016-07-18 10:10:29 -040091 ]
92 }
Ben Wagner211bff32017-10-10 23:53:20 -040093 if (is_clang) {
94 # Remove when crbug.com/428099 is resolved.
Frank Henigmand0ef13a2017-08-28 22:53:24 -040095 cflags += [ "-Winconsistent-missing-override" ]
Ben Wagner211bff32017-10-10 23:53:20 -040096 }
Jamie Madill509a1d42016-07-18 10:10:29 -040097}
98
Daniel Bratell73941de2015-02-25 14:34:49 +010099if (is_win) {
Daniel Bratell73941de2015-02-25 14:34:49 +0100100 copy("copy_compiler_dll") {
Jamie Madilledbc2442016-01-04 11:25:00 -0500101 sources = [
102 "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
103 ]
104 outputs = [
105 "$root_out_dir/d3dcompiler_47.dll",
106 ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100107 }
Daniel Bratell73941de2015-02-25 14:34:49 +0100108}
109
Jamie Madilla8503ce2016-07-18 13:47:12 -0400110angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400111
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400112# Holds the shared includes so we only need to list them once.
113source_set("includes") {
114 sources = [
115 "include/EGL/egl.h",
116 "include/EGL/eglext.h",
117 "include/EGL/eglplatform.h",
118 "include/GLES2/gl2.h",
119 "include/GLES2/gl2ext.h",
120 "include/GLES2/gl2platform.h",
121 "include/GLES3/gl3.h",
Geoff Langee483762015-09-15 13:12:07 -0400122 "include/GLES3/gl31.h",
123 "include/GLES3/gl32.h",
Jamie Madilledbc2442016-01-04 11:25:00 -0500124 "include/GLES3/gl3platform.h",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400125 "include/GLSLANG/ShaderLang.h",
126 "include/KHR/khrplatform.h",
127 ]
128}
129
130static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -0700131 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400132
Jamie Madille2e406c2016-06-02 13:04:10 -0400133 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400134 configs += [
135 ":extra_warnings",
136 ":internal_config",
137 ]
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400138
139 public_deps = [
140 ":angle_common",
141 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400142}
143
Corentin Walleza5615c62016-09-19 09:54:44 -0400144config("translator_disable_pool_alloc") {
145 defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
Jamie Madille5c97ab2014-08-07 12:31:38 -0400146}
147
Cooper Partin75da1972015-06-16 15:03:14 -0700148config("debug_annotations_config") {
149 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500150 defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
Cooper Partin75da1972015-06-16 15:03:14 -0700151 }
152}
153
Jamie Madille31fd872016-05-27 08:35:36 -0400154config("angle_release_asserts_config") {
155 if (dcheck_always_on) {
156 defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
157 }
158}
159
Jamie Madille2e406c2016-06-02 13:04:10 -0400160config("angle_common_config") {
Jamie Madill5ea762a2017-06-07 14:59:51 -0400161 include_dirs = [ "src/common/third_party/base" ]
Jamie Madille2e406c2016-06-02 13:04:10 -0400162}
163
Jamie Madill562e81b2015-01-14 14:31:02 -0500164static_library("angle_common") {
165 sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
Cooper Partin75da1972015-06-16 15:03:14 -0700166
Jamie Madilldcab56a2017-01-05 14:47:34 -0500167 if (is_linux || is_android) {
168 sources += rebase_path(gles_gypi.libangle_common_linux_sources, ".", "src")
169 }
170
171 if (is_mac) {
172 sources += rebase_path(gles_gypi.libangle_common_mac_sources, ".", "src")
173 }
174
175 if (is_win) {
176 sources += rebase_path(gles_gypi.libangle_common_win_sources, ".", "src")
177 }
178
Jamie Madille2e406c2016-06-02 13:04:10 -0400179 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500180 configs += [
Jamie Madille2e406c2016-06-02 13:04:10 -0400181 ":angle_common_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700182 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400183 ":extra_warnings",
Jamie Madille2e406c2016-06-02 13:04:10 -0400184 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500185 ]
Jeremy Roman06feb812016-04-06 16:39:52 -0400186
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400187 public_deps = [
188 ":commit_id",
189 ]
Jamie Madille1fd4752017-04-26 16:46:48 -0400190 public_configs = [ ":angle_common_config" ]
191 all_dependent_configs = [ ":angle_release_asserts_config" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500192}
193
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400194config("angle_image_util_config") {
195 include_dirs = [
196 "include",
197 "src",
198 ]
199}
200
Dirk Pranke313d9442016-07-13 18:01:55 -0700201static_library("angle_image_util") {
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400202 sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
203
204 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500205 configs += [
206 ":internal_config",
207 ":extra_warnings",
208 ]
Geoff Lang6e4cfce2016-06-13 15:06:31 -0400209
210 public_configs = [ ":angle_image_util_config" ]
211
212 public_deps = [
213 ":angle_common",
214 ]
215}
216
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500217config("angle_gpu_info_util_config") {
218 include_dirs = [
219 "include",
220 "src",
221 ]
222}
223
224static_library("angle_gpu_info_util") {
225 configs -= angle_undefine_configs
Corentin Wallez878baf92017-02-15 13:57:16 -0500226 configs += [
227 ":internal_config",
228 ":extra_warnings",
229 ]
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500230
231 public_configs = [ ":angle_gpu_info_util_config" ]
232
233 public_deps = [
234 ":angle_common",
235 ]
236
237 sources = rebase_path(gles_gypi.libangle_gpu_info_util_sources, ".", "src")
238 deps = []
239 libs = []
240 defines = []
241
Corentin Wallez8f77e5d2017-03-24 11:58:59 -0700242 if (is_win) {
243 sources +=
244 rebase_path(gles_gypi.libangle_gpu_info_util_win_sources, ".", "src")
245 libs += [ "setupapi.lib" ]
246 defines += [ "GPU_INFO_USE_SETUPAPI" ]
247 }
248
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500249 if (is_linux) {
250 sources +=
251 rebase_path(gles_gypi.libangle_gpu_info_util_linux_sources, ".", "src")
252
253 if (use_x11) {
Corentin Wallez878baf92017-02-15 13:57:16 -0500254 sources +=
255 rebase_path(gles_gypi.libangle_gpu_info_util_x11_sources, ".", "src")
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500256 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
257 defines += [ "GPU_INFO_USE_X11" ]
258 libs += [
259 "X11",
260 "Xi",
261 "Xext",
262 ]
263 }
264 }
265
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500266 if (use_libpci) {
267 sources +=
268 rebase_path(gles_gypi.libangle_gpu_info_util_libpci_sources, ".", "src")
269 defines += [ "GPU_INFO_USE_LIBPCI" ]
270 libs += [ "pci" ]
271 }
Corentin Wallezd83f64f2017-02-16 10:58:46 -0500272
273 if (is_mac) {
274 sources +=
275 rebase_path(gles_gypi.libangle_gpu_info_util_mac_sources, ".", "src")
276 libs += [
277 "IOKit.framework",
278 "CoreFoundation.framework",
279 ]
280 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500281}
282
Yuly Novikovea586542016-11-10 17:33:43 -0500283static_library("translator") {
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500284 sources = rebase_path(compiler_gypi.angle_translator_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800285 defines = []
286
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700287 if (angle_enable_essl || use_fuzzing_engine) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500288 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500289 rebase_path(compiler_gypi.angle_translator_essl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800290 defines += [ "ANGLE_ENABLE_ESSL" ]
291 }
292
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700293 if (angle_enable_glsl || use_fuzzing_engine) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500294 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500295 rebase_path(compiler_gypi.angle_translator_glsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800296 defines += [ "ANGLE_ENABLE_GLSL" ]
297 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400298
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700299 if (angle_enable_hlsl || use_fuzzing_engine) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500300 sources +=
Yuly Novikovdfd7fb22016-11-11 16:05:11 -0500301 rebase_path(compiler_gypi.angle_translator_hlsl_sources, ".", "src")
Austin Kinross82b5ab62015-12-11 09:30:15 -0800302 defines += [ "ANGLE_ENABLE_HLSL" ]
Daniel Bratell73941de2015-02-25 14:34:49 +0100303 }
Jamie Madille794cd82017-01-13 17:29:51 -0500304
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700305 if (angle_enable_vulkan || use_fuzzing_engine) {
Jamie Madille794cd82017-01-13 17:29:51 -0500306 sources += rebase_path(compiler_gypi.angle_translator_lib_vulkan_sources,
307 ".",
308 "src")
309 defines += [ "ANGLE_ENABLE_VULKAN" ]
310 }
311
Jamie Madille2e406c2016-06-02 13:04:10 -0400312 configs -= angle_undefine_configs
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400313 configs += [
314 ":internal_config",
315 ":extra_warnings",
316 ]
Brett Wilson10ac4042014-09-24 10:20:56 -0700317 public_configs = [ ":external_config" ]
Jonathan Metzmanfb9051a2017-10-09 16:14:06 -0700318 if (use_fuzzing_engine) {
Corentin Walleza5615c62016-09-19 09:54:44 -0400319 all_dependent_configs = [ ":translator_disable_pool_alloc" ]
320 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400321
322 deps = [
323 ":includes",
324 ":preprocessor",
325 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500326
327 public_deps = [
328 ":angle_common",
329 ]
Jamie Madilla8503ce2016-07-18 13:47:12 -0400330
331 if (is_win) {
332 # Necessary to suppress some system header xtree warnigns in Release.
333 # For some reason this warning doesn't get triggered in Chromium
334 cflags = [ "/wd4718" ]
335 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400336}
337
Corentin Wallez30e11ab2016-09-16 10:29:54 -0400338source_set("translator_fuzzer") {
Corentin Wallez28b65282016-06-16 07:24:50 -0700339 sources = [
340 "src/compiler/fuzz/translator_fuzzer.cpp",
341 ]
342
343 include_dirs = [
344 "include",
345 "src",
346 ]
347
348 deps = [
Yuly Novikove6534032016-11-01 18:19:06 -0400349 ":translator",
Corentin Wallez28b65282016-06-16 07:24:50 -0700350 ]
351}
352
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400353config("commit_id_config") {
354 include_dirs = [ "$root_gen_dir/angle" ]
355}
356
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200357commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
358if (angle_use_commit_id) {
359 action("commit_id") {
360 script = "src/commit_id.py"
361 outputs = [
362 commit_id_output_file,
363 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400364
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200365 args = [
366 "gen",
367 rebase_path(".", root_build_dir),
368 rebase_path(commit_id_output_file, root_build_dir),
369 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400370
Tomasz Moniuszko319fb8982015-07-30 14:34:54 +0200371 public_configs = [ ":commit_id_config" ]
372 }
373} else {
374 copy("commit_id") {
375 sources = [
376 "src/commit.h",
377 ]
378 outputs = [
379 commit_id_output_file,
380 ]
381 public_configs = [ ":commit_id_config" ]
382 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400383}
384
Jamie Madill562e81b2015-01-14 14:31:02 -0500385config("libANGLE_config") {
Austin Kinross40853472015-02-12 10:39:56 -0800386 cflags = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500387 defines = []
388 if (angle_enable_d3d9) {
389 defines += [ "ANGLE_ENABLE_D3D9" ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500390 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500391 if (angle_enable_d3d11) {
392 defines += [ "ANGLE_ENABLE_D3D11" ]
393 }
Geoff Langc588ac72015-02-13 15:41:41 -0500394 if (angle_enable_gl) {
395 defines += [ "ANGLE_ENABLE_OPENGL" ]
Steven Bennetts369d03c2016-05-05 10:37:38 -0700396 if (use_x11) {
397 defines += [ "ANGLE_USE_X11" ]
398 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400399 }
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400400 if (angle_enable_vulkan) {
401 defines += [ "ANGLE_ENABLE_VULKAN" ]
402 }
Geoff Langd08f3b32016-09-23 15:56:30 -0400403 if (angle_enable_null) {
404 defines += [ "ANGLE_ENABLE_NULL" ]
405 }
Jamie Madill80ab03c2017-01-03 11:03:23 -0500406 defines += [ "LIBANGLE_IMPLEMENTATION" ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400407
408 if (is_win) {
Austin Kinross40853472015-02-12 10:39:56 -0800409 cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
410 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500411}
Geoff Lang2b5420c2014-11-19 14:20:15 -0500412
Jamie Madill562e81b2015-01-14 14:31:02 -0500413static_library("libANGLE") {
414 sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
Geoff Lang2b5420c2014-11-19 14:20:15 -0500415
Jamie Madill5ea762a2017-06-07 14:59:51 -0400416 include_dirs = []
Jamie Madill562e81b2015-01-14 14:31:02 -0500417 libs = []
Corentin Wallez64598b52016-11-11 08:25:44 -0500418 defines = []
Jamie Madille2e406c2016-06-02 13:04:10 -0400419 public_deps = [
Corentin Wallezcc068e92016-02-29 16:37:04 -0500420 ":angle_common",
Jamie Madille2e406c2016-06-02 13:04:10 -0400421 ]
422 deps = [
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500423 ":angle_gpu_info_util",
Corentin Wallez878baf92017-02-15 13:57:16 -0500424 ":angle_image_util",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500425 ":commit_id",
426 ":includes",
Yuly Novikove6534032016-11-01 18:19:06 -0400427 ":translator",
Corentin Wallezcc068e92016-02-29 16:37:04 -0500428 ]
429
Jamie Madill562e81b2015-01-14 14:31:02 -0500430 # Shared D3D sources.
431 if (angle_enable_d3d9 || angle_enable_d3d11) {
432 sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400433
Jamie Madilledbc2442016-01-04 11:25:00 -0500434 defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500435 }
Geoff Lang2b5420c2014-11-19 14:20:15 -0500436
Jamie Madill562e81b2015-01-14 14:31:02 -0500437 if (angle_enable_d3d9) {
438 sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
439 libs += [ "d3d9.lib" ]
440 }
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400441
Jamie Madill562e81b2015-01-14 14:31:02 -0500442 if (angle_enable_d3d11) {
443 sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
444 sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
Austin Kinross91e71ed2016-08-23 09:29:22 -0700445 libs += [ "dxguid.lib" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500446 }
447
Geoff Langc588ac72015-02-13 15:41:41 -0500448 if (angle_enable_gl) {
449 sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src")
450 include_dirs += [ "src/third_party/khronos" ]
451
452 if (is_win) {
453 sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src")
454 }
Corentin Wallez51e2ad12015-05-26 11:32:58 -0400455 if (use_x11) {
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400456 sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src")
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400457 deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
Corentin Wallezcc068e92016-02-29 16:37:04 -0500458 libs += [
459 "X11",
460 "Xi",
461 "Xext",
462 ]
Corentin Wallez47fc1fe2015-05-14 10:54:18 -0400463 }
Nico Weberde44d3a2016-05-13 17:27:57 -0400464 if (is_mac) {
465 sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src")
466 libs += [
467 "Cocoa.framework",
468 "IOSurface.framework",
469 "OpenGL.framework",
470 "QuartzCore.framework",
471 ]
472 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400473 if (is_android) {
474 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
475 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
476 sources +=
477 rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
478 libs += [
479 "android",
480 "log",
481 ]
482 }
Frank Henigmane8d5c5c2016-07-07 13:17:47 -0400483 if (ozone_platform_gbm) {
Frank Henigman77df6762016-06-13 16:39:01 -0400484 configs += [ ":libdrm" ]
485 defines += [ "ANGLE_USE_OZONE" ]
486 deps += [ "//third_party/minigbm" ]
487 sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
488 sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
489 sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
490 }
Geoff Langc588ac72015-02-13 15:41:41 -0500491 }
492
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400493 if (angle_enable_vulkan) {
494 sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src")
Frank Henigman29f148b2016-11-23 21:05:36 -0500495 if (is_win) {
496 sources +=
497 rebase_path(gles_gypi.libangle_vulkan_win32_sources, ".", "src")
498 }
499 if (is_linux) {
500 sources += rebase_path(gles_gypi.libangle_vulkan_xcb_sources, ".", "src")
501 }
Frank Henigmand0ef13a2017-08-28 22:53:24 -0400502 deps += [ "src/vulkan_support:angle_vulkan" ]
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400503 }
504
Geoff Langd08f3b32016-09-23 15:56:30 -0400505 if (angle_enable_null) {
506 sources += rebase_path(gles_gypi.libangle_null_sources, ".", "src")
507 }
508
Jamie Madill562e81b2015-01-14 14:31:02 -0500509 if (is_debug) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500510 defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400511 }
512
Jamie Madille2e406c2016-06-02 13:04:10 -0400513 configs -= angle_undefine_configs
Jamie Madilla8503ce2016-07-18 13:47:12 -0400514
Jamie Madill562e81b2015-01-14 14:31:02 -0500515 configs += [
516 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700517 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400518 ":extra_warnings",
Jamie Madill562e81b2015-01-14 14:31:02 -0500519 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500520 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400521
Jamie Madill80ab03c2017-01-03 11:03:23 -0500522 public_configs = [ ":libANGLE_config" ]
523
Jamie Madill562e81b2015-01-14 14:31:02 -0500524 if (is_win) {
Jamie Madille2e406c2016-06-02 13:04:10 -0400525 data_deps = [
526 ":copy_compiler_dll",
527 ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500528 }
529}
530
Robert Sesekdb8ae832016-06-21 11:47:03 -0400531config("shared_library_public_config") {
532 if (is_mac && !is_component_build) {
533 # Executable targets that depend on the shared libraries below need to have
534 # the rpath setup in non-component build configurations.
Jamie Madilla8503ce2016-07-18 13:47:12 -0400535 ldflags = [
536 "-rpath",
537 "@executable_path/",
538 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400539 }
540}
541
Jamie Madill80ab03c2017-01-03 11:03:23 -0500542# This config controls export definitions on ANGLE API calls.
543config("angle_static") {
544 defines = [
545 "ANGLE_EXPORT=",
546 "EGLAPI=",
547 "GL_APICALL=",
548 ]
549}
550
Jamie Madill562e81b2015-01-14 14:31:02 -0500551shared_library("libGLESv2") {
552 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
553
Andrew Grieve949e0702017-01-16 09:44:49 -0500554 if (is_android) {
555 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
556 }
557
Jamie Madill562e81b2015-01-14 14:31:02 -0500558 if (is_win) {
Jamie Madilledbc2442016-01-04 11:25:00 -0500559 ldflags =
560 [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
Geoff Lang2b5420c2014-11-19 14:20:15 -0500561 }
John Abd-El-Malek657cd682014-11-05 14:04:19 -0800562
Robert Sesekdb8ae832016-06-21 11:47:03 -0400563 if (is_mac && !is_component_build) {
Jamie Madilla8503ce2016-07-18 13:47:12 -0400564 ldflags = [
565 "-install_name",
566 "@rpath/${target_name}.dylib",
567 ]
Robert Sesekdb8ae832016-06-21 11:47:03 -0400568 public_configs = [ ":shared_library_public_config" ]
569 }
570
Jamie Madille2e406c2016-06-02 13:04:10 -0400571 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500572 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500573 ":commit_id_config",
Cooper Partin75da1972015-06-16 15:03:14 -0700574 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400575 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500576 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500577 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400578
Jamie Madilledbc2442016-01-04 11:25:00 -0500579 defines = [ "LIBGLESV2_IMPLEMENTATION" ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500580 if (is_win) {
581 defines += [ "GL_APICALL=" ]
582 } else {
583 defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
584 }
585
586 deps = [
587 ":includes",
588 ":libANGLE",
Tom Anderson26098cb2017-05-24 20:39:28 -0700589 "//build/config:exe_and_shlib_deps",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500590 ]
591}
592
593static_library("libGLESv2_static") {
594 sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
595
596 configs -= angle_undefine_configs
597 configs += [
598 ":commit_id_config",
599 ":debug_annotations_config",
Ben Wagnerd736ccc2017-10-11 15:08:22 -0400600 ":extra_warnings",
Jamie Madill80ab03c2017-01-03 11:03:23 -0500601 ":internal_config",
602 ]
603
604 public_configs = [ ":angle_static" ]
Jamie Madill562e81b2015-01-14 14:31:02 -0500605
606 deps = [
607 ":includes",
608 ":libANGLE",
609 ]
610}
611
612shared_library("libEGL") {
613 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
614
Andrew Grieve949e0702017-01-16 09:44:49 -0500615 if (is_android) {
616 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
617 }
Jamie Madille2e406c2016-06-02 13:04:10 -0400618 configs -= angle_undefine_configs
Jamie Madill562e81b2015-01-14 14:31:02 -0500619 configs += [
Jamie Madill562e81b2015-01-14 14:31:02 -0500620 ":commit_id_config",
Corentin Wallezbeb81582015-09-02 10:30:55 -0400621 ":debug_annotations_config",
Jamie Madill509a1d42016-07-18 10:10:29 -0400622 ":extra_warnings",
623 ":internal_config",
Jamie Madill562e81b2015-01-14 14:31:02 -0500624 ]
625
Jamie Madilledbc2442016-01-04 11:25:00 -0500626 defines = [ "LIBEGL_IMPLEMENTATION" ]
Yuly Novikova4ab5802016-12-19 17:44:22 -0500627 if (is_win) {
628 defines += [ "EGLAPI=" ]
629 } else {
630 defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
631 }
Jamie Madill562e81b2015-01-14 14:31:02 -0500632
Jamie Madill80ab03c2017-01-03 11:03:23 -0500633 if (is_win) {
634 ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
635 }
636
637 if (is_mac && !is_component_build) {
638 ldflags = [
639 "-install_name",
640 "@rpath/${target_name}.dylib",
641 ]
642 public_configs = [ ":shared_library_public_config" ]
643 }
644
Jamie Madill562e81b2015-01-14 14:31:02 -0500645 deps = [
646 ":includes",
647 ":libGLESv2",
Tom Anderson26098cb2017-05-24 20:39:28 -0700648 "//build/config:exe_and_shlib_deps",
Jamie Madill562e81b2015-01-14 14:31:02 -0500649 ]
650}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400651
Jamie Madill80ab03c2017-01-03 11:03:23 -0500652static_library("libEGL_static") {
653 sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
654
655 configs -= angle_undefine_configs
656 configs += [
657 ":commit_id_config",
658 ":debug_annotations_config",
659 ":extra_warnings",
660 ":internal_config",
661 ]
662
663 public_configs = [ ":angle_static" ]
664
665 deps = [
666 ":includes",
667 ":libGLESv2_static",
668 ]
669}
670
Jamie Madilledbc2442016-01-04 11:25:00 -0500671util_gypi = exec_script("//build/gypi_to_gn.py",
672 [ rebase_path("util/util.gyp") ],
673 "scope",
674 [ "util/util.gyp" ])
675
676config("angle_util_config") {
677 include_dirs = [ "util" ]
Frank Henigman77df6762016-06-13 16:39:01 -0400678 if (is_linux && use_x11) {
Jamie Madill1fae3552016-01-07 14:33:48 -0500679 libs = [ "X11" ]
680 }
Jamie Madilledbc2442016-01-04 11:25:00 -0500681}
Corentin Wallezbeb81582015-09-02 10:30:55 -0400682
Jamie Madill80ab03c2017-01-03 11:03:23 -0500683foreach(is_shared_library,
684 [
685 true,
686 false,
687 ]) {
688 if (is_shared_library) {
689 library_type = "shared_library"
690 library_name = "angle_util"
691 dep_suffix = ""
692 } else {
693 library_type = "static_library"
694 library_name = "angle_util_static"
695 dep_suffix = "_static"
Corentin Wallezbeb81582015-09-02 10:30:55 -0400696 }
697
Jamie Madill80ab03c2017-01-03 11:03:23 -0500698 target(library_type, library_name) {
699 sources = rebase_path(util_gypi.util_sources, ".", "util")
700
701 if (is_win) {
702 sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
703 }
704
705 if (is_linux) {
706 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
707 libs = [
708 "rt",
709 "dl",
710 ]
711 }
712
713 if (is_mac) {
714 sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
715 libs = [
716 "AppKit.framework",
717 "QuartzCore.framework",
718 ]
719 }
720
721 if (use_x11) {
722 sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
723 }
724
725 if (is_android) {
Andrew Grieve949e0702017-01-16 09:44:49 -0500726 if (is_shared_library) {
727 configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
728 }
Corentin Wallez7b4e00d2017-02-08 10:43:47 -0500729
Jamie Madill80ab03c2017-01-03 11:03:23 -0500730 # To prevent linux sources filtering on android
731 set_sources_assignment_filter([])
732 sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
733 sources += rebase_path(util_gypi.util_android_sources, ".", "util")
734 libs = [
735 "android",
736 "log",
737 ]
738 }
739
740 if (use_ozone) {
741 sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
742 }
743
744 configs += [
745 ":debug_annotations_config",
746 ":extra_warnings",
Yuly Novikov87ae8cd2016-05-19 17:59:55 -0400747 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400748
Jamie Madill80ab03c2017-01-03 11:03:23 -0500749 public_configs = [
750 ":angle_util_config",
751 ":internal_config",
Yuly Novikove3352f92016-08-12 20:40:14 -0400752 ]
Corentin Wallezbeb81582015-09-02 10:30:55 -0400753
Jamie Madill80ab03c2017-01-03 11:03:23 -0500754 deps = [
755 ":angle_common",
756 ":libEGL${dep_suffix}",
757 ":libGLESv2${dep_suffix}",
Yuly Novikova6426d62016-06-03 00:18:38 -0400758 ]
Jamie Madill80ab03c2017-01-03 11:03:23 -0500759
760 if (is_shared_library) {
761 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
762
Tom Anderson26098cb2017-05-24 20:39:28 -0700763 deps += [ "//build/config:exe_and_shlib_deps" ]
764
Jamie Madill80ab03c2017-01-03 11:03:23 -0500765 if (is_mac && !is_component_build) {
766 ldflags = [
767 "-install_name",
768 "@rpath/lib${target_name}.dylib",
769 ]
770 public_configs += [ ":shared_library_public_config" ]
771 }
772 }
Yuly Novikova6426d62016-06-03 00:18:38 -0400773 }
Corentin Wallezbeb81582015-09-02 10:30:55 -0400774}
Ken Russellfcadd082017-06-28 14:01:15 -0700775
776# Convenience targets for some of the samples so they can be built
777# with Chromium's toolchain.
778
779executable("angle_shader_translator") {
780 testonly = true
781
782 sources = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400783 "samples/shader_translator/shader_translator.cpp",
Ken Russellfcadd082017-06-28 14:01:15 -0700784 ]
785
786 deps = [
Yuly Novikovf0be43f2017-06-29 21:25:56 -0400787 ":translator",
788 "//build/config:exe_and_shlib_deps",
Ken Russellfcadd082017-06-28 14:01:15 -0700789 ]
790}