[PATCH] Add cmake flags to disable LLD and LLDB from build.

Rick Foos rfoos at codeaurora.org
Fri Jan 16 12:44:44 PST 2015


On 01/13/2015 02:33 AM, Bob Campbell wrote:
>> On Jan 12, 2015, at 11:49 AM, Rick Foos <rfoos at codeaurora.org> wrote:
>>
>> Hi Bob,
>> I was adding these following the WITH_POLLY model and hoping the external projects macros would take care of everything.
> Looking around a bit WITH_POLLY, I think it is more involved that what LLD or LLDB needs,
> (but I don't claim to be an expert). WITH_POLLY effects more than adding the external project, it also modifies
> places where libraries are included. I don't claim to fully understand the polly build.
>
> I am thinking that for lld, lldb, and compiler-rt nothing needed
> to be guarded beyond the call to add_llvm_external_project().
>
> Since add_llvm_external_project() already has a guarding method we should
> just using it instead of creating yet another one.
>
> That said it would be nice to make it easier for people to find these settings,
> I know that it was only when I started research how to make the same changes you
> are making that I discovered I did not actually need to do anything.
>
>> Are you saying to replace LLVM_BUILD_EXTERNAL_COMPILER_RT with WITH_COMPILER_RT?
> I find the existence of the symbols LLVM_BUILD_EXTERNAL_COMPILER_RT and LLVM_EXTERNAL_COMPILER_RT_BUILD
> which have inverted logic a bit confusing:
>
> 1 - setting LLVM_BUILD_EXTERNAL_COMPILER_RT to ON disables building compiler-rt as part of llvm
>      (I think this is indicating that compiler-rt will be built independently)
> 2 - setting LLVM_EXTERNAL_COMPILER_RT_BUILD to OFF
>      (this is the test in add_llvm_external_project() for LLVM_EXTERNAL_${nameUPPER}_BUILD
>
> But, I would not change the existing symbols as I don't know who is using them or how.
>
> That said the symbol "WITH_LLDB" is much clearer to me than "LLVM_EXTERNAL_LLDB_BUILD", one could
> add WITH_LLDB to add_llvm_external_project() something like
>
>      option(LLVM_EXTERNAL_${nameUPPER}_BUILD
>             "Whether to build ${name} as part of LLVM" ON)
>      option(WITH_${nameUPPER}_BUILD
>             "Whether to build ${name} as part of LLVM" ON)
>      if (LLVM_EXTERNAL_${nameUPPER}_BUILD AND WITH_${nameUPPER})
>        add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir})
>      endif()
>
> I would not do it, and wonder if there is a way to better document the existing feature.
>
I'm creating a more generic get llvm source tree in the builders that 
allows all projects to be checked out. (or any combination)

As part of that, I would like the ability to ignore projects in a build.

Doing it in cmake/autoconf would be better than physically removing 
projects from a source tree.

Is there a way to add something like this that makes sense?
>> 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()
> Reading this bit of code had me wondering about what LLVM_IMPLICIT_PROJECT_IGNORE does,
> and it turns out that in my opinion LLVM_BUILD_EXTERNAL_COMPILER_RT=ON does not work
> since it does not add the compiler-rt to the LLVM_IMPLICIT_PROJECT_IGNORE.
>
> This is because add_llvm_implicit_external_projects() will find the CMakeLists.txt and
> add it if the directory is not in LLVM_IMPLICIT_PROJECT_IGNORE.
>
> On the other hand LLVM_BUILD_COMPILER_RT_EXTERNAL=OFF does work because add_llvm_external_project()
> always adds compiler-rt to the LLVM_IMPLICIT_PROJECT_IGNORE list.
>
>> Or I should leave compier-rt alone?
> I believe that for CMake this change is not needed for compiler-rt, lld or lldb, but I am not an expert.
>
> I have spent about 3 hours tonight looking at this, and I think I understand it, but I have not extensively
> tested every combination.
>
> I have built with ninja and XCode on Mac OS setting LLVM_EXTERNAL_LLD_BUILD, LLVM_EXTERNAL_LLDB_BUILD and LLVM_EXTERNAL_COMPILER_RT_BUILD
> to OFF. It seemes to me that these symbols were working.
>
>> 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))
>>
>>
>> REPOSITORY
>>   rL LLVM
>>
>> http://reviews.llvm.org/D6909
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>

-- 
Rick Foos
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project




More information about the llvm-commits mailing list