Given a header-only library like this:
└── foo
├── bar.hpp
└── foo.hpp
How can I package this using Buckaroo?
Join Stack Overflow to learn, share knowledge, and build your career.
The Buckaroo Wiki Page mentions the process:
First, run buckaroo init
to generate a .buckconfig
and buckaroo_macros.bzl
.
Then you will need to edit two files:
BUCK
- it describes the build
buckaroo.toml
- it describes your external dependencies
BUCK:
The following BUCK
file packages your headers so that every file can be included via #include <foo/*.hpp>
:
cxx_library(
name = 'foo',
header_namespace = '',
exported_headers = glob(['foo/*.hpp']),
visibility = ['PUBLIC'],
)
This is equivalent with:
cxx_library(
name = 'foo',
header_namespace = '',
exported_headers = {
'foo/foo.hpp': 'foo/foo.hpp',
'foo/bar.hpp': 'foo/bar.hpp',
},
visibility = ['PUBLIC'],
)
This map describes how the path defined in #include <a/b/c.h>
maps to the actual files in the file-system. As the include-path is identical to your file-system layout, keys and values are identical.
buckaroo.toml
To make the installation of your package convenient for consumers, it is recommended to explicitly list the public packages that should be exported by default in the targets section in buckaroo.toml
targets = [ "//:foo" ]
If you have external dependencies you may want to install them via
buckaroo add URL@VERSION
and connect the dependencies in your BUCK
file:
load('//:buckaroo_macros.bzl', 'buckaroo_deps')
cxx_library(
name = 'foo',
// ...
deps = buckaroo_deps(),
visibility = ['PUBLIC'],
)