File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,13 +49,21 @@ define macos_build
4949endef
5050
5151define windows_build
52- VSWHERE := "C:\ProgramData\Chocolatey\bin\vswhere.exe"
53- VS_PATH := $(shell $(VSWHERE ) -products * -requires Microsoft.Component.MSBuild -property installationPath -latest)
54- echo $(VS_PATH )
55- ifeq ($(VS_PATH ) ,)
56- $(error Could not find Visual Studio installation)
57- endif
58- MSBUILD := "$(VS_PATH ) \MSBuild\Current\Bin\MSBuild.exe"
52+ VSWHERE := $(shell dirname $(shell which vswhere.exe 2>/dev/null) )
53+ MSBUILD_PATH := $(shell \
54+ $(VSWHERE ) /vswhere.exe -products '* ' -requires Microsoft.Component.MSBuild \
55+ -property installationPath -latest 2>/dev/null | tr -d '\r')
56+
57+ # Fallback MSBuild paths
58+ MSBUILD_CANDIDATES := \
59+ "$(MSBUILD_PATH ) /MSBuild/Current/Bin/MSBuild.exe" \
60+ "$(MSBUILD_PATH ) /MSBuild/15.0/Bin/MSBuild.exe" \
61+ "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe" \
62+ "/c/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe"
63+
64+ # Find first existing MSBuild
65+ MSBUILD := $(firstword $(wildcard $(MSBUILD_CANDIDATES ) ) )
66+ echo $(MSBUILD )
5967 $(eval ARCH := $(1 ) )
6068 $(eval BUILD_PATH := $(BUILD_DIR ) /windows-$(ARCH )$(2 ) )
6169 $(eval EXTRA_FLAGS := $(3 ) )
You can’t perform that action at this time.
0 commit comments