[PATCH] D11743: [CMake] First pass at adding support for clang bootstrap builds to CMake
Chris Bieneman
beanz at apple.com
Mon Aug 3 17:20:56 PDT 2015
beanz created this revision.
beanz added reviewers: chandlerc, bogner.
beanz added a subscriber: cfe-commits.
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.
http://reviews.llvm.org/D11743
Files:
CMakeLists.txt
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -96,6 +96,7 @@
option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
"Set to ON to force using an old, unsupported host toolchain." OFF)
+ option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
include(AddLLVM)
include(TableGen)
@@ -551,3 +552,45 @@
${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
COPYONLY)
endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+ include(ExternalProject)
+
+ if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+ set(cmake_3_4_USES_TERMINAL_OPTIONS)
+ else()
+ set(cmake_3_4_USES_TERMINAL_OPTIONS
+ USES_TERMINAL_CONFIGURE 1
+ USES_TERMINAL_BUILD 1
+ USES_TERMINAL_INSTALL 1)
+ endif()
+
+
+ ExternalProject_Add(bootstrap
+ DEPENDS clang
+ PREFIX bootstrap
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}
+ CMAKE_ARGS
+ # We shouldn't need to set this here, but INSTALL_DIR doesn't
+ # seem to work, so instead I'm passing this through
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ ${CLANG_BOOTSTRAP_CMAKE_ARGS}
+ -DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
+ -DCMAKE_C_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
+ STEP_TARGETS configure build install
+ ${cmake_3_4_USES_TERMINAL_OPTIONS}
+ )
+
+ ExternalProject_Add_Step(bootstrap force-reconfigure
+ DEPENDERS configure
+ ALWAYS 1
+ )
+
+ ExternalProject_Add_Step(bootstrap clobber
+ COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR>
+ COMMAND ${CMAKE_COMMAND} -E make_directory <BINARY_DIR>
+ COMMENT "Clobberring bootstrap build directory..."
+ DEPENDERS configure
+ DEPENDS clang
+ )
+endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11743.31288.patch
Type: text/x-patch
Size: 1805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150804/fdb74f99/attachment.bin>
More information about the cfe-commits
mailing list