summaryrefslogtreecommitdiffstats
path: root/scons
diff options
context:
space:
mode:
authorOlivier Pena <opena@isagri.fr>2015-04-27 10:23:58 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-04-27 21:47:27 +0100
commitb94a4e84987f6bdefabf45527ec434d8510da2b8 (patch)
treebfc9129d89cff60d14946b941c19e4002b14a705 /scons
parentdfb0b36e8ff93873920495647381b3faf30df028 (diff)
downloadexternal_mesa3d-b94a4e84987f6bdefabf45527ec434d8510da2b8.zip
external_mesa3d-b94a4e84987f6bdefabf45527ec434d8510da2b8.tar.gz
external_mesa3d-b94a4e84987f6bdefabf45527ec434d8510da2b8.tar.bz2
scons: Support LLVM 3.5 and 3.6 on windows.
llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for detecting LLVM version (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073707.html). Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'scons')
-rw-r--r--scons/llvm.py33
1 files changed, 26 insertions, 7 deletions
diff --git a/scons/llvm.py b/scons/llvm.py
index be7df9f..17278df 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -72,18 +72,25 @@ def generate(env):
return
# Try to determine the LLVM version from llvm/Config/config.h
- llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+ llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/llvm-config.h')
if not os.path.exists(llvm_config):
print 'scons: could not find %s' % llvm_config
return
- llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
+ llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR ([0-9]+)')
+ llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR ([0-9]+)')
llvm_version = None
+ llvm_version_major = None
+ llvm_version_minor = None
for line in open(llvm_config, 'rt'):
- mo = llvm_version_re.match(line)
+ mo = llvm_version_major_re.match(line)
if mo:
- llvm_version = mo.group(1)
- llvm_version = distutils.version.LooseVersion(llvm_version)
- break
+ llvm_version_major = mo.group(1)
+ mo = llvm_version_minor_re.match(line)
+ if mo:
+ llvm_version_minor = mo.group(1)
+ if llvm_version_major is not None and llvm_version_minor is not None:
+ llvm_version = distutils.version.LooseVersion('%s.%s' % (llvm_version_major, llvm_version_minor))
+
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
return
@@ -99,7 +106,19 @@ def generate(env):
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
# LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter`
- if llvm_version >= distutils.version.LooseVersion('3.5'):
+ if llvm_version >= distutils.version.LooseVersion('3.6'):
+ env.Prepend(LIBS = [
+ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+ 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+ 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
+ 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+ 'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
+ 'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
+ 'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
+ 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+ 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'
+ ])
+ elif llvm_version >= distutils.version.LooseVersion('3.5'):
env.Prepend(LIBS = [
'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld',
'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen',