Skip to content

Commit

Permalink
do not find_msvc() multiply times
Browse files Browse the repository at this point in the history
  • Loading branch information
kbkpbot committed Jan 6, 2025
1 parent 504d006 commit 501fa3d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions vlib/v/builder/cc_windows.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@ pub fn (mut v Builder) find_win_cc() ! {
println('failed command: `${cmd_version}`')
println('${v.pref.ccompiler} not found, looking for msvc...')
}
msvc := find_msvc(v.pref.m64) or {
if v.pref.is_verbose {
println('msvc not found, looking for thirdparty/tcc...')
}
thirdparty_tcc := os.join_path(v.pref.vroot, 'thirdparty', 'tcc', 'tcc.exe')
tcc_version_res := os.execute('${os.quoted_path(thirdparty_tcc)} -v')
if tcc_version_res.exit_code != 0 {
if !v.cached_msvc.valid {
msvc := find_msvc(v.pref.m64) or {
if v.pref.is_verbose {
println('tcc not found')
println('msvc not found, looking for thirdparty/tcc...')
}
thirdparty_tcc := os.join_path(v.pref.vroot, 'thirdparty', 'tcc', 'tcc.exe')
tcc_version_res := os.execute('${os.quoted_path(thirdparty_tcc)} -v')
if tcc_version_res.exit_code != 0 {
if v.pref.is_verbose {
println('tcc not found')
}
return error('tcc not found')
}
return error('tcc not found')
v.pref.ccompiler = thirdparty_tcc
v.pref.ccompiler_type = .tinyc
return
}
v.pref.ccompiler = thirdparty_tcc
v.pref.ccompiler_type = .tinyc
return
v.cached_msvc = msvc
}
v.pref.ccompiler = 'msvc'
v.pref.ccompiler_type = .msvc
v.cached_msvc = msvc
return
}
v.pref.ccompiler_type = pref.cc_from_string(v.pref.ccompiler)
Expand Down

0 comments on commit 501fa3d

Please sign in to comment.