@@ -50,16 +50,20 @@ spirv_tools_dir = glslang_spirv_tools_dir
50
50
51
51
config (" glslang_public" ) {
52
52
include_dirs = [ " ." ]
53
+ }
53
54
54
- if (! glslang_angle ) {
55
- defines = [ " ENABLE_HLSL=1" ]
56
- }
55
+ config (" glslang_hlsl" ) {
56
+ defines = [ " ENABLE_HLSL=1" ]
57
57
}
58
58
59
59
template (" glslang_sources_common" ) {
60
60
source_set (target_name ) {
61
61
public_configs = [ " :glslang_public" ]
62
62
63
+ if (invoker .enable_hlsl ) {
64
+ public_configs += [ " :glslang_hlsl" ]
65
+ }
66
+
63
67
sources = [
64
68
" OGLCompilersDLL/InitializeDll.cpp" ,
65
69
" OGLCompilersDLL/InitializeDll.h" ,
@@ -152,21 +156,26 @@ template("glslang_sources_common") {
152
156
" glslang/Public/ShaderLang.h" ,
153
157
]
154
158
155
- if (! glslang_angle ) {
159
+ # Workaround gn issue complaining about these not being allowed even though GLSLANG_HLSL is not
160
+ # defined.
161
+ sources += [
162
+ " glslang/HLSL/hlslParseHelper.h" ,
163
+ " glslang/HLSL/hlslParseables.h" ,
164
+ " glslang/HLSL/hlslScanContext.h" ,
165
+ " glslang/HLSL/hlslTokens.h" ,
166
+ ]
167
+
168
+ if (invoker .enable_hlsl ) {
156
169
sources += [
157
170
" glslang/HLSL/hlslAttributes.cpp" ,
158
171
" glslang/HLSL/hlslAttributes.h" ,
159
172
" glslang/HLSL/hlslGrammar.cpp" ,
160
173
" glslang/HLSL/hlslGrammar.h" ,
161
174
" glslang/HLSL/hlslOpMap.cpp" ,
162
175
" glslang/HLSL/hlslOpMap.h" ,
163
- " glslang/HLSL/hlslParseables.cpp" ,
164
- " glslang/HLSL/hlslParseables.h" ,
165
176
" glslang/HLSL/hlslParseHelper.cpp" ,
166
- " glslang/HLSL/hlslParseHelper.h " ,
177
+ " glslang/HLSL/hlslParseables.cpp " ,
167
178
" glslang/HLSL/hlslScanContext.cpp" ,
168
- " glslang/HLSL/hlslScanContext.h" ,
169
- " glslang/HLSL/hlslTokens.h" ,
170
179
" glslang/HLSL/hlslTokenStream.cpp" ,
171
180
" glslang/HLSL/hlslTokenStream.h" ,
172
181
]
@@ -207,7 +216,7 @@ template("glslang_sources_common") {
207
216
if (invoker .enable_opt ) {
208
217
deps = [
209
218
" ${ spirv_tools_dir } :spvtools_opt" ,
210
- " ${ spirv_tools_dir } :spvtools_val"
219
+ " ${ spirv_tools_dir } :spvtools_val" ,
211
220
]
212
221
}
213
222
@@ -216,19 +225,21 @@ template("glslang_sources_common") {
216
225
}
217
226
}
218
227
219
- glslang_sources_common (" glslang_sources " ) {
228
+ glslang_sources_common (" glslang_lib_sources " ) {
220
229
enable_opt = ! glslang_angle
230
+ enable_hlsl = ! glslang_angle
221
231
}
222
232
223
- glslang_sources_common (" glslang_standalone_sources " ) {
233
+ glslang_sources_common (" glslang_sources " ) {
224
234
enable_opt = true
235
+ enable_hlsl = true
225
236
}
226
237
227
238
source_set (" glslang_default_resource_limits_sources" ) {
228
239
sources = [
229
- " glslang/Include/ResourceLimits.h" ,
230
240
" StandAlone/ResourceLimits.cpp" ,
231
241
" StandAlone/ResourceLimits.h" ,
242
+ " glslang/Include/ResourceLimits.h" ,
232
243
]
233
244
public_configs = [ " :glslang_public" ]
234
245
@@ -247,21 +258,18 @@ executable("glslang_validator") {
247
258
defines = [ " ENABLE_OPT=1" ]
248
259
deps = [
249
260
" :glslang_default_resource_limits_sources" ,
250
- " :glslang_standalone_sources " ,
261
+ " :glslang_sources " ,
251
262
]
263
+ public_configs = [ " :glslang_hlsl" ]
252
264
253
265
configs -= _configs_to_remove
254
266
configs += _configs_to_add
255
267
}
256
268
257
269
executable (" spirv-remap" ) {
258
- sources = [
259
- " StandAlone/spirv-remap.cpp" ,
260
- ]
270
+ sources = [ " StandAlone/spirv-remap.cpp" ]
261
271
defines = [ " ENABLE_OPT=1" ]
262
- deps = [
263
- " :glslang_standalone_sources" ,
264
- ]
272
+ deps = [ " :glslang_sources" ]
265
273
266
274
configs -= _configs_to_remove
267
275
configs += _configs_to_add
0 commit comments