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