1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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() { 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()') verror('Cannot build with msvc on $os.user_os()')
} }
// cgen.genln('// Generated by V') // cgen.genln('// Generated by V')

View File

@ -181,7 +181,12 @@ fn find_msvc() ?MsvcResult {
valid: true valid: true
} }
} $else { } $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
}
} }
} }