1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 if (is_win) { 6 # Only needed on Windows. 7 gles_gypi = exec_script( 8 "//build/gypi_to_gn.py", 9 [ rebase_path("src/libGLESv2.gypi") ], 10 "scope", 11 [ "src/libGLESv2.gypi" ]) 12 13 egl_gypi = exec_script( 14 "//build/gypi_to_gn.py", 15 [ rebase_path("src/libEGL.gypi") ], 16 "scope", 17 [ "src/libEGL.gypi" ]) 18 } 19 20 compiler_gypi = exec_script( 21 "//build/gypi_to_gn.py", 22 [ rebase_path("src/compiler.gypi") ], 23 "scope", 24 [ "src/compiler.gypi" ]) 25 26 # This config is exported to dependent targets (and also applied to internal 27 # ones). 28 config("external_config") { 29 include_dirs = [ 30 "include", 31 ] 32 } 33 34 # This config is applied to internal Angle targets (not pushed to dependents). 35 config("internal_config") { 36 include_dirs = [ 37 "include", 38 "src", 39 ] 40 } 41 42 component("translator") { 43 sources = [ 44 "src/compiler/translator/ShaderLang.cpp", 45 "src/compiler/translator/ShaderVars.cpp", 46 ] 47 48 defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ] 49 50 configs -= [ "//build/config/compiler:chromium_code" ] 51 configs += [ 52 ":internal_config", 53 "//build/config/compiler:no_chromium_code", 54 ] 55 56 deps = [ 57 ":translator_lib", 58 ] 59 forward_dependent_configs_from = [ ":translator_lib" ] 60 } 61 62 # Holds the shared includes so we only need to list them once. 63 source_set("includes") { 64 sources = [ 65 "include/EGL/egl.h", 66 "include/EGL/eglext.h", 67 "include/EGL/eglplatform.h", 68 "include/GLES2/gl2.h", 69 "include/GLES2/gl2ext.h", 70 "include/GLES2/gl2platform.h", 71 "include/GLES3/gl3.h", 72 "include/GLES3/gl3ext.h", 73 "include/GLES3/gl3platform.h", 74 "include/GLSLANG/ShaderLang.h", 75 "include/KHR/khrplatform.h", 76 ] 77 } 78 79 static_library("preprocessor") { 80 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src") 81 82 configs -= [ "//build/config/compiler:chromium_code" ] 83 configs += [ 84 ":internal_config", 85 "//build/config/compiler:no_chromium_code", 86 ] 87 } 88 89 config("translator_static_config") { 90 defines = [ "ANGLE_TRANSLATOR_STATIC" ] 91 } 92 93 static_library("translator_lib") { 94 sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src") 95 96 configs -= [ "//build/config/compiler:chromium_code" ] 97 configs += [ 98 ":internal_config", 99 ":translator_static_config", 100 "//build/config/compiler:no_chromium_code", 101 ] 102 direct_dependent_configs = [ ":external_config" ] 103 104 deps = [ 105 ":includes", 106 ":preprocessor", 107 ] 108 } 109 110 static_library("translator_static") { 111 sources = [ 112 "src/compiler/translator/ShaderLang.cpp", 113 "src/compiler/translator/ShaderVars.cpp", 114 ] 115 116 configs -= [ "//build/config/compiler:chromium_code" ] 117 configs += [ 118 ":internal_config", 119 "//build/config/compiler:no_chromium_code", 120 ] 121 direct_dependent_configs = [ ":translator_static_config" ] 122 123 deps = [ 124 ":translator_lib", 125 ] 126 forward_dependent_configs_from = [ ":translator_lib" ] 127 } 128 129 config("commit_id_config") { 130 include_dirs = [ "$root_gen_dir/angle" ] 131 } 132 133 action("commit_id") { 134 script = "src/commit_id.py" 135 136 output_file = "$root_gen_dir/angle/id/commit.h" 137 outputs = [ output_file ] 138 139 args = [ 140 "gen", 141 rebase_path(".", root_build_dir), 142 rebase_path(output_file, root_build_dir), 143 ] 144 145 direct_dependent_configs = [ ":commit_id_config" ] 146 } 147 148 if (is_win) { 149 angle_enable_d3d9 = true 150 angle_enable_d3d11 = true 151 152 shared_library("libGLESv2") { 153 sources = rebase_path(gles_gypi.angle_libangle_sources, ".", "src") 154 sources += [ 155 "src/libGLESv2/libGLESv2.cpp", 156 "src/libGLESv2/libGLESv2.def", 157 "src/libGLESv2/libGLESv2.rc", 158 ] 159 160 defines = [ 161 "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + 162 "\"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }", 163 "GL_APICALL=", 164 "GL_GLEXT_PROTOTYPES=", 165 "EGLAPI=", 166 ] 167 libs = [] 168 169 # Shared D3dD sources. 170 if (angle_enable_d3d9 || angle_enable_d3d11) { 171 sources += rebase_path(gles_gypi.angle_d3d_shared_sources, ".", "src") 172 } 173 174 if (angle_enable_d3d9) { 175 sources += rebase_path(gles_gypi.angle_d3d9_sources, ".", "src") 176 defines += [ "ANGLE_ENABLE_D3D9" ] 177 libs += [ "d3d9.lib" ] 178 } 179 180 if (angle_enable_d3d11) { 181 sources += rebase_path(gles_gypi.angle_d3d11_sources, ".", "src") 182 defines += [ "ANGLE_ENABLE_D3D11" ] 183 libs += [ "dxguid.lib" ] 184 } 185 186 if (is_debug) { 187 defines += [ "ANGLE_ENABLE_PERF" ] 188 libs += [ "d3d9.lib" ] 189 } 190 191 configs -= [ "//build/config/compiler:chromium_code" ] 192 configs += [ 193 ":internal_config", 194 "//build/config/compiler:no_chromium_code", 195 ] 196 197 include_dirs = [ "src/libGLESv2" ] 198 199 deps = [ 200 ":commit_id", 201 ":includes", 202 ":translator", 203 #":copy_compiler_dll", TODO(GYP) 204 ] 205 } 206 207 shared_library("libEGL") { 208 sources = rebase_path(egl_gypi.angle_libegl_sources, ".", "src") 209 210 defines = [ 211 "GL_APICALL=", 212 "GL_GLEXT_PROTOTYPES=", 213 "EGLAPI=", 214 ] 215 216 configs -= [ "//build/config/compiler:chromium_code" ] 217 configs += [ 218 ":internal_config", 219 "//build/config/compiler:no_chromium_code", 220 ] 221 222 if (is_debug) { 223 defines += [ "ANGLE_ENABLE_PERF" ] 224 } 225 226 include_dirs = [ "src/libGLESv2" ] 227 libs = [ "d3d9.lib" ] 228 229 deps = [ 230 ":commit_id", 231 ":includes", 232 ":libGLESv2", 233 ] 234 } 235 } # is_win 236