-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
57 lines (47 loc) · 1.68 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
# Copyright (c) Zhihao Liang. All rights reserved.
import os
from typing import List
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def get_requirements(filename: str="requirements.txt") -> List[str]:
assert os.path.exists(filename), f"{filename} not exists"
with open(filename, "r") as f:
content = f.read()
lines = content.split("\n")
requirements_list = list(
filter(lambda x: x != "" and not x.startswith("#"), lines))
return requirements_list
def get_version() -> str:
version_file = os.path.join("cumcubes", "version.py")
with open(version_file, "r", encoding="utf-8") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__version__"]
def get_extensions():
ext_modules = [
CUDAExtension(
name="cumcubes.src",
sources=[
"cumcubes/src/bindings.cpp",
"cumcubes/src/cumcubes.cpp",
"cumcubes/src/cumcubes_kernel.cu",
],
include_dirs=[os.path.join(ROOT_DIR, "cumcubes", "include")],
optional=False),
]
return ext_modules
setup(
name="cumcubes",
version=get_version(),
author="Zhihao Liang",
author_email="[email protected]",
description="CUDA implementation of marching cubes",
url="https://github.com/lzhnb/CuMCubes",
long_description=open("README.md").read(),
license="BSD-3",
ext_modules=get_extensions(),
setup_requires=["pybind11>=2.5.0"],
packages=["cumcubes", "cumcubes.src"],
cmdclass={"build_ext": BuildExtension},
zip_safe=False,
)