blob: 86339be7ad0199a17d184f7ef2f2dc3b41d27784 [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") {
Brett Wilson04bac602014-07-16 14:19:18 -0700153 sources = rebase_path(gles_gypi.angle_libglesv2_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400154
155 defines = [
156 "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " +
Jamie Madill58c55c12014-07-31 17:34:30 -0400157 "\"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400158 "GL_APICALL=",
159 "GL_GLEXT_PROTOTYPES=",
160 "EGLAPI=",
161 ]
162 libs = []
163
164 # Shared D3dD sources.
165 if (angle_enable_d3d9 || angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700166 sources += rebase_path(gles_gypi.angle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400167 }
168
169 if (angle_enable_d3d9) {
Brett Wilson04bac602014-07-16 14:19:18 -0700170 sources += rebase_path(gles_gypi.angle_d3d9_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400171 defines += [ "ANGLE_ENABLE_D3D9" ]
172 libs += [ "d3d9.lib" ]
173 }
174
175 if (angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700176 sources += rebase_path(gles_gypi.angle_d3d11_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400177 defines += [ "ANGLE_ENABLE_D3D11" ]
178 libs += [ "dxguid.lib" ]
179 }
180
181 if (is_debug) {
182 defines += [ "ANGLE_ENABLE_PERF" ]
183 libs += [ "d3d9.lib" ]
184 }
185
186 configs -= [ "//build/config/compiler:chromium_code" ]
187 configs += [
188 ":internal_config",
189 "//build/config/compiler:no_chromium_code",
190 ]
191
192 include_dirs = [ "src/libGLESv2" ]
193
194 deps = [
195 ":commit_id",
196 ":includes",
197 ":translator",
198 #":copy_compiler_dll", TODO(GYP)
199 ]
200 }
201
202 shared_library("libEGL") {
Brett Wilson04bac602014-07-16 14:19:18 -0700203 sources = rebase_path(egl_gypi.angle_libegl_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400204
Jamie Madill7bf0c862014-08-01 10:04:09 -0400205 defines = [
206 "GL_APICALL=",
207 "GL_GLEXT_PROTOTYPES=",
208 "EGLAPI=",
209 ]
210
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400211 configs -= [ "//build/config/compiler:chromium_code" ]
212 configs += [
213 ":internal_config",
214 "//build/config/compiler:no_chromium_code",
215 ]
216
217 if (is_debug) {
Jamie Madill7bf0c862014-08-01 10:04:09 -0400218 defines += [ "ANGLE_ENABLE_PERF" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400219 }
220
221 include_dirs = [ "src/libGLESv2" ]
222 libs = [ "d3d9.lib" ]
223
224 deps = [
225 ":commit_id",
226 ":includes",
227 ":libGLESv2",
228 ]
229 }
230} # is_win