builder: allow for `-os windows -cc msvc -o x.c` on any platform

pull/7216/head
Delyan Angelov 2020-12-05 15:35:39 +02:00
parent fbf6910ab9
commit daa659e1fd
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,7 @@ pub fn (mut b Builder) build_c(v_files []string, out_file string) {
}
pub fn (mut b Builder) compile_c() {
if os.user_os() != 'windows' && b.pref.ccompiler == 'msvc' {
if os.user_os() != 'windows' && b.pref.ccompiler == 'msvc' && !b.pref.out_name.ends_with('.c') {
verror('Cannot build with msvc on $os.user_os()')
}
// cgen.genln('// Generated by V')

View File

@ -181,7 +181,12 @@ fn find_msvc() ?MsvcResult {
valid: true
}
} $else {
return error('msvc not found')
// This hack allows to at least see the generated .c file with `-os windows -cc msvc -o x.c`
// Please do not remove it, unless you also check that the above continues to work.
return MsvcResult{
full_cl_exe_path: '/usr/bin/true'
valid: true
}
}
}