This repository has been archived by the owner on Aug 15, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
77 lines (72 loc) · 2.94 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
from setuptools import setup, Extension
import subprocess
import sys
# Set up the build environment.
try:
llvm_home = os.environ['LLVM_HOME']
llvm_config = os.path.join(llvm_home, 'bin', 'llvm-config')
llvm_cflags = subprocess.check_output([llvm_config, '--cxxflags']).split()
llvm_ldflags = subprocess.check_output([llvm_config, '--ldflags']).split()
if sys.version_info.major >= 3:
llvm_cflags = [p.decode('utf-8') for p in llvm_cflags]
llvm_ldflags = [p.decode('utf-8') for p in llvm_ldflags]
setup(
name='sealang',
version='3.9.dev259750',
description='An extended set of Python bindings for libclang',
long_description=open('README.rst').read(),
url='http://github.com/pybee/sealang',
license='License :: OSI Approved :: University of Illinois/NCSA Open Source License',
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: University of Illinois/NCSA Open Source License',
'Programming Language :: Python',
'Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Compilers',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
keywords=['llvm', 'clang', 'libclang'],
author='LLVM team and Russell Keith-Magee',
author_email='[email protected]',
packages=[
'clang',
'sealang'
],
ext_modules=[
Extension(
'sealang',
sources=['sealang/sealang.cpp'],
libraries=[
'clangAST', 'clangLex', 'clangBasic', 'LLVMSupport',
'm', 'z', 'pthread', 'curses'
],
extra_compile_args=llvm_cflags,
extra_link_args=llvm_ldflags,
),
],
# if nose.collector is used, many plugins will not be available
# see: https://nose.readthedocs.io/en/latest/setuptools_integration.html
test_suite='nose.collector',
tests_require=['nose']
)
except KeyError:
print("Unable to set up build environment. Have you installed LLVM and set LLVM_HOME?")
print('')
if platform.system() == 'Darwin':
print("Using homebrew:")
print(" brew install llvm --with-clang --with-asan")
print(" export LLVM_HOME=/usr/local/opt/llvm")
print(" export DYLD_LIBRARY_PATH=$LLVM_HOME/lib")
elif platform.dist()[0] == 'Ubuntu':
print(" sudo apt-get install libclang-3.6 clang-3.6 -y")
print(" export LLVM_HOME=/usr/lib/llvm-3.6")
print(" export LD_LIBRARY_PATH=$LLVM_HOME/lib")
print('')