freecad: new package w/ dependencies/updates (#37557)

* freecad: new package w/ dependencies/updates

* review

* symbols/debug variants only when autotools
This commit is contained in:
Andrew W Elble 2023-05-13 22:14:50 -04:00 committed by GitHub
parent 811cd5e7ef
commit 6e07bf149d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 152 additions and 6 deletions

View File

@ -7,17 +7,24 @@
from spack.pkg.builtin.boost import Boost
class Coin3d(AutotoolsPackage):
class Coin3d(AutotoolsPackage, CMakePackage):
"""Coin is an OpenGL-based, 3D graphics library that has its roots in the
Open Inventor 2.1 API, which Coin still is compatible with."""
homepage = "https://github.com/coin3d/coin"
url = "https://github.com/coin3d/coin/archive/Coin-4.0.0.tar.gz"
url = "https://github.com/coin3d/coin/releases/download/Coin-4.0.0/coin-4.0.0-src.tar.gz"
version("4.0.0", sha256="e4f4bd57804b8ed0e017424ad2e45c112912a928b83f86c89963df9015251476")
version("3.1.0", sha256="70dd5ef39406e1d9e05eeadd54a5b51884a143e127530876a97744ca54173dc3")
version("3.0.0", sha256="d5c2eb0ecaa5c83d93daf0e9e275e58a6a8dfadc74c873d51b0c939011f81bfa")
version("2.0.0", sha256="6d26435aa962d085b7accd306a0b478069a7de1bc5ca24e22344971852dd097c")
build_system(
conditional("cmake", when="@4.0.0:"),
conditional("autotools", when="@:3.1.0"),
default="cmake",
)
depends_on("boost@1.45.0:", type="build")
# TODO: replace this with an explicit list of components of Boost,
@ -40,9 +47,31 @@ class Coin3d(AutotoolsPackage):
variant("framework", default=False, description="Do 'UNIX-style' installation on Mac OS X")
variant("shared", default=True, description="Build shared library (off: build static library)")
variant("debug", default=False, description="Make debug build")
variant("symbols", default=False, description="Enable debug symbols")
variant("debug", default=False, description="Make debug build", when="build_system=autotools")
variant(
"symbols", default=False, description="Enable debug symbols", when="build_system=autotools"
)
def url_for_version(self, version):
if version >= Version("4.0.0"):
url = "https://github.com/coin3d/coin/releases/download/Coin-{0}/coin-{0}-src.tar.gz"
else:
url = "https://github.com/coin3d/coin/archive/Coin-{0}.tar.gz"
return url.format(version.dotted)
class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder):
def cmake_args(self):
args = [
self.define_from_variant("COIN_BUILD_DOCUMENTATION_MAN", "man"),
self.define_from_variant("COIN_BUILD_DOCUMENTATION_CHM", "html"),
self.define_from_variant("COIN_BUILD_MAC_FRAMEWORK", "framework"),
self.define_from_variant("COIN_BUILD_SHARED_LIBS", "shared"),
]
return args
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
def configure_args(self):
args = []
args += self.enable_or_disable("framework")

View File

