[Darwin] Need to add -isysroot on OS X otherwise the tests will fail if you don't have the command line tools package installed.

This mirrors how other LLVM suites are configured for running on OS X.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Bieneman 2015-10-12 00:49:56 +00:00
parent cb23a49e40
commit bf64c23851

View File

@ -6,6 +6,7 @@ import pkgutil
import re
import shlex
import sys
import subprocess
import lit.Test # pylint: disable=import-error,no-name-in-module
import lit.util # pylint: disable=import-error,no-name-in-module
@ -42,6 +43,24 @@ def loadSiteConfig(lit_config, config, param_name, env_name):
ld_fn(config, site_cfg)
lit_config.load_config = ld_fn
def getSysrootFlagsOnDarwin(config, lit_config):
# On Darwin, support relocatable SDKs by providing Clang with a
# default system root path.
if 'darwin' in config.target_triple:
try:
cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = cmd.communicate()
out = out.strip()
res = cmd.wait()
except OSError:
res = -1
if res == 0 and out:
sdk_path = out
lit_config.note('using SDKROOT: %r' % sdk_path)
return ["-isysroot", sdk_path]
return []
class Configuration(object):
# pylint: disable=redefined-outer-name
@ -339,6 +358,8 @@ class Configuration(object):
# Configure extra flags
compile_flags_str = self.get_lit_conf('compile_flags', '')
self.cxx.compile_flags += shlex.split(compile_flags_str)
sysroot_flags = getSysrootFlagsOnDarwin(self.config, self.lit_config)
self.cxx.compile_flags.extend(sysroot_flags)
def configure_default_compile_flags(self):
# Try and get the std version from the command line. Fall back to