[libc-commits] [libc] 465f4ac - [libc] Install GPU headers to `gpu-none-llvm/` subfolder

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Mar 28 12:27:45 PDT 2023


Author: Joseph Huber
Date: 2023-03-28T14:27:35-05:00
New Revision: 465f4ac9d7c4167a11c2c5a159c4b4c09f49a35a

URL: https://github.com/llvm/llvm-project/commit/465f4ac9d7c4167a11c2c5a159c4b4c09f49a35a
DIFF: https://github.com/llvm/llvm-project/commit/465f4ac9d7c4167a11c2c5a159c4b4c09f49a35a.diff

LOG: [libc] Install GPU headers to `gpu-none-llvm/` subfolder

The GPU support for the `libc` generates all its own headers. Since
these headers use the same names as the system headers we need to make
sure that they are separate. Currently, we either use the system headers
on the GPU or the GPU headers on the system. This patch makes them
explicitly separate. A follow-up patch will then make `clang` look in
this folder by default.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D146970

Added: 
    

Modified: 
    libc/include/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 39b598824e24e..9c48fd782c590 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -511,6 +511,11 @@ foreach(target IN LISTS all_install_header_targets)
   endif()
   file(RELATIVE_PATH relative_path ${LIBC_INCLUDE_BINARY_DIR} ${header_file})
   get_filename_component(nested_dir ${relative_path} DIRECTORY)
+  # The GPU headers are installed to 'gpu-none-llvm/' to prevent shadowing the
+  # system headers.
+  if(LIBC_TARGET_ARCHITECTURE_IS_GPU)
+    set(nested_dir gpu-none-llvm/${nested_dir})
+  endif()
   install(FILES ${header_file}
           DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${nested_dir}
           COMPONENT libc-headers)


        


More information about the libc-commits mailing list