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')
14out_dir = os.getenv('ANDROID_PRODUCT_OUT')
15
16if top is None or out_dir is None:
17    sys.exit('ANDROID_BUILD_TOP or ANDROID_PRODUCT_OUT is not set. Have you '
18             'run lunch?')
19
20config.cxx_under_test = os.path.join(
21    top, "prebuilts/clang/linux-x86/host/3.6/bin/clang++")
22config.std = "c++11"
23config.libcxx_src_root = os.path.join(top, "external/libcxx")
24config.libcxx_obj_root = os.path.join(top, "external/libcxx")
25config.cxx_library_root = os.path.join(out_dir, 'system/lib')
26config.enable_exceptions = "True"
27config.enable_rtti = "True"
28config.enable_shared = "False"
29config.enable_32bit = "False"
30config.enable_threads = "True"
31config.enable_monotonic_clock = "True"
32config.cxx_abi = "libcxxabi"
33config.use_sanitizer = ""
34config.configuration_variant = "libcxx.ndk"
35config.target_triple = "armv7a-linux-androideabi"
36config.sysroot = os.path.join(ndk, "platforms/android-21/arch-arm/")
37config.gcc_toolchain = os.path.join(
38    top, "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9")
39
40# Let the main config do the real work.
41lit_config.load_config(
42    config, os.path.join(top, "external/libcxx/test/lit.cfg"))
43