Switch to using a fake llvm-config program, so there's just one setup.py
This should help keep windows and other platforms in synch easier.
This commit is contained in:
parent
bc2c9a24ed
commit
397a81d5bd
3 changed files with 83 additions and 163 deletions
70
llvm-config-win32.py
Normal file
70
llvm-config-win32.py
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import sys, os
|
||||
|
||||
def find_path_of(filename):
|
||||
"""Finds the path from $PATH where the file exists, returns None if not found."""
|
||||
pathlist = os.getenv('PATH').split(os.pathsep)
|
||||
for path in pathlist:
|
||||
if os.path.exists(os.path.join(path, filename)):
|
||||
return os.path.abspath(path)
|
||||
return None
|
||||
|
||||
if sys.argv[1] == '--version':
|
||||
cmd = 'llvm-tblgen --version'
|
||||
# Hardcoded extraction, only tested on llvm 3.1
|
||||
result = os.popen(cmd).read().split('\n')[1].strip().split(' ')[2]
|
||||
print result
|
||||
elif sys.argv[1] == '--libs':
|
||||
# NOTE: instead of actually looking at the components requested,
|
||||
# we just spit out a bunch of libs
|
||||
for lib in """
|
||||
LLVMAnalysis
|
||||
LLVMAsmParser
|
||||
LLVMAsmPrinter
|
||||
LLVMBitReader
|
||||
LLVMBitWriter
|
||||
LLVMCodeGen
|
||||
LLVMCore
|
||||
LLVMExecutionEngine
|
||||
LLVMInstCombine
|
||||
LLVMInstrumentation
|
||||
LLVMInterpreter
|
||||
LLVMipa
|
||||
LLVMipo
|
||||
LLVMJIT
|
||||
LLVMLinker
|
||||
LLVMMC
|
||||
LLVMMCParser
|
||||
LLVMScalarOpts
|
||||
LLVMSelectionDAG
|
||||
LLVMSupport
|
||||
LLVMTarget
|
||||
LLVMTransformUtils
|
||||
LLVMVectorize
|
||||
LLVMX86AsmParser
|
||||
LLVMX86AsmPrinter
|
||||
LLVMX86CodeGen
|
||||
LLVMX86Desc
|
||||
LLVMX86Info
|
||||
LLVMX86Utils
|
||||
Advapi32
|
||||
Shell32
|
||||
""".split():
|
||||
print('-l%s' % lib)
|
||||
elif sys.argv[1] == '--includedir':
|
||||
llvmbin = find_path_of('llvm-tblgen.exe')
|
||||
if llvmbin is None:
|
||||
raise RuntimeError('Could not find LLVM')
|
||||
incdir = os.path.abspath(os.path.join(llvmbin, '../include'))
|
||||
if not os.path.exists(os.path.join(incdir, 'llvm/BasicBlock.h')):
|
||||
raise RuntimeError('Could not find LLVM include dir')
|
||||
print incdir
|
||||
elif sys.argv[1] == '--libdir':
|
||||
llvmbin = find_path_of('llvm-tblgen.exe')
|
||||
if llvmbin is None:
|
||||
raise RuntimeError('Could not find LLVM')
|
||||
libdir = os.path.abspath(os.path.join(llvmbin, '../lib'))
|
||||
if not os.path.exists(os.path.join(libdir, 'LLVMCore.lib')):
|
||||
raise RuntimeError('Could not find LLVM lib dir')
|
||||
print libdir
|
||||
else:
|
||||
raise RuntimeError('Unrecognized llvm-config command %s' % sys.argv[1])
|
||||
Loading…
Add table
Add a link
Reference in a new issue