[libcxx-commits] [libcxx] [libcxx] Add cache file for the GPU build (PR #99348)

Joseph Huber via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 21 07:07:26 PDT 2024


https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/99348

>From 23a0080ae31a245975c4dd947f042638f693e44f Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 17 Jul 2024 11:12:57 -0500
Subject: [PATCH 1/4] [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: #99259, #99243, #99287, and #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`.
---
 libcxx/cmake/caches/GPU.cmake | 94 +++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 libcxx/cmake/caches/GPU.cmake

diff --git a/libcxx/cmake/caches/GPU.cmake b/libcxx/cmake/caches/GPU.cmake
new file mode 100644
index 00000000000000..0d9fba64de7597
--- /dev/null
+++ b/libcxx/cmake/caches/GPU.cmake
@@ -0,0 +1,94 @@
+# Handle default arguments when done through the LLVM runtimes interface.
+foreach(target amdgcn-amd-amdhsa nvptx64-nvidia-cuda)
+  set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+  set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+  set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+
+  # Configuration options for libcxxabi.
+  set(RUNTIMES_${target}_LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+
+  # Target specific compile flags.
+  if(${target} MATCHES "^amdgcn")
+    set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+    set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs" CACHE STRING "")
+  else()
+    set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+    set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS
+        "-flto -nodefaultlibs -c -Wno-unused-command-line-argument" CACHE STRING "")
+  endif()
+endforeach()
+
+# Handle default arguments when being built directly.
+if(${CMAKE_CXX_COMPILER_TARGET} MATCHES "^amdgcn|^nvptx")
+  set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
+  set(LIBCXX_CXX_ABI none CACHE STRING "")
+  set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+  set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+  set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+  set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+  set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+  set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+  set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+  set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+  set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+  set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+
+  # Configuration options for libcxxabi.
+  set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+  set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+  set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+  set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+  set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+  set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+
+  # Target specific compile flags.
+  if(${target} MATCHES "^amdgcn")
+    set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+    set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+    set(CMAKE_REQUIRED_FLAGS "-nogpulib" CACHE STRING "")
+  else()
+    set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+    set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+    set(CMAKE_REQUIRED_FLAGS "-flto;-c;-Wno-unused-command-line-argument" CACHE STRING "")
+  endif()
+endif()

>From 074073039ebe1280a48304f5183213893750e799 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 14 Aug 2024 13:00:17 -0500
Subject: [PATCH 2/4] Move to separate files

---
 libcxx/cmake/caches/AMDGPU.cmake | 36 ++++++++++++
 libcxx/cmake/caches/GPU.cmake    | 94 --------------------------------
 libcxx/cmake/caches/NVPTX.cmake  | 36 ++++++++++++
 3 files changed, 72 insertions(+), 94 deletions(-)
 create mode 100644 libcxx/cmake/caches/AMDGPU.cmake
 delete mode 100644 libcxx/cmake/caches/GPU.cmake
 create mode 100644 libcxx/cmake/caches/NVPTX.cmake

diff --git a/libcxx/cmake/caches/AMDGPU.cmake b/libcxx/cmake/caches/AMDGPU.cmake
new file mode 100644
index 00000000000000..127f880d2fb44c
--- /dev/null
+++ b/libcxx/cmake/caches/AMDGPU.cmake
@@ -0,0 +1,36 @@
+# Configuration options for libcxx.
+set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
+set(LIBCXX_CXX_ABI none CACHE STRING "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+
+# Configuration options for libcxxabi.
+set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+
+# Necessary compile flags for AMDGPU.
+set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
+    "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+    "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+set(CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs" CACHE STRING "")
diff --git a/libcxx/cmake/caches/GPU.cmake b/libcxx/cmake/caches/GPU.cmake
deleted file mode 100644
index 0d9fba64de7597..00000000000000
--- a/libcxx/cmake/caches/GPU.cmake
+++ /dev/null
@@ -1,94 +0,0 @@
-# Handle default arguments when done through the LLVM runtimes interface.
-foreach(target amdgcn-amd-amdhsa nvptx64-nvidia-cuda)
-  set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
-  set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_LIBC "llvm-libc" CACHE STRING "")
-  set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
-
-  # Configuration options for libcxxabi.
-  set(RUNTIMES_${target}_LIBCXXABI_BAREMETAL ON CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-  set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
-
-  # Target specific compile flags.
-  if(${target} MATCHES "^amdgcn")
-    set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
-    set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
-    set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs" CACHE STRING "")
-  else()
-    set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
-    set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
-    set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS
-        "-flto -nodefaultlibs -c -Wno-unused-command-line-argument" CACHE STRING "")
-  endif()
-endforeach()
-
-# Handle default arguments when being built directly.
-if(${CMAKE_CXX_COMPILER_TARGET} MATCHES "^amdgcn|^nvptx")
-  set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
-  set(LIBCXX_CXX_ABI none CACHE STRING "")
-  set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
-  set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-  set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
-  set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
-  set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
-  set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
-  set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
-  set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
-  set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
-
-  # Configuration options for libcxxabi.
-  set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
-  set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
-  set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-  set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
-  set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-  set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
-
-  # Target specific compile flags.
-  if(${target} MATCHES "^amdgcn")
-    set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
-    set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
-    set(CMAKE_REQUIRED_FLAGS "-nogpulib" CACHE STRING "")
-  else()
-    set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
-    set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
-        "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
-    set(CMAKE_REQUIRED_FLAGS "-flto;-c;-Wno-unused-command-line-argument" CACHE STRING "")
-  endif()
-endif()
diff --git a/libcxx/cmake/caches/NVPTX.cmake b/libcxx/cmake/caches/NVPTX.cmake
new file mode 100644
index 00000000000000..f921bb2741b498
--- /dev/null
+++ b/libcxx/cmake/caches/NVPTX.cmake
@@ -0,0 +1,36 @@
+# Configuration options for libcxx.
+set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
+set(LIBCXX_CXX_ABI none CACHE STRING "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+
+# Configuration options for libcxxabi.
+set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+
+# Necessary compile flags for NVPTX.
+set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
+    "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+    "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+set(CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs -flto -c" CACHE STRING "")

>From ca85c42e88165ee819d419c7afea8b7f1442dbb2 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 21 Aug 2024 08:50:26 -0500
Subject: [PATCH 3/4] fix

---
 libcxx/cmake/caches/AMDGPU.cmake | 2 +-
 libcxx/cmake/caches/NVPTX.cmake  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/cmake/caches/AMDGPU.cmake b/libcxx/cmake/caches/AMDGPU.cmake
index 127f880d2fb44c..48b8f4b2225096 100644
--- a/libcxx/cmake/caches/AMDGPU.cmake
+++ b/libcxx/cmake/caches/AMDGPU.cmake
@@ -1,6 +1,6 @@
 # Configuration options for libcxx.
 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
-set(LIBCXX_CXX_ABI none CACHE STRING "")
+set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
 set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/NVPTX.cmake b/libcxx/cmake/caches/NVPTX.cmake
index f921bb2741b498..5e93f1c8865a99 100644
--- a/libcxx/cmake/caches/NVPTX.cmake
+++ b/libcxx/cmake/caches/NVPTX.cmake
@@ -1,6 +1,6 @@
 # Configuration options for libcxx.
 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
-set(LIBCXX_CXX_ABI none CACHE STRING "")
+set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
 set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")

>From 310631bba99d83d6d8f4c65f7f56fc7ac52ae192 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 21 Aug 2024 09:07:10 -0500
Subject: [PATCH 4/4] sort

---
 libcxx/cmake/caches/AMDGPU.cmake | 24 ++++++++++++------------
 libcxx/cmake/caches/NVPTX.cmake  | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/libcxx/cmake/caches/AMDGPU.cmake b/libcxx/cmake/caches/AMDGPU.cmake
index 48b8f4b2225096..0cd2eebfb9c16a 100644
--- a/libcxx/cmake/caches/AMDGPU.cmake
+++ b/libcxx/cmake/caches/AMDGPU.cmake
@@ -1,31 +1,31 @@
 # Configuration options for libcxx.
 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
 set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
-set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
-set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
 set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
 set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
 set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
 
 # Configuration options for libcxxabi.
 set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
-set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
 
 # Necessary compile flags for AMDGPU.
diff --git a/libcxx/cmake/caches/NVPTX.cmake b/libcxx/cmake/caches/NVPTX.cmake
index 5e93f1c8865a99..47a24a349e996e 100644
--- a/libcxx/cmake/caches/NVPTX.cmake
+++ b/libcxx/cmake/caches/NVPTX.cmake
@@ -1,31 +1,31 @@
 # Configuration options for libcxx.
 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
 set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
-set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
-set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
 set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
-set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
 set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
 set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
 
 # Configuration options for libcxxabi.
 set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
-set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
 
 # Necessary compile flags for NVPTX.



More information about the libcxx-commits mailing list