Skip to content

Commit 40efc99

Browse files
AlexeySachkovvmaksimo
authored andcommitted
Update in-tree build instruction (#778)
Updated REAMDE.md to mention that `clang` is required to build/test the translator.
1 parent bbb261f commit 40efc99

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

llvm-spirv/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,28 @@ git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
7070
Run (or re-run) cmake as usual for LLVM. After that you should have `llvm-spirv` and `check-llvm-spirv` targets available.
7171
```
7272
mkdir llvm-project/build && cd llvm-project/build
73-
cmake ../llvm
73+
cmake ../llvm -DLLVM_ENABLE_PROJECTS="clang"
7474
make llvm-spirv -j`nproc`
7575
```
7676

77+
Note on enabling the `clang` project: there are tests in the translator that depend
78+
on `clang` binary, which makes clang a required dependency (search for
79+
`LLVM_SPIRV_TEST_DEPS` in [test/CMakeLists.txt](test/CMakeLists.txt)) for
80+
`check-llvm-spirv` target.
81+
82+
Building clang from sources takes time and resources and it can be avoided:
83+
- if you are not interested in launching unit-tests for the translator after
84+
build, you can disable generation of test targets by passing
85+
`-DLLVM_INCLUDE_TESTS=OFF` option.
86+
- if you are interested in launching unit-tests, but don't want to build clang
87+
you can pass `-DSPIRV_SKIP_CLANG_BUILD` cmake option to avoid adding `clang`
88+
as dependency for `check-llvm-spirv` target. However, LIT will search for
89+
`clang` binary when tests are launched and it should be available at this
90+
point.
91+
- building and testing completely without `clang` is not supported at the
92+
moment, see [KhronosGroup/SPIRV-LLVM-Translator#477](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/477)
93+
to track progress, discuss and contribute.
94+
7795
## Test instructions
7896

7997
All tests related to the translator are placed in the [test](test) directory. A number of the tests require spirv-as (part of SPIR-V Tools) to run, but the remainder of the tests can still be run without this. Optionally the tests can make use of spirv-val (part of SPIRV-Tools) in order to validate the generated SPIR-V against the official SPIR-V specification.

0 commit comments

Comments
 (0)