1 import os 2 import sys 3 4 # pylint: disable=invalid-name 5 6 # Tell pylint that we know config and lit_config exist somewhere. 7 if 'PYLINT_IMPORT' in os.environ: 8 config = object() 9 lit_config = object() 10 lit_config.params = {} 11 12 ndk = os.getenv('NDK') 13 if ndk is None: 14 sys.exit('The environment variable NDK must point to an NDK toolchain.') 15 16 top = os.getenv('ANDROID_BUILD_TOP') 17 libcxx_dir = os.path.join(ndk, 'sources/cxx-stl/llvm-libc++') 18 19 abi = lit_config.params["abi"] 20 host_tag = lit_config.params["host_tag"] 21 toolchain = lit_config.params["toolchain"] 22 triple = lit_config.params["triple"] 23 24 config.cxx_under_test = os.path.join( 25 ndk, "toolchains/llvm/prebuilt", host_tag, "bin/clang++") 26 config.std = "c++14" 27 config.libcxx_src_root = libcxx_dir 28 config.libcxx_obj_root = libcxx_dir 29 config.cxx_include = os.path.join(libcxx_dir, "include") 30 config.cxx_library_root = os.path.join(libcxx_dir, "libs", abi) 31 config.use_target = "True" 32 config.enable_exceptions = "True" 33 config.enable_rtti = "True" 34 config.enable_shared = "False" 35 config.enable_32bit = "False" 36 config.enable_threads = "True" 37 config.enable_monotonic_clock = "True" 38 config.cxx_abi = "libcxxabi" 39 config.use_sanitizer = "" 40 config.configuration_variant = "libcxx.ndk" 41 config.target_triple = triple 42 config.gcc_toolchain = os.path.join( 43 ndk, "toolchains", toolchain + "-4.9", "prebuilt", host_tag) 44 45 # Let the main config do the real work. 46 config.loaded_site_config = True 47 lit_config.load_config( 48 config, os.path.join(libcxx_dir, "test/lit.cfg")) 49