-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsetup.py
69 lines (61 loc) · 1.77 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
import os
import re
import sys
from pathlib import Path
import cmake_build_extension
import setuptools
import sysconfig
import subprocess
lib_path = sysconfig.get_path("purelib")
assert os.path.exists(
f"{lib_path}/torch"
), "Could not find PyTorch; please make sure it is installed in your environment before installing radfoam."
cmake_options = []
if "CUDA_HOME" in os.environ:
cmake_options.append(f"-DCUDA_TOOLKIT_ROOT_DIR={os.environ['CUDA_HOME']}")
source_dir = Path(__file__).parent.absolute()
cmake = (source_dir / "CMakeLists.txt").read_text()
version = re.search(r"project\(\S+ VERSION (\S+)\)", cmake).group(1)
install_requirements = [
"cmake==3.29.2",
"cmake-format",
"cmake_build_extension",
"ConfigArgParse",
"einops",
"glfw==2.6.5",
"pycolmap",
"opencv-python",
"pillow",
"plyfile",
"pybind11[global]",
"pyyaml",
"scipy",
"tensorboard",
"tqdm",
]
setuptools.setup(
version=version,
install_requires=install_requirements,
ext_modules=[
cmake_build_extension.CMakeExtension(
name="RadFoamBindings",
install_prefix="radfoam",
cmake_depends_on=["pybind11"],
write_top_level_init=None,
source_dir=str(source_dir),
cmake_configure_options=[
f"-DPython3_ROOT_DIR={Path(sys.prefix)}",
"-DCALL_FROM_SETUP_PY:BOOL=ON",
"-DBUILD_SHARED_LIBS:BOOL=OFF",
"-DGPU_DEBUG:BOOL=OFF",
"-DEXAMPLE_WITH_PYBIND11:BOOL=ON",
f"-DTorch_DIR={lib_path}/torch/share/cmake/Torch",
"-DPIP_GLFW:BOOL=ON",
]
+ cmake_options,
),
],
cmdclass=dict(
build_ext=cmake_build_extension.BuildExtension,
),
)