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

Petr Hosek via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jun 23 10:43:48 PDT 2023


phosek added inline comments.


================
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})
----------------
jhuber6 wrote:
> 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`?
This is intentional and matches what we do for other runtimes like libc++. Our goal has always been for the layout of the build directory to match the layout of the install directory so you can run the compiler without having to do the install step first. Clang driver looks for headers in `<path to clang>/../include/...`. If this is undesirable for the GPU target, we can adjust the logic, but we want to keep this for other targets.


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