summaryrefslogtreecommitdiffstats
path: root/scons/llvm.py
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2016-11-22 17:01:35 -0800
committerVinson Lee <[email protected]>2016-11-24 13:37:33 -0800
commitf07da5aa5e2e6021f02104235429b670f6b468ec (patch)
treecb507050618b004789cc72595fa58ae3ee6d4851 /scons/llvm.py
parenta794f0901719eb2689cbbabd5724fa89a2cfecd2 (diff)
scons: Recognize LLVM_CONFIG environment variable.
Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'scons/llvm.py')
-rw-r--r--scons/llvm.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/scons/llvm.py b/scons/llvm.py
index 977e47a8e19..2d0f05b0279 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -194,11 +194,12 @@ def generate(env):
# that.
env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
else:
- if not env.Detect('llvm-config'):
- print 'scons: llvm-config script not found'
+ llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')
+ if not env.Detect(llvm_config):
+ print 'scons: %s script not found' % llvm_config
return
- llvm_version = env.backtick('llvm-config --version').rstrip()
+ llvm_version = env.backtick('%s --version' % llvm_config).rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
if llvm_version < distutils.version.LooseVersion(required_llvm_version):
@@ -208,7 +209,7 @@ def generate(env):
try:
# Treat --cppflags specially to prevent NDEBUG from disabling
# assertion failures in debug builds.
- cppflags = env.ParseFlags('!llvm-config --cppflags')
+ cppflags = env.ParseFlags('!%s --cppflags' % llvm_config)
try:
cppflags['CPPDEFINES'].remove('NDEBUG')
except ValueError:
@@ -216,16 +217,16 @@ def generate(env):
env.MergeFlags(cppflags)
# Match llvm --fno-rtti flag
- cxxflags = env.backtick('llvm-config --cxxflags').split()
+ cxxflags = env.backtick('%s --cxxflags' % llvm_config).split()
if '-fno-rtti' in cxxflags:
env.Append(CXXFLAGS = ['-fno-rtti'])
components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler', 'irreader']
- env.ParseConfig('llvm-config --libs ' + ' '.join(components))
- env.ParseConfig('llvm-config --ldflags')
+ env.ParseConfig('%s --libs ' % llvm_config + ' '.join(components))
+ env.ParseConfig('%s --ldflags' % llvm_config)
if llvm_version >= distutils.version.LooseVersion('3.5'):
- env.ParseConfig('llvm-config --system-libs')
+ env.ParseConfig('%s --system-libs' % llvm_config)
env.Append(CXXFLAGS = ['-std=c++11'])
except OSError:
print 'scons: llvm-config version %s failed' % llvm_version