Skip to content

Instantly share code, notes, and snippets.

@photex
Forked from aras-p/package_builds_vs2017.cmd
Created January 10, 2024 14:36
Show Gist options
  • Save photex/13d8cec5b6bd8f1a4468f1be20f94583 to your computer and use it in GitHub Desktop.
Save photex/13d8cec5b6bd8f1a4468f1be20f94583 to your computer and use it in GitHub Desktop.
Packaging up Visual Studio & Windows 10 SDK for in-repository usage
@echo off
@rem Packages up VS2017 toolchain into builds.7z archive
@set TOOLS_VERSION=14.13.26128
@cd "%~dp0"
@set VC_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\
@if not exist "%VC_PATH%" goto error_no_vs
@if not exist "%VC_PATH%"Tools\MSVC\%TOOLS_VERSION% goto error_no_vs
@echo *** Deleting existing builds
@del builds.7z
@rmdir /S /Q builds
@echo *** Copying VS2017 toolkit files from %VC_PATH%
@set DST_PATH=builds\
@mkdir %DST_PATH%
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\bin\Hostx64\x64" "%DST_PATH%bin\Hostx64\x64"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\bin\Hostx86\x86" "%DST_PATH%bin\Hostx86\x86"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\bin\Hostx64\arm" "%DST_PATH%bin\Hostx64\arm"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\bin\Hostx64\arm64" "%DST_PATH%bin\Hostx64\arm64"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\include" "%DST_PATH%include"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\lib\x64" "%DST_PATH%lib\x64"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\lib\x86" "%DST_PATH%lib\x86"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\lib\arm" "%DST_PATH%lib\arm"
@xcopy /s /y /q /i "%VC_PATH%Tools\MSVC\%TOOLS_VERSION%\lib\arm64" "%DST_PATH%lib\arm64"
@echo *** Compressing into builds.7z
@cd builds
@call ..\..\..\..\..\..\External\7z\win64\7za.exe a ..\builds.7z *
@cd ..
@echo *** builds.7z file created with VS2017 toolchain
@goto end
:error_no_vs
@echo ERROR: Cannot find VS2017 Professional (%TOOLS_VERSION%) installation folder
@goto end
:end
pause
@echo off
@rem Packages up Windows 10 SDK into builds.7z archive
@set WIN10_SDK_VERSION=10.0.17134.0
@cd "%~dp0"
@set SDK_PATH=%ProgramFiles(x86)%\Windows Kits\10\
@if not exist "%SDK_PATH%"Include\%WIN10_SDK_VERSION% goto error_no_sdk
@if not exist "%SDK_PATH%"Lib\%WIN10_SDK_VERSION% goto error_no_sdk
@echo *** Deleting existing builds
@if exist builds.7z del builds.7z
@rmdir /S /Q builds
@echo *** Copying Windows SDK %WIN10_SDK_VERSION% files from %SDK_PATH%
@set DST_PATH=builds\
@mkdir %DST_PATH%Include\%WIN10_SDK_VERSION%
@mkdir %DST_PATH%Lib\%WIN10_SDK_VERSION%
@mkdir %DST_PATH%UnionMetadata
@xcopy /s /y /q /i "%SDK_PATH%Bin\%WIN10_SDK_VERSION%\arm" "%DST_PATH%Bin\arm"
@xcopy /s /y /q /i "%SDK_PATH%Bin\%WIN10_SDK_VERSION%\arm64" "%DST_PATH%Bin\arm64"
@xcopy /s /y /q /i "%SDK_PATH%Bin\%WIN10_SDK_VERSION%\x64" "%DST_PATH%Bin\x64"
@xcopy /s /y /q /i "%SDK_PATH%Bin\%WIN10_SDK_VERSION%\x86" "%DST_PATH%Bin\x86"
@xcopy /s /y /q /i "%SDK_PATH%DesignTime\CommonConfiguration\Neutral\UAP\%WIN10_SDK_VERSION%" "%DST_PATH%DesignTime\CommonConfiguration\Neutral\UAP\%WIN10_SDK_VERSION%"
@xcopy /s /y /q /i "%SDK_PATH%Include\%WIN10_SDK_VERSION%" "%DST_PATH%Include\%WIN10_SDK_VERSION%"
@xcopy /s /y /q /i "%SDK_PATH%Lib\%WIN10_SDK_VERSION%" "%DST_PATH%Lib\%WIN10_SDK_VERSION%"
@xcopy /s /y /q /i "%SDK_PATH%UnionMetadata\%WIN10_SDK_VERSION%" "%DST_PATH%UnionMetadata"
@echo *** Compressing into builds.7z
@cd builds
@call ..\..\..\..\..\..\External\7z\win64\7za.exe a ..\builds.7z *
@cd ..
@echo *** builds.7z file created with Win10 SDK %WIN10_SDK_VERSION%
@goto end
:error_no_sdk
@echo ERROR: Cannot determine Windows SDK location (need %WIN10_SDK_VERSION% version)
@goto end
:end
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment