-
Notifications
You must be signed in to change notification settings - Fork 105
/
setup.py
58 lines (51 loc) · 1.67 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
#!/usr/bin/env python3
import os
import glob
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
_ext_src_root = "./pvn3d/_ext-src"
_ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob(
"{}/src/*.cu".format(_ext_src_root)
)
_ext_headers = glob.glob("{}/include/*".format(_ext_src_root))
setup(
name='pvn3d',
ext_modules=[
CUDAExtension(
name='pointnet2_utils._ext',
sources=_ext_sources,
extra_compile_args={
"cxx": ["-O2", "-I{}".format("{}/include".format(_ext_src_root))],
"nvcc": [
"-O2", "-I{}".format("{}/include".format(_ext_src_root))
],
},
)
],
cmdclass={
'build_ext': BuildExtension
}
)
try:
src_pth = './build'
tg_pth = 'pvn3d/lib/pointnet2_utils/'
fd_lst = os.listdir(src_pth)
for fd in fd_lst:
if 'lib' in fd:
src_pth = os.path.join(src_pth, fd, 'pointnet2_utils')
f_nm = os.listdir(src_pth)[0]
src_pth = os.path.join(src_pth, f_nm)
tg_pth = os.path.join(tg_pth, f_nm)
os.system('cp {} {}'.format(src_pth, tg_pth))
print(
src_pth, '==>', tg_pth,
)
except:
print(
"\n****************************************************************\n",
"Failed to copy builded .so to ./pvn3d/lib/pointnet2_utils/.\n",
"Please manually copy the builded .so file (_ext.cpython*.so) in ./build"+\
" to ./pvn3d/lib/pointnet2_utils/.",
"\n****************************************************************\n"
)
# vim: ts=4 sw=4 sts=4 expandtab