diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-11-05 06:30:03 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-11-05 06:30:03 +0000 |
commit | 965d2feeddd4bb672396e620b8c2f402f7bb99d6 (patch) | |
tree | 87b69b7ae6278c75cf7f618d884af4baecabc96a | |
parent | 5f73f68d39ef02b6ca4a082e7bc4c64903ed860a (diff) |
build/cmake: Enable initial llvm-build integration.
- Generates the llvm-config-2 LibraryDependencies.inc file.
- Generates dependency information so that cmake will automatically reconfigure
when LLVMBuild.txt files are changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143793 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 616330f571..2a5a33a1f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,54 @@ if( NOT PYTHONINTERP_FOUND ) Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") endif() +###### +# LLVMBuild Integration +# +# We use llvm-build to generate all the data required by the CMake based +# build system in one swoop: +# +# - We generate a file (a CMake fragment) in the object root which contains +# all the definitions that are required by CMake. +# +# - We generate the library table used by llvm-config. +# +# - We generate the dependencies for the CMake fragment, so that we will +# automatically reconfigure outselves. + +set(LLVMBUILDTOOL "${LLVM_MAIN_SRC_DIR}/utils/llvm-build/llvm-build") +set(LLVMCONFIGLIBRARYDEPENDENCIESINC + "${LLVM_BINARY_DIR}/tools/llvm-config-2/LibraryDependencies.inc") +set(LLVMBUILDCMAKEFRAG + "${LLVM_BINARY_DIR}/LLVMBuild.cmake") +message(STATUS "Constructing LLVMBuild project information") +execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL} + --write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC} + --write-cmake-fragment ${LLVMBUILDCMAKEFRAG} + ERROR_VARIABLE LLVMBUILDOUTPUT + ERROR_VARIABLE LLVMBUILDERRORS + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE LLVMBUILDRESULT) + +# On Win32, CMake doesn't properly handle piping the default output/error +# streams into the GUI console. So, we explicitly catch and report them. +if( NOT "${LLVMBUILDOUTPUT}" STREQUAL "") + message(STATUS "llvm-build output: ${LLVMBUILDOUTPUT}") +endif() +if( NOT "${LLVMBUILDRESULT}" STREQUAL "0" ) + message(FATAL_ERROR + "Unexpected failure executing llvm-build: ${LLVMBUILDERRORS}") +endif() + +# Include the generated CMake fragment. This will define properties from the +# LLVMBuild files in a format which is easy to consume from CMake, and will add +# the dependencies so that CMake will reconfigure properly when the LLVMBuild +# files change. +include(${LLVMBUILDCMAKEFRAG}) + +###### + # Configure all of the various header file fragments LLVM uses which depend on # configuration variables. set(LLVM_ENUM_ASM_PRINTERS "") |