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

Visual Studio Projects: Build Cleanup for Initial VS2026 Support

- Cleanup build details and provide initial detection support for
  building Visual Studio 2026.
- Automatically leverage the v141 Visual Studio platform Toolset if
  it is installed.  This avoids failing build attempts when windows_build
  hasn't yet been updated to support the frequently changing VS2022
  or VS2026 build components.
- Fix pdp11.vcproj to avoid warning when project is converted.
- Fix trivial compiler warnings in alpha_cpu.c and hp_tapelib.c
This commit is contained in:
Mark Pizzolato 2025-11-21 02:22:30 -10:00
parent 3e3fc123c7
commit 3503e7b794
8 changed files with 176 additions and 81 deletions

View File

@ -1732,7 +1732,8 @@ else { /* otherwise the command
dpprintf (cvptr->device, TL_DEB_CMD, "%s succeeded\n", dpprintf (cvptr->device, TL_DEB_CMD, "%s succeeded\n",
opcode_names [opcode]); opcode_names [opcode]);
outbound = IFGTC | RQSRV | Class_Control; /* indicate that a control command was executed */ outbound = (CNTLR_IFN_IBUS)IFGTC | (CNTLR_IFN_IBUS)RQSRV | (CNTLR_IFN_IBUS)Class_Control;
/* indicate that a control command was executed */
} }
else if (flags & CMXEQ) { /* otherwise if the command is to be executed */ else if (flags & CMXEQ) { /* otherwise if the command is to be executed */
@ -1745,7 +1746,8 @@ else { /* otherwise the command
CNTLR_UPTR->PHASE = Wait_Phase; /* then set up the wait phase */ CNTLR_UPTR->PHASE = Wait_Phase; /* then set up the wait phase */
CNTLR_UPTR->OPCODE = opcode; /* and command opcode on the controller unit */ CNTLR_UPTR->OPCODE = opcode; /* and command opcode on the controller unit */
outbound = IFGTC | RQSRV | cmd_props [opcode].class; /* return the transfer class (read or write) */ outbound = (CNTLR_IFN_IBUS)IFGTC | (CNTLR_IFN_IBUS)RQSRV | (CNTLR_IFN_IBUS)(cmd_props [opcode].class);
/* return the transfer class (read or write) */
} }
else { /* otherwise it's a control command */ else { /* otherwise it's a control command */
@ -1765,7 +1767,8 @@ else { /* otherwise the command
activate_unit (cvptr, uptr); /* schedule the start phase */ activate_unit (cvptr, uptr); /* schedule the start phase */
outbound = IFGTC | Class_Control; /* indicate a control command is executing */ outbound = (CNTLR_IFN_IBUS)IFGTC | (CNTLR_IFN_IBUS)Class_Control;
/* indicate a control command is executing */
} }
} }

View File

