| 1 |
# Build libc++abi and libc++ closely resembling what is shipped in the Android |
| 2 |
# NDK. |
| 3 |
|
| 4 |
# The NDK names the libraries libc++_shared.so and libc++_static.a. Using the |
| 5 |
# libc++_shared.so soname ensures that the library doesn't interact with the |
| 6 |
# libc++.so in /system/lib[64]. |
| 7 |
set(LIBCXX_SHARED_OUTPUT_NAME c++_shared CACHE STRING "") |
| 8 |
set(LIBCXX_STATIC_OUTPUT_NAME c++_static CACHE STRING "") |
| 9 |
|
| 10 |
# The NDK libc++ uses a special namespace to help isolate its symbols from those |
| 11 |
# in the platform's STL (e.g. /system/lib[64]/libc++.so, but possibly stlport on |
| 12 |
# older versions of Android). |
| 13 |
set(LIBCXX_ABI_VERSION 1 CACHE STRING "") |
| 14 |
set(LIBCXX_ABI_NAMESPACE __ndk1 CACHE STRING "") |
| 15 |
|
| 16 |
# CMake doesn't add a version suffix to an Android shared object filename, |
| 17 |
# (because CMAKE_PLATFORM_NO_VERSIONED_SONAME is set), so it writes both a |
| 18 |
# libc++_shared.so ELF file and a libc++_shared.so linker script to the same |
| 19 |
# output path (the script clobbers the binary). Turn off the linker script. |
| 20 |
set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "") |
| 21 |
|
| 22 |
set(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY ON CACHE BOOL "") |
| 23 |
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") |
| 24 |
|
| 25 |
# Android uses its own unwinder library |
| 26 |
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "") |
| 27 |
|
| 28 |
# Clang links libc++ by default, but it doesn't exist yet. The libc++ CMake |
| 29 |
# files specify -nostdlib++ to avoid this problem, but CMake's default "compiler |
| 30 |
# works" testing doesn't pass that flag, so force those tests to pass. |
| 31 |
set(CMAKE_C_COMPILER_WORKS ON CACHE BOOL "") |
| 32 |
set(CMAKE_CXX_COMPILER_WORKS ON CACHE BOOL "") |
| 33 |
|
| 34 |
# Use adb to push tests to a locally-connected device (e.g. emulator) and run |
| 35 |
# them. |
| 36 |
set(LIBCXX_TEST_CONFIG "llvm-libc++-android-ndk.cfg.in" CACHE STRING "") |
| 37 |
set(LIBCXXABI_TEST_CONFIG "llvm-libc++abi-android-ndk.cfg.in" CACHE STRING "") |