tools/build_vcpkg.bat
author Wuzzy <Wuzzy2@mail.ru>
Sat, 06 Jun 2020 15:40:51 +0200
changeset 15597 6e72bd61002e
parent 15350 81037b6052f4
child 15948 4ec24af5909a
permissions -rw-r--r--
Disable gfMoreWind for land objects on turn end only after a fixed-time delay 15s sounds much, but it's the average amount for gfMineStrike mines to settle naturally. And it would be very confusing to see falling mines suddenly not caring about gfMoreWind for no apparent reason. Note this whole thing is a giant hack anyway, to prevent a turn being blocked by infinitely bouncing mines. The better solution would be to help gfMoreWind-affected land objects settle naturally more reliably even under extreme wind. But this commit is "good enough" for now. If you don't like the delay, you can always tweak the constant.

@echo off
setlocal
::CONFIG START
::edit these variables if necessary

::change between Debug and Release
set BUILD_TYPE=Release
::path where Hedgewars will be installed to
::default is %ProgramFiles%\hedgewars and requires running this script as administrator  
set INSTALL_LOCATION=
::set if vcpkg is not on path
set VCPKG_PATH=%VCPKG_ROOT%
::set if CMake is not on path
set CMAKE_PATH=
::set if FPC is not on path
set PASCAL_PATH=
::set to 1 if x86 to x64 cross-compiler is not enabled automatically
set FORCE_X64_CROSS_COMPILE=
::set to 1 to build the game server
set BUILD_SERVER=

::CONFIG END
            
:setup
set CURRDIR="%CD%"
cd %CURRDIR%\..\

set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH%

if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
    set FORCE_X64_CROSS_COMPILE=1
)

if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
    set CROSS_COMPILE_FLAG=-DWIN32_WIN64_CROSS_COMPILE=1
    if "%INSTALL_LOCATION%" == "" (
        set INSTALL_LOCATION=%ProgramFiles%/hedgewars
    )
) else (
    set CROSS_COMPILE_FLAG=
)

if "%INSTALL_LOCATION%" NEQ "" (
    set PREFIX_FLAG=-DCMAKE_INSTALL_PREFIX=%INSTALL_LOCATION%
) else (
    set PREFIX_FLAG=
)

if "%BUILD_SERVER%" == "" (
    set BUILD_SERVER_FLAG=-DNOSERVER=1
) else (
    set BUILD_SERVER_FLAG=
)             

echo Running cmake...
set ERRORLEVEL=

cmake . -DCMAKE_TOOLCHAIN_FILE="%VCPKG_PATH%\scripts\buildsystems\vcpkg.cmake" -G"NMake Makefiles" %CROSS_COMPILE_FLAG% %BUILD_SERVER_FLAG% "%PREFIX_FLAG%" -DCMAKE_BUILD_TYPE="%BUILD_TYPE%" -DSDL2_BUILDING_LIBRARY=1

if %ERRORLEVEL% NEQ 0 goto exitpoint

echo Configuration completed successfully

echo Building...
set ERRORLEVEL=

nmake

if %ERRORLEVEL% NEQ 0 goto exitpoint

echo Build completed successfully

nmake install

:exitpoint
cd %CURRDIR%

endlocal
pause