@@ -51,10 +51,7 @@ py_binary(
51
51
52
52
genrule (
53
53
name = "gen_build_info_h" ,
54
- srcs = [
55
- "CHANGES.md" ,
56
- "build_info.h.tmpl" ,
57
- ],
54
+ srcs = ["CHANGES.md" , "build_info.h.tmpl" ],
58
55
outs = ["glslang/build_info.h" ],
59
56
cmd = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)" ,
60
57
tools = [":build_info" ],
@@ -95,8 +92,10 @@ cc_library(
95
92
) + [
96
93
"OGLCompilersDLL/InitializeDll.cpp" ,
97
94
] + select ({
98
- "@bazel_tools//src/conditions:windows" : ["glslang/OSDependent/Windows/ossource.cpp" ],
99
- "//conditions:default" : ["glslang/OSDependent/Unix/ossource.cpp" ],
95
+ "@bazel_tools//src/conditions:windows" :
96
+ ["glslang/OSDependent/Windows/ossource.cpp" ],
97
+ "//conditions:default" :
98
+ ["glslang/OSDependent/Unix/ossource.cpp" ],
100
99
}),
101
100
hdrs = glob ([
102
101
"glslang/HLSL/*.h" ,
@@ -119,10 +118,7 @@ cc_library(
119
118
],
120
119
linkopts = select ({
121
120
"@bazel_tools//src/conditions:windows" : ["" ],
122
- "//conditions:default" : [
123
- "-lm" ,
124
- "-lpthread" ,
125
- ],
121
+ "//conditions:default" : ["-lm" , "-lpthread" ],
126
122
}),
127
123
linkstatic = 1 ,
128
124
)
@@ -228,6 +224,18 @@ cc_binary(
228
224
],
229
225
)
230
226
227
+ filegroup (
228
+ name = "test_files" ,
229
+ srcs = glob (
230
+ ["Test/**" ],
231
+ exclude = [
232
+ "Test/bump" ,
233
+ "Test/glslangValidator" ,
234
+ "Test/runtests" ,
235
+ ],
236
+ ),
237
+ )
238
+
231
239
cc_library (
232
240
name = "glslang_test_lib" ,
233
241
testonly = 1 ,
@@ -241,9 +249,16 @@ cc_library(
241
249
"gtests/main.cpp" ,
242
250
],
243
251
copts = COMMON_COPTS ,
244
- defines = [
245
- "GLSLANG_TEST_DIRECTORY='\" USE_FLAG_INSTEAD\" '" ,
246
- ],
252
+ data = [":test_files" ],
253
+ defines = select ({
254
+ # Unfortunately we can't use $(location) in cc_library at the moment.
255
+ # See https://github.com/bazelbuild/bazel/issues/1023
256
+ # So we'll specify the path manually.
257
+ "@bazel_tools//src/conditions:windows" :
258
+ ["GLSLANG_TEST_DIRECTORY='\" ../../../../../Test\" '" ],
259
+ "//conditions:default" :
260
+ ["GLSLANG_TEST_DIRECTORY='\" Test\" '" ],
261
+ }),
247
262
linkstatic = 1 ,
248
263
deps = [
249
264
":SPIRV" ,
@@ -266,13 +281,9 @@ GLSLANG_TESTS = glob(
266
281
[cc_test (
267
282
name = test_file .replace ("gtests/" , "" ).replace (".FromFile.cpp" , "" ) + "_test" ,
268
283
srcs = [test_file ],
269
- args = [
270
- "--test-root" ,
271
- "$(rootpath Test)" ,
272
- ],
273
284
copts = COMMON_COPTS ,
274
285
data = [
275
- "Test " ,
286
+ ":test_files " ,
276
287
],
277
288
deps = [
278
289
":SPIRV" ,
0 commit comments