@ -54,7 +54,8 @@ The project files in this directory build these simulators with support for
both network and asynchronous I/O. both network and asynchronous I/O.
To build any of the supported simulators you should open the simh.sln file To build any of the supported simulators you should open the simh.sln file
in this directory. in this directory or build directly from a Windows Command prompt using
the build_vstudio.bat script.
The installer for Visual Studio 2008 SP1 is available from: The installer for Visual Studio 2008 SP1 is available from:
@ -65,7 +66,7 @@ on that DVD image. No need to install "Silverlight Runtime" or
"Microsoft SQL Server 2008 Express Edition". Depending on your OS Version "Microsoft SQL Server 2008 Express Edition". Depending on your OS Version
you may be prompted to install an older version of .NET Framework which should you may be prompted to install an older version of .NET Framework which should
be installed. Once that install completes, you will need to run Windows-Update be installed. Once that install completes, you will need to run Windows-Update
(with "Recieve updates for other Microsoft products enabled") to completely (with "Receive updates for other Microsoft products enabled") to completely
update the Visual Studio environment you've just installed. update the Visual Studio environment you've just installed.
Visual Studio Express 2008 will build executables that will run on all Windows Visual Studio Express 2008 will build executables that will run on all Windows
@ -81,29 +82,31 @@ conversion process.
If you have a version of Visual Studio installed and want to build all the If you have a version of Visual Studio installed and want to build all the
simulators from a command prompt, the file build_vstudio.bat in the root simulators from a command prompt, the file build_vstudio.bat in the root
of the simh source tree will do that without any furthur interaction. In of the simh source tree will do that without any further interaction. In
fact, the best way to convert the VS2008 solution and project files is by fact, the best way to convert the VS2008 solution and project files is by
using build_vstudio.bat since it will create a new solution file named using build_vstudio.bat since it will create a new solution file named
Simh-2022.sln that can then be used directly by the Visual Studio IDE. Simh-2022.sln or Simh-2026.sln that can then be used directly by the
Visual Studio IDE.
Almost all newer Visual Studio versions after VS2008 will build executables Almost all newer Visual Studio versions after VS2008 will build executables
that only run on the system that built it or one running the same OS. that only run on the system that built it or one running the same OS.
If you're using Visual Studio Community 2022, and you follow these If you're using Visual Studio Community 2022 or 2026, and you follow these
installation instructions, you can also build simulator executables which installation instructions, you can also build simulator executables using
will run on all versions of Windows from XP onward if you install as the newer Visual Studio IDE and tools while not necessarily needing updated
indicated here and you use the build_vstudio.bat file to perform the windows_build support. This is convenient since both VS2022 and VS2026
project conversions. Once projects are converted, they can be used in come up with updates possibly many times per month and once an update is
the Visual Studio 2022 IDE for further development. 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 - New install
- In the "Workloads" pane, check "Desktop development with C++" workload's - In the "Workloads" pane, check "Desktop development with C++" workload's
checkbox, if not already checked. checkbox, if not already checked.
- Click on the tab labeled "Individual components" - Click on the tab labeled "Individual components"
- In the "Individual components" pane: - In the "Individual components" pane:
- Enter "XP" in the "Search components (Ctrl-Q)" field. - Scroll down and check the box next to "MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)"
- Locate the "Compilers, build tools and runtimes" heading
- Select "C++ for Windows XP Support for VS 2017 (v141) tools [Deprecated]" checkbox.
- Continue to customize your VS 2022 installation as needed. - Continue to customize your VS 2022 installation as needed.
- Click on "Install" in the lower right hand corner - Click on "Install" in the lower right hand corner
@ -112,9 +115,8 @@ the Visual Studio 2022 IDE for further development.
- In the "Modifying --" window, click on "Individual Components" - In the "Modifying --" window, click on "Individual Components"
- Click on the tab labeled "Individual components" - Click on the tab labeled "Individual components"
- In the "Individual components" pane: - In the "Individual components" pane:
- Enter "XP" in the "Search components (Ctrl-Q)" field. - In the "Individual components" pane:
- Locate the "Compilers, build tools and runtimes" heading - Scroll down and check the box next to "MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)"
- Select "C++ for Windows XP Support for VS 2017 (v141) tools [Deprecated]" checkbox.
- Continue to customize your VS 2022 installation as needed. - Continue to customize your VS 2022 installation as needed.
- Click on the "Modify" button in the lower right corner of the Window. - Click on the "Modify" button in the lower right corner of the Window.

View File

