open3d: add new package (#27577)

This commit is contained in:
Adam J. Stewart 2021-12-15 10:34:22 -06:00 committed by GitHub
parent 116e1bb6cb
commit 0cf3176462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 190 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# Copyright 2013-2021 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)
from spack import *
class Imgui(Package):
"""Dear ImGui is a bloat-free graphical user interface library for C++.
It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline
enabled application. It is fast, portable, renderer agnostic and self-contained
(no external dependencies)."""
homepage = "https://github.com/ocornut/imgui"
url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.85.tar.gz"
version('1.85', sha256='7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77')
def install(self, spec, prefix):
# No specific build process is required.
# You can add the .cpp files to your existing project.
install_tree('.', prefix)

View File

@ -0,0 +1,19 @@
# Copyright 2013-2021 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)
from spack import *
class Liblzf(AutotoolsPackage):
"""LibLZF is a very small data compression library.
It consists of only two .c and two .h files and is very easy to incorporate into
your own programs. The compression algorithm is very, very fast, yet still written
in portable C."""
homepage = "http://oldhome.schmorp.de/marc/liblzf.html"
url = "http://dist.schmorp.de/liblzf/liblzf-3.6.tar.gz"
version('3.6', sha256='9c5de01f7b9ccae40c3f619d26a7abec9986c06c36d260c179cedd04b89fb46a')

View File

@ -0,0 +1,113 @@
# Copyright 2013-2021 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 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', 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')
# depends_on('eigen')
# depends_on('flann')
# depends_on('fmt')
# 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')
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'),
# 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')

View File

@ -0,0 +1,17 @@
# Copyright 2013-2021 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)
from spack import *
class Tinygltf(CMakePackage):
"""Header only C++11 tiny glTF 2.0 library."""
homepage = "https://github.com/syoyo/tinygltf"
url = "https://github.com/syoyo/tinygltf/archive/refs/tags/v2.5.0.tar.gz"
version('2.5.0', sha256='5d85bd556b60b1b69527189293cfa4902957d67fabb8582b6532f23a5ef27ec1')
depends_on('cmake@3.6:', type='build')

View File

@ -0,0 +1,17 @@
# Copyright 2013-2021 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)
from spack import *
class Tinyobjloader(CMakePackage):
"""Tiny but powerful single file wavefront obj loader."""
homepage = "https://github.com/tinyobjloader/tinyobjloader"
url = "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.6.tar.gz"
version('1.0.6', sha256='19ee82cd201761954dd833de551edb570e33b320d6027e0d91455faf7cd4c341')
depends_on('cmake@2.8.11:', type='build')