[CMake] Connect Compiler-RT targets to LLVM Runtimes directory
authorChris Bieneman <beanz@apple.com>
Fri, 26 Aug 2016 20:52:22 +0000 (20:52 +0000)
committerChris Bieneman <beanz@apple.com>
Fri, 26 Aug 2016 20:52:22 +0000 (20:52 +0000)
commit21395f9839d71e581370e6534e30558571057409
tree8749e6fde701851923b53436118eb436386343f8
parent403423cb59dab420a3be3f54017c32e98fada746
[CMake] Connect Compiler-RT targets to LLVM Runtimes directory

This patch builds on LLVM r279776.

In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth.

The three steps I abstract are:

(1) Add a top-level target (i.e asan, msan, ...)
(2) Set the target properties for sorting files in IDE generators
(3) Make the compiler-rt target depend on the top-level target

The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name.

The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings.

With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is:

> cmake [...]
> ninja runtimes-configure
> ninja asan

The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build.

Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats).
llvm-svn: 279863
13 files changed:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/lib/asan/CMakeLists.txt
compiler-rt/lib/cfi/CMakeLists.txt
compiler-rt/lib/dfsan/CMakeLists.txt
compiler-rt/lib/esan/CMakeLists.txt
compiler-rt/lib/lsan/CMakeLists.txt
compiler-rt/lib/msan/CMakeLists.txt
compiler-rt/lib/profile/CMakeLists.txt
compiler-rt/lib/safestack/CMakeLists.txt
compiler-rt/lib/scudo/CMakeLists.txt
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/lib/ubsan/CMakeLists.txt
compiler-rt/lib/xray/CMakeLists.txt