This is an archive of the discontinued LLVM Phabricator instance.

Add cmake flags to disable LLD and LLDB from build.
AbandonedPublic

Authored by rfoos on Jan 9 2015, 3:49 PM.

Details

Summary

An existing flag WITH_POLLY can be used to disable building with polly when tools/polly is in the source tree.

This change adds similar flags WITH_LLD and WITH_LLDB to better define builds without needing to change the source tree.

Diff Detail

Repository
rL LLVM

Event Timeline

rfoos updated this revision to Diff 17957.Jan 9 2015, 3:49 PM
rfoos retitled this revision from to Add cmake flags to disable LLD and LLDB from build..
rfoos updated this object.
rfoos edited the test plan for this revision. (Show Details)
rfoos added a reviewer: echristo.
rfoos set the repository for this revision to rL LLVM.
rfoos updated this object.
rfoos added a subscriber: Unknown Object (MLST).

Adding Chandler since CMake is more his area... that said, if you want to do this it'd be nice to add one for autoconf as well.

Continuing though, we don't have this for clang...?

I was looking for this functionality, and thought I found it in:

cmake/modules/AddLLVM.cmake: macro add_llvm_external_project

where it tests LLVM_EXTERNAL_${nameUPPER}_BUILD

So I thought if if I forced LLVM_EXTERNAL_LLDB_BUILD to OFF, then it would not build LLDB.

I did not test it yet as I found the solution to the problem that made me want to turn off building LLDB.

rfoos added a comment.Jan 9 2015, 4:21 PM

Lol, I thought you were going to bring up autoconf :-)

In autoconf/configure.ac --enable-polly is defined.

Did you want me to add them as --enable-lld, or --with-lld?

Yes, there's nothing for compiler-rt, clang, and clang/tools/extra and a few more.

The builders select compiler-rt which might be worth adding. I wasn't sure if compiler-rt was also done with add_llvm_external_project.

So I tried it out this evening and setting LLVM_EXTERNAL_LLDB_BUILD to OFF does work, so for CMake anything added with add_llvm_external_project() can be disabled by setting the LLVM_EXTERNAL_<name>_BUILD flag to off.

This includes: CLANG, COMPILER_RT, LIBCXXABI, LIBCXX, LLDB, LLD

I do wish that I had figured this out 6 months ago when I first was trying to do this, it was only last week when I decided to do exactly what this change does that I dug deep and found the switch that works.

Hi Bob,
I was adding these following the WITH_POLLY model and hoping the external projects macros would take care of everything.

Are you saying to replace LLVM_BUILD_EXTERNAL_COMPILER_RT with WITH_COMPILER_RT?

projects/CMakeLists.txt

if(${LLVM_BUILD_RUNTIME})
  if(WITH_COMPILER_RT)
    add_llvm_external_project(compiler-rt)
  else(WITH_COMPILER_RT)
    list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${LLVM_MAIN_SRC_DIR}/projects/compiler-rt")
  endif(WITH_COMPILER_RT)
endif()

Or I should leave compier-rt alone?

Rick
compiler-rt is a little different in autoconf than in cmake. Have to think a little more to handle it.

projects/Makefile

;; Don't build compiler-rt, it isn't designed to be built directly.
DIRS := $(filter-out compiler-rt,$(DIRS))
rfoos planned changes to this revision.Jan 16 2015, 9:15 AM

Bob's comments point out that this may not be the right direction.

I still would like to solve the problem of trimming the build when more projects than you need are checked out into your source tree.

rfoos abandoned this revision.Aug 6 2015, 10:51 AM

Impacts existing flags for llvm, wrong direction.