tools/build_vcpkg.bat
author alfadur
Thu, 22 Aug 2019 22:46:19 +0300
changeset 15370 96254b857257
parent 15368 1a4ec45a4803
child 15371 81037b6052f4
permissions -rw-r--r--
update windows build to detect when a cross-compiler is necessary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     1
@echo off
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
     2
setlocal
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
     3
::CONFIG START
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     4
::edit these variables if necessary
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
     5
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
     6
::change between "Debug" and "Release"
15336
90f9a0eac3ae remove nopng from vcpkg build
alfadur
parents: 14289
diff changeset
     7
set BUILD_TYPE="Release"
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     8
::set if vcpkg is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
     9
set VCPKG_PATH=%VCPKG_ROOT%
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    10
::set if CMake is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    11
set CMAKE_PATH=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    12
::set if FPC is not on path
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    13
set PASCAL_PATH=
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    14
::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: 15368
diff changeset
    15
set FORCE_X64_CROSS_COMPILE=
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    16
::set to 1 to build the game server
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    17
set BUILD_SERVER=
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    18
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    19
::CONFIG END
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    20
            
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    21
:setup
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    22
set CURRDIR="%CD%"
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    23
cd %CURRDIR%\..\
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    24
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    25
set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH%
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    26
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    27
if "%VSCMD_ARG_TGT_ARCH%" == "x64" (
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    28
    set FORCE_X64_CROSS_COMPILE=1
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    29
)
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    30
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    31
if "%FORCE_X64_CROSS_COMPILE%" NEQ "" (
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    32
    set CROSS_COMPILE_FLAG="-DWIN32_WIN64_CROSS_COMPILE=1"
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    33
)
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    34
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    35
if "%BUILD_SERVER%" == "" (
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    36
    set BUILD_SERVER_FLAG="-DNOSERVER=1"
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    37
)              
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    38
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    39
echo Running cmake...
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    40
set ERRORLEVEL=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    41
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    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
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    43
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    44
if %ERRORLEVEL% NEQ 0 goto exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    45
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    46
echo Configuration completed successfully
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    47
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    48
echo Building...
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    49
set ERRORLEVEL=
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    50
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    51
nmake
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    52
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    53
if %ERRORLEVEL% NEQ 0 goto exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    54
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    55
echo Build completed successfully
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    56
15336
90f9a0eac3ae remove nopng from vcpkg build
alfadur
parents: 14289
diff changeset
    57
nmake install
90f9a0eac3ae remove nopng from vcpkg build
alfadur
parents: 14289
diff changeset
    58
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    59
:exitpoint
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    60
cd %CURRDIR%
15370
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    61
96254b857257 update windows build to detect when a cross-compiler is necessary
alfadur
parents: 15368
diff changeset
    62
endlocal
13944
4d63acb2b978 Add basic windows build script
alfadur
parents:
diff changeset
    63
pause