1import os
2import sys
3
4# Tell pylint that we know config and lit_config exist somewhere.
5if 'PYLINT_IMPORT' in os.environ:
6    config = object()
7    lit_config = object()
8
9ndk = os.getenv('NDK')
10if ndk is None:
11    sys.exit('The environment variable NDK must point to an NDK toolchain.')
12
13top = os.getenv('ANDROID_BUILD_TOP')
14libcxx_dir = os.path.join(ndk, 'sources/cxx-stl/llvm-libc++')
15libcxx_src_dir = os.path.join(libcxx_dir, 'libcxx')
16
17config.cxx_under_test = os.path.join(
18    ndk, "toolchains/llvm/prebuilt/linux-x86_64/bin/clang++")
19config.std = "c++11"
20config.libcxx_src_root = libcxx_src_dir
21config.libcxx_obj_root = libcxx_src_dir
22config.cxx_library_root = os.path.join(libcxx_dir, 'libs/%ABI%')
23config.enable_exceptions = "True"
24config.enable_rtti = "True"
25config.enable_shared = "False"
26config.enable_32bit = "False"
27config.enable_threads = "True"
28config.enable_monotonic_clock = "True"
29config.cxx_abi = "libcxxabi"
30config.use_sanitizer = ""
31config.configuration_variant = "libcxx.ndk"
32config.target_triple = "%TRIPLE%"
33config.sysroot = os.path.join(ndk, "platforms/android-21/arch-%ARCH%/")
34config.gcc_toolchain = os.path.join(
35    ndk, "toolchains/%TRIPLE%-4.9/prebuilt/linux-x86_64")
36
37# Let the main config do the real work.
38lit_config.load_config(
39    config, os.path.join(libcxx_src_dir, "test/lit.cfg"))
40