2024-09-24 02:49:24 +03:00
|
|
|
REM To build the project for an architecture other than x64, pass the -A flag to the script.
|
|
|
|
REM Example: build.bat -A arm64 -DCMAKE_ENABLE...
|
2020-12-05 10:37:53 +03:00
|
|
|
@ECHO OFF
|
|
|
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
2024-06-18 02:58:11 +03:00
|
|
|
|
|
|
|
IF NOT EXIST "%ProgramFiles%\CMake\bin\cmake.exe" GOTO :FIND_VS
|
|
|
|
set cmake_exe="%ProgramFiles%\CMake\bin\cmake.exe"
|
|
|
|
|
|
|
|
:FIND_VS
|
2022-05-12 02:51:59 +03:00
|
|
|
IF DEFINED VSINSTALLDIR GOTO :VSDEV_CMD
|
2023-02-07 05:23:56 +03:00
|
|
|
set _VSFINDER=%~dp0tools\get_vsdevcmd.ps1
|
|
|
|
for /f "tokens=* USEBACKQ" %%i in (
|
|
|
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "%_VSFINDER%"`) do call "%%i"
|
2020-12-05 10:37:53 +03:00
|
|
|
|
2023-02-07 05:23:56 +03:00
|
|
|
IF NOT DEFINED VSINSTALLDIR GOTO :NOT_FOUND
|
2022-05-12 02:51:59 +03:00
|
|
|
|
2024-06-18 02:58:11 +03:00
|
|
|
IF DEFINED cmake_exe GOTO :CMAKE_DEF
|
|
|
|
set cmake_exe="%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
|
|
|
|
|
|
|
|
:CMAKE_DEF
|
2023-03-09 02:00:01 +03:00
|
|
|
IF "%1" == "-A" GOTO :VSDEV_CMD
|
|
|
|
set GEN_PLATFORM=-A x64
|
|
|
|
|
2022-05-12 02:51:59 +03:00
|
|
|
:VSDEV_CMD
|
|
|
|
set GENERATOR="Visual Studio 16 2019"
|
|
|
|
IF "%VisualStudioVersion:~0,2%" == "16" GOTO :START_BUILD
|
|
|
|
set GENERATOR="Visual Studio 17 2022"
|
|
|
|
|
|
|
|
:START_BUILD
|
2020-10-20 22:53:14 +03:00
|
|
|
mkdir .\out\Windows\ 2>NUL
|
2024-06-18 02:58:11 +03:00
|
|
|
ECHO %cmake_exe% -G %GENERATOR% %GEN_PLATFORM% %* -B out\Windows -S .
|
2023-03-09 02:00:01 +03:00
|
|
|
%cmake_exe% -G %GENERATOR% %GEN_PLATFORM% %* -B out\Windows -S .
|
2020-12-05 10:37:53 +03:00
|
|
|
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
2022-08-04 20:13:17 +03:00
|
|
|
%cmake_exe% --build out\Windows --config RelWithDebInfo
|
2020-12-05 10:37:53 +03:00
|
|
|
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
|
|
|
GOTO :EOF
|
|
|
|
|
|
|
|
:NOT_FOUND
|
2022-08-02 20:09:35 +03:00
|
|
|
ECHO "No Microsoft Visual Studio installation found!"
|
|
|
|
ECHO " Please run build from Developer Command Prompt"
|
2020-12-05 10:37:53 +03:00
|
|
|
EXIT /B 1
|
|
|
|
|
|
|
|
ENDLOCAL
|