tools/build_vcpkg.bat
author Wuzzy <Wuzzy2@mail.ru>
Tue, 29 Oct 2019 22:03:08 +0100
changeset 15499 55436712b5e9
parent 15355 81037b6052f4
permissions -rw-r--r--
Rope Training: Add flower effects when player returns all the way to the start
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     1
@echo off
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
     2
setlocal
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
     3
::CONFIG START
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     4
::edit these variables if necessary
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
     5
15355
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
     6
::change between Debug and Release
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
     7
set BUILD_TYPE=Release
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
     8
::path where Hedgewars will be installed to
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
     9
::default is %ProgramFiles%\hedgewars and requires running this script as administrator  
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    10
set INSTALL_LOCATION=
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    11
::set if vcpkg is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    12
set VCPKG_PATH=%VCPKG_ROOT%
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    13
::set if CMake is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    14
set CMAKE_PATH=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    15
::set if FPC is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    16
set PASCAL_PATH=
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    17
::set to 1 if x86 to x64 cross-compiler is not enabled automatically
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    18
set FORCE_X64_CROSS_COMPILE=
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    19
::set to 1 to build the game server
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    20
set BUILD_SERVER=
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    21
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    22
::CONFIG END
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    23
            
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    24
:setup
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    25
set CURRDIR="%CD%"
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    26
cd %CURRDIR%\..\
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    27
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    28
set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH%
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    29
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    30
if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    31
    set FORCE_X64_CROSS_COMPILE=1
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    32
)
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    33
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    34
if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
15355
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    35
    set CROSS_COMPILE_FLAG=-DWIN32_WIN64_CROSS_COMPILE=1
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    36
    if "%INSTALL_LOCATION%" == "" (
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    37
        set INSTALL_LOCATION=%ProgramFiles%/hedgewars
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    38
    )
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    39
) else (
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    40
    set CROSS_COMPILE_FLAG=
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    41
)
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    42
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    43
if "%INSTALL_LOCATION%" NEQ "" (
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    44
    set PREFIX_FLAG=-DCMAKE_INSTALL_PREFIX=%INSTALL_LOCATION%
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    45
) else (
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    46
    set PREFIX_FLAG=
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    47
)
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    48
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    49
if "%BUILD_SERVER%" == "" (
15355
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    50
    set BUILD_SERVER_FLAG=-DNOSERVER=1
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    51
) else (
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    52
    set BUILD_SERVER_FLAG=
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    53
)             
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    54
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    55
echo Running cmake...
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    56
set ERRORLEVEL=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    57
15355
81037b6052f4 install win64 builds into ProgramFiles by default
alfadur
parents: 15354
diff changeset
    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
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    59
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    60
if %ERRORLEVEL% NEQ 0 goto exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    61
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    62
echo Configuration completed successfully
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    63
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    64
echo Building...
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    65
set ERRORLEVEL=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    66
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    67
nmake
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    68
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    69
if %ERRORLEVEL% NEQ 0 goto exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    70
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    71
echo Build completed successfully
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    72
15320
90f9a0eac3ae remove nopng from vcpkg build
alfadur
parents: 14273
diff changeset
    73
nmake install
90f9a0eac3ae remove nopng from vcpkg build
alfadur
parents: 14273
diff changeset
    74
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    75
:exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    76
cd %CURRDIR%
15354
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    77
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15352
diff changeset
    78
endlocal
13928
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    79
pause