[libc-commits] [libc] [llvm] [libc] delete hdrgen (PR #117220)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Dec 3 09:06:44 PST 2024


https://github.com/jhuber6 commented:

The GPU loader utilities still need this weird "forced projects" thing.
```diff
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 73ab38227768..fd82359022cf 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -50,16 +50,28 @@ set(LIBC_NAMESPACE ${default_namespace}
   CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
 )
 
-
-add_subdirectory(newhdrgen)
-
-
 # We will build the GPU utilities if we are not doing a runtimes build.
 option(LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF)
-if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
-  add_subdirectory(utils/gpu)
+if(LIBC_BUILD_GPU_LOADER OR NOT LLVM_RUNTIMES_BUILD)
+  foreach(_name ${LLVM_RUNTIME_TARGETS})
+    if("libc" IN_LIST RUNTIMES_${_name}_LLVM_ENABLE_RUNTIMES)
+      if("${_name}" STREQUAL "amdgcn-amd-amdhsa" OR "${_name}" STREQUAL "nvptx64-nvidia-cuda")
+        set(LIBC_NEED_LOADER_UTILS TRUE)
+      endif()
+    endif()
+  endforeach()
+  if("${LIBC_TARGET_TRIPLE}" STREQUAL "amdgcn-amd-amdhsa" OR
+     "${LIBC_TARGET_TRIPLE}" STREQUAL "nvptx64-nvidia-cuda")
+    set(LIBC_NEED_LOADER_UTILS TRUE)
+  endif()
+  if(LIBC_NEED_LOADER_UTILS)
+    add_subdirectory(utils/gpu)
+    return()
+  endif()
 endif()
 
+add_subdirectory(newhdrgen)
+
 option(LIBC_CMAKE_VERBOSE_LOGGING
   "Log details warnings and notifications during CMake configuration." OFF)
 
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 03c1486c45ee..cb7a8bf6cbf8 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -190,6 +190,10 @@ if("${LIBC_TARGET_TRIPLE}" STREQUAL "amdgcn-amd-amdhsa" OR
    "${LIBC_TARGET_TRIPLE}" STREQUAL "nvptx64-nvidia-cuda")
   set(LLVM_LIBC_GPU_BUILD ON)
 endif()
+if (NOT "libc" IN_LIST LLVM_ENABLE_PROJECTS AND LLVM_LIBC_GPU_BUILD)
+  message(STATUS "Enabling libc project to build libc testing tools")
+  list(APPEND LLVM_ENABLE_PROJECTS "libc")
+endif()
 
 # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
 # `LLVM_ENABLE_PROJECTS` CMake cache variable.  This exists for
```
This seemed to work for me.

https://github.com/llvm/llvm-project/pull/117220


More information about the libc-commits mailing list