-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
82 lines (71 loc) · 2.98 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
import os
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
# Package meta-data.
NAME = 'gimpact'
DESCRIPTION = 'An unofficial python extension for the GImpact collision library.'
URL = 'https://github.com/StephenNneji'
AUTHOR = 'Stephen Nneji'
EMAIL = '[email protected]'
VERSION = '1.0.1'
path=os.path.abspath(os.path.dirname(__file__))
try:
with open(os.path.join(path, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
except FileNotFoundError:
long_description = DESCRIPTION
class build_ext(build_ext):
def build_extensions(self):
import numpy
try:
from Cython.Build import cythonize
BUILD_CYTHON = True
except ImportError:
BUILD_CYTHON = False
source = 'gimpact.pyx' if BUILD_CYTHON else 'gimpact.cpp'
modules = Extension(
name='gimpact',
sources=[source, 'GIMPACT/src/gimpact.cpp', 'GIMPACT/src/gim_contact.cpp', 'GIMPACT/src/gim_math.cpp',
'GIMPACT/src/gim_boxpruning.cpp', 'GIMPACT/src/gim_memory.cpp','GIMPACT/src/gim_tri_tri_overlap.cpp',
'GIMPACT/src/gim_trimesh.cpp','GIMPACT/src/gim_trimesh_capsule_collision.cpp', 'GIMPACT/src/gim_trimesh_ray_collision.cpp',
'GIMPACT/src/gim_trimesh_sphere_collision.cpp', 'GIMPACT/src/gim_trimesh_trimesh_collision.cpp'],
language='c++',
include_dirs=['GIMPACT/include', numpy.get_include()],
)
self.distribution.ext_modules[:] = cythonize([modules]) if BUILD_CYTHON else [modules]
self.swig_opts = None
super().finalize_options()
super().build_extensions()
setup(name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=long_description,
long_description_content_type="text/markdown",
url=URL,
author=AUTHOR,
author_email=EMAIL,
license='BSD',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Topic :: Games/Entertainment :: Simulation',
'Topic :: Scientific/Engineering :: Physics',
'License :: OSI Approved :: BSD License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Cython'
],
keywords='GImpact, Trimesh, Collision detection, Cython',
cmdclass={"build_ext": build_ext},
ext_modules=[Extension("", [])],
test_suite='tests'
)