compiler: support setting pref.output_cross_c with -os cross

pull/4564/head
Delyan Angelov 2020-04-23 20:24:30 +03:00
parent 7bcca827b6
commit 878be4d886
1 changed files with 7 additions and 4 deletions

View File

@ -170,14 +170,17 @@ fn parse_args(args []string) (&pref.Preferences, string) {
res.backend = .x64 res.backend = .x64
} }
'-os' { '-os' {
// TODO Remove `tmp` variable when it doesn't error out in C.
target_os := cmdline.option(current_args, '-os', '') target_os := cmdline.option(current_args, '-os', '')
tmp := pref.os_from_string(target_os) or { i++
target_os_kind := pref.os_from_string(target_os) or {
if target_os == 'cross' {
res.output_cross_c = true
continue
}
println('unknown operating system target `$target_os`') println('unknown operating system target `$target_os`')
exit(1) exit(1)
} }
res.os = tmp res.os = target_os_kind
i++
} }
'-cflags' { '-cflags' {
res.cflags = cmdline.option(current_args, '-cflags', '') res.cflags = cmdline.option(current_args, '-cflags', '')