This is an archive of the discontinued LLVM Phabricator instance.

[CMake] install clang and other resource headers into `CLANG_RESOURCE_DIR/include` if `CLANG_RESOURCE_DIR` is not empty
AbandonedPublic

Authored by paperchalice on Sep 25 2022, 2:25 AM.

Details

Reviewers
phosek
jdoerfert
Summary

When CLANG_RESOURCE_DIR is not empty, clang will look up builtin headers in CLANG_RESOURCE_DIR/include, this patch makes sure resource headers are installed into the correct location.
Resolve issue #57708.

Diff Detail

Event Timeline

paperchalice created this revision.Sep 25 2022, 2:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2022, 2:25 AM
paperchalice requested review of this revision.Sep 25 2022, 2:25 AM
phosek added inline comments.Sep 26 2022, 11:47 PM
clang/lib/Headers/CMakeLists.txt
266

The property we maintain is that the build directory layout matches the installation directory which makes it possible to use the toolchain without having to install it first.

I believe we need to set the output_dir depending on the value of CLANG_RESOURCE_DIR as well to preserve that behavior.

423–426

nit: can we use if ... else?

Update the output_dir.

phosek accepted this revision.Sep 27 2022, 2:12 AM

LGTM

This revision is now accepted and ready to land.Sep 27 2022, 2:12 AM

If it is ready to land, could you commit this change? I don't have commit right, thanks.

Let other projects consider CLANG_RESOURCE_DIR too.

Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptOct 7 2022, 9:28 PM
Herald added subscribers: llvm-commits, openmp-commits, Restricted Project, Enna1. · View Herald Transcript
paperchalice retitled this revision from [CMake] install clang resource headers into `CLANG_RESOURCE_DIR/include` if `CLANG_RESOURCE_DIR` is not empty to [CMake] install clang and other resource headers into `CLANG_RESOURCE_DIR/include` if `CLANG_RESOURCE_DIR` is not empty.Oct 18 2022, 2:31 AM

Ping @phosek, but may need suggestions from other reviewers...
Thanks in advance if someone can commit this change.

openmp/CMakeLists.txt
80 ↗(On Diff #466249)

Should support CLANG_RESOURCE_DIR in standalone mode?

paperchalice abandoned this revision.Oct 26 2022, 6:35 PM