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
119
120
121
122
123
124
125
126
127
128
129
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
class Open3d(CMakePackage, CudaPackage):
"""Open3D: A Modern Library for 3D Data Processing."""
homepage = "http://www.open3d.org/"
url = "https://github.com/isl-org/Open3D/archive/refs/tags/v0.13.0.tar.gz"
git = "https://github.com/isl-org/Open3D.git"
version(
"0.13.0", tag="v0.13.0", commit="c3f9de224e13838a72da0e5565a7ba51038b0f11", submodules=True
)
variant("python", default=False, description="Build the Python module")
# http://www.open3d.org/docs/latest/compilation.html
depends_on("cmake@3.19:", type="build")
# https://github.com/isl-org/Open3D/issues/3762
# https://github.com/isl-org/Open3D/issues/4570
depends_on("llvm@7:+clang")
depends_on("eigen")
depends_on("flann")
# https://github.com/isl-org/Open3D/issues/4360
# https://github.com/isl-org/Open3D/pull/5303
depends_on("fmt@:7")
depends_on("glew")
depends_on("glfw")
# depends_on('imgui')
depends_on("jpeg")
# depends_on('liblzf')
depends_on("libpng")
depends_on("py-pybind11")
depends_on("qhull")
# depends_on('tinygltf')
# depends_on('tinyobjloader')
extends("python", when="+python", type=("build", "link", "run"))
depends_on("python@3.6:", when="+python", type=("build", "link", "run"))
depends_on("py-pip", when="+python", type="build")
depends_on("py-setuptools@40.8:", when="+python", type="build")
depends_on("py-wheel@0.36:", when="+python", type="build")
depends_on("py-numpy@1.18:", when="+python", type=("build", "run"))
depends_on("py-pytest", when="+python", type="test")
depends_on("cuda@10.1:", when="+cuda")
# C++14 compiler required
conflicts("%gcc@:4")
conflicts("%clang@:6")
# LLVM must be built with the C++ library
conflicts("^llvm libcxx=none")
def patch(self):
# Force Python libraries to be installed to self.prefix
filter_file(
"pip install",
"pip install --prefix " + self.prefix,
os.path.join("cpp", "pybind", "make_install_pip_package.cmake"),
)
def cmake_args(self):
args = [
self.define("BUILD_UNIT_TESTS", self.run_tests),
self.define_from_variant("BUILD_PYTHON_MODULE", "python"),
self.define_from_variant("BUILD_CUDA_MODULE", "cuda"),
# https://github.com/isl-org/Open3D/issues/4570
# self.define('BUILD_FILAMENT_FROM_SOURCE', 'ON'),
# Use Spack-installed dependencies instead of vendored dependencies
# Numerous issues with using externally installed dependencies:
# https://github.com/isl-org/Open3D/issues/4333
# https://github.com/isl-org/Open3D/issues/4360
self.define("USE_SYSTEM_EIGEN3", True),
self.define("USE_SYSTEM_FLANN", True),
self.define("USE_SYSTEM_FMT", True),
self.define("USE_SYSTEM_GLEW", True),
self.define("USE_SYSTEM_GLFW", True),
# self.define('USE_SYSTEM_IMGUI', True),
self.define("USE_SYSTEM_JPEG", True),
# self.define('USE_SYSTEM_LIBLZF', True),
self.define("USE_SYSTEM_PNG", True),
self.define("USE_SYSTEM_PYBIND11", True),
self.define("USE_SYSTEM_QHULL", True),
# self.define('USE_SYSTEM_TINYGLTF', True),
# self.define('USE_SYSTEM_TINYOBJLOADER', True),
]
if "+python" in self.spec:
args.append(self.define("PYTHON_EXECUTABLE", self.spec["python"].command.path))
return args
def check(self):
with working_dir(self.build_directory):
tests = Executable(os.path.join("bin", "tests"))
tests()
def install(self, spec, prefix):
with working_dir(self.build_directory):
make("install")
if "+python" in spec:
make("install-pip-package")
# Tests don't pass unless all optional features are compiled, including PyTorch
# @run_after('install')
# @on_package_attributes(run_tests=True)
# def unit_test(self):
# if '+python' in self.spec:
# pytest = which('pytest')
# pytest(os.path.join('python', 'test'))
@run_after("install")
@on_package_attributes(run_tests=True)
def test(self):
if "+python" in self.spec:
self.run_test(
self.spec["python"].command.path,
["-c", "import open3d"],
purpose="checking import of open3d",
work_dir="spack-test",
)
|