This is an archive of the discontinued LLVM Phabricator instance.

[CMake] First pass at adding support for clang bootstrap builds to CMake
ClosedPublic

Authored by beanz on Aug 3 2015, 5:20 PM.

Details

Summary

This patch adds a new CLANG_ENABLE_BOOTSTRAP option to CMake which adds targets for building a stage2 bootstrap compiler. The targets are:

bootstrap-configure
bootstrap-build
bootstrap-install
bootstrap (which does all 3).

If you are using 3.3.20150708 or greater it utilizes the ninja USES_TERMINAL_* settings on the external project so that the output is properly buffered.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 31288.Aug 3 2015, 5:20 PM
beanz retitled this revision from to [CMake] First pass at adding support for clang bootstrap builds to CMake.
beanz updated this object.
beanz added reviewers: chandlerc, bogner.
beanz added a subscriber: cfe-commits.
chandlerc edited edge metadata.Aug 3 2015, 5:25 PM

This is pretty awesome.

A question -- how can we document better what this does? In particular, the fact that we have both 'bootstrap-install' and 'install' seems... confusing. Is it possible to make 'install' == 'bootstrap-install' in the case where the CMake option is set?

Other thoughts:

Can we get 'bootstrap-check'? 'bootstrap-ccheck-foo' for all the 'check-foo' variants?

I think 'bootstrap' shouldn't do 'bootstrap-install', it should be equivalent to 'bootstrap-check-all' IMO.

filcab added a subscriber: filcab.Aug 3 2015, 5:29 PM

Thank you!
I was going to ask you to change the bootstrap-install name, but it seems it's a cmake thing.

CMakeLists.txt
565 ↗(On Diff #31288)

Nit: not consistent with the other parens closing multi-line macros/directives.

beanz added a comment.Aug 3 2015, 6:39 PM

Chandler,

I would eventually like to make install be bootstrap-install in cases where CLANG_ENABLE_BOOTSTRAP=On. Doing that will require a larger reworking of how clang's install targets are structured. It is on my todo list, but in the interest of sending out smaller patches I wanted to send this out early and expand it in the public tree.

We can document the existing behavior in the Building LLVM With CMake documentation under frequently used variables (http://llvm.org/docs/CMake.html#frequently-used-cmake-variables).

I'm not super familiar with the ExternalProject support, but since you can't import targets from the external project I don't think we'll want to do a bootstrap-check-foo for all foo. Unless someone from the CMake community has some better ideas how to do that. Part of my motivation for prototyping this up was to start getting to know ExternalProject so that I can take advantage of it for compiler-rt.

I don't want bootstrap to do bootstrap-install either, but I can't find a way to make bootstrap-install work without it being part of the bootstrap target.

If it is alright with you, I'd really like to land this mostly as is, and iterate on it in-tree. There should be no real risk to this because it is fully gated by an option that defaults off.

Thanks,
-Chris

CMakeLists.txt
565 ↗(On Diff #31288)

I will fix this and update the patches.

beanz updated this revision to Diff 31334.Aug 4 2015, 9:31 AM
beanz edited edge metadata.

Fixing the formatting as per filcab's request.

beanz updated this revision to Diff 31359.Aug 5 2015, 9:26 AM
  • Fixed a dependency tracking issue with figuring out when to clear out the bootstrap build
  • Removed 'bootstrap-install' from the 'bootstrap' target
  • Added 'bootstrap-check' and 'bootstrap-check-all' targets
chandlerc accepted this revision.Aug 5 2015, 10:00 AM
chandlerc edited edge metadata.

Totally awesome man, ship it. I've left a nit-pick below, but this is definitely the right starting place.

CMakeLists.txt
615 ↗(On Diff #31359)

nit pick: I'd call it 'check-llvm', 'check-clang', and 'check-all'. I'm OK if we have to hard code the list though, that seems a minor inconvenience.

This revision is now accepted and ready to land.Aug 5 2015, 10:00 AM
This revision was automatically updated to reflect the committed changes.