2022-08-23 04:14:06 -05:00
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\t\n'
|
|
|
|
|
|
|
|
IFS=$'\t\n\r'
|
|
|
|
for i in $("$(env | grep '^ProgramFiles(x86)=' | cut -d = -f 2-)/Microsoft Visual Studio/Installer/vswhere.exe" \
|
|
|
|
-sort \
|
|
|
|
-prerelease \
|
|
|
|
-requiresAny \
|
|
|
|
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
|
|
|
|
-requires Microsoft.VisualStudio.Workload.WDExpress \
|
|
|
|
-products \* \
|
|
|
|
-utf8 \
|
|
|
|
-property installationPath); do
|
2022-10-28 12:20:09 -05:00
|
|
|
if ! [ -z ${VS_ENV_FILTER-} ]; then
|
|
|
|
if ! echo $i | grep $VS_ENV_FILTER >/dev/null; then
|
2022-08-23 04:14:06 -05:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
vs_install_dir=$i
|
|
|
|
break
|
|
|
|
done
|
|
|
|
IFS=$'\t\n'
|
|
|
|
|
2022-10-28 12:20:09 -05:00
|
|
|
for i in $(MSYS_NO_PATHCONV=1 cmd /c "$vs_install_dir\\VC\\Auxiliary\\Build\\vcvarsall.bat" $VS_ENV_PARAMS \& env \& exit /b); do
|
2022-08-23 04:14:06 -05:00
|
|
|
set +e
|
|
|
|
export "$i" 2>/dev/null
|
|
|
|
set -e
|
|
|
|
done
|