mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-16 17:18:57 +00:00
Use gcc instead of cc, fix wasmer/lib/c-api in wasmer_base_dir string
This commit is contained in:
@@ -67,7 +67,11 @@ impl Config {
|
||||
let wasmer_base_dir = env!("CARGO_MANIFEST_DIR");
|
||||
let mut path2 = wasmer_base_dir.split("wasmer").collect::<Vec<_>>();
|
||||
path2.pop();
|
||||
let wasmer_base_dir = path2.join("wasmer");
|
||||
let mut wasmer_base_dir = path2.join("wasmer");
|
||||
|
||||
if wasmer_base_dir.contains("wasmer/lib/c-api") {
|
||||
wasmer_base_dir = wasmer_base_dir.split("wasmer/lib/c-api").next().unwrap().to_string();
|
||||
}
|
||||
|
||||
if config.wasmer_dir.is_empty() {
|
||||
println!("manifest dir = {manifest_dir}, wasmer root dir = {wasmer_base_dir}");
|
||||
@@ -203,7 +207,13 @@ fn test_run() {
|
||||
}
|
||||
} else {
|
||||
for test in TESTS.iter() {
|
||||
let mut command = std::process::Command::new("cc");
|
||||
|
||||
let compiler_cmd = match std::process::Command::new("cc").output() {
|
||||
Ok(_) => "cc",
|
||||
Err(_) => "gcc",
|
||||
};
|
||||
|
||||
let mut command = std::process::Command::new(compiler_cmd);
|
||||
|
||||
if !config.cflags.is_empty() {
|
||||
command.arg(config.cflags.clone());
|
||||
|
||||
@@ -37,7 +37,11 @@ impl Config {
|
||||
let wasmer_base_dir = env!("CARGO_MANIFEST_DIR");
|
||||
let mut path2 = wasmer_base_dir.split("wasmer").collect::<Vec<_>>();
|
||||
path2.pop();
|
||||
let wasmer_base_dir = path2.join("wasmer");
|
||||
let mut wasmer_base_dir = path2.join("wasmer");
|
||||
|
||||
if wasmer_base_dir.contains("wasmer/lib/c-api") {
|
||||
wasmer_base_dir = wasmer_base_dir.split("wasmer/lib/c-api").next().unwrap().to_string();
|
||||
}
|
||||
|
||||
if config.wasmer_dir.is_empty() {
|
||||
println!("manifest dir = {manifest_dir}, wasmer root dir = {wasmer_base_dir}");
|
||||
@@ -214,7 +218,12 @@ fn test_ok() {
|
||||
}
|
||||
} else {
|
||||
for test in CAPI_BASE_TESTS.iter() {
|
||||
let mut command = std::process::Command::new("cc");
|
||||
|
||||
let compiler_cmd = match std::process::Command::new("cc").output() {
|
||||
Ok(_) => "cc",
|
||||
Err(_) => "gcc",
|
||||
};
|
||||
let mut command = std::process::Command::new(compiler_cmd);
|
||||
|
||||
if !config.cflags.is_empty() {
|
||||
command.arg(config.cflags.clone());
|
||||
|
||||
@@ -480,9 +480,14 @@ impl CreateExe {
|
||||
include_dir.pop();
|
||||
include_dir.push("include");
|
||||
|
||||
let compiler_cmd = match std::process::Command::new("cc").output() {
|
||||
Ok(_) => "cc",
|
||||
Err(_) => "gcc",
|
||||
};
|
||||
|
||||
let mut cmd = Command::new(zig_binary_path);
|
||||
let mut cmd_mut: &mut Command = cmd
|
||||
.arg("cc")
|
||||
.arg(compiler_cmd)
|
||||
.arg("-w")
|
||||
.arg("-fgnu-inline-asm")
|
||||
.arg("-fsanitize=undefined")
|
||||
@@ -549,7 +554,13 @@ impl CreateExe {
|
||||
|
||||
/* Compile main function */
|
||||
let compilation = {
|
||||
Command::new("cc")
|
||||
|
||||
let compiler_cmd = match Command::new("cc").output() {
|
||||
Ok(_) => "cc",
|
||||
Err(_) => "gcc",
|
||||
};
|
||||
|
||||
Command::new(compiler_cmd)
|
||||
.arg("-c")
|
||||
.arg(&c_src_path)
|
||||
.arg(if linkcode.optimization_flag.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user