examples: Run the correct example executable on Windows

We were accidentally always running the `fib-debug/main` example because of
shenanigans with alphabetical ordering and hard coding "main.exe" as the command
we run. Now we properly detect which example we built and run the appropriate
executable.
This commit is contained in:
Nick Fitzgerald
2020-07-13 08:56:32 -07:00
parent 9f0ec620f0
commit 3638dba855

View File

@@ -84,10 +84,14 @@ fn main() -> anyhow::Result<()> {
.arg("ntdll.lib") .arg("ntdll.lib")
.arg("shell32.lib") .arg("shell32.lib")
.arg("ole32.lib"); .arg("ole32.lib");
"./main.exe" if is_dir {
"main.exe".to_string()
} else {
format!("./{}.exe", example)
}
} else { } else {
cmd.arg("target/debug/libwasmtime.a").arg("-o").arg("foo"); cmd.arg("target/debug/libwasmtime.a").arg("-o").arg("foo");
"./foo" "./foo".to_string()
}; };
if cfg!(target_os = "linux") { if cfg!(target_os = "linux") {
cmd.arg("-lpthread").arg("-ldl").arg("-lm"); cmd.arg("-lpthread").arg("-ldl").arg("-lm");