Only use XCode clang wrappers for packages that set use_xcode=True (#6077)
This commit is contained in:
parent
c4db3d384e
commit
c96f2e50a6
@ -125,7 +125,6 @@ def __init__(self, cspec, operating_system, target,
|
||||
def check(exe):
|
||||
if exe is None:
|
||||
return None
|
||||
exe = self._find_full_path(exe)
|
||||
_verify_executables(exe)
|
||||
return exe
|
||||
|
||||
@ -286,17 +285,6 @@ def check(key):
|
||||
successful.reverse()
|
||||
return dict(((v, p, s), path) for v, p, s, path in successful)
|
||||
|
||||
def _find_full_path(self, path):
|
||||
"""Return the actual path for a tool.
|
||||
|
||||
Some toolchains use forwarding executables (particularly Xcode-based
|
||||
toolchains) which can be manipulated by external environment variables.
|
||||
This method should be used to extract the actual path used for a tool
|
||||
by finding out the end executable the forwarding executables end up
|
||||
running.
|
||||
"""
|
||||
return path
|
||||
|
||||
def setup_custom_environment(self, pkg, env):
|
||||
"""Set any environment variables necessary to use the compiler."""
|
||||
pass
|
||||
|
@ -158,16 +158,6 @@ def default_version(cls, comp):
|
||||
|
||||
return _version_cache[comp]
|
||||
|
||||
def _find_full_path(self, path):
|
||||
basename = os.path.basename(path)
|
||||
|
||||
if not self.is_apple or basename not in ('clang', 'clang++'):
|
||||
return super(Clang, self)._find_full_path(path)
|
||||
|
||||
xcrun = Executable('xcrun')
|
||||
full_path = xcrun('-f', basename, output=str)
|
||||
return full_path.strip()
|
||||
|
||||
@classmethod
|
||||
def fc_version(cls, fc):
|
||||
# We could map from gcc/gfortran version to clang version, but on macOS
|
||||
@ -202,6 +192,14 @@ def setup_custom_environment(self, pkg, env):
|
||||
# consequently render MPI non-functional outside of Spack.
|
||||
return
|
||||
|
||||
# Use special XCode versions of compiler wrappers when using XCode
|
||||
# Overwrites build_environment's setting of SPACK_CC and SPACK_CXX
|
||||
xcrun = Executable('xcrun')
|
||||
xcode_clang = xcrun('-f', 'clang', output=str).strip()
|
||||
xcode_clangpp = xcrun('-f', 'clang++', output=str).strip()
|
||||
env.set('SPACK_CC', xcode_clang, force=True)
|
||||
env.set('SPACK_CXX', xcode_clangpp, force=True)
|
||||
|
||||
xcode_select = Executable('xcode-select')
|
||||
|
||||
# Get the path of the active developer directory
|
||||
|
@ -460,7 +460,9 @@ def set_or_unset_not_first(variable, changes, errstream):
|
||||
modifications have already been requested.
|
||||
"""
|
||||
indexes = [ii for ii, item in enumerate(changes)
|
||||
if ii != 0 and type(item) in [SetEnv, UnsetEnv]]
|
||||
if ii != 0 and
|
||||
not item.args.get('force', False) and
|
||||
type(item) in [SetEnv, UnsetEnv]]
|
||||
if indexes:
|
||||
good = '\t \t{context} at {filename}:{lineno}'
|
||||
nogood = '\t--->\t{context} at {filename}:{lineno}'
|
||||
|
Loading…
Reference in New Issue
Block a user