This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Support passing arguments to build tool (bootstrap).
ClosedPublic

Authored by CarlosAlbertoEnciso on Aug 11 2022, 3:43 AM.

Details

Summary

For bootstrap builds (CLANG_ENABLE_BOOTSTRAP=ON) allow
arguments to be passed to the native tool used in CMake
for the stage2 step.

Can be used to pass extra arguments for enhanced versions
of build tools, e.g. distributed build options.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 3:43 AM
Herald added a subscriber: mgorny. · View Herald Transcript
CarlosAlbertoEnciso requested review of this revision.Aug 11 2022, 3:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 3:43 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Noting related review: https://reviews.llvm.org/D115815 which added this variable to support this for other "external projects".

To give more scope to the reviewers, the following CMake options illustrate the benefit of this patch.

For example, if I want to do a dry run on stage-2, I will pass -DLLVM_EXTERNAL_PROJECT_BUILD_TOOL_ARGS="-n --verbose"

-DCLANG_ENABLE_BOOTSTRAP=ON -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -G"Ninja" -DLLVM_EXTERNAL_PROJECT_BUILD_TOOL_ARGS="-n --verbose"

When ninja builds stage-2 it receives the additional -n and --verbose options.

The build_tool_args passed to BUILD_COMMAND looks like:

'--;-n;--verbose'
russell.gallop resigned from this revision.Aug 22 2022, 3:00 AM

Resign as reviewer as I work with Carlos (and am not familiar enough with the details of this area).

andrewng resigned from this revision.Aug 22 2022, 4:09 AM

Resign as reviewer as I also work with Carlos and helped to author this patch.

phosek accepted this revision.Aug 22 2022, 9:48 AM

LGTM

This revision is now accepted and ready to land.Aug 22 2022, 9:48 AM

LGTM

@phosek Thanks for your review.