#
# Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator.
-licenses(["notice"]) # Mixed: BSD, MIT, Khronos, Apache 2.0
+licenses(["notice"])
exports_files(["LICENSE"])
-COMMON_COPTS = [
- "-Wall",
- "-Wuninitialized",
- "-Wunused",
- "-Wunused-local-typedefs",
- "-Wunused-parameter",
- "-Wunused-value",
- "-Wunused-variable",
- "-Wno-reorder",
- "-std=c++11",
- "-fvisibility=hidden",
- "-fvisibility-inlines-hidden",
- "-fno-exceptions",
- "-fno-rtti",
-]
+COMMON_COPTS = select({
+ "@bazel_tools//src/conditions:windows": [""],
+ "//conditions:default": [
+ "-Wall",
+ "-Wuninitialized",
+ "-Wunused",
+ "-Wunused-local-typedefs",
+ "-Wunused-parameter",
+ "-Wunused-value",
+ "-Wunused-variable",
+ "-Wno-reorder",
+ "-std=c++11",
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fno-exceptions",
+ "-fno-rtti",
+ ],
+})
cc_library(
name = "glslang",
],
) + [
"OGLCompilersDLL/InitializeDll.cpp",
- "glslang/OSDependent/Unix/ossource.cpp",
- ],
+ ] + select({
+ "@bazel_tools//src/conditions:windows":
+ ["glslang/OSDependent/Windows/ossource.cpp"],
+ "//conditions:default":
+ ["glslang/OSDependent/Unix/ossource.cpp"],
+ }),
hdrs = glob([
"glslang/Include/*.h",
"glslang/MachineIndependent/*.h",
"AMD_EXTENSIONS",
"ENABLE_HLSL=0",
"ENABLE_OPT=0",
- "GLSLANG_OSINCLUDE_UNIX",
"NV_EXTENSIONS",
],
- linkopts = [
- "-lm",
- "-lpthread",
- ],
+ linkopts = select({
+ "@bazel_tools//src/conditions:windows": [""],
+ "//conditions:default": ["-lm", "-lpthread"],
+ }),
linkstatic = 1,
)
"SPIRV/GLSL.ext.KHR.h",
"SPIRV/GLSL.ext.NV.h",
"SPIRV/GLSL.std.450.h",
+ "SPIRV/NonSemanticDebugPrintf.h",\r
"SPIRV/spirv.hpp",
],
outs = [
"include/SPIRV/GLSL.ext.KHR.h",
"include/SPIRV/GLSL.ext.NV.h",
"include/SPIRV/GLSL.std.450.h",
+ "include/SPIRV/NonSemanticDebugPrintf.h",\r
"include/SPIRV/spirv.hpp",
],
cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
],
copts = COMMON_COPTS,
includes = ["SPIRV"],
- linkopts = ["-lm"],
+ linkopts = select({
+ "@bazel_tools//src/conditions:windows": [""],
+ "//conditions:default": ["-lm"],
+ }),
linkstatic = 1,
deps = [
":SPIRV_headers",
),
)
-filegroup(
- name = "test_dir",
- srcs = ["Test"],
-)
-
cc_library(
name = "glslang_test_lib",
testonly = 1,
],
copts = COMMON_COPTS,
data = [":test_files"],
- defines = [
- 'GLSLANG_TEST_DIRECTORY=\\"\\"',
- ],
+ defines = select({
+ # Unfortunately we can't use $(location) in cc_library at the moment.
+ # See https://github.com/bazelbuild/bazel/issues/1023
+ # So we'll specify the path manually.
+ "@bazel_tools//src/conditions:windows":
+ ["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
+ "//conditions:default":
+ ["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
+ }),
linkstatic = 1,
deps = [
":SPIRV",
[cc_test(
name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
srcs = [test_file],
- args = [
- "--test-root",
- "$(location :test_dir)",
- ],
copts = COMMON_COPTS,
data = [
- ":test_dir",
":test_files",
],
deps = [