Add Binder spackage (#38371)

* Add Binder spackage
* Format binder recipe
* Format binder recipe
This commit is contained in:
Kim Liegeois 2023-06-14 13:41:35 -06:00 committed by GitHub
parent 1afbf72037
commit 1485275d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,54 @@
# 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 Binder(CMakePackage):
"""
Binder is a tool for automatic generation of Python bindings
for C++11 projects using Pybind11 and Clang LibTooling libraries.
That is, Binder, takes a C++ project and compiles it into objects
and functions that are all usable within Python.
Binder is different from prior tools in that it handles special
features new in C++11.
"""
homepage = "https://github.com/RosettaCommons/binder"
git = "https://github.com/RosettaCommons/binder.git"
maintainers("lyskov", "kliegeois")
version("master", branch="master")
version("1.3.0", tag="v1.3.0")
version("1.2.0", tag="v1.2.0")
version("1.1.0", tag="v1.0.0")
version("1.0.0", tag="v1.0.0")
# Add dependencies
depends_on("llvm+clang+llvm_dylib@7.0:9")
def cmake_args(self):
spec = self.spec
llvm_dir = spec["llvm"].prefix
clang_dir = spec["llvm"].prefix
options = []
options.extend(
[
"-DLLVM_DIR:FILEPATH={0}".format(llvm_dir),
"-DClang_DIR:FILEPATH={0}".format(clang_dir),
"-DCMAKE_CXX_FLAGS=-Wl,--verbose",
"-DBINDER_ENABLE_TEST=OFF",
]
)
return options
def setup_dependent_package(self, module, dependent_spec):
llvm_dir = self.spec["llvm"].prefix
self.spec.clang_include_dirs = llvm_dir.include
self.spec.LibClang_include_dir = llvm_dir.lib.clang.join(
format(self.spec["llvm"].version)
).include