Skip to content

Instantly share code, notes, and snippets.

@t-mat
Created March 17, 2021 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t-mat/2620171257cca0136c83b017a283ac40 to your computer and use it in GitHub Desktop.
Save t-mat/2620171257cca0136c83b017a283ac40 to your computer and use it in GitHub Desktop.
Build RunCPM with VC++2019
@rem Build RunCPM for Windows x64 Desktop, VC++2019
@setlocal enabledelayedexpansion
@echo off
pushd .
set /a errorno=1
git --version || goto :ERROR
rem
rem Set Visual C++ environment for Windows, desktop, x64.
rem
rem https://github.com/Microsoft/vswhere
rem https://github.com/microsoft/vswhere/wiki/Find-VC#batch
rem
set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%vswhere%" (
echo Can't find "vswhere.exe". Please install the latest version of Visual Studio.
goto :ERROR
)
set "InstallDir="
for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set "InstallDir=%%i"
)
if "%InstallDir%" == "" (
echo Can't find Visual C++. Please install the latest version of Visual C++.
goto :ERROR
)
rem Set -no_logo
rem For details, see %InstallDir%\Common7\Tools\vsdevcmd\core\parse_cmd.bat
set __VSCMD_ARG_NO_LOGO=1
echo call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat"
call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" || goto :ERROR
rem
rem Build RunCPM
rem
if not exist "RunCPM" (
git clone --depth 1 https://github.com/MockbaTheBorg/RunCPM.git || goto :ERROR
)
pushd RunCPM
msbuild RunCPM.sln /nologo /v:minimal /m /p:Configuration=Release /p:Platform=x64 /t:Clean,Build || goto :ERROR
popd
if not exist artifacts ( md artifacts )
if not exist artifacts\A\0 ( md artifacts\A\0 )
copy RunCPM\x64\Release\RunCPM.exe .\artifacts
tar -xf RunCPM\DISK\A.ZIP -C .\artifacts\A\0
echo All artifacts are in %CD%\artifacts
echo Run the following command to execute RunCPM
echo start "" /D "%CD%\artifacts" "%CD%\artifacts\RunCPM.exe"
echo Build Status - SUCCEEDED
set /a errorno=0
goto :END
:ERROR
echo Abort by error.
echo Build Status - ERROR
:END
popd
exit /B %errorno%
@t-mat
Copy link
Author

t-mat commented Mar 17, 2021

cd /d "%USERPROFILE%\Documents"
md MyRunCPM
cd MyRunCPM
curl -JOL https://gist.github.com/t-mat/2620171257cca0136c83b017a283ac40/raw/afd4f24ba61fe0ac833a460bf693cb5345c9266a/build-runcpm-vc2019.bat
type build-runcpm-vc2019.bat | find "" /V > build.bat
.\build.bat
cd artifacts
.\RunCPM.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment