forked from nerfstudio-project/gsplat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
118 lines (102 loc) · 3.81 KB
/
setup.py
File metadata and controls
118 lines (102 loc) · 3.81 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# SPDX-FileCopyrightText: Copyright 2023-2026 the Regents of the University of California, Nerfstudio Team and contributors. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import glob
import os
import os.path as osp
import pathlib
import platform
import sys
from setuptools import find_packages, setup
__version__ = None
exec(open("gsplat/version.py", "r").read())
URL = "https://github.com/nerfstudio-project/gsplat"
BUILD_NO_CUDA = os.getenv("BUILD_NO_CUDA", "0") == "1"
def get_ext():
from torch.utils.cpp_extension import BuildExtension
return BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=True)
def get_extensions():
from torch.utils.cpp_extension import CUDAExtension
# Use the same build parameters as the JIT build. However, directly
# importing the gsplat.cuda.build module would trigger a circular
# dependency where gsplat is imported before it is built. To avoid
# this, we sidestep the traditional Python import mechanism and construct
# the module directly from build.py.
import importlib.util
spec = importlib.util.spec_from_file_location(
"gsplat_cuda_build", os.path.join("gsplat", "cuda", "build.py")
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
params = module.get_build_parameters()
setup_dir = os.path.dirname(os.path.abspath(__file__))
sources = [os.path.relpath(s, setup_dir) for s in params.sources]
extension = CUDAExtension(
"gsplat.csrc",
sources=sources,
include_dirs=params.extra_include_paths,
extra_compile_args={
"cxx": params.extra_cflags,
"nvcc": params.extra_cuda_cflags,
},
extra_link_args=params.extra_ldflags,
)
return [extension]
setup(
name="gsplat",
version=__version__,
description=" Python package for differentiable rasterization of gaussians",
keywords="gaussian, splatting, cuda",
url=URL,
download_url=f"{URL}/archive/gsplat-{__version__}.tar.gz",
python_requires=">=3.7",
install_requires=[
"ninja",
"numpy",
"jaxtyping",
"rich>=12",
"torch",
"typing_extensions; python_version<'3.8'",
],
extras_require={
# lidar dependencies. Install them by `pip install gsplat[lidar]`
"lidar": [
"scipy",
],
# dev dependencies. Install them by `pip install gsplat[dev]`
"dev": [
"black[jupyter]==22.3.0",
"isort==5.10.1",
"pylint==2.13.4",
"pytest==7.1.3",
"pytest-env==0.8.1",
"pytest-xdist==2.5.0",
"typeguard>=2.13.3",
"pyyaml>=6.0.1",
"build",
"twine",
"cupy",
"nerfacc>=0.5.3",
"PLAS @ git+https://github.com/fraunhoferhhi/PLAS.git",
"imageio>=2.37.2",
"torchpq>=0.3.0.6",
],
},
ext_modules=get_extensions() if not BUILD_NO_CUDA else [],
cmdclass={"build_ext": get_ext()} if not BUILD_NO_CUDA else {},
packages=find_packages(),
# https://github.com/pypa/setuptools/issues/1461#issuecomment-954725244
include_package_data=True,
)