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
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions aws-lc-fips-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
33 changes: 30 additions & 3 deletions aws-lc-fips-sys/builder/printenv.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
@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\"
justsmth marked this conversation as resolved.
Show resolved Hide resolved
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 (
justsmth marked this conversation as resolved.
Show resolved Hide resolved
if exist "%%~fa" (
justsmth marked this conversation as resolved.
Show resolved Hide resolved
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
Loading