Skip to content

Commit 8586995

Browse files
committed
[libcxx] Add cache file for the GPU build
Summary: This patch adds a CMake cache config file for the GPU build. This cache will set the default required options when used from the LLVM runtime interface or directly. These options pretty much disable everything the GPU can't handle. With this and the fllowing patches: llvm#99259, llvm#99243, llvm#99287, and llvm#99333, we will be able to build `libc++` targeting the GPU with an invocation like this. ``` $ cmake ../llvm -C${LLVM_ROOT}/libcxx/cmake/caches/GPU.cmake \ -DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=compiler-rt;libc;libcxx \ -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=compiler-rt;libc;libcxx \ -DLLVM_RUNTIME_TARGETS=amdgcn-amd-amdhsa;nvptx64-nvidia-cuda \ ``` This will then install the libraries and headers into the appropriate locations for use with `clang`.
1 parent 351a4b2 commit 8586995

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

libcxx/cmake/caches/GPU.cmake

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Handle default arguments when done through the LLVM runtimes interface.
2+
foreach(target amdgcn-amd-amdhsa nvptx64-nvidia-cuda)
3+
set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
4+
set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
5+
set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
6+
set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
7+
set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
8+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
9+
set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
10+
set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
11+
set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
12+
set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
13+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
14+
set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
15+
set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
16+
set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
17+
set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
18+
set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
19+
set(RUNTIMES_${target}_LIBCXX_USE_LLVM_LIBC ON CACHE BOOL "")
20+
set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
21+
set(RUNTIMES_${target}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
22+
endforeach()
23+
24+
# Handle default arguments when being built directly.
25+
if(${CMAKE_CXX_COMPILER_TARGET} MATCHES "^amdgcn|^nvptx")
26+
set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
27+
set(LIBCXX_CXX_ABI none CACHE STRING "")
28+
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
29+
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
30+
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
31+
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
32+
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
33+
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
34+
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
35+
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
36+
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
37+
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
38+
set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
39+
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
40+
set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
41+
set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
42+
set(LIBCXX_USE_LLVM_LIBC ON CACHE BOOL "")
43+
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
44+
set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
45+
endif()

0 commit comments

Comments
 (0)