2 unstable releases
0.2.0 | Jan 20, 2024 |
---|---|
0.1.0 | Jun 11, 2022 |
#8 in #pkg-config
15KB
433 lines
cc-args
tl;dr
bindgen::Builder::merge_cc_args(&self, &pkg_config::Library)
This crate exports CcArgs
and MergeCcArgs
.
CcArgs
It provides link_paths, include_paths, framework_paths, frameworks, libs, ld_args and defines.
MergeCcArgs
It provides the method merge_cc_args
that accept a CcArgs
implementation.
Features
- pkg_config implements
CcArgs
forpkg_config::Library
- cc implements
MergeCcArgs
forcc::Build
- bindgen implements
MergeCcArgs
forbindgen::Builder
Example
build.rs
use std::path::PathBuf;
use cc_args::{bindgen, pkg_config, MergeCcArgs};
fn main() {
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
println!("cargo:rerun-if-changed=wrapper.h");
bindgen::Builder::default()
.merge_cc_args(&pkg_config::probe_library("libzstd").unwrap())
.header("wrapper.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.unwrap()
.write_to_file(out_path.join("bindings.rs"))
.unwrap();
}
Dependencies
~0–1.3MB
~25K SLoC