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