Skip to content

Commit 7b1becd

Browse files
authored
[libc] Add CMake cache file for the GPU build (llvm#124589)
Summary: This introduces libc cache files and adds one for building the GPU support. The cache files will set defaults for these arguments which can be overridden if the user needs to. They also serve as documentation for how the builid is expected to look.
1 parent 88cca8e commit 7b1becd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libc/cmake/caches/gpu.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
2+
set(LLVM_RUNTIME_TARGETS default;amdgcn-amd-amdhsa;nvptx64-nvidia-cuda CACHE STRING "")
3+
set(RUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES "compiler-rt;libc" CACHE STRING "")
4+
set(RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES "compiler-rt;libc" CACHE STRING "")

libc/docs/gpu/building.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ OpenMP support. We then set ``RUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES`` to enable
5858
``libc`` for the GPU targets. The ``LLVM_RUNTIME_TARGETS`` sets the enabled
5959
targets to build, in this case we want the default target and the GPU targets.
6060
Note that if ``libc`` were included in ``LLVM_ENABLE_RUNTIMES`` it would build
61-
targeting the default host environment as well.
61+
targeting the default host environment as well. Alternatively, you can point
62+
your build towards the ``libc/cmake/caches/gpu.cmake`` cache file with ``-C``.
6263

6364
Runtimes cross build
6465
--------------------

0 commit comments

Comments
 (0)