Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sysroot flag not passed to C build #21

Merged
merged 2 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wasm3-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ cty = "0.2"

[build-dependencies]
cc = "1"
shlex = "0.1.1"

[build-dependencies.bindgen]
version = "0.54"
optional = true

[package.metadata.docs.rs]
all-features = true
all-features = true
23 changes: 19 additions & 4 deletions wasm3-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,39 @@ fn gen_bindings() {

fn main() {
gen_bindings();
// build

let mut cfg = cc::Build::new();

cfg.files(
fs::read_dir(WASM3_SOURCE)
.unwrap_or_else(|_| panic!("failed to read {} directory", WASM3_SOURCE))
.filter_map(Result::ok)
.map(|entry| entry.path())
.filter(|p| p.extension().and_then(OsStr::to_str) == Some("c")),
);
let cfg = cfg
.warnings(false)
.cpp(false)

cfg.cpp(false)
.define("d_m3LogOutput", Some("0"))
.warnings(false)
.extra_warnings(false)
.include(WASM3_SOURCE);

// Add any extra arguments from the environment to the CC command line.
if let Some(extra_clang_args) = std::env::var("BINDGEN_EXTRA_CLANG_ARGS").ok() {
// Try to parse it with shell quoting. If we fail, make it one single big argument.
if let Some(strings) = shlex::split(&extra_clang_args) {
strings.iter().for_each(|string| {
cfg.flag(string);
})
} else {
cfg.flag(&extra_clang_args);
};
}

if cfg!(feature = "wasi") {
cfg.define("d_m3HasWASI", None);
}

cfg.define(
"d_m3Use32BitSlots",
if cfg!(feature = "use-32bit-slots") {
Expand Down