Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how vcvarsall is located #327

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fips.yml
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ jobs:
fail-fast: false
matrix:
rust: [ stable ]
os: [ windows-2019, windows-2022 ]
os: [ windows-2019, windows-latest ]
args:
- --all-targets --features fips,unstable
- --all-targets --features fips,bindgen,unstable
1 change: 1 addition & 0 deletions aws-lc-fips-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
@@ -162,6 +162,7 @@ impl CmakeBuilder {
let script_path = self.manifest_dir.join("builder").join("printenv.bat");
let result = test_command(script_path.as_os_str(), &[]);
if !result.status {
eprintln!("{}", result.output);
return Err("Failed to run vccarsall.bat.".to_owned());
}
let lines = result.output.lines();
34 changes: 31 additions & 3 deletions aws-lc-fips-sys/builder/printenv.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
@echo off
setlocal EnableDelayedExpansion
for /f "usebackq tokens=* delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do (
set "VS_PATH=%%i"
set "VS_PATH=%%i\VC\Auxiliary\Build\"
echo FOUND: "!VS_PATH!"
goto FoundVS
)
call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64

set
echo Visual Studio installation not found using vswhere. Searching in default directories...
for /R "%ProgramFiles(x86)%\Microsoft Visual Studio" %%a in (vcvarsall.bat) do (
if exist "%%~fa" (
set "VS_PATH=%%~dpa"
echo FOUND: "!VS_PATH!"
goto FoundVS
)
)
echo vcvarsall.bat not found.
goto End

:FoundVS
call "!VS_PATH!vcvarsall.bat" x64
if !ERRORLEVEL! neq 0 (
echo Failed to set Visual Studio environment variables.
echo PATH: "!VS_PATH!vcvarsall.bat"
goto End
)
echo Visual Studio environment variables set for x64.

set
endlocal
exit /b 0

:End
endlocal
exit /b 1