forked from sybrenstuvel/Python-RVO2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
59 lines (50 loc) · 1.88 KB
/
setup.py
File metadata and controls
59 lines (50 loc) · 1.88 KB
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
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from Cython.Build import cythonize
from os import name as os_name
if os_name == 'nt':
#windows requires static links for exported symbols
ext_list = ['src/*.pyx', 'src/rvo2.cpp', 'src/RVOSimulator.cpp', 'src/KdTree.cpp', 'src/Obstacle.cpp', 'src/Agent.cpp']
else:
#unix is smarter
ext_list = ['src/*.pyx']
class BuildRvo2Ext(_build_ext):
"""Builds RVO2 before our module."""
def run(self):
# Build RVO2
import os
import os.path
import subprocess
build_dir = os.path.abspath('build/RVO2')
if not os.path.exists(build_dir):
os.makedirs(build_dir)
subprocess.check_call(['cmake', '../..'],
cwd=build_dir)
subprocess.check_call(['cmake', '--build', '.', '--config', 'Release'], cwd=build_dir)
_build_ext.run(self)
extensions = [
Extension('rvo2', ext_list,
include_dirs=['src'],
libraries=['RVO'],
library_dirs=['build/RVO2/src', 'build/RVO2/src/Release'],
extra_compile_args=[]),
]
setup(
name="pyrvo2",
ext_modules=cythonize(extensions),
cmdclass={'build_ext': BuildRvo2Ext},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Information Technology',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Cython',
'Topic :: Games/Entertainment :: Simulation',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)