Skip to content

Commit 30dee57

Browse files
fix: Try alternative windows build method
1 parent 8680611 commit 30dee57

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,21 @@ define macos_build
4949
endef
5050

5151
define 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))

0 commit comments

Comments
 (0)