-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
86 lines (76 loc) · 2.37 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
"""A setuptools based setup module.
"""
import sys
from setuptools import find_packages
REQUIREMENTS = [
'numpy',
'matplotlib',
'opencv-python',
'scipy',
'torch'
]
SETUP_KWARGS = dict(
name='stereomatch',
version="1.0.0",
author='Otavio Gomes',
author_email='[email protected]',
description='Sample implementation of stereo matching algorithms',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5'
],
packages=find_packages(exclude=['*._test']),
install_requires=REQUIREMENTS,
entry_points={
'console_scripts': [
'stm-image=stereomatch.cli_image:main',
'stm-video=stereomatch.cli_video:main'
]
}
)
try:
from skbuild import setup
setup(**SETUP_KWARGS)
except ImportError:
print('Note: scikit-build is required for developers source builds.',
file=sys.stderr)
print('Please run:', file=sys.stderr)
print('', file=sys.stderr)
print(' python -m pip install scikit-build')
print('Using production build')
# pylint: disable=ungrouped-imports
from setuptools import setup
import torch
from torch.utils.cpp_extension import (
BuildExtension, CUDAExtension, include_paths)
if torch.version.cuda is None:
print("Your Torch version must support CUDA")
sys.exit(1)
SETUP_KWARGS.update(
dict(ext_modules=[
CUDAExtension('_cstereomatch', [
'src/cuda_utils.cpp',
'src/cuda_texture.cpp',
'src/cuda_texture_gpu.cu',
'src/cost.cpp',
'src/ssd.cu',
'src/birchfield_cost.cu',
'src/winners_take_all.cu',
'src/dynamic_programming.cu',
'src/disparity_reduce.cpp',
'src/semiglobal.cpp',
'src/semiglobal_gpu.cu',
'src/aggregation.cpp',
'src/_cstereomatch.cpp'
],
include_dirs=include_paths(
cuda=True) + ["include", "include/stereomatch"],
extra_compile_args=["-std=c++17"]
)
],
cmdclass={'build_ext': BuildExtension}
))
setup(**SETUP_KWARGS)