[PATCH] Add the option to build/test compiler-rt as a standalone project with just-built Clang.
Alexey Samsonov
samsonov at google.com
Tue Feb 25 00:26:38 PST 2014
Update to latest version.
Hi brad.king, chapuni,
http://llvm-reviews.chandlerc.com/D2868
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2868?vs=7313&id=7342#toc
Files:
runtime/CMakeLists.txt
Index: runtime/CMakeLists.txt
===================================================================
--- runtime/CMakeLists.txt
+++ runtime/CMakeLists.txt
@@ -1,12 +1,61 @@
# TODO: Set the install directory.
+include(ExternalProject)
+
set(known_subdirs
- "compiler-rt"
"libcxx"
)
foreach (dir ${known_subdirs})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${dir})
endif()
endforeach()
+
+set(COMPILER_RT_SRC_ROOT ${LLVM_MAIN_SRC_DIR}/projects/compiler-rt)
+if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
+ # Add compiler-rt as an external project.
+ set(COMPILER_RT_PREFIX ${CMAKE_BINARY_DIR}/projects/compiler-rt)
+
+ ExternalProject_Add(compiler-rt
+ PREFIX ${COMPILER_RT_PREFIX}
+ SOURCE_DIR ${COMPILER_RT_SRC_ROOT}
+ CMAKE_ARGS -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+ -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config
+ -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
+ -DCOMPILER_RT_INSTALL_PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+ -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+ -DCOMPILER_RT_ENABLE_WERROR=ON
+ INSTALL_COMMAND ""
+ )
+ # Due to a bug, DEPENDS in ExternalProject_Add doesn't work
+ # in CMake 2.8.9 and 2.8.10.
+ add_dependencies(compiler-rt llvm-config clang clang++)
+
+ # Add a custom step to always re-configure compiler-rt (in case some of its
+ # sources have changed).
+ ExternalProject_Add_Step(compiler-rt force-reconfigure
+ DEPENDERS configure
+ ALWAYS 1
+ )
+
+ ExternalProject_Add_Step(compiler-rt clobber
+ COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR>
+ COMMAND ${CMAKE_COMMAND} -E make_directory <BINARY_DIR>
+ COMMENT "Clobberring compiler-rt build directory..."
+ DEPENDERS configure
+ DEPENDS ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+ )
+
+ ExternalProject_Get_Property(compiler-rt BINARY_DIR)
+ add_custom_target(check-compiler-rt
+ COMMAND ${CMAKE_COMMAND} --build . --target check-all
+ --config $<CONFIGURATION>
+ DEPENDS compiler-rt
+ WORKING_DIRECTORY ${BINARY_DIR})
+ # Add binaries that compiler-rt tests depend on.
+ add_dependencies(check-compiler-rt FileCheck count
+ not llvm-nm llvm-symbolizer)
+endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2868.4.patch
Type: text/x-patch
Size: 2595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140225/d91dcbb6/attachment.bin>
More information about the cfe-commits
mailing list