ci: fix msvc finding (3)
parent
68864d0703
commit
5d18ece661
|
@ -281,7 +281,7 @@ pub fn exec(cmd string) ?Result {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
soutput := read_data.str()
|
soutput := read_data.str().trim_space()
|
||||||
read_data.free()
|
read_data.free()
|
||||||
exit_code := u32(0)
|
exit_code := u32(0)
|
||||||
C.WaitForSingleObject(proc_info.h_process, C.INFINITE)
|
C.WaitForSingleObject(proc_info.h_process, C.INFINITE)
|
||||||
|
|
|
@ -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 {
|
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)
|
return error(err)
|
||||||
}
|
}
|
||||||
path := res.output.trim_space().trim_right('\r\n')
|
res_output := res.output.trim_right('\r\n')
|
||||||
// println('res: "$res"')
|
// 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')
|
// println('Unable to find msvc version')
|
||||||
return error('Unable to find vs installation')
|
return error('Unable to find vs installation')
|
||||||
}
|
}
|
||||||
version2 := version // TODO remove. cgen option bug if expr
|
version2 := version // TODO remove. cgen option bug if expr
|
||||||
// println('version: $version')
|
// println('version: $version')
|
||||||
v := if version.ends_with('\n') { version2[..version.len - 2] } else { version2 }
|
v := if version.ends_with('\n') { version2[..version.len - 2] } else { version2 }
|
||||||
lib_path := '$path\\VC\\Tools\\MSVC\\$v\\lib\\$host_arch'
|
lib_path := '$res.output\\VC\\Tools\\MSVC\\$v\\lib\\$host_arch'
|
||||||
include_path := '$path\\VC\\Tools\\MSVC\\$v\\include'
|
include_path := '$res.output\\VC\\Tools\\MSVC\\$v\\include'
|
||||||
if os.exists('$lib_path\\vcruntime.lib') {
|
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')
|
// println('$lib_path $include_path')
|
||||||
return VsInstallation{
|
return VsInstallation{
|
||||||
exe_path: p
|
exe_path: p
|
||||||
|
@ -303,14 +303,14 @@ pub fn (mut v Builder) cc_msvc() {
|
||||||
// println('$cmd')
|
// println('$cmd')
|
||||||
ticks := time.ticks()
|
ticks := time.ticks()
|
||||||
res := os.exec(cmd) or {
|
res := os.exec(cmd) or {
|
||||||
println(err.trim_space())
|
println(err)
|
||||||
verror('msvc error')
|
verror('msvc error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
diff := time.ticks() - ticks
|
diff := time.ticks() - ticks
|
||||||
v.timing_message('C msvc', diff)
|
v.timing_message('C msvc', diff)
|
||||||
if res.exit_code != 0 {
|
if res.exit_code != 0 {
|
||||||
verror(res.output.trim_space())
|
verror(res.output)
|
||||||
}
|
}
|
||||||
// println(res)
|
// println(res)
|
||||||
// println('C OUTPUT:')
|
// 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')
|
// println('thirdparty cmd line: $cmd')
|
||||||
res := os.exec(cmd) or {
|
res := os.exec(cmd) or {
|
||||||
println('msvc: failed thirdparty object build cmd: $cmd')
|
println('msvc: failed thirdparty object build cmd: $cmd')
|
||||||
verror(err.trim_space())
|
verror(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if res.exit_code != 0 {
|
if res.exit_code != 0 {
|
||||||
println('msvc: failed thirdparty object build cmd: $cmd')
|
println('msvc: failed thirdparty object build cmd: $cmd')
|
||||||
verror(res.output.trim_space())
|
verror(res.output)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
println(res.output.trim_space())
|
println(res.output)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MsvcStringFlags {
|
struct MsvcStringFlags {
|
||||||
|
|
Loading…
Reference in New Issue