-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
96 lines (81 loc) · 2.31 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from distutils.core import setup, Extension
from os.path import join, dirname, abspath
current_dir = dirname(abspath(__file__))
default_lib_dir = abspath(join(current_dir, 'build', 'lib'))
compile_args = [
'-std=c++11',
'-Wwrite-strings',
'-Wsign-compare',
'-fPIC',
'-pedantic',
'-Wall',
'-Wextra'
]
link_args = ['-fPIC']
def mend(ex):
for attr in ['library_dirs', 'include_dirs', 'sources']:
value = getattr(ex, attr)
if isinstance(value, list):
value = [join(current_dir, val) for val in value]
setattr(ex, attr, value)
return ex
def RelativeExtension(*args, **kwargs):
return mend(Extension(*args, **kwargs))
jupiter = RelativeExtension(
'jupiter',
include_dirs=[
'lib/jupiter/src/lib',
'lib/asteroid'
],
libraries=['jupiter', 'glog'],
library_dirs=[default_lib_dir, 'lib/jupiter/lib', 'lib/jupiter/build/lib'],
sources=['src/jupiter.cpp', 'lib/jupiter/src/lib/libjupiter.cpp'],
extra_compile_args=compile_args,
extra_link_args=link_args
)
pluto = RelativeExtension(
'pluto',
include_dirs=[
'lib/pluto/src/lib',
'lib/asteroid'
],
libraries=['pluto'],
library_dirs=[default_lib_dir, 'lib/pluto/lib', 'lib/pluto/build/lib'],
sources=['src/pluto.cpp', 'lib/pluto/src/lib/libpluto.cpp'],
extra_compile_args=compile_args,
extra_link_args=link_args
)
saturn = RelativeExtension(
'saturn',
include_dirs=['lib/libsaturn/include'],
libraries=['saturn'],
library_dirs=[default_lib_dir, 'lib/libsaturn/lib'],
sources=['src/saturn.cpp', 'src/pydevice.cpp'],
extra_compile_args=compile_args,
extra_link_args=link_args
)
asteroid = RelativeExtension(
'asteroid',
include_dirs=['lib/asteroid'],
sources=['src/asteroid.cpp'],
extra_compile_args=compile_args,
extra_link_args=link_args,
language='c++'
)
settings = {
'name': 'galaxpy',
'version': '0.1',
'license': 'GPL',
'description': 'A Python API to the Galaxy DCPU-16 toolchain',
'maintainer': 'David Beckley',
'maintainer_email': '[email protected]',
'url': 'http://www.github.com/galaxy-team/galaxpy',
'ext_package': 'galaxpy',
'ext_modules': [
jupiter,
saturn,
asteroid,
pluto
]
}
setup(**settings)