tools/build_vcpkg.bat
branchui-scaling
changeset 15663 d92eeb468dad
parent 15350 81037b6052f4
child 15948 4ec24af5909a
equal deleted inserted replaced
15283:c4fd2813b127 15663:d92eeb468dad
       
     1 @echo off
       
     2 setlocal
       
     3 ::CONFIG START
       
     4 ::edit these variables if necessary
       
     5 
       
     6 ::change between Debug and Release
       
     7 set BUILD_TYPE=Release
       
     8 ::path where Hedgewars will be installed to
       
     9 ::default is %ProgramFiles%\hedgewars and requires running this script as administrator  
       
    10 set INSTALL_LOCATION=
       
    11 ::set if vcpkg is not on path
       
    12 set VCPKG_PATH=%VCPKG_ROOT%
       
    13 ::set if CMake is not on path
       
    14 set CMAKE_PATH=
       
    15 ::set if FPC is not on path
       
    16 set PASCAL_PATH=
       
    17 ::set to 1 if x86 to x64 cross-compiler is not enabled automatically
       
    18 set FORCE_X64_CROSS_COMPILE=
       
    19 ::set to 1 to build the game server
       
    20 set BUILD_SERVER=
       
    21 
       
    22 ::CONFIG END
       
    23             
       
    24 :setup
       
    25 set CURRDIR="%CD%"
       
    26 cd %CURRDIR%\..\
       
    27 
       
    28 set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH%
       
    29 
       
    30 if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
       
    31     set FORCE_X64_CROSS_COMPILE=1
       
    32 )
       
    33 
       
    34 if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
       
    35     set CROSS_COMPILE_FLAG=-DWIN32_WIN64_CROSS_COMPILE=1
       
    36     if "%INSTALL_LOCATION%" == "" (
       
    37         set INSTALL_LOCATION=%ProgramFiles%/hedgewars
       
    38     )
       
    39 ) else (
       
    40     set CROSS_COMPILE_FLAG=
       
    41 )
       
    42 
       
    43 if "%INSTALL_LOCATION%" NEQ "" (
       
    44     set PREFIX_FLAG=-DCMAKE_INSTALL_PREFIX=%INSTALL_LOCATION%
       
    45 ) else (
       
    46     set PREFIX_FLAG=
       
    47 )
       
    48 
       
    49 if "%BUILD_SERVER%" == "" (
       
    50     set BUILD_SERVER_FLAG=-DNOSERVER=1
       
    51 ) else (
       
    52     set BUILD_SERVER_FLAG=
       
    53 )             
       
    54 
       
    55 echo Running cmake...
       
    56 set ERRORLEVEL=
       
    57 
       
    58 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
       
    59 
       
    60 if %ERRORLEVEL% NEQ 0 goto exitpoint
       
    61 
       
    62 echo Configuration completed successfully
       
    63 
       
    64 echo Building...
       
    65 set ERRORLEVEL=
       
    66 
       
    67 nmake
       
    68 
       
    69 if %ERRORLEVEL% NEQ 0 goto exitpoint
       
    70 
       
    71 echo Build completed successfully
       
    72 
       
    73 nmake install
       
    74 
       
    75 :exitpoint
       
    76 cd %CURRDIR%
       
    77 
       
    78 endlocal
       
    79 pause