opennurbs: multiple build systems (#44871)
This commit is contained in:
parent
9d0102ac89
commit
c24265fe7e
@ -4,10 +4,11 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
|
||||
from spack.build_systems import cmake, makefile
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class Opennurbs(Package):
|
||||
class Opennurbs(CMakePackage, MakefilePackage):
|
||||
"""OpenNURBS is an open-source NURBS-based geometric modeling library
|
||||
and toolset, with meshing and display / output functions.
|
||||
"""
|
||||
@ -20,34 +21,31 @@ class Opennurbs(Package):
|
||||
license("Zlib")
|
||||
|
||||
version("develop", branch="develop")
|
||||
|
||||
version(
|
||||
"percept",
|
||||
sha256="d12a8f14f0b27d286fb7a75ab3c4e300f77d1fbb028326d1c8d28e4641605538",
|
||||
url="https://github.com/PerceptTools/percept/raw/master/build-cmake/opennurbs-percept.tar.gz",
|
||||
)
|
||||
|
||||
build_system(
|
||||
conditional("cmake", when="@1:"), conditional("makefile", when="@:0"), default="cmake"
|
||||
)
|
||||
|
||||
variant("shared", default=True, description="Build shared libraries")
|
||||
|
||||
# CMake installation method
|
||||
def install(self, spec, prefix):
|
||||
cmake_args = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
|
||||
|
||||
cmake_args.extend(std_cmake_args)
|
||||
class CMakeBuilder(cmake.CMakeBuilder):
|
||||
def cmake_args(self):
|
||||
return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
|
||||
|
||||
with working_dir("spack-build", create=True):
|
||||
cmake("..", *cmake_args)
|
||||
make()
|
||||
make("install")
|
||||
|
||||
# Pre-cmake installation method
|
||||
@when("@percept")
|
||||
def install(self, spec, prefix):
|
||||
make(parallel=False)
|
||||
class MakefileBuilder(makefile.MakefileBuilder):
|
||||
|
||||
# Install manually
|
||||
def build(self, pkg, spec, prefix):
|
||||
make("RM=rm -f", "AR=ar cr", f"CC={spack_cc}", f"CCC={spack_cxx}", parallel=False)
|
||||
|
||||
def install(self, pkg, spec, prefix):
|
||||
mkdir(prefix.lib)
|
||||
mkdir(prefix.include)
|
||||
install("libopenNURBS.a", prefix.lib)
|
||||
install_tree("zlib", join_path(prefix.include, "zlib"))
|
||||
install("*.h", prefix.include)
|
||||
|
Loading…
Reference in New Issue
Block a user