2 default_visibility = ["//visibility:public"],
7 # Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator.
11 exports_files(["LICENSE"])
13 COMMON_COPTS = select({
14 "@bazel_tools//src/conditions:windows": [""],
15 "//conditions:default": [
19 "-Wunused-local-typedefs",
25 "-fvisibility=hidden",
26 "-fvisibility-inlines-hidden",
36 "glslang/GenericCodeGen/*.cpp",
37 "glslang/MachineIndependent/*.cpp",
38 "glslang/MachineIndependent/preprocessor/*.cpp",
42 "glslang/MachineIndependent/pch.cpp",
43 "glslang/MachineIndependent/pch.h",
48 "OGLCompilersDLL/InitializeDll.cpp",
50 "@bazel_tools//src/conditions:windows":
51 ["glslang/OSDependent/Windows/ossource.cpp"],
52 "//conditions:default":
53 ["glslang/OSDependent/Unix/ossource.cpp"],
56 "glslang/Include/*.h",
57 "glslang/MachineIndependent/*.h",
58 "glslang/MachineIndependent/preprocessor/*.h",
61 "OGLCompilersDLL/InitializeDll.h",
62 "StandAlone/DirStackFileIncluder.h",
63 "glslang/OSDependent/osinclude.h",
64 "glslang/Public/ShaderLang.h",
74 "@bazel_tools//src/conditions:windows": [""],
75 "//conditions:default": ["-lm", "-lpthread"],
81 name = "export_spirv_headers",
83 "SPIRV/GLSL.ext.AMD.h",
84 "SPIRV/GLSL.ext.EXT.h",
85 "SPIRV/GLSL.ext.KHR.h",
86 "SPIRV/GLSL.ext.NV.h",
87 "SPIRV/GLSL.std.450.h",
88 "SPIRV/NonSemanticDebugPrintf.h",
92 "include/SPIRV/GLSL.ext.AMD.h",
93 "include/SPIRV/GLSL.ext.EXT.h",
94 "include/SPIRV/GLSL.ext.KHR.h",
95 "include/SPIRV/GLSL.ext.NV.h",
96 "include/SPIRV/GLSL.std.450.h",
97 "include/SPIRV/NonSemanticDebugPrintf.h",
98 "include/SPIRV/spirv.hpp",
100 cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
104 name = "SPIRV_headers",
105 hdrs = [":export_spirv_headers"],
106 copts = COMMON_COPTS,
119 "SPIRV/SpvTools.cpp",
123 "SPIRV/GlslangToSpv.h",
125 "SPIRV/SPVRemapper.h",
126 "SPIRV/SpvBuilder.h",
129 "SPIRV/disassemble.h",
134 copts = COMMON_COPTS,
135 includes = ["SPIRV"],
137 "@bazel_tools//src/conditions:windows": [""],
138 "//conditions:default": ["-lm"],
148 name = "glslang-default-resource-limits",
149 srcs = ["StandAlone/ResourceLimits.cpp"],
150 hdrs = ["StandAlone/ResourceLimits.h"],
151 copts = COMMON_COPTS,
157 name = "glslangValidator",
159 "StandAlone/StandAlone.cpp",
160 "StandAlone/Worklist.h",
162 copts = COMMON_COPTS,
166 ":glslang-default-resource-limits",
171 name = "spirv-remap",
172 srcs = ["StandAlone/spirv-remap.cpp"],
173 copts = COMMON_COPTS,
177 ":glslang-default-resource-limits",
187 "Test/glslangValidator",
194 name = "glslang_test_lib",
197 "gtests/HexFloat.cpp",
198 "gtests/Initializer.h",
199 "gtests/Settings.cpp",
201 "gtests/TestFixture.cpp",
202 "gtests/TestFixture.h",
205 copts = COMMON_COPTS,
206 data = [":test_files"],
208 # Unfortunately we can't use $(location) in cc_library at the moment.
209 # See https://github.com/bazelbuild/bazel/issues/1023
210 # So we'll specify the path manually.
211 "@bazel_tools//src/conditions:windows":
212 ["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
213 "//conditions:default":
214 ["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
220 ":glslang-default-resource-limits",
221 "@com_google_googletest//:gtest",
225 GLSLANG_TESTS = glob(
226 ["gtests/*.FromFile.cpp"],
227 # Since we are not building the SPIRV-Tools dependency, the following tests
228 # cannot be performed.
230 "gtests/Hlsl.FromFile.cpp",
231 "gtests/Spv.FromFile.cpp",
236 name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
238 copts = COMMON_COPTS,
247 ) for test_file in GLSLANG_TESTS]