Merge pull request #131 from lukaszgotszaldintel/new_branch

add cmake option SPIRV_HEADERS_SKIP_INSTALL
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000..29f43ce
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,124 @@
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+licenses(["notice"])
+
+exports_files(["LICENSE"])
+
+filegroup(
+    name = "spirv_core_grammar_1.0",
+    srcs = ["include/spirv/1.0/spirv.core.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_glsl_grammar_1.0",
+    srcs = ["include/spirv/1.0/extinst.glsl.std.450.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_opencl_grammar_1.0",
+    srcs = ["include/spirv/1.0/extinst.opencl.std.100.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_core_grammar_1.1",
+    srcs = ["include/spirv/1.1/spirv.core.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_glsl_grammar_1.1",
+    srcs = ["include/spirv/1.1/extinst.glsl.std.450.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_opencl_grammar_1.1",
+    srcs = ["include/spirv/1.1/extinst.opencl.std.100.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_core_grammar_1.2",
+    srcs = ["include/spirv/1.2/spirv.core.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_glsl_grammar_1.2",
+    srcs = ["include/spirv/1.2/extinst.glsl.std.450.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_opencl_grammar_1.2",
+    srcs = ["include/spirv/1.2/extinst.opencl.std.100.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_core_grammar_unified1",
+    srcs = ["include/spirv/unified1/spirv.core.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_glsl_grammar_unified1",
+    srcs = ["include/spirv/unified1/extinst.glsl.std.450.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_opencl_grammar_unified1",
+    srcs = ["include/spirv/unified1/extinst.opencl.std.100.grammar.json"],
+)
+
+filegroup(
+    name = "spirv_xml_registry",
+    srcs = ["include/spirv/spir-v.xml"],
+)
+
+cc_library(
+    name = "spirv_common_headers",
+    hdrs = [
+        "include/spirv/1.0/GLSL.std.450.h",
+        "include/spirv/1.0/OpenCL.std.h",
+        "include/spirv/1.1/GLSL.std.450.h",
+        "include/spirv/1.1/OpenCL.std.h",
+        "include/spirv/1.2/GLSL.std.450.h",
+        "include/spirv/1.2/OpenCL.std.h",
+        "include/spirv/unified1/GLSL.std.450.h",
+        "include/spirv/unified1/OpenCL.std.h",
+    ],
+    includes = ["include"],
+)
+
+cc_library(
+    name = "spirv_c_headers",
+    hdrs = [
+        "include/spirv/1.0/spirv.h",
+        "include/spirv/1.1/spirv.h",
+        "include/spirv/1.2/spirv.h",
+        "include/spirv/unified1/spirv.h",
+    ],
+    includes = ["include"],
+    deps = [":spirv_common_headers"],
+)
+
+cc_library(
+    name = "spirv_cpp_headers",
+    hdrs = [
+        "include/spirv/1.0/spirv.hpp",
+        "include/spirv/1.1/spirv.hpp",
+        "include/spirv/1.2/spirv.hpp",
+        "include/spirv/unified1/spirv.hpp",
+    ],
+    includes = ["include"],
+    deps = [":spirv_common_headers"],
+)
+
+cc_library(
+    name = "spirv_cpp11_headers",
+    hdrs = [
+        "include/spirv/1.0/spirv.hpp11",
+        "include/spirv/1.1/spirv.hpp11",
+        "include/spirv/1.2/spirv.hpp11",
+        "include/spirv/unified1/spirv.hpp11",
+    ],
+    includes = ["include"],
+    deps = [":spirv_common_headers"],
+)
+
diff --git a/README.md b/README.md
index beb1b7e..53c476f 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@
 
 ## Using the headers without installing
 
+### Using CMake
 A CMake-based project can use the headers without installing, as follows:
 
 1. Add an `add_subdirectory` directive to include this source tree.
@@ -69,6 +70,55 @@
 See also the [example](example/) subdirectory.  But since that example is
 *inside* this repostory, it doesn't use and `add_subdirectory` directive.
 
+### Using Bazel
+A Bazel-based project can use the headers without installing, as follows:
+
+1. Add SPIRV-Headers as a submodule of your project, and add a
+`local_repository` to your `WORKSPACE` file. For example, if you place
+SPIRV-Headers under `external/spirv-headers`, then add the following to your
+`WORKSPACE` file:
+
+```
+local_repository(
+    name = "spirv_headers",
+    path = "external/spirv-headers",
+)
+```
+
+2. Add one of the following to the `deps` attribute of your build target based
+on your needs:
+```
+@spirv_headers//:spirv_c_headers
+@spirv_headers//:spirv_cpp_headers
+@spirv_headers//:spirv_cpp11_headers
+```
+
+For example:
+
+```
+cc_library(
+  name = "project",
+  srcs = [
+    # Path to project sources
+  ],
+  hdrs = [
+    # Path to project headers
+  ],
+  deps = [
+    "@spirv_tools//:spirv_c_headers",
+    # Other dependencies,
+  ],
+)
+```
+
+3. In your C or C++ source code use `#include` directives that explicitly mention
+   the `spirv` path component.
+```
+#include "spirv/unified1/GLSL.std.450.h"
+#include "spirv/unified1/OpenCL.std.h"
+#include "spirv/unified1/spirv.hpp"
+```
+
 ## Generating the headers from the JSON grammar
 
 This will generally be done by Khronos, for a change to the JSON grammar.
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/WORKSPACE
diff --git a/include/spirv/unified1/spirv.cs b/include/spirv/unified1/spirv.cs
index 3760951..705aa59 100644
--- a/include/spirv/unified1/spirv.cs
+++ b/include/spirv/unified1/spirv.cs
@@ -48,7 +48,7 @@
     public static class Specification
     {
         public const uint MagicNumber = 0x07230203;
-        public const uint Version = 0x00010400;
+        public const uint Version = 0x00010500;
         public const uint Revision = 1;
         public const uint OpCodeMask = 0xffff;
         public const uint WordCountShift = 16;
diff --git a/include/spirv/unified1/spirv.h b/include/spirv/unified1/spirv.h
index f93fde9..1b67617 100644
--- a/include/spirv/unified1/spirv.h
+++ b/include/spirv/unified1/spirv.h
@@ -53,7 +53,7 @@
 
 typedef unsigned int SpvId;
 
-#define SPV_VERSION 0x10400
+#define SPV_VERSION 0x10500
 #define SPV_REVISION 1
 
 static const unsigned int SpvMagicNumber = 0x07230203;
diff --git a/include/spirv/unified1/spirv.hpp b/include/spirv/unified1/spirv.hpp
index 1e96f7b..f5cbda1 100644
--- a/include/spirv/unified1/spirv.hpp
+++ b/include/spirv/unified1/spirv.hpp
@@ -49,7 +49,7 @@
 
 typedef unsigned int Id;
 
-#define SPV_VERSION 0x10400
+#define SPV_VERSION 0x10500
 #define SPV_REVISION 1
 
 static const unsigned int MagicNumber = 0x07230203;
diff --git a/include/spirv/unified1/spirv.hpp11 b/include/spirv/unified1/spirv.hpp11
index a51ce6c..00c7b18 100644
--- a/include/spirv/unified1/spirv.hpp11
+++ b/include/spirv/unified1/spirv.hpp11
@@ -49,7 +49,7 @@
 
 typedef unsigned int Id;
 
-#define SPV_VERSION 0x10400
+#define SPV_VERSION 0x10500
 #define SPV_REVISION 1
 
 static const unsigned int MagicNumber = 0x07230203;
diff --git a/include/spirv/unified1/spirv.json b/include/spirv/unified1/spirv.json
index 5a48338..b08a1a5 100644
--- a/include/spirv/unified1/spirv.json
+++ b/include/spirv/unified1/spirv.json
@@ -54,7 +54,7 @@
                 ]
             ],
             "MagicNumber": 119734787,
-            "Version": 66560,
+            "Version": 66816,
             "Revision": 1,
             "OpCodeMask": 65535,
             "WordCountShift": 16
diff --git a/include/spirv/unified1/spirv.lua b/include/spirv/unified1/spirv.lua
index d05a779..27385db 100644
--- a/include/spirv/unified1/spirv.lua
+++ b/include/spirv/unified1/spirv.lua
@@ -44,7 +44,7 @@
 
 spv = {
     MagicNumber = 0x07230203,
-    Version = 0x00010400,
+    Version = 0x00010500,
     Revision = 1,
     OpCodeMask = 0xffff,
     WordCountShift = 16,
diff --git a/include/spirv/unified1/spirv.py b/include/spirv/unified1/spirv.py
index e669fdf..6968e7b 100644
--- a/include/spirv/unified1/spirv.py
+++ b/include/spirv/unified1/spirv.py
@@ -44,7 +44,7 @@
 
 spv = {
     'MagicNumber' : 0x07230203,
-    'Version' : 0x00010400,
+    'Version' : 0x00010500,
     'Revision' : 1,
     'OpCodeMask' : 0xffff,
     'WordCountShift' : 16,
diff --git a/include/spirv/unified1/spv.d b/include/spirv/unified1/spv.d
index 145c8b3..ec5a161 100644
--- a/include/spirv/unified1/spv.d
+++ b/include/spirv/unified1/spv.d
@@ -51,7 +51,7 @@
 module spv;
 
 enum uint MagicNumber = 0x07230203;
-enum uint Version = 0x00010400;
+enum uint Version = 0x00010500;
 enum uint Revision = 1;
 enum uint OpCodeMask = 0xffff;
 enum uint WordCountShift = 16;