author | alfadur |
Mon, 25 Mar 2024 16:05:11 +0300 | |
changeset 16000 | d9f1b239b6d7 |
parent 15948 | 4ec24af5909a |
permissions | -rw-r--r-- |
13923 | 1 |
@echo off |
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
2 |
setlocal |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
3 |
::CONFIG START |
13923 | 4 |
::edit these variables if necessary |
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
5 |
|
15350
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
6 |
::change between Debug and Release |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
7 |
set BUILD_TYPE=Release |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
8 |
::path where Hedgewars will be installed to |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
9 |
::default is %ProgramFiles%\hedgewars and requires running this script as administrator |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
10 |
set INSTALL_LOCATION= |
13923 | 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= |
|
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
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:
15347
diff
changeset
|
18 |
set FORCE_X64_CROSS_COMPILE= |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
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:
15347
diff
changeset
|
20 |
set BUILD_SERVER= |
13923 | 21 |
|
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
22 |
::CONFIG END |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
23 |
|
13923 | 24 |
:setup |
25 |
set CURRDIR="%CD%" |
|
26 |
cd %CURRDIR%\..\ |
|
27 |
||
28 |
set PATH=%PASCAL_PATH%;%VCPKG_PATH%;%CMAKE_PATH%;%PATH% |
|
29 |
||
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
30 |
if "%VSCMD_ARG_TGT_ARCH%" == "x64" ( |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
31 |
set FORCE_X64_CROSS_COMPILE=1 |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
32 |
) |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
33 |
|
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
34 |
if "%FORCE_X64_CROSS_COMPILE%" NEQ "" ( |
15350
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
35 |
set CROSS_COMPILE_FLAG=-DWIN32_WIN64_CROSS_COMPILE=1 |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
36 |
if "%INSTALL_LOCATION%" == "" ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
37 |
set INSTALL_LOCATION=%ProgramFiles%/hedgewars |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
38 |
) |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
39 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
40 |
set CROSS_COMPILE_FLAG= |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
41 |
) |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
42 |
|
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
43 |
if "%INSTALL_LOCATION%" NEQ "" ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
44 |
set PREFIX_FLAG=-DCMAKE_INSTALL_PREFIX=%INSTALL_LOCATION% |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
45 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
46 |
set PREFIX_FLAG= |
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
47 |
) |
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
48 |
|
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
49 |
if "%BUILD_SERVER%" == "" ( |
15350
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
50 |
set BUILD_SERVER_FLAG=-DNOSERVER=1 |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
51 |
) else ( |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
52 |
set BUILD_SERVER_FLAG= |
81037b6052f4
install win64 builds into ProgramFiles by default
alfadur
parents:
15349
diff
changeset
|
53 |
) |
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
54 |
|
13923 | 55 |
echo Running cmake... |
56 |
set ERRORLEVEL= |
|
57 |
||
15948 | 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 -DNOVIDEOREC=1 |
13923 | 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 |
||
15315 | 73 |
nmake install |
74 |
||
13923 | 75 |
:exitpoint |
76 |
cd %CURRDIR% |
|
15349
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
77 |
|
96254b857257
update windows build to detect when a cross-compiler is necessary
alfadur
parents:
15347
diff
changeset
|
78 |
endlocal |
13923 | 79 |
pause |