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 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | |
| 66 | copy("commit_id") { |
| 67 | sources = [ |
| 68 | "$angle_root/src/commit.h", |
| 69 | ] |
| 70 | outputs = [ |
| 71 | "$root_gen_dir/angle2/id/commit.h", |
| 72 | ] |
| 73 | } |
| 74 | |
| 75 | shared_library("libGLESv2") { |
| 76 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 77 | configs -= [ "//gn:warnings" ] |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 78 | defines = [ |
| 79 | "LIBANGLE_IMPLEMENTATION", |
| 80 | "LIBGLESV2_IMPLEMENTATION", |
| 81 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 82 | deps = [ |
| 83 | ":commit_id", |
| 84 | ] |
| 85 | libs = [] |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 86 | sources = rebase_path( |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 87 | compiler_gypi.angle_preprocessor_sources + |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 88 | compiler_gypi.angle_translator_sources + |
| 89 | compiler_gypi.angle_translator_essl_sources + |
| 90 | compiler_gypi.angle_translator_glsl_sources + |
| 91 | compiler_gypi.angle_translator_hlsl_sources + |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 92 | gles_gypi.libangle_sources + gles_gypi.libangle_common_sources + |
| 93 | gles_gypi.libangle_image_util_sources + |
| 94 | gles_gypi.libglesv2_sources + gles_gypi.libangle_gl_sources, |
| 95 | ".", |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 96 | "$angle_root/src") |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 97 | if (!is_win) { |
| 98 | sources -= [ "$angle_root/src/libGLESv2/libGLESv2.def" ] |
| 99 | } |
| 100 | |
| 101 | if (is_linux) { |
| 102 | libs += [ |
| 103 | "X11", |
| 104 | "Xi", |
| 105 | "Xext", |
| 106 | ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 107 | sources += |
| 108 | rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "$angle_root/src") + |
| 109 | [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ] |
| 110 | } else if (is_win) { |
| 111 | defines += [ |
| 112 | # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES |
| 113 | ] |
| 114 | sources += rebase_path(gles_gypi.libangle_gl_wgl_sources + |
| 115 | gles_gypi.libangle_d3d_shared_sources + |
| 116 | gles_gypi.libangle_d3d9_sources + |
| 117 | gles_gypi.libangle_d3d11_sources + |
| 118 | gles_gypi.libangle_d3d11_win32_sources, |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 119 | ".", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 120 | "$angle_root/src") |
| 121 | libs += [ |
| 122 | "d3d9.lib", |
| 123 | "dxguid.lib", |
Mike Klein | a2c2fdd | 2016-10-17 12:34:38 -0400 | [diff] [blame] | 124 | "gdi32.lib", |
| 125 | "user32.lib", |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 126 | ] |
| 127 | deps += [ |
| 128 | # TODO: copy_compiler_dll? |
| 129 | ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 130 | } |
| 131 | } |
| 132 | |
| 133 | shared_library("libEGL") { |
| 134 | configs += [ ":common" ] |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 135 | configs -= [ "//gn:warnings" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 136 | defines = [ "LIBEGL_IMPLEMENTATION" ] |
| 137 | deps = [ |
| 138 | ":libGLESv2", |
| 139 | ] |
| 140 | sources = rebase_path(gles_gypi.libegl_sources, ".", "$angle_root/src") |
| 141 | if (!is_win) { |
| 142 | sources -= [ "$angle_root/src/libEGL/libEGL.def" ] |
| 143 | } |
| 144 | } |