forked from pmneila/PyMCubes
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsetup.py
88 lines (71 loc) · 2.4 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
# -*- encoding: utf-8 -*-
from setuptools import setup
from setuptools.extension import Extension
class lazy_cythonize(list):
"""
Lazy evaluate extension definition, to allow correct requirements install.
"""
def __init__(self, callback):
super(lazy_cythonize, self).__init__()
self._list, self.callback = None, callback
def c_list(self):
if self._list is None:
self._list = self.callback()
return self._list
def __iter__(self):
for e in self.c_list():
yield e
def __getitem__(self, ii):
return self.c_list()[ii]
def __len__(self):
return len(self.c_list())
def extensions():
from Cython.Build import cythonize
import numpy
numpy_include_dir = numpy.get_include()
marching_cubes_module = Extension(
"marching_cubes._mcubes",
[
"marching_cubes/src/_mcubes.pyx",
"marching_cubes/src/pywrapper.cpp",
"marching_cubes/src/marchingcubes.cpp"
],
language="c++",
extra_compile_args=['-std=c++11', '-Wall'],
include_dirs=[numpy_include_dir],
depends=[
"marching_cubes/src/marchingcubes.h",
"marching_cubes/src/pyarray_symbol.h",
"marching_cubes/src/pyarraymodule.h",
"marching_cubes/src/pywrapper.h"
],
)
return cythonize([marching_cubes_module])
setup(
name="PyMarchingCubes",
version="0.0.2",
description="Marching cubes for Python",
author="Justus Thies (PyMCubes: Pablo Márquez Neila)",
url="https://github.com/JustusThies/PyMarchingCubes",
license="BSD 3-clause",
long_description="""
Marching cubes for Python
""",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: C++",
"Programming Language :: Python",
"Topic :: Multimedia :: Graphics :: 3D Modeling",
"Topic :: Scientific/Engineering :: Image Recognition",
],
packages=["marching_cubes"],
ext_modules=lazy_cythonize(extensions),
requires=['numpy', 'Cython', 'PyCollada'],
setup_requires=['numpy', 'Cython']
)