Page MenuHomePhabricator

[CMake] Ensure `CLANG_RESOURCE_DIR` is respected
AbandonedPublic

Authored by paperchalice on Oct 26 2022, 6:53 PM.

Details

Summary

Install resource headers correctly, when CLANG_RESOURCE_DIR is set to some non empty string.
Resolves #57708.

Diff Detail

Unit TestsFailed

TimeTest
60,040 msx64 debian > MLIR.Examples/standalone::test.toy
Script: -- : 'RUN: at line 1'; /usr/bin/cmake /var/lib/buildkite-agent/builds/llvm-project/mlir/examples/standalone -G "Ninja" -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/var/lib/buildkite-agent/builds/llvm-project/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld -DPython3_EXECUTABLE="/usr/bin/python3.9"
60,040 msx64 debian > libFuzzer.libFuzzer::fuzzer-leak.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LeakTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-leak.test.tmp-LeakTest
60,050 msx64 debian > libFuzzer.libFuzzer::minimize_crash.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/NullDerefTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/minimize_crash.test.tmp-NullDerefTest
60,040 msx64 debian > libFuzzer.libFuzzer::out-of-process-fuzz.test
Script: -- : 'RUN: at line 2'; rm -rf /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/out-of-process-fuzz.test.tmp && mkdir /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/out-of-process-fuzz.test.tmp

Event Timeline

paperchalice created this revision.Oct 26 2022, 6:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 6:53 PM
Herald added a subscriber: Enna1. · View Herald Transcript
paperchalice requested review of this revision.Oct 26 2022, 6:53 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added subscribers: llvm-commits, openmp-commits, Restricted Project and 2 others. · View Herald Transcript
paperchalice added a comment.EditedOct 26 2022, 7:02 PM

Thanks a lot if someone can commit this change because I don't have the permission.

This change introduces a lot of conditional code, that is not necessary. This change also uses CLANG_ outside clang/ which is messy. and confusing. Please clean up.

Ericson2314 requested changes to this revision.Nov 7 2022, 5:37 AM
This revision now requires changes to proceed.Nov 7 2022, 5:37 AM

Add cmake module to handle clang resource dir.

Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 3:52 AM
paperchalice added inline comments.Nov 11 2022, 4:01 AM
clang/lib/Headers/CMakeLists.txt
285

Another choice is ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}, but the variable CMAKE_CFG_INTDIR is deprecated since 3.21

cmake/Modules/GetClangResourceDir.cmake
14

Can I always rely on PACKAGE_VERSION?

paperchalice retitled this revision from [CMake] Make sure all headers are installed into `CLANG_RESOURCE_DIR` to [CMake] Ensure `CLANG_RESOURCE_DIR` is respected.Nov 11 2022, 4:07 AM
paperchalice marked 2 inline comments as not done.Nov 16 2022, 2:35 AM
paperchalice added reviewers: tstellar, MaskRay.

Use genex $<CONFIG> due to CMAKE_CFG_INTDIR is deprecated since cmake 3.21.

paperchalice abandoned this revision.Dec 19 2022, 9:37 PM