Fix wasm host_input_path generation

This commit is contained in:
Richard Feldman 2022-11-23 00:38:54 -05:00
parent 04e3ac37f4
commit e1959d0a84
No known key found for this signature in database
GPG Key ID: F1F21AA5B1D9E43B

View File

@ -107,19 +107,27 @@ pub fn build_file<'a>(
} }
}; };
let (app_extension, extension) = { let (app_extension, extension, host_filename) = {
use roc_target::OperatingSystem::*; use roc_target::OperatingSystem::*;
match roc_target::OperatingSystem::from(target.operating_system) { match roc_target::OperatingSystem::from(target.operating_system) {
Wasi => { Wasi => {
if matches!(code_gen_options.opt_level, OptLevel::Development) { if matches!(code_gen_options.opt_level, OptLevel::Development) {
("wasm", Some("wasm")) ("wasm", Some("wasm"), "host.zig".to_string())
} else { } else {
("bc", Some("wasm")) ("bc", Some("wasm"), "host.zig".to_string())
} }
} }
Unix => ("o", None), Unix => (
Windows => ("obj", Some("exe")), "o",
None,
legacy_host_filename(target, code_gen_options.opt_level).unwrap(),
),
Windows => (
"obj",
Some("exe"),
legacy_host_filename(target, code_gen_options.opt_level).unwrap(),
),
} }
}; };
@ -132,8 +140,7 @@ pub fn build_file<'a>(
let host_input_path = if let EntryPoint::Executable { platform_path, .. } = &loaded.entry_point let host_input_path = if let EntryPoint::Executable { platform_path, .. } = &loaded.entry_point
{ {
cwd.join(platform_path) cwd.join(platform_path).with_file_name(host_filename)
.with_file_name(legacy_host_filename(target, code_gen_options.opt_level).unwrap())
} else { } else {
unreachable!(); unreachable!();
}; };