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") |
| 12 | |
| 13 | third_party("angle2") { |
| 14 | public_include_dirs = [ "$angle_root/include" ] |
| 15 | deps = [ |
| 16 | ":libEGL", |
| 17 | ":libGLESv2", |
| 18 | ] |
| 19 | } |
| 20 | |
| 21 | compiler_gypi = exec_script("//gn/gypi_to_gn.py", |
| 22 | [ rebase_path("$angle_root/src/compiler.gypi") ], |
| 23 | "scope", |
| 24 | []) |
| 25 | |
| 26 | gles_gypi = exec_script("//gn/gypi_to_gn.py", |
| 27 | [ rebase_path("$angle_root/src/libGLESv2.gypi") ], |
| 28 | "scope", |
| 29 | []) |
| 30 | |
| 31 | config("common") { |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 32 | defines = [ |
| 33 | "ANGLE_ENABLE_ESSL", |
| 34 | "ANGLE_ENABLE_GLSL", |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 35 | "ANGLE_ENABLE_HLSL", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 36 | "ANGLE_ENABLE_OPENGL", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 37 | "EGL_EGLEXT_PROTOTYPES", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 38 | "GL_GLEXT_PROTOTYPES", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 39 | ] |
| 40 | include_dirs = [ |
| 41 | "$root_gen_dir/angle2", |
| 42 | "$angle_root/include", |
| 43 | "$angle_root/src", |
Robert Phillips | ffaa47e | 2017-06-12 08:40:56 -0400 | [diff] [blame] | 44 | "$angle_root/src/common/third_party/base", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 45 | "$angle_root/src/third_party/khronos", |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 46 | ] |
Brian Salomon | 8009488 | 2017-08-18 11:44:28 -0400 | [diff] [blame] | 47 | cflags_cc = [] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 48 | assert(is_linux || is_win) # TODO: is_mac? |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 49 | if (is_linux) { |
| 50 | defines += [ |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 51 | "ANGLE_USE_X11", |
| 52 | "GL_APICALL=__attribute__((visibility(\"default\")))", |
| 53 | "EGLAPI=__attribute__((visibility(\"default\")))", |
| 54 | ] |
Brian Salomon | 8009488 | 2017-08-18 11:44:28 -0400 | [diff] [blame] | 55 | cflags_cc += [ "-std=c++14" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 56 | } else if (is_win) { |
| 57 | defines += [ |
| 58 | "ANGLE_ENABLE_D3D11", |
| 59 | "ANGLE_ENABLE_D3D9", |
| 60 | "GL_APICALL=", |
| 61 | "EGLAPI=", |
| 62 | ] |
Brian Osman | 514094c | 2017-11-12 13:53:26 -0500 | [diff] [blame] | 63 | |
| 64 | # Allow noexcept, even though we build without exceptions |
| 65 | cflags_cc += [ "/wd4577" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
| 69 | copy("commit_id") { |
| 70 | sources = [ |
| 71 | "$angle_root/src/commit.h", |
| 72 | ] |
| 73 | outputs = [ |
| 74 | "$root_gen_dir/angle2/id/commit.h", |
| 75 | ] |
| 76 | } |
| 77 | |
| 78 | shared_library("libGLESv2") { |
| 79 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 80 | configs -= [ "//gn:warnings" ] |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 81 | defines = [ |
| 82 | "LIBANGLE_IMPLEMENTATION", |
| 83 | "LIBGLESV2_IMPLEMENTATION", |
| 84 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 85 | deps = [ |
| 86 | ":commit_id", |
| 87 | ] |
| 88 | libs = [] |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 89 | sources = rebase_path( |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 90 | compiler_gypi.angle_preprocessor_sources + |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 91 | compiler_gypi.angle_translator_sources + |
| 92 | compiler_gypi.angle_translator_essl_sources + |
| 93 | compiler_gypi.angle_translator_glsl_sources + |
| 94 | compiler_gypi.angle_translator_hlsl_sources + |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 95 | gles_gypi.libangle_sources + gles_gypi.libangle_common_sources + |
| 96 | gles_gypi.libangle_image_util_sources + |
| 97 | gles_gypi.libglesv2_sources + gles_gypi.libangle_gl_sources, |
| 98 | ".", |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 99 | "$angle_root/src") |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 100 | if (!is_win) { |
| 101 | sources -= [ "$angle_root/src/libGLESv2/libGLESv2.def" ] |
| 102 | } |
| 103 | |
| 104 | if (is_linux) { |
| 105 | libs += [ |
| 106 | "X11", |
| 107 | "Xi", |
| 108 | "Xext", |
| 109 | ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 110 | sources += |
| 111 | rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "$angle_root/src") + |
| 112 | [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ] |
| 113 | } else if (is_win) { |
| 114 | defines += [ |
| 115 | # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES |
| 116 | ] |
| 117 | sources += rebase_path(gles_gypi.libangle_gl_wgl_sources + |
| 118 | gles_gypi.libangle_d3d_shared_sources + |
| 119 | gles_gypi.libangle_d3d9_sources + |
| 120 | gles_gypi.libangle_d3d11_sources + |
| 121 | gles_gypi.libangle_d3d11_win32_sources, |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 122 | ".", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 123 | "$angle_root/src") |
| 124 | libs += [ |
| 125 | "d3d9.lib", |
| 126 | "dxguid.lib", |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 127 | "gdi32.lib", |
| 128 | "user32.lib", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 129 | ] |
| 130 | deps += [ |
| 131 | # TODO: copy_compiler_dll? |
| 132 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 133 | } |
| 134 | } |
| 135 | |
| 136 | shared_library("libEGL") { |
| 137 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 138 | configs -= [ "//gn:warnings" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 139 | defines = [ "LIBEGL_IMPLEMENTATION" ] |
| 140 | deps = [ |
| 141 | ":libGLESv2", |
| 142 | ] |
| 143 | sources = rebase_path(gles_gypi.libegl_sources, ".", "$angle_root/src") |
| 144 | if (!is_win) { |
| 145 | sources -= [ "$angle_root/src/libEGL/libEGL.def" ] |
| 146 | } |
| 147 | } |