38 lines · plain
1# Build libc++abi and libc++ closely resembling what is shipped in the Android2# NDK.3 4# The NDK names the libraries libc++_shared.so and libc++_static.a. Using the5# libc++_shared.so soname ensures that the library doesn't interact with the6# libc++.so in /system/lib[64].7set(LIBCXX_SHARED_OUTPUT_NAME c++_shared CACHE STRING "")8set(LIBCXX_STATIC_OUTPUT_NAME c++_static CACHE STRING "")9 10# The NDK libc++ uses a special namespace to help isolate its symbols from those11# in the platform's STL (e.g. /system/lib[64]/libc++.so, but possibly stlport on12# older versions of Android).13set(LIBCXX_ABI_VERSION 1 CACHE STRING "")14set(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 a18# libc++_shared.so ELF file and a libc++_shared.so linker script to the same19# output path (the script clobbers the binary). Turn off the linker script.20set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")21 22set(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY ON CACHE BOOL "")23set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")24 25# Android uses its own unwinder library26set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")27 28# Clang links libc++ by default, but it doesn't exist yet. The libc++ CMake29# files specify -nostdlib++ to avoid this problem, but CMake's default "compiler30# works" testing doesn't pass that flag, so force those tests to pass.31set(CMAKE_C_COMPILER_WORKS ON CACHE BOOL "")32set(CMAKE_CXX_COMPILER_WORKS ON CACHE BOOL "")33 34# Use adb to push tests to a locally-connected device (e.g. emulator) and run35# them.36set(LIBCXX_TEST_CONFIG "llvm-libc++-android.cfg.in" CACHE STRING "")37set(LIBCXXABI_TEST_CONFIG "llvm-libc++abi-android.cfg.in" CACHE STRING "")38