blob: 7c5a5630fb419cbb88bf19f44a18a5899e3cf818 [file] [log] [blame]
Jamie Madill72f5b5e2014-06-23 15:13:02 -04001# 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
Brett Wilson04bac602014-07-16 14:19:18 -07005if (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
20compiler_gypi = exec_script(
21 "//build/gypi_to_gn.py",
22 [ rebase_path("src/compiler.gypi") ],
23 "scope",
24 [ "src/compiler.gypi" ])
25
Brett Wilson2f5469c2014-07-22 17:00:17 -070026# This config is exported to dependent targets (and also applied to internal
27# ones).
28config("external_config") {
29 include_dirs = [
30 "include",
31 ]
32}
33
Jamie Madill72f5b5e2014-06-23 15:13:02 -040034# This config is applied to internal Angle targets (not pushed to dependents).
35config("internal_config") {
36 include_dirs = [
37 "include",
38 "src",
39 ]
40}
41
42component("translator") {
43 sources = [
44 "src/compiler/translator/ShaderLang.cpp",
Jamie Madille5c97ab2014-08-07 12:31:38 -040045 "src/compiler/translator/ShaderVars.cpp",
Jamie Madill72f5b5e2014-06-23 15:13:02 -040046 ]
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 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070059 forward_dependent_configs_from = [ ":translator_lib" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040060}
61
62# Holds the shared includes so we only need to list them once.
63source_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
79static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -070080 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -040081
82 configs -= [ "//build/config/compiler:chromium_code" ]
83 configs += [
84 ":internal_config",
85 "//build/config/compiler:no_chromium_code",
86 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040087}
88
Jamie Madille5c97ab2014-08-07 12:31:38 -040089config("translator_static_config") {
90 defines = [ "ANGLE_TRANSLATOR_STATIC" ]
91}
92
Jamie Madill72f5b5e2014-06-23 15:13:02 -040093static_library("translator_lib") {
Brett Wilson04bac602014-07-16 14:19:18 -070094 sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -040095
96 configs -= [ "//build/config/compiler:chromium_code" ]
97 configs += [
98 ":internal_config",
Jamie Madille5c97ab2014-08-07 12:31:38 -040099 ":translator_static_config",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400100 "//build/config/compiler:no_chromium_code",
101 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -0700102 direct_dependent_configs = [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400103
104 deps = [
105 ":includes",
106 ":preprocessor",
107 ]
108}
109
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400110static_library("translator_static") {
111 sources = [
112 "src/compiler/translator/ShaderLang.cpp",
Jamie Madilla2ad4e82014-07-17 14:16:32 -0400113 "src/compiler/translator/ShaderVars.cpp",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400114 ]
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 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -0700126 forward_dependent_configs_from = [ ":translator_lib" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400127}
128
129config("commit_id_config") {
130 include_dirs = [ "$root_gen_dir/angle" ]
131}
132
133action("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
148if (is_win) {
149 angle_enable_d3d9 = true
150 angle_enable_d3d11 = true
151
152 shared_library("libGLESv2") {
Jamie Madill04994ec2014-08-28 11:31:36 -0400153 sources = rebase_path(gles_gypi.angle_libangle_sources, ".", "src")
154 sources += [
Cem Kocagilf8a16d72014-09-16 21:35:39 +0300155 "src/libGLESv2/libGLESv2.cpp",
156 "src/libGLESv2/libGLESv2.def",
157 "src/libGLESv2/libGLESv2.rc",
Jamie Madill04994ec2014-08-28 11:31:36 -0400158 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400159
160 defines = [
161 "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " +
Jamie Madill58c55c12014-07-31 17:34:30 -0400162 "\"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400163 "GL_APICALL=",
164 "GL_GLEXT_PROTOTYPES=",
165 "EGLAPI=",
166 ]
167 libs = []
168
169 # Shared D3dD sources.
170 if (angle_enable_d3d9 || angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700171 sources += rebase_path(gles_gypi.angle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400172 }
173
174 if (angle_enable_d3d9) {
Brett Wilson04bac602014-07-16 14:19:18 -0700175 sources += rebase_path(gles_gypi.angle_d3d9_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400176 defines += [ "ANGLE_ENABLE_D3D9" ]
177 libs += [ "d3d9.lib" ]
178 }
179
180 if (angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700181 sources += rebase_path(gles_gypi.angle_d3d11_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400182 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") {
Brett Wilson04bac602014-07-16 14:19:18 -0700208 sources = rebase_path(egl_gypi.angle_libegl_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400209
Jamie Madill7bf0c862014-08-01 10:04:09 -0400210 defines = [
211 "GL_APICALL=",
212 "GL_GLEXT_PROTOTYPES=",
213 "EGLAPI=",
214 ]
215
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400216 configs -= [ "//build/config/compiler:chromium_code" ]
217 configs += [
218 ":internal_config",
219 "//build/config/compiler:no_chromium_code",
220 ]
221
222 if (is_debug) {
Jamie Madill7bf0c862014-08-01 10:04:09 -0400223 defines += [ "ANGLE_ENABLE_PERF" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400224 }
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