author | alfadur <mail@none> |
Tue, 24 Dec 2019 22:12:02 +0300 | |
changeset 15550 | 17ad5d43e820 |
parent 15371 | 81037b6052f4 |
child 15978 | 4ec24af5909a |
permissions | -rw-r--r-- |
13944 | 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 | 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 |
|
15371
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
6 |
::change between Debug and Release |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
7 |
set BUILD_TYPE=Release |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
8 |
::path where Hedgewars will be installed to |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
9 |
::default is %ProgramFiles%\hedgewars and requires running this script as administrator |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
10 |
set INSTALL_LOCATION= |
13944 | 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= |
|
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
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:
15368
diff
changeset
|
18 |
set FORCE_X64_CROSS_COMPILE= |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
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:
15368
diff
changeset
|
20 |
set BUILD_SERVER= |
13944 | 21 |
|
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
22 |
::CONFIG END |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
23 |
|
13944 | 24 |
:setup |
25 |
set CURRDIR="%CD%" |
|
26 |
cd %CURRDIR%\..\ |
|
27 |
||
28 |
set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH% |
|
29 |
||
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
30 |
if "%VSCMD_ARG_TGT_ARCH%" == "x64" ( |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
31 |
set FORCE_X64_CROSS_COMPILE=1 |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
32 |
) |
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 |
if "%FORCE_X64_CROSS_COMPILE%" NEQ "" ( |
15371
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
35 |
set CROSS_COMPILE_FLAG=-DWIN32_WIN64_CROSS_COMPILE=1 |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
36 |
if "%INSTALL_LOCATION%" == "" ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
37 |
set INSTALL_LOCATION=%ProgramFiles%/hedgewars |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
38 |
) |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
39 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
40 |
set CROSS_COMPILE_FLAG= |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
41 |
) |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
42 |
|
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
43 |
if "%INSTALL_LOCATION%" NEQ "" ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
44 |
set PREFIX_FLAG=-DCMAKE_INSTALL_PREFIX=%INSTALL_LOCATION% |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
45 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
46 |
set PREFIX_FLAG= |
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
47 |
) |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
48 |
|
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
49 |
if "%BUILD_SERVER%" == "" ( |
15371
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
50 |
set BUILD_SERVER_FLAG=-DNOSERVER=1 |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
51 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
52 |
set BUILD_SERVER_FLAG= |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
diff
changeset
|
53 |
) |
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
54 |
|
13944 | 55 |
echo Running cmake... |
56 |
set ERRORLEVEL= |
|
57 |
||
15371
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15370
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 |
13944 | 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 |
||
15336 | 73 |
nmake install |
74 |
||
13944 | 75 |
:exitpoint |
76 |
cd %CURRDIR% |
|
15370
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
77 |
|
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15368
diff
changeset
|
78 |
endlocal |
13944 | 79 |
pause |