fix: set VCTargetsPath

This commit is contained in:
Amin Yahyaabadi 2021-09-15 06:21:09 -05:00
parent 8555309081
commit 2761be4b10
1 changed files with 7 additions and 1 deletions

View File

@ -30,11 +30,12 @@ export async function setupMSVC(
arch = osArch() arch = osArch()
): Promise<void> { ): Promise<void> {
let toolset: string | undefined let toolset: string | undefined
let VCTargetsPath: string | undefined
if (version === "2015") { if (version === "2015") {
toolset = "14.0.25420.1" toolset = "14.0.25420.1"
await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"]) await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"])
const VCTargetsPath = "C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\v140" VCTargetsPath = "C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\v140"
if (existsSync(VCTargetsPath)) { if (existsSync(VCTargetsPath)) {
exportVariable("VCTargetsPath", VCTargetsPath) exportVariable("VCTargetsPath", VCTargetsPath)
} }
@ -44,12 +45,17 @@ export async function setupMSVC(
"--package-parameters", "--package-parameters",
"add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive",
]) ])
VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\Microsoft\\VC\\v150"
} else if (version === "2019") { } else if (version === "2019") {
toolset = "16.11.2.0" toolset = "16.11.2.0"
await setupChocoPack("visualstudio2019buildtools", toolset, [ await setupChocoPack("visualstudio2019buildtools", toolset, [
"--package-parameters", "--package-parameters",
"add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive",
]) ])
VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Microsoft\\VC\\v160"
}
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
exportVariable("VCTargetsPath", VCTargetsPath)
} }
setupMSVCDevCmd(getArch(arch), sdk, toolset, uwp, spectre) setupMSVCDevCmd(getArch(arch), sdk, toolset, uwp, spectre)
} }