Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder: do not search for msvc when no need #23386

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions vlib/v/builder/builder.v
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ pub fn new_builder(pref_ &pref.Preferences) Builder {
}
table.pointer_size = if pref_.m64 { 8 } else { 4 }
mut msvc := MsvcResult{}
$if windows {
msvc = find_msvc(pref_.m64) or {
if pref_.ccompiler == 'msvc' {
// verror('cannot find MSVC on this OS')
}
MsvcResult{
valid: false
if pref_.ccompiler == 'msvc' {
$if windows {
msvc = find_msvc(pref_.m64) or {
MsvcResult{
valid: false
}
}
}
}
Expand Down
27 changes: 15 additions & 12 deletions vlib/v/builder/cc_windows.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ pub fn (mut v Builder) find_win_cc() ! {
println('failed command: `${cmd_version}`')
println('${v.pref.ccompiler} not found, looking for 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
Expand Down
Loading