windows create dylibs for gen tests

This commit is contained in:
Folkert de Vries 2022-08-02 15:38:05 +02:00
parent f601a56d52
commit fc369ddebb

View file

@ -1104,29 +1104,56 @@ fn link_windows(
_target: &Triple, _target: &Triple,
output_path: PathBuf, output_path: PathBuf,
input_paths: &[&str], input_paths: &[&str],
_link_type: LinkType, link_type: LinkType,
) -> io::Result<(Child, PathBuf)> { ) -> io::Result<(Child, PathBuf)> {
let zig_str_path = find_zig_str_path(); let zig_str_path = find_zig_str_path();
let child = Command::new(&zig_executable()) match link_type {
.args(&["build-exe"]) LinkType::Dylib => {
.args(input_paths) let child = Command::new(&zig_executable())
.args([ .args(&["build-lib"])
"-lc", .args(input_paths)
&format!("-femit-bin={}", output_path.to_str().unwrap()), .args([
"-target", "-lc",
"native", &format!("-femit-bin={}", output_path.to_str().unwrap()),
"--pkg-begin", "-target",
"str", "native",
zig_str_path.to_str().unwrap(), "--pkg-begin",
"--pkg-end", "str",
"--strip", zig_str_path.to_str().unwrap(),
"-O", "--pkg-end",
"Debug", "--strip",
]) "-O",
.spawn()?; "Debug",
"-dynamic"
])
.spawn()?;
Ok((child, output_path)) Ok((child, output_path))
}
LinkType::Executable => {
let child = Command::new(&zig_executable())
.args(&["build-exe"])
.args(input_paths)
.args([
"-lc",
&format!("-femit-bin={}", output_path.to_str().unwrap()),
"-target",
"native",
"--pkg-begin",
"str",
zig_str_path.to_str().unwrap(),
"--pkg-end",
"--strip",
"-O",
"Debug",
])
.spawn()?;
Ok((child, output_path))
}
LinkType::None => todo!(),
}
} }
pub fn llvm_module_to_dylib( pub fn llvm_module_to_dylib(