Skip to content

Commit f5ed7a6

Browse files
authored
Merge pull request KhronosGroup#2322 from ShabbyX/fix-dawn-tests
gn: Fix dawn tests in Chromium
2 parents 309ffa2 + a55029d commit f5ed7a6

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

BUILD.gn

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,20 @@ spirv_tools_dir = glslang_spirv_tools_dir
5050

5151
config("glslang_public") {
5252
include_dirs = [ "." ]
53+
}
5354

54-
if (!glslang_angle) {
55-
defines = [ "ENABLE_HLSL=1" ]
56-
}
55+
config("glslang_hlsl") {
56+
defines = [ "ENABLE_HLSL=1" ]
5757
}
5858

5959
template("glslang_sources_common") {
6060
source_set(target_name) {
6161
public_configs = [ ":glslang_public" ]
6262

63+
if (invoker.enable_hlsl) {
64+
public_configs += [ ":glslang_hlsl" ]
65+
}
66+
6367
sources = [
6468
"OGLCompilersDLL/InitializeDll.cpp",
6569
"OGLCompilersDLL/InitializeDll.h",
@@ -152,21 +156,26 @@ template("glslang_sources_common") {
152156
"glslang/Public/ShaderLang.h",
153157
]
154158

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) {
156169
sources += [
157170
"glslang/HLSL/hlslAttributes.cpp",
158171
"glslang/HLSL/hlslAttributes.h",
159172
"glslang/HLSL/hlslGrammar.cpp",
160173
"glslang/HLSL/hlslGrammar.h",
161174
"glslang/HLSL/hlslOpMap.cpp",
162175
"glslang/HLSL/hlslOpMap.h",
163-
"glslang/HLSL/hlslParseables.cpp",
164-
"glslang/HLSL/hlslParseables.h",
165176
"glslang/HLSL/hlslParseHelper.cpp",
166-
"glslang/HLSL/hlslParseHelper.h",
177+
"glslang/HLSL/hlslParseables.cpp",
167178
"glslang/HLSL/hlslScanContext.cpp",
168-
"glslang/HLSL/hlslScanContext.h",
169-
"glslang/HLSL/hlslTokens.h",
170179
"glslang/HLSL/hlslTokenStream.cpp",
171180
"glslang/HLSL/hlslTokenStream.h",
172181
]
@@ -207,7 +216,7 @@ template("glslang_sources_common") {
207216
if (invoker.enable_opt) {
208217
deps = [
209218
"${spirv_tools_dir}:spvtools_opt",
210-
"${spirv_tools_dir}:spvtools_val"
219+
"${spirv_tools_dir}:spvtools_val",
211220
]
212221
}
213222

@@ -216,19 +225,21 @@ template("glslang_sources_common") {
216225
}
217226
}
218227

219-
glslang_sources_common("glslang_sources") {
228+
glslang_sources_common("glslang_lib_sources") {
220229
enable_opt = !glslang_angle
230+
enable_hlsl = !glslang_angle
221231
}
222232

223-
glslang_sources_common("glslang_standalone_sources") {
233+
glslang_sources_common("glslang_sources") {
224234
enable_opt = true
235+
enable_hlsl = true
225236
}
226237

227238
source_set("glslang_default_resource_limits_sources") {
228239
sources = [
229-
"glslang/Include/ResourceLimits.h",
230240
"StandAlone/ResourceLimits.cpp",
231241
"StandAlone/ResourceLimits.h",
242+
"glslang/Include/ResourceLimits.h",
232243
]
233244
public_configs = [ ":glslang_public" ]
234245

@@ -247,21 +258,18 @@ executable("glslang_validator") {
247258
defines = [ "ENABLE_OPT=1" ]
248259
deps = [
249260
":glslang_default_resource_limits_sources",
250-
":glslang_standalone_sources",
261+
":glslang_sources",
251262
]
263+
public_configs = [ ":glslang_hlsl" ]
252264

253265
configs -= _configs_to_remove
254266
configs += _configs_to_add
255267
}
256268

257269
executable("spirv-remap") {
258-
sources = [
259-
"StandAlone/spirv-remap.cpp",
260-
]
270+
sources = [ "StandAlone/spirv-remap.cpp" ]
261271
defines = [ "ENABLE_OPT=1" ]
262-
deps = [
263-
":glslang_standalone_sources",
264-
]
272+
deps = [ ":glslang_sources" ]
265273

266274
configs -= _configs_to_remove
267275
configs += _configs_to_add

0 commit comments

Comments
 (0)