r5sdk/CreateSolution.bat

39 lines
873 B
Batchfile
Raw Permalink Normal View History

2023-05-13 00:15:53 +02:00
@echo off
setlocal
2023-05-13 00:15:53 +02:00
set BUILDDIR=build_intermediate
set BINDIR=game
2023-05-13 00:15:53 +02:00
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
2023-05-13 00:15:53 +02:00
if not exist "%BUILDDIR%" (
mkdir "%BUILDDIR%"
)
if not exist "%BINDIR%" (
mkdir "%BINDIR%"
)
2023-05-13 00:15:53 +02:00
cd "%BUILDDIR%"
cmake .. -G"%CMAKE_GENERATOR%" -A"x64"
2023-05-13 00:15:53 +02:00
cd ..
echo Finished generating solution files.