blob: 396d7d31a927663378f079ad1106b121a62df963 [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",
45 ]
46
47 defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ]
48
49 configs -= [ "//build/config/compiler:chromium_code" ]
50 configs += [
51 ":internal_config",
52 "//build/config/compiler:no_chromium_code",
53 ]
54
55 deps = [
56 ":translator_lib",
57 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070058 forward_dependent_configs_from = [ ":translator_lib" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040059}
60
61# Holds the shared includes so we only need to list them once.
62source_set("includes") {
63 sources = [
64 "include/EGL/egl.h",
65 "include/EGL/eglext.h",
66 "include/EGL/eglplatform.h",
67 "include/GLES2/gl2.h",
68 "include/GLES2/gl2ext.h",
69 "include/GLES2/gl2platform.h",
70 "include/GLES3/gl3.h",
71 "include/GLES3/gl3ext.h",
72 "include/GLES3/gl3platform.h",
73 "include/GLSLANG/ShaderLang.h",
74 "include/KHR/khrplatform.h",
75 ]
76}
77
78static_library("preprocessor") {
Brett Wilson04bac602014-07-16 14:19:18 -070079 sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -040080
81 configs -= [ "//build/config/compiler:chromium_code" ]
82 configs += [
83 ":internal_config",
84 "//build/config/compiler:no_chromium_code",
85 ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040086}
87
88static_library("translator_lib") {
Brett Wilson04bac602014-07-16 14:19:18 -070089 sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -040090
91 configs -= [ "//build/config/compiler:chromium_code" ]
92 configs += [
93 ":internal_config",
94 "//build/config/compiler:no_chromium_code",
95 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -070096 direct_dependent_configs = [ ":external_config" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -040097
98 deps = [
99 ":includes",
100 ":preprocessor",
101 ]
102}
103
104config("translator_static_config") {
105 defines = [ "ANGLE_TRANSLATOR_STATIC" ]
106}
107
108static_library("translator_static") {
109 sources = [
110 "src/compiler/translator/ShaderLang.cpp",
111 ]
112
113 configs -= [ "//build/config/compiler:chromium_code" ]
114 configs += [
115 ":internal_config",
116 "//build/config/compiler:no_chromium_code",
117 ]
118 direct_dependent_configs = [ ":translator_static_config" ]
119
120 deps = [
121 ":translator_lib",
122 ]
Brett Wilson2f5469c2014-07-22 17:00:17 -0700123 forward_dependent_configs_from = [ ":translator_lib" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400124}
125
126config("commit_id_config") {
127 include_dirs = [ "$root_gen_dir/angle" ]
128}
129
130action("commit_id") {
131 script = "src/commit_id.py"
132
133 output_file = "$root_gen_dir/angle/id/commit.h"
134 outputs = [ output_file ]
135
136 args = [
137 "gen",
138 rebase_path(".", root_build_dir),
139 rebase_path(output_file, root_build_dir),
140 ]
141
142 direct_dependent_configs = [ ":commit_id_config" ]
143}
144
145if (is_win) {
146 angle_enable_d3d9 = true
147 angle_enable_d3d11 = true
148
149 shared_library("libGLESv2") {
Brett Wilson04bac602014-07-16 14:19:18 -0700150 sources = rebase_path(gles_gypi.angle_libglesv2_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400151
152 defines = [
153 "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " +
Jamie Madill58c55c12014-07-31 17:34:30 -0400154 "\"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }",
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400155 "GL_APICALL=",
156 "GL_GLEXT_PROTOTYPES=",
157 "EGLAPI=",
158 ]
159 libs = []
160
161 # Shared D3dD sources.
162 if (angle_enable_d3d9 || angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700163 sources += rebase_path(gles_gypi.angle_d3d_shared_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400164 }
165
166 if (angle_enable_d3d9) {
Brett Wilson04bac602014-07-16 14:19:18 -0700167 sources += rebase_path(gles_gypi.angle_d3d9_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400168 defines += [ "ANGLE_ENABLE_D3D9" ]
169 libs += [ "d3d9.lib" ]
170 }
171
172 if (angle_enable_d3d11) {
Brett Wilson04bac602014-07-16 14:19:18 -0700173 sources += rebase_path(gles_gypi.angle_d3d11_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400174 defines += [ "ANGLE_ENABLE_D3D11" ]
175 libs += [ "dxguid.lib" ]
176 }
177
178 if (is_debug) {
179 defines += [ "ANGLE_ENABLE_PERF" ]
180 libs += [ "d3d9.lib" ]
181 }
182
183 configs -= [ "//build/config/compiler:chromium_code" ]
184 configs += [
185 ":internal_config",
186 "//build/config/compiler:no_chromium_code",
187 ]
188
189 include_dirs = [ "src/libGLESv2" ]
190
191 deps = [
192 ":commit_id",
193 ":includes",
194 ":translator",
195 #":copy_compiler_dll", TODO(GYP)
196 ]
197 }
198
199 shared_library("libEGL") {
Brett Wilson04bac602014-07-16 14:19:18 -0700200 sources = rebase_path(egl_gypi.angle_libegl_sources, ".", "src")
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400201
Jamie Madill7bf0c862014-08-01 10:04:09 -0400202 defines = [
203 "GL_APICALL=",
204 "GL_GLEXT_PROTOTYPES=",
205 "EGLAPI=",
206 ]
207
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400208 configs -= [ "//build/config/compiler:chromium_code" ]
209 configs += [
210 ":internal_config",
211 "//build/config/compiler:no_chromium_code",
212 ]
213
214 if (is_debug) {
Jamie Madill7bf0c862014-08-01 10:04:09 -0400215 defines += [ "ANGLE_ENABLE_PERF" ]
Jamie Madill72f5b5e2014-06-23 15:13:02 -0400216 }
217
218 include_dirs = [ "src/libGLESv2" ]
219 libs = [ "d3d9.lib" ]
220
221 deps = [
222 ":commit_id",
223 ":includes",
224 ":libGLESv2",
225 ]
226 }
227} # is_win