-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
45 lines (39 loc) · 1.2 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
from setuptools import setup, Extension
from os import popen
cxxflags = popen('llvm-config --cxxflags').readline().split()
ldflags = popen('llvm-config --ldflags').readline().split()
libs = popen('llvm-config --libs all').readline().split()\
+ popen('llvm-config --system-libs').readline().split()
includeDirs = []
libraryDirs = []
defineMacros = []
extraCompileArgs = []
for f in cxxflags:
if f.startswith('-I'):
includeDirs.append(f[2:])
elif f.startswith('-D'):
defineMacros.append((f[2:], None))
else:
extraCompileArgs.append(f)
for f in ldflags:
if f.startswith('-LIBPATH:'):
libraryDirs.append(f[9:])
elif f.startswith('-L'):
libraryDirs.append(f[2:])
metadata = dict(
name='pubbon',
package={
'pubbon',
},
ext_modules=[
Extension(name='pubbon',
sources=['Pubbon/pubbon.cpp', 'Pubbon/translate.cpp', 'Pubbon/llvm_env.cpp'],
include_dirs=includeDirs,
library_dirs=libraryDirs,
define_macros=defineMacros,
extra_objects=libs,
extra_compile_args=extraCompileArgs)
],
license='BSD',
)
setup(**metadata)