tools/build_vcpkg.bat
changeset 15355 81037b6052f4
parent 15354 96254b857257
equal deleted inserted replaced
15354:96254b857257 15355:81037b6052f4
     1 @echo off
     1 @echo off
     2 setlocal
     2 setlocal
     3 ::CONFIG START
     3 ::CONFIG START
     4 ::edit these variables if necessary
     4 ::edit these variables if necessary
     5 
     5 
     6 ::change between "Debug" and "Release"
     6 ::change between Debug and Release
     7 set BUILD_TYPE="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=
     8 ::set if vcpkg is not on path
    11 ::set if vcpkg is not on path
     9 set VCPKG_PATH=%VCPKG_ROOT%
    12 set VCPKG_PATH=%VCPKG_ROOT%
    10 ::set if CMake is not on path
    13 ::set if CMake is not on path
    11 set CMAKE_PATH=
    14 set CMAKE_PATH=
    12 ::set if FPC is not on path
    15 ::set if FPC is not on path
    27 if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
    30 if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
    28     set FORCE_X64_CROSS_COMPILE=1
    31     set FORCE_X64_CROSS_COMPILE=1
    29 )
    32 )
    30 
    33 
    31 if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
    34 if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
    32     set CROSS_COMPILE_FLAG="-DWIN32_WIN64_CROSS_COMPILE=1"
    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=
    33 )
    47 )
    34 
    48 
    35 if "%BUILD_SERVER%" == "" (
    49 if "%BUILD_SERVER%" == "" (
    36     set BUILD_SERVER_FLAG="-DNOSERVER=1"
    50     set BUILD_SERVER_FLAG=-DNOSERVER=1
    37 )              
    51 ) else (
       
    52     set BUILD_SERVER_FLAG=
       
    53 )             
    38 
    54 
    39 echo Running cmake...
    55 echo Running cmake...
    40 set ERRORLEVEL=
    56 set ERRORLEVEL=
    41 
    57 
    42 cmake . -DCMAKE_TOOLCHAIN_FILE="%VCPKG_PATH%\scripts\buildsystems\vcpkg.cmake" -G"NMake Makefiles" "%CROSS_COMPILE_FLAG%" "%BUILD_SERVER_FLAG%" -DCMAKE_BUILD_TYPE="%BUILD_TYPE%" -DSDL2_BUILDING_LIBRARY=1
    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
    43 
    59 
    44 if %ERRORLEVEL% NEQ 0 goto exitpoint
    60 if %ERRORLEVEL% NEQ 0 goto exitpoint
    45 
    61 
    46 echo Configuration completed successfully
    62 echo Configuration completed successfully
    47 
    63