diff options
author | Ehsan Nasiri <ehsannas@gmail.com> | 2019-09-23 14:38:23 -0400 |
---|---|---|
committer | Ehsan Nasiri <ehsannas@gmail.com> | 2019-09-23 14:39:52 -0400 |
commit | ab22babed072a2456502162d44c9583aa9a0084e (patch) | |
tree | b9627ec0a882e15efe6681b5fa8ea63c26c475fd | |
parent | 4163b36393b353af12797392c6b4e239c31fb173 (diff) | |
download | SPIRV-Headers-ab22babed072a2456502162d44c9583aa9a0084e.tar.gz |
Update documentation.
-rw-r--r-- | README.md | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -53,6 +53,7 @@ If you want to install them somewhere else, then use ## 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,51 @@ A CMake-based project can use the headers without installing, as follows: 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 a `local_repository` to your `WORKSPACE` file. For example: +``` +local_repository( + name = "spirv_headers", + path = "external/spirv-headers", +) +``` + +2. Add one of the following to the `deps` 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. |