1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

Visual Studio Projects: Add a 'clean' option for the command line build

This commit is contained in:
Mark Pizzolato 2025-11-28 16:54:00 -10:00
parent 4fd9ded9ae
commit b5bb4fa6dd
2 changed files with 34 additions and 30 deletions

View File

@ -94,29 +94,8 @@ that only run on the system that built it or one running the same OS.
If you're using Visual Studio Community 2022 or 2026, and you follow these
installation instructions, you can also build simulator executables using
the newer Visual Studio IDE and tools while not necessarily needing updated
windows_build support. This is convenient since both VS2022 and VS2026
come up with updates possibly many times per month and once an update is
installed, the windows_update build support won't be available for the
latest version. This problem only affects simulators compiled in Release
mode. Once projects are converted, by the build_vstudio.bat file directly
with the IDE, the Visual Studio 2022 or 2026 IDE for further development.
- New install
- In the "Workloads" pane, check "Desktop development with C++" workload's
checkbox, if not already checked.
- Click on the tab labeled "Individual components"
- In the "Individual components" pane:
- Scroll down and check the box next to "MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)"
- Continue to customize your VS 2022 installation as needed.
- Click on "Install" in the lower right hand corner
- Modifying an existing VS2022 installation
- Click on the Visual Studio 2022 `Modify` button.
- In the "Modifying --" window, click on "Individual Components"
- Click on the tab labeled "Individual components"
- In the "Individual components" pane:
- In the "Individual components" pane:
- Scroll down and check the box next to "MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)"
- Continue to customize your VS 2022 installation as needed.
- Click on the "Modify" button in the lower right corner of the Window.
windows_build support. Once projects are converted by the build_vstudio.bat
file or directly with the Visual Studio 2022 or 2026 IDE, the IDE can be
used for further development. If merely building a simulator is all that
you need building your preferred simulators from the command line may be
easiest.

View File

@ -1,5 +1,5 @@
@echo off
:: Rebuild all of SIMH simulators using Visual Studio
:: Rebuild all (or some) of SIMH simulators using Visual Studio
::
:: If this procedure is not invoked from a Developer command prompt
:: then the VS2008 tools are preferred if VS2008 is installed,
@ -9,17 +9,24 @@
:: If this is invoked with Visual Studio 2022 or 2026 installed
:: along with the "C++ for Windows Support for VS 2017 (v141) tools"
:: option installed, then the project files will be converted, if
:: needed, to leverage the stable windows_build support that doesn't
:: change at least every month.
:: needed, to include support for those tools.
::
:: If this procedure is invoked from a Developer command prompt
:: then the tool chain provided with the command prompt is used
:: to build the simh projects.
::
:: A single argument to this procedure may be the word Debug, which
:: An argument to this procedure may be the word Debug, which
:: will cause Debug binaries to be built rather than the Release
:: binaries which is the default.
::
:: An argument to this procedure may be the word Clean, which
:: will cause all the outputs produced by this procedure or
:: activities produced by the Visual Studio IDE to be removed
:: before possible converting of the simh.sln and or building
:: anything. If the simh.sln had been previously converted
:: by the IDE to support a newer version of Visual Studio,
:: that conversion will also be undone.
::
:: The default is to build all simulators mentioned in the simh solution.
:: Optionally, individual simulators may be built by listing the specific
:: simulator name(s) on the command line invoking this procedure.
@ -34,11 +41,13 @@ set _BUILD_CONFIG=Release
set _BUILD_PROJECTS=
set _REBUILD_PROJECTS=
set _BUILD_PROJECT_NAMES=
set _BUILD_CLEAN_FIRST=
set _BUILD_PROJECT_DIR=%~dp0Visual Studio Projects\
:_CheckArg
if "%1" == "" goto _DoneArgs
if /i "%1" == "Debug" set _BUILD_CONFIG=Debug& shift & goto _CheckArg
if /i "%1" == "Release" set _BUILD_CONFIG=Release& shift & goto _CheckArg
if /i "%1" == "Clean" set _BUILD_CLEAN_FIRST=True& shift & goto _CheckArg
call :GetFileName "%_BUILD_PROJECT_DIR%%1.vcproj" _BUILD_PROJECT
if exist "%_BUILD_PROJECT_DIR%%1.vcproj" set _BUILD_PROJECTS=%_BUILD_PROJECTS%;%_BUILD_PROJECT%
if exist "%_BUILD_PROJECT_DIR%%1.vcproj" set _REBUILD_PROJECTS=%_REBUILD_PROJECTS%;%_BUILD_PROJECT%:Rebuild
@ -241,7 +250,23 @@ exit /B 0
set %2=%~n1
exit /B 0
:DoClean
if exist "%~1..\BIN" echo Removing everything from .\BIN & rmdir/s/q "%~1..\BIN"
if exist "%~1*.vcxproj*" echo Removing .vcxproj Projects & del "%~1*.vcxproj*" & if exist "%~1.vs" rmdir /s /q "%~1.vs"
for %%a in ("%~1Simh-*.sln") do echo Removing "%%a" & del "%%a"
set _X_SLN_VERSION=
for /F "usebackq tokens=8" %%a in (`findstr /C:"Microsoft Visual Studio Solution File, Format Version" "%~1Simh.sln"`) do SET _X_SLN_VERSION=%%a
SET _X_BACKUP_SLN_DIR=
if not "%_X_SLN_VERSION%" == "10.00" for /D %%a in ("%~1Backup*") do if exist "%%a\Simh.sln" SET _X_BACKUP_SLN_DIR=%%a
if not "%_X_BACKUP_SLN_DIR%" == "" echo Restoring original Simh.sln & move /y "%_X_BACKUP_SLN_DIR%\Simh.sln" "%~1" > NUL 2>&1
if not "%_X_BACKUP_SLN_DIR%" == "" rmdir /s /q "%_X_BACKUP_SLN_DIR%"
SET _X_BACKUP_SLN_DIR=
:DoneClean
exit /B 0
:GotVC
if not "%_BUILD_CLEAN_FIRST%" == "" call :DoClean "%_BUILD_PROJECT_DIR%"
if not "%_BUILD_CLEAN_FIRST%" == "" if "%_BUILD_PROJECT_NAMES%" == "" exit /B 0
if "%_BUILD_PROJECT_NAMES%" == "" echo Building All Projects with %_BUILD_CONFIG% Configuration
if not "%_BUILD_PROJECT_NAMES%" == "" echo Building%_BUILD_PROJECT_NAMES% Projects with %_BUILD_CONFIG% Configuration
echo Building with Visual Studio Components from %_VC_DIR%