mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 1 | # 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 | |
| 6 | declare_args() { |
| 7 | } |
| 8 | |
| 9 | angle_root = "../externals/angle2" |
| 10 | |
| 11 | import("../third_party.gni") |
Mike Klein | 3e74c51 | 2018-08-30 11:30:01 -0400 | [diff] [blame] | 12 | import("$angle_root/src/compiler.gni") |
| 13 | import("$angle_root/src/libGLESv2.gni") |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 14 | |
| 15 | third_party("angle2") { |
| 16 | public_include_dirs = [ "$angle_root/include" ] |
| 17 | deps = [ |
| 18 | ":libEGL", |
| 19 | ":libGLESv2", |
| 20 | ] |
| 21 | } |
| 22 | |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 23 | config("common") { |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 24 | defines = [ |
| 25 | "ANGLE_ENABLE_ESSL", |
| 26 | "ANGLE_ENABLE_GLSL", |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 27 | "ANGLE_ENABLE_HLSL", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 28 | "ANGLE_ENABLE_OPENGL", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 29 | "EGL_EGLEXT_PROTOTYPES", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 30 | "GL_GLEXT_PROTOTYPES", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 31 | ] |
| 32 | include_dirs = [ |
| 33 | "$root_gen_dir/angle2", |
| 34 | "$angle_root/include", |
| 35 | "$angle_root/src", |
Robert Phillips | ffaa47e | 2017-06-12 08:40:56 -0400 | [diff] [blame] | 36 | "$angle_root/src/common/third_party/base", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 37 | "$angle_root/src/third_party/khronos", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 38 | ] |
Brian Salomon | 8009488 | 2017-08-18 11:44:28 -0400 | [diff] [blame] | 39 | cflags_cc = [] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 40 | assert(is_linux || is_win) # TODO: is_mac? |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 41 | if (is_linux) { |
| 42 | defines += [ |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 43 | "ANGLE_USE_X11", |
| 44 | "GL_APICALL=__attribute__((visibility(\"default\")))", |
Geoff Lang | 03362c3 | 2018-01-22 17:37:57 -0500 | [diff] [blame] | 45 | "GL_API=__attribute__((visibility(\"default\")))", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 46 | "EGLAPI=__attribute__((visibility(\"default\")))", |
| 47 | ] |
Brian Salomon | 8009488 | 2017-08-18 11:44:28 -0400 | [diff] [blame] | 48 | cflags_cc += [ "-std=c++14" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 49 | } else if (is_win) { |
| 50 | defines += [ |
| 51 | "ANGLE_ENABLE_D3D11", |
| 52 | "ANGLE_ENABLE_D3D9", |
| 53 | "GL_APICALL=", |
Geoff Lang | 03362c3 | 2018-01-22 17:37:57 -0500 | [diff] [blame] | 54 | "GL_API=", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 55 | "EGLAPI=", |
| 56 | ] |
Brian Osman | 514094c | 2017-11-12 13:53:26 -0500 | [diff] [blame] | 57 | |
| 58 | # Allow noexcept, even though we build without exceptions |
| 59 | cflags_cc += [ "/wd4577" ] |
Brian Osman | e562f41 | 2017-12-08 11:33:52 -0500 | [diff] [blame] | 60 | if (is_clang) { |
| 61 | # utilities.cpp includes an 'unsigned long' <= UINT_MAX check |
| 62 | cflags_cc += [ "-Wno-tautological-constant-compare" ] |
| 63 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 64 | } |
| 65 | } |
| 66 | |
| 67 | copy("commit_id") { |
| 68 | sources = [ |
| 69 | "$angle_root/src/commit.h", |
| 70 | ] |
| 71 | outputs = [ |
| 72 | "$root_gen_dir/angle2/id/commit.h", |
| 73 | ] |
| 74 | } |
| 75 | |
| 76 | shared_library("libGLESv2") { |
| 77 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 78 | configs -= [ "//gn:warnings" ] |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 79 | defines = [ |
| 80 | "LIBANGLE_IMPLEMENTATION", |
| 81 | "LIBGLESV2_IMPLEMENTATION", |
| 82 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 83 | deps = [ |
| 84 | ":commit_id", |
| 85 | ] |
| 86 | libs = [] |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 87 | sources = rebase_path( |
Mike Klein | 3e74c51 | 2018-08-30 11:30:01 -0400 | [diff] [blame] | 88 | 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 Salomon | 8d2abe9 | 2018-12-19 14:58:18 -0500 | [diff] [blame] | 92 | libglesv2_sources + libangle_gl_sources + |
| 93 | angle_system_utils_sources, |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 94 | ".", |
Mike Klein | ce086d3 | 2018-08-30 16:40:55 -0400 | [diff] [blame] | 95 | angle_root) |
Brian Osman | 64a1d4a | 2018-05-15 10:43:08 -0400 | [diff] [blame] | 96 | if (is_win) { |
| 97 | sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 98 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 99 | if (is_linux) { |
| 100 | libs += [ |
| 101 | "X11", |
| 102 | "Xi", |
| 103 | "Xext", |
| 104 | ] |
Brian Salomon | 8d2abe9 | 2018-12-19 14:58:18 -0500 | [diff] [blame] | 105 | sources += rebase_path(libangle_gl_glx_sources, ".", angle_root) + |
| 106 | [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 107 | } else if (is_win) { |
| 108 | defines += [ |
| 109 | # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES |
| 110 | ] |
Brian Salomon | 8d2abe9 | 2018-12-19 14:58:18 -0500 | [diff] [blame] | 111 | 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 Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 117 | libs += [ |
| 118 | "d3d9.lib", |
| 119 | "dxguid.lib", |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 120 | "gdi32.lib", |
| 121 | "user32.lib", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 122 | ] |
| 123 | deps += [ |
| 124 | # TODO: copy_compiler_dll? |
| 125 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 126 | } |
| 127 | } |
| 128 | |
| 129 | shared_library("libEGL") { |
| 130 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 131 | configs -= [ "//gn:warnings" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 132 | defines = [ "LIBEGL_IMPLEMENTATION" ] |
| 133 | deps = [ |
| 134 | ":libGLESv2", |
| 135 | ] |
Mike Klein | ce086d3 | 2018-08-30 16:40:55 -0400 | [diff] [blame] | 136 | sources = rebase_path(libegl_sources, ".", angle_root) |
Brian Osman | 64a1d4a | 2018-05-15 10:43:08 -0400 | [diff] [blame] | 137 | if (is_win) { |
| 138 | sources += [ "$angle_root/src/libEGL/libEGL.def" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 139 | } |
| 140 | } |