Page MenuHomePhabricator

add LLVM_INCLUDE_LIB CMake option
Needs RevisionPublic

Authored by ilelann on Oct 23 2020, 4:29 AM.

Details

Reviewers
smeenai
ldionne
Summary

Including lib does not seem to be required when one want, example given, to build libcxx.
Same rationale as the others LLLM_INCLUDE options: it reduces the number of targets, and makes life inside IDE easier.

Diff Detail

Unit TestsFailed

TimeTest
430 mslinux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp

Event Timeline

ilelann created this revision.Oct 23 2020, 4:29 AM
ilelann requested review of this revision.Oct 23 2020, 4:29 AM
ldionne resigned from this revision.Oct 23 2020, 7:10 AM
ldionne added a subscriber: smeenai.

Sorry, I'm not sufficiently familiar with LLVM's build system to review this. I work on the runtimes almost exclusively. @smeenai might be a better fit here.

Sorry, I'm not sufficiently familiar with LLVM's build system to review this. I work on the runtimes almost exclusively. @smeenai might be a better fit here.

Oh, I looked a bit fast. I think I understand the intent here -- you're trying to make it easier to build libcxx as part of the monorepo without the rest of LLVM?

I don't think that's the right way forward, I think we need to setup a separate build root for the runtimes.

Oh, I looked a bit fast. I think I understand the intent here -- you're trying to make it easier to build libcxx as part of the monorepo without the rest of LLVM?

That is the intent indeed.
Starting from the "official" build instructions found here https://libcxx.llvm.org/docs/BuildingLibcxx.html, I ultimately got this CMake incantation to get a minimal libunwind+libcxxabi+libcxx static build:
https://github.com/ilelann/IncludeOS/blob/master/CMakeLists.txt#L77-L130

And I am totally happy with it, despite the arguably long list of flags.
The additionnal LLVM_INCLUDE_LIB proposed here is only to avoid configuring and building a large set of irrelevant targets.
With my patch and LLVM_INCLUDE_LIB set to OFF, the "pollution" brought by including the main LLVM CMake file is really minimal: when I "make" my super-project I don't notice any irrelevant target.

smeenai requested changes to this revision.Nov 11 2020, 12:58 PM
smeenai added subscribers: tstellar, beanz.

Yeah, in general, we've tried to move away from configure-time options for parts of the build like this (CC @beanz and @tstellar). The separate build root for the runtimes is the way to go here.

This revision now requires changes to proceed.Nov 11 2020, 12:58 PM