@ -0,0 +1,96 @@
# This script converts Visual Studio 2022 and 2026 upgraded VS2008 projects to produce
# VS2022 or VS2026 projects that will build executables that will link against Visual
# Studio 2017 libraries which are stable in the windows_build repo.
#
#$SDK = $env:WindowsSDKVersion
param(
[string]$Solution
)
$changedProjects = 0
$changedSolution = 0
$SDK = "10.0.26100.0\"
$SDK = $SDK.Replace("\","")
$solutionFile = $Solution
$solutionPath = Split-Path -Path $solutionFile -Parent
if (-not $solutionPath.Contains('\'))
{
$solutionPath = "."
}
if (-not (Test-Path -Path $solutionFile -PathType Any)) {if (-not (Get-Item -Path $solutionFile -ErrorAction Ignore)) {Write-Host "No such file: $solutionFile"; }}
$solution = Get-Content -Path $solutionFile -Raw
$startingSolution = $Solution
if ($solution -match 'Project\("{([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})}"\) = "BuildROMs", "BuildROMs.[a-z]*", "{([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})}"')
{
$BuildROMsGUID = $($Matches[2])
}
$Projects = [Regex]::Matches($solution, '(?sm)}"\) = "(?<project>.*?)", "(?<file>.*?)"')
if ($solution.Contains(".vcproj"))
{
Write-Host "Attempting to fix Solution file which wasn't completely migrated:"
Write-Host $solutionFile
}
$dependencyPattern = "(?sm)\s\sProjectSection\(ProjectDependencies\) \= postProject.*?({.*?}).*?EndProjectSection"
$solution = $solution -replace $dependencyPattern, ""
$solution = $solution -replace ".vcproj", ".vcxproj"
if (-not $solution.Contains("GlobalSection(ExtensibilityGlobals)"))
{
$solution = $solution.Replace(
"EndGlobal
",
" GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {$(New-Guid)}
EndGlobalSection
EndGlobal
")
$solution = $solution.Replace("Format Version 10.00", "Format Version 12.00")
$solution = $solution.Replace("Visual C++ Express 2008", "Visual Studio Version 17
VisualStudioVersion = 17.14.36705.20 d17.14
MinimumVisualStudioVersion = 10.0.40219.1")
}
ForEach ($Project in $Projects)
{
$projFile = $solutionPath + "\" + $($Project.Groups['file'].Value).Replace(".vcproj", ".vcxproj")
if (-not (Test-Path -Path $ProjFile -PathType Any)) {if (-not (Get-Item -Path $ProjFile -ErrorAction Ignore)) {Write-Host "No such file: $ProjFile"; continue; }}
$projString = Get-Content -Path $projFile -Raw
$startingProjString = $projString
if ($projString.Contains("<WindowsTargetPlatformVersion>")) {Write-Host "$projFile - already converted"; continue; }
$projString = $projString.Replace(
"<Keyword>Win32Proj</Keyword>
",
"<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>$SDK</WindowsTargetPlatformVersion>
")
$projString = $projString.Replace("<PlatformToolset>v143</PlatformToolset>","<PlatformToolset>v141</PlatformToolset>")
$projString = $projString.Replace("<PlatformToolset>v144</PlatformToolset>","<PlatformToolset>v141</PlatformToolset>")
$projString = $projString.Replace("<PlatformToolset>v145</PlatformToolset>","<PlatformToolset>v141</PlatformToolset>")
$projString = $projString.Replace(
' Label="LocalAppDataPlatform" />
',' Label="LocalAppDataPlatform" />
<Import Project="simh.props" />
')
if (-not $projString.Contains($BuildROMsGUID))
{
$ProjString = $ProjString.Replace(
' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />',
(' <ItemGroup>
<ProjectReference Include="BuildROMs.vcxproj">
<Project>{' + $BuildROMsGUID.ToLower() + '}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />'))
}
if (-not ($projString -ceq $startingProjString))
{
$projString | Out-File -Force -FilePath "$projFile" -Encoding utf8
$changedProjects = $changedProjects + 1
}
}
if (-not ($solution -ceq $startingSolution))
{
$solution | Out-File -Force -FilePath "$solutionFile" -Encoding utf8
$changedSolution = 1
}
Write-Host "Projects Changed: $changedProjects Solution Changed: $changedSolution"

View File

@ -1,26 +0,0 @@
# This script converts Visual Studio 2022 upgraded VS2008 projects to produce VS2022
# projects that will build executables that will run on all versions of windows since XP
#
ForEach ($arg in ($args))
{
if (-not (Test-Path -Path $arg -PathType Any)) {if (-not (Get-Item -Path $arg -ErrorAction Ignore)) {Write-Host "No such file: $arg"; continue; }}
ForEach ($file in (Get-Item -Path $arg))
{
$string = Get-Content -Path $file -Raw
if ($string.Contains("<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")) {Write-Host "$file - already converted"; continue; }
Write-Host "Processing: $file"
$string = $string.Replace(
"<Keyword>Win32Proj</Keyword>
",
"<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
")
$string = $string.Replace("<PlatformToolset>v143</PlatformToolset>","<PlatformToolset>v141_xp</PlatformToolset>")
$string = $string.Replace(
' Label="LocalAppDataPlatform" />
',' Label="LocalAppDataPlatform" />
<Import Project="simh.props" />
')
$string | Out-File -Force -FilePath "$file" -Encoding utf8
}
}

View File

@ -34,9 +34,6 @@
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
@ -120,9 +117,6 @@
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />

View File

@ -25,7 +25,9 @@ rem - performing the activities which make confirm or generate the git
rem repository commit id available in an include file during compiles. rem repository commit id available in an include file during compiles.
rem rem
rem rem
set _CONFIGURATION_DIR=%~p1 set _CONFIGURATION_DIR=%~p1
set _CONFIGURATION_NAME=Debug
if not "Debug" == "%_CONFIGURATION_DIR:~-6,-1%" if not "Debug\BuildTools" == "%_CONFIGURATION_DIR:~-17,-1%" set _CONFIGURATION_NAME=Release if not "Debug" == "%_CONFIGURATION_DIR:~-6,-1%" if not "Debug\BuildTools" == "%_CONFIGURATION_DIR:~-17,-1%" set _CONFIGURATION_NAME=Release
set _PDB=%~dpn1.pdb set _PDB=%~dpn1.pdb
@ -40,7 +42,7 @@ set _ARG=
rem Everything implicitly requires BUILD to also be set to have rem Everything implicitly requires BUILD to also be set to have
rem any meaning, it always gets set. rem any meaning, it always gets set.
set _X_BUILD=BUILD set _X_BUILD=BUILD
set _X_REQUIRED_WINDOWS_BUILD=20251112 set _X_REQUIRED_WINDOWS_BUILD=20251119
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
echo _VC_VER=%_VC_VER% echo _VC_VER=%_VC_VER%
echo _MSVC_VER=%_MSVC_VER% echo _MSVC_VER=%_MSVC_VER%
@ -65,8 +67,7 @@ goto _next_arg
pushd .. pushd ..
if "%_X_ROM%" == "" goto _done_rom if "%_X_ROM%" == "" goto _done_rom
SET _BLD= SET _BLD=
if exist BIN\NT\Win32-Debug\BuildTools\BuildROMs.exe SET _BLD=BIN\NT\Win32-%_CONFIGURATION_NAME%\BuildTools\BuildROMs.exe if exist "BIN\NT\Win32-%_CONFIGURATION_NAME%\BuildTools\BuildROMs.exe" SET _BLD=BIN\NT\Win32-%_CONFIGURATION_NAME%\BuildTools\BuildROMs.exe
if exist BIN\NT\Win32-Release\BuildTools\BuildROMs.exe SET _BLD=BIN\NT\Win32-%_CONFIGURATION_NAME%\BuildTools\BuildROMs.exe
if "%_BLD%" == "" echo ************************************************ if "%_BLD%" == "" echo ************************************************
if "%_BLD%" == "" echo ************************************************ if "%_BLD%" == "" echo ************************************************
if "%_BLD%" == "" echo ** Project dependencies are not correct. ** if "%_BLD%" == "" echo ** Project dependencies are not correct. **
@ -77,8 +78,7 @@ if "%_BLD%" == "" echo error: Review the Output Tab for more details.
if "%_BLD%" == "" exit 1 if "%_BLD%" == "" exit 1
%_BLD% %_BLD%
if not errorlevel 1 goto _done_rom if not errorlevel 1 goto _done_rom
if not exist "BIN\NT\Win32-Release\BuildTools\BuildROMs.exe" exit 1 if not exist "BIN\NT\Win32-%_CONFIGURATION_NAME%\BuildTools\BuildROMs.exe" exit 1
del "BIN\NT\Win32-Release\BuildTools\BuildROMs.exe"
popd popd
goto _do_rom goto _do_rom
:_done_rom :_done_rom
@ -530,6 +530,7 @@ if "%_VC_NUM_%" neq "" set %_VC_TMP%=%~1
if "%_VC_NUM_%" neq "" goto _VCCheck_Done if "%_VC_NUM_%" neq "" goto _VCCheck_Done
goto _VCCheck_Next goto _VCCheck_Next
:_VCCheck_Done :_VCCheck_Done
if "%~1" equ "18" set %_VC_TMP%=2026
set _VC_TMP=_MSVC_TOOLSET_ set _VC_TMP=_MSVC_TOOLSET_
:_VCTSCheck_Next :_VCTSCheck_Next
shift shift

View File

@ -950,7 +950,7 @@ while (reason == 0) {
break; break;
case 0x61: /* AMASK */ case 0x61: /* AMASK */
res = rbv & ~arch_mask; res = rbv & ~((t_uint64)arch_mask);
break; break;
case 0x64: /* CMOVLE */ case 0x64: /* CMOVLE */

View File

@ -6,11 +6,11 @@
:: otherwise the installed Visual Studio tools will be used :: otherwise the installed Visual Studio tools will be used
:: preferring newer Visual Studio versions over older ones. :: preferring newer Visual Studio versions over older ones.
:: ::
:: If this is invoked with Visual Studio 2022 installed along with :: If this is invoked with Visual Studio 2022 or 2026 installed
:: the "C++ for Windows XP Support for VS 2017 (v141) tools" option :: along with the "C++ for Windows Support for VS 2017 (v141) tools"
:: installed, then the project files will be converted, if needed :: option installed, then the project files will be converted, if
:: to leverage the available support so that the executables created :: needed, to leverage the stable windows_build support that doesn't
:: will run on all versions of Windows from XP onward. :: change at least every month.
:: ::
:: If this procedure is invoked from a Developer command prompt :: If this procedure is invoked from a Developer command prompt
:: then the tool chain provided with the command prompt is used :: then the tool chain provided with the command prompt is used
@ -22,7 +22,7 @@
:: ::
:: The default is to build all simulators mentioned in the simh solution. :: The default is to build all simulators mentioned in the simh solution.
:: Optionally, individual simulators may be built by listing the specific :: Optionally, individual simulators may be built by listing the specific
:: simulator names on the command line invoking this procedure. :: simulator name(s) on the command line invoking this procedure.
:: ::
:: Individual simulator sources are in .\simulator_name :: Individual simulator sources are in .\simulator_name
:: Individual simulator executables are produced in .\BIN\NT\Win32-{Debug or Release}\ :: Individual simulator executables are produced in .\BIN\NT\Win32-{Debug or Release}\
@ -54,27 +54,44 @@ echo ** ERROR ** ERROR ** ERROR ** ERROR ** ERROR ** ERROR
exit /b 1 exit /b 1
:_DoneArgs :_DoneArgs
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
set _VC_VER= set _VC_VER=
if not "%VSINSTALLDIR%" == "" set _VC_DIR=%VSINSTALLDIR%
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" set _VC_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0
if exist "%_VC_DIR%\VC\vcvarsall.bat" call "%_VC_DIR%\VC\vcvarsall.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat" call "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat" set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\2022\Professional
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\2022\Community
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\18\Professional
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC
set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\18\Community
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC
set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\2019\Community
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC
set _VC_DIR=%ProgramFiles%\Microsoft Visual Studio\2017\Community
if exist "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat" call "%_VC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR call :FindVCVersion _VC_VER _MSVC_VER _MSVC_TOOLSET_VER _MSVC_TOOLSET_DIR
if not "%_VC_VER%" == "" goto GotVC if not "%_VC_VER%" == "" goto GotVC
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
@ -155,6 +172,7 @@ if "%_VC_NUM_%" neq "" set %_VC_TMP%=%~1
if "%_VC_NUM_%" neq "" goto _VCCheck_Done if "%_VC_NUM_%" neq "" goto _VCCheck_Done
goto _VCCheck_Next goto _VCCheck_Next
:_VCCheck_Done :_VCCheck_Done
if "%~1" equ "18" set %_VC_TMP%=2026
set _VC_TMP=_MSVC_TOOLSET_ set _VC_TMP=_MSVC_TOOLSET_
:_VCTSCheck_Next :_VCTSCheck_Next
shift shift
@ -165,6 +183,7 @@ if "%_VC_NUM_%" neq "" set %_VC_TMP%=%~1
if "%_VC_NUM_%" neq "" goto _VCTSCheck_Done if "%_VC_NUM_%" neq "" goto _VCTSCheck_Done
goto _VCTSCheck_Next goto _VCTSCheck_Next
:_VCTSCheck_Done :_VCTSCheck_Done
if "%~1" equ "18" set %_VCTMP%=2026
set _VC_TMP_= set _VC_TMP_=
set _VC_TMP= set _VC_TMP=
set _VC_NUM_= set _VC_NUM_=
@ -223,6 +242,10 @@ set %2=%~n1
exit /B 0 exit /B 0
:GotVC :GotVC
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%
if "%_VC_VER%" == "18" set _VC_VER=2026
set _BUILD_PARALLEL=8 set _BUILD_PARALLEL=8
if %_BUILD_PARALLEL% GTR %NUMBER_OF_PROCESSORS% set _BUILD_PARALLEL=%NUMBER_OF_PROCESSORS% if %_BUILD_PARALLEL% GTR %NUMBER_OF_PROCESSORS% set _BUILD_PARALLEL=%NUMBER_OF_PROCESSORS%
set _SLN_FILE=%_BUILD_PROJECT_DIR%Simh.sln set _SLN_FILE=%_BUILD_PROJECT_DIR%Simh.sln
@ -246,21 +269,23 @@ goto _NextProject
:_DoMSBuild :_DoMSBuild
if "%_X_SLN_VERSION%" == "10.00" set _NEW_SLN_FILE=%_BUILD_PROJECT_DIR%Simh-%_VC_VER%.sln if "%_X_SLN_VERSION%" == "10.00" set _NEW_SLN_FILE=%_BUILD_PROJECT_DIR%Simh-%_VC_VER%.sln
if "%_X_SLN_VERSION%" == "10.00" copy /y "%_SLN_FILE%" "%_NEW_SLN_FILE%" >NUL & echo Converting the VS2008 projects to VS%_VC_VER%, this will take several (5-8) minutes & DevEnv /Upgrade "%_NEW_SLN_FILE%" & set _SLN_FILE=%_NEW_SLN_FILE% if "%_X_SLN_VERSION%" == "10.00" copy /y "%_SLN_FILE%" "%_NEW_SLN_FILE%" >NUL & echo Converting the VS2008 projects to VS%_VC_VER%, this will take several (5-8) minutes... & echo Project conversion starting at %TIME% & DevEnv /Upgrade "%_NEW_SLN_FILE%" & set _SLN_FILE=%_NEW_SLN_FILE%
if not "%_NEW_SLN_FILE%" == "" echo Project conversion completed at %TIME%
set _NEW_SLN_FILE= set _NEW_SLN_FILE=
if not "%_VC_VER%" == "2022" goto _RunBuild if not "%_VC_VER%" == "2022" if not "%_VC_VER%" == "2026" goto _RunBuild
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\v141_xp" goto _DoXPConvert if exist "%_VC_DIR%\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\v141" goto _DoV141Convert
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\v141_xp" goto _DoXPConvert for /F "usebackq tokens=8" %%a in (`findstr /C:"Microsoft Visual Studio Solution File, Format Version" "%_SLN_FILE%"`) do SET _X_SLN_VERSION=%%a
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\v141_xp" goto _DoXPConvert if "%_X_SLN_VERSION%" == "10.00" goto _DoV141Convert
goto _RunBuild goto _RunBuild
:_DoXPConvert :_DoV141Convert
echo Doing XP Convert
set _X_PROJS_CONVERTED= set _X_PROJS_CONVERTED=
for /F "usebackq tokens=1" %%a in (`findstr /C:"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>" "%_BUILD_PROJECT_DIR%BuildROMs.vcxproj"`) do set _X_PROJS_CONVERTED=%%a for /F "usebackq tokens=1" %%a in (`findstr /C:"<WindowsTargetPlatformVersion>10." "%_BUILD_PROJECT_DIR%BuildROMs.vcxproj"`) do set _X_PROJS_CONVERTED=%%a
if not "%_X_PROJS_CONVERTED%" == "" goto _RunBuild if not "%_X_PROJS_CONVERTED%" == "" goto _RunBuild
echo Converting the VS2022 projects to generate XP compatible binaries echo v141 Convert starting at %TIME%
Powershell -NoLogo -File "%~dp0\Visual Studio Projects\ConvertToXPProject.ps1" "%~dp0\Visual Studio Projects\*.vcxproj" echo Converting the VS2022 or VS2026 projects to used the 2017 support libraries
Powershell -NoLogo -File "%~dp0\Visual Studio Projects\ConvertToV141Project.ps1" "%_SLN_FILE%"
echo v141 Convert completed at %TIME%
set _X_PROJS_CONVERTED= set _X_PROJS_CONVERTED=
:_RunBuild :_RunBuild