[libc-commits] [PATCH] D152592: [libc] Place headers in the right include directory

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jun 23 06:22:43 PDT 2023


jhuber6 added inline comments.


================
Comment at: libc/CMakeLists.txt:22
 
-if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND LIBC_ENABLE_USE_BY_CLANG)
+if(LIBC_TARGET_ARCHITECTURE_IS_GPU)
+  set(LIBC_INCLUDE_DIR ${LLVM_BINARY_DIR}/include/gpu-none-llvm)
----------------
This does not work, this macro isn't defined until line 107 below.


================
Comment at: libc/cmake/modules/LLVMLibCHeaderRules.cmake:23
+  file(RELATIVE_PATH relative_path ${LIBC_INCLUDE_SOURCE_DIR} ${absolute_path})
+  set(dest_file ${LIBC_INCLUDE_DIR}/${relative_path})
   set(src_file ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_HEADER_HDR})
----------------
The old logic used to create for example this file when doing a runtimes build.
```
./runtimes/runtimes-bins/libc/include/llvm-libc-types/rpc_opcodes_t.h
```
Now I get
```
./include/gpu-none-llvm/llvm-libc-types/rpc_opcodes_t.h
```
Which is wrong because we should not be building these outside of the runtimes directory when doing a runtimes build, and because of the discrepancy it causes the relative path to be completely wrong. Did you test this with a runtimes build of `libc`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152592/new/

https://reviews.llvm.org/D152592



More information about the libc-commits mailing list