-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathsetup.py
82 lines (68 loc) · 2.26 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
# Copyright (c) Facebook, Inc. and its affiliates.
from os import path, listdir
import setuptools
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
here = path.abspath(path.dirname(__file__))
def find_sources(root_dir):
sources = []
for file in listdir(root_dir):
_, ext = path.splitext(file)
if ext in [".cpp", ".cu"]:
sources.append(path.join(root_dir, file))
return sources
def make_extension(name, package):
return CUDAExtension(
name="{}.{}._backend".format(package, name),
sources=find_sources(path.join("src", name)),
extra_compile_args={
"cxx": ["-O3"],
"nvcc": ["--expt-extended-lambda"],
},
include_dirs=[path.join(here, "include")],
)
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setuptools.setup(
# Meta-data
name="seamseg",
author="Lorenzo Porzi",
author_email="[email protected]",
description="Seamless Scene Segmentation for Pytorch",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/mapillary/seamseg",
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
# Versioning
use_scm_version={"root": ".", "relative_to": __file__, "write_to": "seamseg/_version.py"},
# Requirements
setup_requires=["setuptools_scm"],
python_requires=">=3, <4",
# Package description
packages=[
"seamseg",
"seamseg.algos",
"seamseg.config",
"seamseg.data",
"seamseg.models",
"seamseg.modules",
"seamseg.modules.heads",
"seamseg.utils",
"seamseg.utils.bbx",
"seamseg.utils.nms",
"seamseg.utils.parallel",
"seamseg.utils.roi_sampling",
],
ext_modules=[
make_extension("nms", "seamseg.utils"),
make_extension("bbx", "seamseg.utils"),
make_extension("roi_sampling", "seamseg.utils")
],
cmdclass={"build_ext": BuildExtension},
include_package_data=True,
)