summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scons/llvm.py57
1 files changed, 13 insertions, 44 deletions
diff --git a/scons/llvm.py b/scons/llvm.py
index 134a0728ef1..cdfbe43708f 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -37,6 +37,9 @@ import SCons.Errors
import SCons.Util
+required_llvm_version = '3.1'
+
+
def generate(env):
env['llvm'] = False
@@ -84,6 +87,9 @@ def generate(env):
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
return
+ if llvm_version < distutils.version.LooseVersion(required_llvm_version):
+ print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version)
+ return
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
@@ -104,8 +110,8 @@ def generate(env):
'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
'LLVMSupport', 'LLVMRuntimeDyld', 'LLVMObject'
])
- elif llvm_version >= distutils.version.LooseVersion('3.0'):
- # 3.0
+ else:
+ # 3.1
env.Prepend(LIBS = [
'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
@@ -116,46 +122,6 @@ def generate(env):
'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
'LLVMSupport'
])
- elif llvm_version >= distutils.version.LooseVersion('2.9'):
- # 2.9
- env.Prepend(LIBS = [
- 'LLVMObject', 'LLVMMCJIT', 'LLVMMCDisassembler',
- 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
- 'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
- 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
- 'LLVMMCParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
- 'LLVMSelectionDAG', 'LLVMX86Utils', 'LLVMX86Info', 'LLVMAsmPrinter',
- 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMInstCombine',
- 'LLVMTransformUtils', 'LLVMipa', 'LLVMAsmParser',
- 'LLVMArchive', 'LLVMBitReader', 'LLVMAnalysis', 'LLVMTarget',
- 'LLVMCore', 'LLVMMC', 'LLVMSupport',
- ])
- elif llvm_version >= distutils.version.LooseVersion('2.7'):
- # 2.7
- env.Prepend(LIBS = [
- 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
- 'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
- 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
- 'LLVMMCParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
- 'LLVMSelectionDAG', 'LLVMX86Info', 'LLVMAsmPrinter',
- 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMInstCombine',
- 'LLVMTransformUtils', 'LLVMipa', 'LLVMAsmParser',
- 'LLVMArchive', 'LLVMBitReader', 'LLVMAnalysis', 'LLVMTarget',
- 'LLVMMC', 'LLVMCore', 'LLVMSupport', 'LLVMSystem',
- ])
- else:
- # 2.6
- env.Prepend(LIBS = [
- 'LLVMX86AsmParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
- 'LLVMX86Info', 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
- 'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
- 'LLVMDebugger', 'LLVMBitWriter', 'LLVMAsmParser',
- 'LLVMArchive', 'LLVMBitReader', 'LLVMSelectionDAG',
- 'LLVMAsmPrinter', 'LLVMCodeGen', 'LLVMScalarOpts',
- 'LLVMTransformUtils', 'LLVMipa', 'LLVMAnalysis',
- 'LLVMTarget', 'LLVMMC', 'LLVMCore', 'LLVMSupport',
- 'LLVMSystem',
- ])
env.Append(LIBS = [
'imagehlp',
'psapi',
@@ -180,6 +146,10 @@ def generate(env):
llvm_version = env.backtick('llvm-config --version').rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
+ if llvm_version < distutils.version.LooseVersion(required_llvm_version):
+ print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version)
+ return
+
try:
# Treat --cppflags specially to prevent NDEBUG from disabling
# assertion failures in debug builds.
@@ -197,8 +167,7 @@ def generate(env):
components = ['engine', 'bitwriter', 'x86asmprinter']
- if llvm_version >= distutils.version.LooseVersion('3.1'):
- components.append('mcjit')
+ components.append('mcjit')
env.ParseConfig('llvm-config --libs ' + ' '.join(components))
env.ParseConfig('llvm-config --ldflags')