Re-add NV enums for raytracing to prevent build breaks.
[platform/upstream/glslang.git] / BUILD.bazel
index 550dde1..d70bc7f 100644 (file)
@@ -6,25 +6,28 @@ package(
 #
 # 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",
@@ -43,8 +46,12 @@ cc_library(
         ],
     ) + [
         "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",
@@ -61,13 +68,12 @@ cc_library(
         "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,
 )
 
@@ -79,6 +85,7 @@ genrule(
         "SPIRV/GLSL.ext.KHR.h",
         "SPIRV/GLSL.ext.NV.h",
         "SPIRV/GLSL.std.450.h",
+        "SPIRV/NonSemanticDebugPrintf.h",\r
         "SPIRV/spirv.hpp",
     ],
     outs = [
@@ -87,6 +94,7 @@ genrule(
         "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/",
@@ -125,7 +133,10 @@ cc_library(
     ],
     copts = COMMON_COPTS,
     includes = ["SPIRV"],
-    linkopts = ["-lm"],
+    linkopts = select({
+        "@bazel_tools//src/conditions:windows": [""],
+        "//conditions:default": ["-lm"],
+    }),
     linkstatic = 1,
     deps = [
         ":SPIRV_headers",
@@ -179,11 +190,6 @@ filegroup(
     ),
 )
 
-filegroup(
-    name = "test_dir",
-    srcs = ["Test"],
-)
-
 cc_library(
     name = "glslang_test_lib",
     testonly = 1,
@@ -198,9 +204,15 @@ cc_library(
     ],
     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",
@@ -223,13 +235,8 @@ GLSLANG_TESTS = glob(
 [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 = [