Don't reuse the command between c/c++

This commit is contained in:
Alexandru Ene
2020-06-19 00:14:29 +01:00
parent 9213717917
commit 38f4ed084d

View File

@@ -52,19 +52,19 @@ fn main() {
.arg(&example)); .arg(&example));
println!("======== C/C++ example `{}` ============", example); println!("======== C/C++ example `{}` ============", example);
let mut cmd = cc::Build::new()
.opt_level(0)
.cargo_metadata(false)
.target(env!("TARGET"))
.host(env!("TARGET"))
.include("crates/c-api/include")
.include("crates/c-api/wasm-c-api/include")
.define("WASM_API_EXTERN", Some("")) // static linkage, not dynamic
.warnings(false)
.get_compiler()
.to_command();
for extension in ["c", "cc"].iter() { for extension in ["c", "cc"].iter() {
let mut cmd = cc::Build::new()
.opt_level(0)
.cargo_metadata(false)
.target(env!("TARGET"))
.host(env!("TARGET"))
.include("crates/c-api/include")
.include("crates/c-api/wasm-c-api/include")
.define("WASM_API_EXTERN", Some("")) // static linkage, not dynamic
.warnings(false)
.get_compiler()
.to_command();
let file = if is_dir { let file = if is_dir {
format!("examples/{}/main.{}", example, extension) format!("examples/{}/main.{}", example, extension)
} else { } else {