set LLVMPY_DYNLINK=1, if you want to link _core.so dynamically to libLLVM.so

This commit is contained in:
Ilan Schnell 2012-08-19 00:42:03 -05:00
commit dd59821ac5

View file

@ -37,6 +37,8 @@ from distutils.core import setup, Extension
LLVM_PY_VERSION = '0.8.2' LLVM_PY_VERSION = '0.8.2'
llvm_config = os.environ.get('LLVM_CONFIG_PATH', 'llvm-config') llvm_config = os.environ.get('LLVM_CONFIG_PATH', 'llvm-config')
# set LLVMPY_DYNLINK=1, if you want to link _core.so dynamically to libLLVM.so
dynlink = int(os.environ.get('LLVMPY_DYNLINK', 0))
def run_llvm_config(args): def run_llvm_config(args):
cmd = llvm_config + ' ' + ' '.join(args) cmd = llvm_config + ' ' + ' '.join(args)
@ -86,27 +88,30 @@ print('LLVM version = %d.%d' % llvm_version)
auto_intrinsic_gen(incdir) auto_intrinsic_gen(incdir)
if llvm_version <= (3, 1): # select between PTX & NVPTX if dynlink:
print('Using PTX') libs_core = ['LLVM-%d.%d' % llvm_version]
ptx_components = ['ptx', objs_core = []
'ptxasmprinter',
'ptxcodegen',
'ptxdesc',
'ptxinfo']
else: else:
print('Using NVPTX') if llvm_version <= (3, 1): # select between PTX & NVPTX
ptx_components = ['nvptx', print('Using PTX')
'nvptxasmprinter', ptx_components = ['ptx',
'nvptxcodegen', 'ptxasmprinter',
'nvptxdesc', 'ptxcodegen',
'nvptxinfo'] 'ptxdesc',
'ptxinfo']
libs_core, objs_core = get_libs_and_objs( else:
['core', 'analysis', 'scalaropts', 'executionengine', print('Using NVPTX')
'jit', 'native', 'interpreter', 'bitreader', 'bitwriter', ptx_components = ['nvptx',
'instrumentation', 'ipa', 'ipo', 'transformutils', 'nvptxasmprinter',
'asmparser', 'linker', 'support', 'vectorize'] 'nvptxcodegen',
+ ptx_components) 'nvptxdesc',
'nvptxinfo']
libs_core, objs_core = get_libs_and_objs(
['core', 'analysis', 'scalaropts', 'executionengine',
'jit', 'native', 'interpreter', 'bitreader', 'bitwriter',
'instrumentation', 'ipa', 'ipo', 'transformutils',
'asmparser', 'linker', 'support', 'vectorize']
+ ptx_components)
std_libs = ['pthread', 'm', 'stdc++', 'dl'] std_libs = ['pthread', 'm', 'stdc++', 'dl']
extra_link_args = ["-fPIC"] extra_link_args = ["-fPIC"]