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