blob: 310cdd7babf496badb269928971f5e3bd7a6364e [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 = []
Brian Osman21d742d2017-01-10 13:31:33 -050093 sources = rebase_path(
Mike Klein3e74c512018-08-30 11:30:01 -040094 angle_preprocessor_sources + angle_translator_sources +
95 angle_translator_essl_sources + angle_translator_glsl_sources +
96 angle_translator_hlsl_sources + libangle_sources +
97 libangle_common_sources + libangle_image_util_sources +
Brian Salomon8d2abe92018-12-19 14:58:18 -050098 libglesv2_sources + libangle_gl_sources +
Eric Boren56bf8ce2019-02-07 13:05:06 -050099 angle_system_utils_sources + xxhash_sources,
Mike Klein1a8d6752016-10-17 11:51:11 -0400100 ".",
Mike Kleince086d32018-08-30 16:40:55 -0400101 angle_root)
Brian Osman64a1d4a2018-05-15 10:43:08 -0400102 if (is_win) {
103 sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
mtkleind68f9b02016-09-23 13:18:41 -0700104 }
mtkleind68f9b02016-09-23 13:18:41 -0700105 if (is_linux) {
106 libs += [
107 "X11",
108 "Xi",
109 "Xext",
110 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500111 sources += rebase_path(libangle_gl_glx_sources, ".", angle_root) +
112 [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400113 } else if (is_win) {
114 defines += [
115 # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
116 ]
Brian Salomon8d2abe92018-12-19 14:58:18 -0500117 sources +=
118 rebase_path(libangle_gl_wgl_sources + libangle_d3d_shared_sources +
119 libangle_d3d9_sources + libangle_d3d11_sources +
120 libangle_d3d11_win32_sources,
121 ".",
122 angle_root)
Mike Klein1a8d6752016-10-17 11:51:11 -0400123 libs += [
124 "d3d9.lib",
125 "dxguid.lib",
Mike Kleina2c2fdd2016-10-17 12:34:38 -0400126 "gdi32.lib",
127 "user32.lib",
Mike Klein1a8d6752016-10-17 11:51:11 -0400128 ]
129 deps += [
130 # TODO: copy_compiler_dll?
131 ]
mtkleind68f9b02016-09-23 13:18:41 -0700132 }
133}
134
135shared_library("libEGL") {
136 configs += [ ":common" ]
Mike Klein1a8d6752016-10-17 11:51:11 -0400137 configs -= [ "//gn:warnings" ]
mtkleind68f9b02016-09-23 13:18:41 -0700138 defines = [ "LIBEGL_IMPLEMENTATION" ]
139 deps = [
140 ":libGLESv2",
141 ]
Mike Kleince086d32018-08-30 16:40:55 -0400142 sources = rebase_path(libegl_sources, ".", angle_root)
Brian Osman64a1d4a2018-05-15 10:43:08 -0400143 if (is_win) {
144 sources += [ "$angle_root/src/libEGL/libEGL.def" ]
mtkleind68f9b02016-09-23 13:18:41 -0700145 }
146}