@ -21,6 +21,7 @@ class Flann(CMakePackage):
homepage = "https://github.com/mariusmuja/flann"
url = "https://github.com/mariusmuja/flann/archive/1.9.1.tar.gz"
version("1.9.2", sha256="e26829bb0017f317d9cc45ab83ddcb8b16d75ada1ae07157006c1e7d601c8824")
version("1.9.1", sha256="b23b5f4e71139faa3bcb39e6bbcc76967fbaf308c4ee9d4f5bfbeceaa76cc5d3")
version("1.8.5", sha256="59a9925dac0705b281496ae52b5dfd79d6b69316d37015e3d3b38c859bac4f2f")
version("1.8.4", sha256="ed5843113150b3d6bc4c325fecb51337838a9fc09ad64bdb6aea79d6e610ee13")
@ -61,6 +62,7 @@ def url_for_version(self, version):
depends_on("cuda", when="+cuda")
depends_on("mpi", when="+mpi")
depends_on("hdf5", when="+hdf5")
depends_on("lz4", when="@1.9.2:")
# HDF5_IS_PARALLEL actually comes from hdf5+mpi
# https://github.com/mariusmuja/flann/blob/06a49513138009d19a1f4e0ace67fbff13270c69/CMakeLists.txt#L108-L112
depends_on(
@ -77,7 +79,7 @@ def url_for_version(self, version):
depends_on("googletest", type="test")
# See: https://github.com/mariusmuja/flann/issues/369
patch("linux-gcc-cmakev3.11-plus.patch", when="%gcc^cmake@3.11:")
patch("linux-gcc-cmakev3.11-plus.patch", when="@:1.9.1%gcc^cmake@3.11:")
def patch(self):
# Fix up the python setup.py call inside the install(CODE

View File

@ -0,0 +1,59 @@
# 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)
from spack.package import *
class Freecad(CMakePackage):
"""FreeCAD is an open-source parametric 3D modeler made primarily
to design real-life objects of any size. Parametric modeling
allows you to easily modify your design by going back into your
model history to change its parameters."""
homepage = "https://www.freecad.org/"
url = "https://github.com/FreeCAD/FreeCAD/archive/refs/tags/0.20.2.tar.gz"
maintainers("aweits")
version("0.20.2", sha256="46922f3a477e742e1a89cd5346692d63aebb2b67af887b3e463e094a4ae055da")
depends_on("opencascade")
depends_on("xerces-c")
depends_on("vtk")
depends_on("salome-med")
depends_on(
"boost+python+filesystem+date_time+graph+iostreams+program_options+regex+serialization+system+thread" # noqa: E501
)
depends_on("qt@5:")
depends_on("swig", type="build")
depends_on("netgen")
depends_on("pcl")
depends_on("coin3d")
depends_on("python")
depends_on("gmsh+opencascade")
depends_on("py-pyside2@1.2.4:", type=("build", "run"))
depends_on("py-matplotlib@3.0.2:", type=("build", "run"))
depends_on("py-six@1.12.0:", type=("build", "run"))
depends_on("py-markdown@3.2.2:", type=("build", "run"))
depends_on("py-pivy", type=("build", "run"))
depends_on("py-pybind11", type="build")
def patch(self):
filter_file(
"# include <Standard_TooManyUsers.hxx>", "", "src/Mod/Part/App/OCCError.h", string=True
)
filter_file('putenv("PYTHONPATH=");', "", "src/Main/MainGui.cpp", string=True)
filter_file('_putenv("PYTHONPATH=");', "", "src/Main/MainGui.cpp", string=True)
def cmake_args(self):
args = []
# requires qt5 + webkit, which requires python2
args.append("-DBUILD_WEB=OFF")
args.append("-DFREECAD_USE_PYBIND11:BOOL=ON")
args.append("-DFREECAD_USE_PCL:BOOL=ON")
# TODO:
# args.append("-DBUILD_FEM_NETGEN:BOOL=ON")
# args.append("-DNETGEN_INCLUDEDIR={}".format(self.spec["netgen"].prefix.include))
return args

View File

@ -43,6 +43,16 @@ class Med(CMakePackage):
# fix problem where CMake "could not find TARGET hdf5"
patch("med-4.1.0-hdf5-target.patch", when="@4.0.0:4.1.99")
def patch(self):
# resembles FindSalomeHDF5.patch as in salome-configuration
# see https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.html
filter_file(
"GET_PROPERTY(_lib_lst TARGET hdf5-shared PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)", # noqa: E501
"#GET_PROPERTY(_lib_lst TARGET hdf5-shared PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)", # noqa: E501
"config/cmake_files/FindMedfileHDF5.cmake",
string=True,
)
def cmake_args(self):
spec = self.spec

View File

@ -0,0 +1,29 @@
# 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)
from spack.package import *
class PyPivy(PythonPackage):
"""Python bindings to coin3d"""
homepage = "https://github.com/coin3d/pivy"
url = "https://github.com/coin3d/pivy/archive/refs/tags/0.6.8.tar.gz"
version("0.6.8", sha256="c443dd7dd724b0bfa06427478b9d24d31e0c3b5138ac5741a2917a443b28f346")
depends_on("coin3d")
depends_on("py-setuptools", type="build")
depends_on("cmake@3.18:", type="build")
depends_on("swig", type="build")
def patch(self):
# https://github.com/coin3d/pivy/issues/93
filter_file(
"project(pivy_cmake_setup NONE)",
"project(pivy_cmake_setup)",
"distutils_cmake/CMakeLists.txt",
string=True,
)

View File

@ -34,7 +34,9 @@ class PyPyside2(PythonPackage):
depends_on("python@2.7.0:2.7,3.5.0:3.5,3.6.1:3.8", when="@:5.14", type=("build", "run"))
depends_on("cmake@3.1:", type="build")
depends_on("llvm@6:", type="build")
# libclang versioning from sources/shiboken2/doc/gettingstarted.rst
depends_on("llvm@6", type="build", when="@5.12:5.13")
depends_on("llvm@10", type="build", when="@5.15")
depends_on("py-setuptools", type="build")
depends_on("py-packaging", type="build")
depends_on("py-wheel", type="build")
@ -51,8 +53,13 @@ def install_options(self, spec, prefix):
args = [
"--parallel={0}".format(make_jobs),
"--ignore-git",
# if you want to debug build problems, uncomment this
# "--verbose-build",
"--qmake={0}".format(spec["qt"].prefix.bin.qmake),
]
if spec.satisfies("^python@3.10:"):
args.append("--limited-api=yes")
if self.run_tests:
args.append("--build-tests")
return args

View File

@ -47,6 +47,16 @@ def check(self):
with working_dir(self.build_directory):
make("test", parallel=False)
def patch(self):
# resembles FindSalomeHDF5.patch as in salome-configuration
# see https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.html
filter_file(
"GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)", # noqa: E501
"#GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)", # noqa: E501
"config/cmake_files/FindMedfileHDF5.cmake",
string=True,
)
def setup_dependent_build_environment(self, env, dependent_spec):
env.set("HDF5_ROOT_DIR", self.spec["hdf5"].prefix)