[libcxx] Add support for building and testing with an ABI library not along linker paths

Summary:
This patch adds support for building/testing libc++ with an ABI library that the linker would not normally find.

- `CMAKE_LIBRARY_PATH` is used to specify the list of search directories.
- The ABI library is now found using `find_library` instead of assuming its along the linker's search path.
- `CMAKE_LIBRARY_PATH` is passed to our LIT config as `library_paths`.
- For each path in `library_paths` the following flags are added `-L<path> -Wl,-rpath -Wl,<path>`

Some changes in existing behavior were also added:
- `target_link_libraries` is now passed the ABI library file instead of the library name. Ex `target_link_libraries(cxx "/usr/lib/libc++abi.so")` vs `target_link_libraries(cxx "c++abi")`.
- `-Wl,-rpath -Wl,<path>` is now used on OSX to link to libc++ instead of env['DYLD_LIBRARY_PATH'] if `use_system_lib=False`.




Reviewers: mclow.lists, danalbert, EricWF

Reviewed By: EricWF

Subscribers: emaste, cfe-commits

Differential Revision: http://reviews.llvm.org/D5038

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220118 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2014-10-18 01:15:17 +00:00
parent 950ee77d24
commit 9071bc098b
5 changed files with 162 additions and 106 deletions

View File

@@ -436,6 +436,36 @@ End of search list.
</p>
</p>
<!--=====================================================================-->
<h2 id="local-abi">Using a local ABI library</h2>
<!--=====================================================================-->
<p>
<strong>Note: This is not recommended in almost all cases.</strong><br>
Generally these instructions should only be used when you can't install
your ABI library.
</p>
<p>
Normally you must link libc++ against a ABI shared library that the
linker can find. If you want to build and test libc++ against an ABI
library not in the linker's path you need to set
<code>-DCMAKE_LIBRARY_PATH=/path/to/abi/lib</code> when configuring CMake.
</p>
<p>
An example build using libc++abi would look like:
<ul>
<li><code>CC=clang CXX=clang++ cmake
-DLIBCXX_CXX_ABI=libc++abi
-DLIBCXX_LIBCXXABI_INCLUDE_PATHS="/path/to/libcxxabi/include"
-DCMAKE_LIBRARY_PATH="/path/to/libcxxabi-build/lib"
path/to/libcxx</code></li>
<li><code>make</code></li>
</ul>
</p>
<p>
When testing libc++ LIT will automatically link against the proper ABI
library.
</p>
<!--=====================================================================-->
<h2>Design Documents</h2>
<!--=====================================================================-->