forked from pmneila/PyMCubes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
93 lines (74 loc) · 2.42 KB
/
setup.py
File metadata and controls
93 lines (74 loc) · 2.42 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
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
# -*- encoding: utf-8 -*-
import runpy
from setuptools import setup
from setuptools.extension import Extension
__version_str__ = runpy.run_path("mcubes/version.py")["__version_str__"]
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()
mcubes_module = Extension(
"mcubes._mcubes",
[
"mcubes/src/_mcubes.pyx",
"mcubes/src/pywrapper.cpp",
"mcubes/src/marchingcubes.cpp"
],
language="c++",
extra_compile_args=['-std=c++11', '-Wall'],
include_dirs=[numpy_include_dir],
depends=[
"mcubes/src/marchingcubes.h",
"mcubes/src/pyarray_symbol.h",
"mcubes/src/pyarraymodule.h",
"mcubes/src/pywrapper.h"
],
)
return cythonize([mcubes_module])
setup(
name="PyMCubes",
version=__version_str__,
description="Marching cubes for Python",
author="Pablo Márquez Neila",
author_email="pablo.marquez@artorg.unibe.ch",
url="https://github.com/pmneila/PyMCubes",
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=["mcubes"],
ext_modules=lazy_cythonize(extensions),
requires=['numpy', 'Cython', 'PyCollada'],
setup_requires=['numpy', 'Cython']
)