blob: 981acda1ed1aa9bf746aa1e7f29439ccde59b575 [file] [log] [blame]
mtkleind68f9b02016-09-23 13:18:41 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6declare_args() {
7}
8
9angle_root = "../externals/angle2"
10
11import("../third_party.gni")
Mike Klein3e74c512018-08-30 11:30:01 -040012import("$angle_root/src/compiler.gni")
13import("$angle_root/src/libGLESv2.gni")
mtkleind68f9b02016-09-23 13:18:41 -070014
15third_party("angle2") {
16 public_include_dirs = [ "$angle_root/include" ]
17 deps = [
18 ":libEGL",
19 ":libGLESv2",
20 ]
21}
22
mtkleind68f9b02016-09-23 13:18:41 -070023config("common") {
mtkleind68f9b02016-09-23 13:18:41 -070024 defines = [
25 "ANGLE_ENABLE_ESSL",
26 "ANGLE_ENABLE_GLSL",
Mike Kleina2c2fdd2016-10-17 12:34:38 -040027 "ANGLE_ENABLE_HLSL",
Mike Klein1a8d6752016-10-17 11:51:11 -040028 "ANGLE_ENABLE_OPENGL",
mtkleind68f9b02016-09-23 13:18:41 -070029 "EGL_EGLEXT_PROTOTYPES",
Mike Klein1a8d6752016-10-17 11:51:11 -040030 "GL_GLEXT_PROTOTYPES",
mtkleind68f9b02016-09-23 13:18:41 -070031 ]
32 include_dirs = [
33 "$root_gen_dir/angle2",
34 "$angle_root/include",
35 "$angle_root/src",
Robert Phillipsffaa47e2017-06-12 08:40:56 -040036 "$angle_root/src/common/third_party/base",
Mike Klein1a8d6752016-10-17 11:51:11 -040037 "$angle_root/src/third_party/khronos",
mtkleind68f9b02016-09-23 13:18:41 -070038 ]
Brian Salomon80094882017-08-18 11:44:28 -040039 cflags_cc = []
Mike Klein1a8d6752016-10-17 11:51:11 -040040 assert(is_linux || is_win) # TODO: is_mac?
mtkleind68f9b02016-09-23 13:18:41 -070041 if (is_linux) {
42 defines += [
mtkleind68f9b02016-09-23 13:18:41 -070043 "ANGLE_USE_X11",
44 "GL_APICALL=__attribute__((visibility(\"default\")))",
Geoff Lang03362c32018-01-22 17:37:57 -050045 "GL_API=__attribute__((visibility(\"default\")))",
mtkleind68f9b02016-09-23 13:18:41 -070046 "EGLAPI=__attribute__((visibility(\"default\")))",
47 ]
Brian Salomon80094882017-08-18 11:44:28 -040048 cflags_cc += [ "-std=c++14" ]
Mike Klein1a8d6752016-10-17 11:51:11 -040049 } else if (is_win) {
50 defines += [
51 "ANGLE_ENABLE_D3D11",
52 "ANGLE_ENABLE_D3D9",
53 "GL_APICALL=",
Geoff Lang03362c32018-01-22 17:37:57 -050054 "GL_API=",
Mike Klein1a8d6752016-10-17 11:51:11 -040055 "EGLAPI=",
56 ]
Brian Osman514094c2017-11-12 13:53:26 -050057
58 # Allow noexcept, even though we build without exceptions
59 cflags_cc += [ "/wd4577" ]
Brian Osmane562f412017-12-08 11:33:52 -050060 if (is_clang) {
61 # utilities.cpp includes an 'unsigned long' <= UINT_MAX check
62 cflags_cc += [ "-Wno-tautological-constant-compare" ]
63 }
mtkleind68f9b02016-09-23 13:18:41 -070064 }
65}
66
67copy("commit_id") {
68 sources = [
69 "$angle_root/src/commit.h",
70 ]
71 outputs = [
72 "$root_gen_dir/angle2/id/commit.h",
73 ]
74}
75
76shared_library("libGLESv2") {
77 configs += [ ":common" ]
Mike Klein1a8d6752016-10-17 11:51:11 -040078 configs -= [ "//gn:warnings" ]
Mike Kleina2c2fdd2016-10-17 12:34:38 -040079 defines = [
80 "LIBANGLE_IMPLEMENTATION",
81 "LIBGLESV2_IMPLEMENTATION",
82 ]
mtkleind68f9b02016-09-23 13:18:41 -070083 deps = [
84 ":commit_id",
85 ]
86 libs = []
Brian Osman21d742d2017-01-10 13:31:33 -050087 sources = rebase_path(
Mike Klein3e74c512018-08-30 11:30:01 -040088 angle_preprocessor_sources + angle_translator_sources +
89 angle_translator_essl_sources + angle_translator_glsl_sources +
90 angle_translator_hlsl_sources + libangle_sources +
91 libangle_common_sources + libangle_image_util_sources +
Brian Salomon8d2abe92018-12-19 14:58:18 -050092 libglesv2_sources + libangle_gl_sources +
93 angle_system_utils_sources,
Mike Klein1a8d6752016-10-17 11:51:11 -040094 ".",
Mike Kleince086d32018-08-30 16:40:55 -040095 angle_root)
Brian Osman64a1d4a2018-05-15 10:43:08 -040096 if (is_win) {
97 sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
mtkleind68f9b02016-09-23 13:18:41 -070098 }
mtkleind68f9b02016-09-23 13:18:41 -070099 if (is_linux) {
100 libs += [
101 "X11",
102 "Xi",
103 "Xext",
104 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500105 sources += rebase_path(libangle_gl_glx_sources, ".", angle_root) +
106 [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400107 } else if (is_win) {
108 defines += [
109 # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
110 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500111 sources +=
112 rebase_path(libangle_gl_wgl_sources + libangle_d3d_shared_sources +
113 libangle_d3d9_sources + libangle_d3d11_sources +
114 libangle_d3d11_win32_sources,
115 ".",
116 angle_root)
Mike Klein1a8d6752016-10-17 11:51:11 -0400117 libs += [
118 "d3d9.lib",
119 "dxguid.lib",
Mike Kleina2c2fdd2016-10-17 12:34:38 -0400120 "gdi32.lib",
121 "user32.lib",
Mike Klein1a8d6752016-10-17 11:51:11 -0400122 ]
123 deps += [
124 # TODO: copy_compiler_dll?
125 ]
mtkleind68f9b02016-09-23 13:18:41 -0700126 }
127}
128
129shared_library("libEGL") {
130 configs += [ ":common" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400131 configs -= [ "//gn:warnings" ]
mtkleind68f9b02016-09-23 13:18:41 -0700132 defines = [ "LIBEGL_IMPLEMENTATION" ]
133 deps = [
134 ":libGLESv2",
135 ]
Mike Kleince086d32018-08-30 16:40:55 -0400136 sources = rebase_path(libegl_sources, ".", angle_root)
Brian Osman64a1d4a2018-05-15 10:43:08 -0400137 if (is_win) {
138 sources += [ "$angle_root/src/libEGL/libEGL.def" ]
mtkleind68f9b02016-09-23 13:18:41 -0700139 }
140}