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

ci: fix msvc finding (3)

This commit is contained in:
Delyan Angelov 2020-08-28 20:06:41 +03:00
parent 68864d0703
commit 5d18ece661
2 changed files with 11 additions and 11 deletions

View File

@ -281,7 +281,7 @@ pub fn exec(cmd string) ?Result {
break
}
}
soutput := read_data.str()
soutput := read_data.str().trim_space()
read_data.free()
exit_code := u32(0)
C.WaitForSingleObject(proc_info.h_process, C.INFINITE)

View File

@ -138,19 +138,19 @@ fn find_vs(vswhere_dir, host_arch string) ?VsInstallation {
res := os.exec('"$vswhere_dir\\Microsoft Visual Studio\\Installer\\vswhere.exe" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath') or {
return error(err)
}
path := res.output.trim_space().trim_right('\r\n')
res_output := res.output.trim_right('\r\n')
// println('res: "$res"')
version := os.read_file('$path\\VC\\Auxiliary\\Build\\Microsoft.VCToolsVersion.default.txt') or {
version := os.read_file('$res_output\\VC\\Auxiliary\\Build\\Microsoft.VCToolsVersion.default.txt') or {
// println('Unable to find msvc version')
return error('Unable to find vs installation')
}
version2 := version // TODO remove. cgen option bug if expr
// println('version: $version')
v := if version.ends_with('\n') { version2[..version.len - 2] } else { version2 }
lib_path := '$path\\VC\\Tools\\MSVC\\$v\\lib\\$host_arch'
include_path := '$path\\VC\\Tools\\MSVC\\$v\\include'
lib_path := '$res.output\\VC\\Tools\\MSVC\\$v\\lib\\$host_arch'
include_path := '$res.output\\VC\\Tools\\MSVC\\$v\\include'
if os.exists('$lib_path\\vcruntime.lib') {
p := '$path\\VC\\Tools\\MSVC\\$v\\bin\\Host$host_arch\\$host_arch'
p := '$res.output\\VC\\Tools\\MSVC\\$v\\bin\\Host$host_arch\\$host_arch'
// println('$lib_path $include_path')
return VsInstallation{
exe_path: p
@ -303,14 +303,14 @@ pub fn (mut v Builder) cc_msvc() {
// println('$cmd')
ticks := time.ticks()
res := os.exec(cmd) or {
println(err.trim_space())
println(err)
verror('msvc error')
return
}
diff := time.ticks() - ticks
v.timing_message('C msvc', diff)
if res.exit_code != 0 {
verror(res.output.trim_space())
verror(res.output)
}
// println(res)
// println('C OUTPUT:')
@ -343,15 +343,15 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(path string, moduleflags
// println('thirdparty cmd line: $cmd')
res := os.exec(cmd) or {
println('msvc: failed thirdparty object build cmd: $cmd')
verror(err.trim_space())
verror(err)
return
}
if res.exit_code != 0 {
println('msvc: failed thirdparty object build cmd: $cmd')
verror(res.output.trim_space())
verror(res.output)
return
}
println(res.output.trim_space())
println(res.output)
}
struct MsvcStringFlags {