Win: Add scripts to install and setup
This commit is contained in:
parent
9f91f3617b
commit
a333fb1ecc
Notes:
git
2025-05-30 10:58:56 +00:00
7
.github/workflows/windows.yml
vendored
7
.github/workflows/windows.yml
vendored
@ -95,13 +95,8 @@ jobs:
|
||||
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
|
||||
run: |
|
||||
::- Set up VC ${{ matrix.vc }}
|
||||
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
for /f "delims=;" %%I in ('%vswhere% -latest -property installationPath') do (
|
||||
set VCVARS="%%I\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set VCVARS
|
||||
set | uutils sort > old.env
|
||||
call %VCVARS% ${{ matrix.target || 'amd64' }} ${{ matrix.vcvars || '' }}
|
||||
call ..\src\win32\vssetup.cmd ${{ matrix.target || 'amd64' }} ${{ matrix.vcvars || '' }}
|
||||
nmake -f nul
|
||||
set TMP=%USERPROFILE%\AppData\Local\Temp
|
||||
set TEMP=%USERPROFILE%\AppData\Local\Temp
|
||||
|
@ -81,29 +81,9 @@ sh ../../ruby/configure -C --disable-install-doc --with-opt-dir=C:\Users\usernam
|
||||
* VC++/MSVC on VS 2017/2019/2022 version build tools.
|
||||
* Windows 10/11 SDK
|
||||
|
||||
You can install Visual Studio Build Tools with `winget`. The minimum requirement manifest is:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
|
||||
"Microsoft.Component.MSBuild",
|
||||
"Microsoft.VisualStudio.Component.CoreBuildTools",
|
||||
"Microsoft.VisualStudio.Workload.MSBuildTools",
|
||||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
||||
"Microsoft.VisualStudio.Component.Windows11SDK.26100"
|
||||
],
|
||||
"extensions": []
|
||||
}
|
||||
```
|
||||
|
||||
You save the above JSON to a file like `minimum.vsconfig` and run the following command:
|
||||
|
||||
```batch
|
||||
winget install Microsoft.VisualStudio.2022.BuildTools --override "--passive --config minimum.vsconfig"
|
||||
```
|
||||
You can install Visual Studio Build Tools with `winget`.
|
||||
`win32\install-buildtools.cmd` is a batch file to install the
|
||||
minimum requirements excluding the IDE etc.
|
||||
|
||||
3. Please set environment variable `INCLUDE`, `LIB`, `PATH`
|
||||
to run required commands properly from the command line.
|
||||
@ -111,7 +91,7 @@ sh ../../ruby/configure -C --disable-install-doc --with-opt-dir=C:\Users\usernam
|
||||
the following command to set them in your command line.
|
||||
|
||||
```
|
||||
cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmd /k win32\vssetup.cmd
|
||||
```
|
||||
|
||||
**Note** building ruby requires following commands.
|
||||
|
14
win32/install-buildtools.cmd
Normal file
14
win32/install-buildtools.cmd
Normal file
@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set components=VC.Tools.x86.x64 VC.Redist.14.Latest CoreBuildTools
|
||||
set components=%components% Windows11SDK.26100
|
||||
if /i "%PROCESSOR_ARCHITECTURE%" == "ARM64" (
|
||||
set components=%components% VC.Tools.ARM64 VC.Tools.ARM64EC
|
||||
)
|
||||
set override=--passive
|
||||
for %%I in (%components%) do (
|
||||
call set override=%%override%% --add Microsoft.VisualStudio.Component.%%I
|
||||
)
|
||||
echo on
|
||||
winget uninstall --id Microsoft.VisualStudio.2022.BuildTools --override "%override%"
|
24
win32/vssetup.cmd
Normal file
24
win32/vssetup.cmd
Normal file
@ -0,0 +1,24 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
::- check for vswhere
|
||||
set vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
|
||||
if not exist "%vswhere%" (
|
||||
echo 1>&2 vswhere.exe not found
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
::- find the latest build tool and its setup batch file.
|
||||
set VCVARS=
|
||||
for /f "delims=" %%I in ('"%vswhere%" -products * -latest -property installationPath') do (
|
||||
set VCVARS=%%I\VC\Auxiliary\Build\vcvarsall.bat
|
||||
)
|
||||
if not defined VCVARS (
|
||||
echo 1>&2 Visual Studio not found
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
::- If no target is given, setup for the current processor.
|
||||
set target=
|
||||
if "%1" == "" set target=%PROCESSOR_ARCHITECTURE%
|
||||
echo on && endlocal && "%VCVARS%" %target% %*
|
Loading…
x
Reference in New Issue
Block a user