mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Automatically detect Visual Studio version
Automatically detect when using the batch file to create solution files. The system will search from Visual Studio 2017 up to Visual Studio 2022.
This commit is contained in:
parent
7078a8b10a
commit
2174cc977c
@ -1,13 +1,34 @@
|
||||
@echo off
|
||||
set CMAKE_GENERATOR=Visual Studio 16 2019
|
||||
setlocal
|
||||
|
||||
set BUILDDIR=build_intermediate
|
||||
|
||||
REM Check for Visual Studio versions in order
|
||||
for %%V in (15 16 17) do (
|
||||
reg query "HKEY_CLASSES_ROOT\VisualStudio.DTE.%%V.0" >> nul 2>&1
|
||||
if NOT ERRORLEVEL 1 (
|
||||
if "%%V"=="15" (
|
||||
set "CMAKE_GENERATOR=Visual Studio 15 2017"
|
||||
) else if "%%V"=="16" (
|
||||
set "CMAKE_GENERATOR=Visual Studio 16 2019"
|
||||
) else if "%%V"=="17" (
|
||||
set "CMAKE_GENERATOR=Visual Studio 17 2022"
|
||||
)
|
||||
echo Using Visual Studio %%V as generator.
|
||||
goto :build
|
||||
)
|
||||
)
|
||||
|
||||
echo Could not find a supported version of Visual Studio; exiting...
|
||||
exit /b 1
|
||||
|
||||
:build
|
||||
if not exist "%BUILDDIR%" (
|
||||
mkdir "%BUILDDIR%"
|
||||
)
|
||||
|
||||
cd "%BUILDDIR%"
|
||||
cmake .. -G"%CMAKE_GENERATOR%"
|
||||
cmake .. -G"%CMAKE_GENERATOR%" -A"x64"
|
||||
cd ..
|
||||
|
||||
echo Finished generating solution files.
|
||||
|
Loading…
x
Reference in New Issue
Block a user