mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 20:58:28 +00:00
Ignore presence of zig if --use-system-linker is specified
This commit is contained in:
@@ -72,6 +72,10 @@ pub struct CreateExe {
|
|||||||
// Cross-compilation options with `zig`
|
// Cross-compilation options with `zig`
|
||||||
#[derive(Debug, Clone, Default, Parser)]
|
#[derive(Debug, Clone, Default, Parser)]
|
||||||
pub(crate) struct CrossCompile {
|
pub(crate) struct CrossCompile {
|
||||||
|
/// Use the system linker instead of zig instead of zig for linking
|
||||||
|
#[clap(long)]
|
||||||
|
use_system_linker: bool,
|
||||||
|
|
||||||
/// Cross-compilation library path (path to libwasmer.a / wasmer.lib)
|
/// Cross-compilation library path (path to libwasmer.a / wasmer.lib)
|
||||||
#[clap(long = "library-path", requires = "target")]
|
#[clap(long = "library-path", requires = "target")]
|
||||||
library_path: Option<PathBuf>,
|
library_path: Option<PathBuf>,
|
||||||
@@ -130,11 +134,7 @@ impl CreateExe {
|
|||||||
/// Runs logic for the `compile` subcommand
|
/// Runs logic for the `compile` subcommand
|
||||||
pub fn execute(&self) -> Result<()> {
|
pub fn execute(&self) -> Result<()> {
|
||||||
let target_triple = self.target_triple.clone().unwrap_or_else(Triple::host);
|
let target_triple = self.target_triple.clone().unwrap_or_else(Triple::host);
|
||||||
let mut cc = CrossCompile {
|
let mut cc = self.cross_compile.clone();
|
||||||
library_path: self.cross_compile.library_path.clone(),
|
|
||||||
zig_binary_path: self.cross_compile.zig_binary_path.clone(),
|
|
||||||
tarball: self.cross_compile.tarball.clone(),
|
|
||||||
};
|
|
||||||
let target = utils::target_triple_to_target(&target_triple, &self.cpu_features);
|
let target = utils::target_triple_to_target(&target_triple, &self.cpu_features);
|
||||||
|
|
||||||
let starting_cd = env::current_dir()?;
|
let starting_cd = env::current_dir()?;
|
||||||
@@ -689,7 +689,7 @@ fn link_exe_from_dir(
|
|||||||
|
|
||||||
object_paths.push(object_path);
|
object_paths.push(object_path);
|
||||||
|
|
||||||
link_objects_system_linker(
|
return link_objects_system_linker(
|
||||||
&library_path,
|
&library_path,
|
||||||
linker,
|
linker,
|
||||||
&optimization_flag,
|
&optimization_flag,
|
||||||
@@ -698,7 +698,7 @@ fn link_exe_from_dir(
|
|||||||
&additional_libraries,
|
&additional_libraries,
|
||||||
&output_path,
|
&output_path,
|
||||||
debug,
|
debug,
|
||||||
)?;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let zig_binary_path = cross_compilation
|
let zig_binary_path = cross_compilation
|
||||||
@@ -1028,14 +1028,18 @@ pub(super) mod utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let zig_binary_path = find_zig_binary(cross_subc.zig_binary_path.as_ref().and_then(|p| {
|
let zig_binary_path = if !cross_subc.use_system_linker {
|
||||||
if p.is_absolute() {
|
find_zig_binary(cross_subc.zig_binary_path.as_ref().and_then(|p| {
|
||||||
p.canonicalize().ok()
|
if p.is_absolute() {
|
||||||
} else {
|
p.canonicalize().ok()
|
||||||
starting_cd.join(p).canonicalize().ok()
|
} else {
|
||||||
}
|
starting_cd.join(p).canonicalize().ok()
|
||||||
}))
|
}
|
||||||
.ok();
|
}))
|
||||||
|
.ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let library = if let Some(v) = cross_subc.library_path.clone() {
|
let library = if let Some(v) = cross_subc.library_path.clone() {
|
||||||
Some(v.canonicalize().unwrap_or(v))
|
Some(v.canonicalize().unwrap_or(v))
|
||||||
|
|||||||
Reference in New Issue
Block a user