Skip to content

Commit 64f7e1b

Browse files
[libclc] Update build instructions in readme (#111369)
The configure Python script was removed by d6e0e6d / https://reviews.llvm.org/D69966. The readme was never updated with the cmake way to do it. I couldn't find any dedicated buildbots for this so I'm making an educated guess. This is what built locally for me.
1 parent 7fa0d05 commit 64f7e1b

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

libclc/README.TXT

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,46 @@ generic implementations of most library requirements, allowing the target
2323
to override the generic implementation at the granularity of individual
2424
functions.
2525

26-
libclc currently only supports the PTX target, but support for more
27-
targets is welcome.
26+
libclc currently supports PTX, AMDGPU, SPIRV and CLSPV targets, but support for
27+
more targets is welcome.
2828

29-
Compiling and installing with Make
30-
----------------------------------
29+
Compiling and installing
30+
------------------------
3131

32-
$ ./configure.py --with-llvm-config=/path/to/llvm-config && make
33-
$ make install
32+
(in the following instructions you can use make or ninja)
3433

35-
Note you can use the DESTDIR Makefile variable to do staged installs.
34+
For an in-tree build, Clang must also be built at the same time:
3635

37-
$ make install DESTDIR=/path/for/staged/install
36+
$ cmake <path-to>/llvm-project/llvm/CMakeLists.txt -DLLVM_ENABLE_PROJECTS="libclc;clang" \
37+
-DCMAKE_BUILD_TYPE=Release -G Ninja
38+
$ ninja
3839

39-
Compiling and installing with Ninja
40-
-----------------------------------
40+
Then install:
4141

42-
$ ./configure.py -g ninja --with-llvm-config=/path/to/llvm-config && ninja
4342
$ ninja install
4443

45-
Note you can use the DESTDIR environment variable to do staged installs.
44+
Note you can use the DESTDIR Makefile variable to do staged installs.
4645

4746
$ DESTDIR=/path/for/staged/install ninja install
4847

48+
To build out of tree, or in other words, against an existing LLVM build or install:
49+
50+
$ cmake <path-to>/llvm-project/libclc/CMakeLists.txt -DCMAKE_BUILD_TYPE=Release \
51+
-G Ninja -DLLVM_DIR=$(<path-to>/llvm-config --cmakedir)
52+
$ ninja
53+
54+
Then install as before.
55+
56+
In both cases this will include all supported targets. You can choose which
57+
targets are enabled by passing `-DLIBCLC_TARGETS_TO_BUILD` to CMake. The default
58+
is "all".
59+
60+
In both cases, the LLVM used must include the targets you want libclc support for
61+
(AMDGPU and NVPTX are enabled in LLVM by default). Apart from SPIRV where you do
62+
not need an LLVM target but you do need the llvm-spirv tool
63+
(https://github.com/KhronosGroup/SPIRV-LLVM-Translator) available. Either build
64+
this in-tree, or place it in the directory pointed to by `LLVM_TOOLS_BINARY_DIR`.
65+
4966
Website
5067
-------
5168

0 commit comments

Comments
 (0)