-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
82 lines (71 loc) · 2.15 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
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension
import numpy
# Get the numpy include directory.
numpy_include_dir = numpy.get_include()
# print(numpy_include_dir)
# Extensions
# pykdtree (kd tree)
# mcubes (marching cubes algorithm)
mcubes_module = Extension(
'core.models.utils.occnet_utils.utils.libmcubes.mcubes',
sources=[
'core/models/utils/occnet_utils/utils/libmcubes/mcubes.pyx',
'core/models/utils/occnet_utils/utils/libmcubes/pywrapper.cpp',
'core/models/utils/occnet_utils/utils/libmcubes/marchingcubes.cpp'
],
language='c++',
extra_compile_args=['-std=c++11'],
include_dirs=[numpy_include_dir]
)
# triangle hash (efficient mesh intersection)
triangle_hash_module = Extension(
'core.models.utils.occnet_utils.utils.libmesh.triangle_hash',
sources=[
'core/models/utils/occnet_utils/utils/libmesh/triangle_hash.pyx'
],
libraries=['m'] # Unix-like specific
)
# mise (efficient mesh extraction)
mise_module = Extension(
'core.models.utils.occnet_utils.utils.libmise.mise',
sources=[
'core/models/utils/occnet_utils/utils/libmise/mise.pyx'
],
)
# simplify (efficient mesh simplification)
simplify_mesh_module = Extension(
'core.models.utils.occnet_utils.utils.libsimplify.simplify_mesh',
sources=[
'core/models/utils/occnet_utils/utils/libsimplify/simplify_mesh.pyx'
]
)
# voxelization (efficient mesh voxelization)
voxelize_module = Extension(
'core.models.utils.occnet_utils.utils.libvoxelize.voxelize',
sources=[
'core/models/utils/occnet_utils/utils/libvoxelize/voxelize.pyx'
],
libraries=['m'] # Unix-like specific
)
# Gather all extension modules
ext_modules = [
# pykdtree,
mcubes_module,
triangle_hash_module,
mise_module,
simplify_mesh_module,
voxelize_module,
]
setup(
ext_modules=cythonize(ext_modules),
cmdclass={
'build_ext': BuildExtension
},
include_dirs=[numpy_include_dir],
)