blob: 9b6ab3b1d9257763cf2332e8e5e63c1d7a25055e [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) {
Brian Osman06e14af2019-05-07 11:15:29 -040061 cflags_cc += [
62 # utilities.cpp includes an 'unsigned long' <= UINT_MAX check
63 "-Wno-tautological-constant-compare",
64
65 # With distributed Windows builds, files may lose their case during copy, causing
66 # case-sensitivity mismatch on remote machines.
67 "-Wno-nonportable-include-path",
68 ]
Brian Osmane562f412017-12-08 11:33:52 -050069 }
mtkleind68f9b02016-09-23 13:18:41 -070070 }
71}
72
73copy("commit_id") {
74 sources = [
75 "$angle_root/src/commit.h",
76 ]
77 outputs = [
78 "$root_gen_dir/angle2/id/commit.h",
79 ]
80}
81
82shared_library("libGLESv2") {
83 configs += [ ":common" ]
Mike Klein1a8d6752016-10-17 11:51:11 -040084 configs -= [ "//gn:warnings" ]
Mike Kleina2c2fdd2016-10-17 12:34:38 -040085 defines = [
86 "LIBANGLE_IMPLEMENTATION",
87 "LIBGLESV2_IMPLEMENTATION",
88 ]
mtkleind68f9b02016-09-23 13:18:41 -070089 deps = [
90 ":commit_id",
91 ]
92 libs = []
skia-autoroll39dda0f2019-08-01 04:01:19 +000093 sources =
94 rebase_path(
Mike Klein3e74c512018-08-30 11:30:01 -040095 angle_preprocessor_sources + angle_translator_sources +
96 angle_translator_essl_sources + angle_translator_glsl_sources +
97 angle_translator_hlsl_sources + libangle_sources +
98 libangle_common_sources + libangle_image_util_sources +
Brian Salomon8d2abe92018-12-19 14:58:18 -050099 libglesv2_sources + libangle_gl_sources +
Eric Boren56bf8ce2019-02-07 13:05:06 -0500100 angle_system_utils_sources + xxhash_sources,
Mike Klein1a8d6752016-10-17 11:51:11 -0400101 ".",
skia-autoroll39dda0f2019-08-01 04:01:19 +0000102 angle_root) + [ "$angle_root/src/libANGLE/FrameCapture.cpp" ]
Brian Osman64a1d4a2018-05-15 10:43:08 -0400103 if (is_win) {
104 sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
mtkleind68f9b02016-09-23 13:18:41 -0700105 }
mtkleind68f9b02016-09-23 13:18:41 -0700106 if (is_linux) {
107 libs += [
108 "X11",
109 "Xi",
110 "Xext",
111 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500112 sources += rebase_path(libangle_gl_glx_sources, ".", angle_root) +
113 [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400114 } else if (is_win) {
115 defines += [
116 # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
117 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500118 sources +=
119 rebase_path(libangle_gl_wgl_sources + libangle_d3d_shared_sources +
120 libangle_d3d9_sources + libangle_d3d11_sources +
121 libangle_d3d11_win32_sources,
122 ".",
123 angle_root)
Mike Klein1a8d6752016-10-17 11:51:11 -0400124 libs += [
125 "d3d9.lib",
126 "dxguid.lib",
Mike Kleina2c2fdd2016-10-17 12:34:38 -0400127 "gdi32.lib",
128 "user32.lib",
Mike Klein1a8d6752016-10-17 11:51:11 -0400129 ]
130 deps += [
131 # TODO: copy_compiler_dll?
132 ]
mtkleind68f9b02016-09-23 13:18:41 -0700133 }
134}
135
136shared_library("libEGL") {
137 configs += [ ":common" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400138 configs -= [ "//gn:warnings" ]
mtkleind68f9b02016-09-23 13:18:41 -0700139 defines = [ "LIBEGL_IMPLEMENTATION" ]
140 deps = [
141 ":libGLESv2",
142 ]
Mike Kleince086d32018-08-30 16:40:55 -0400143 sources = rebase_path(libegl_sources, ".", angle_root)
Brian Osman64a1d4a2018-05-15 10:43:08 -0400144 if (is_win) {
145 sources += [ "$angle_root/src/libEGL/libEGL.def" ]
mtkleind68f9b02016-09-23 13:18:41 -0700146 }
147}