forked from Tkap1/epic_online_thing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
88 lines (71 loc) · 2.49 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@echo off
cls
if NOT defined VSCMD_ARG_TGT_ARCH (
@REM Replace with your path
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
)
if not exist build\NUL mkdir build
set comp=-nologo -std:c++20 -Zc:strictStrings- -W4 -FC -Gm- -GR- -EHa- -wd 4324 -wd 4127 -wd 4505 -D_CRT_SECURE_NO_WARNINGS
@REM @TODO(tkap, 15/10/2023): We increase stack size because we just use too much. What we actually want is to use an arena for the things
@REM that are too big for the stack. I tried but ran into problems and I'm too lazy to figure it out.
set linker=user32.lib Shell32.lib -INCREMENTAL:NO -STACK:0x200000,0x200000
set debug=2
if %debug%==0 (
set comp=%comp% -O2 -MT
)
if %debug%==1 (
set comp=%comp% -O2 -Dm_debug -MTd
)
if %debug%==2 (
set comp=%comp% -Od -Dm_debug -Zi -MTd
)
@REM taskkill /IM "client.exe" > NUL 2> NUL
@REM taskkill /IM "server.exe" > NUL 2> NUL
SETLOCAL ENABLEDELAYEDEXPANSION
pushd build
..\stamp_timer.exe start
cl ..\src\client.cpp -LD -Feclient.dll %comp% -Dm_app -link %linker% -PDB:client.pdb opengl32.lib > temp_compiler_output.txt
if NOT !ErrorLevel! == 0 (
type temp_compiler_output.txt
popd
goto fail
)
type temp_compiler_output.txt
cl ..\src\server.cpp -LD -Feserver.dll %comp% -Dm_app -link %linker% -PDB:server.pdb > temp_compiler_output.txt
if NOT !ErrorLevel! == 0 (
type temp_compiler_output.txt
popd
goto fail
)
type temp_compiler_output.txt
tasklist /fi "ImageName eq client.exe" /fo csv 2>NUL | find /I "client.exe">NUL
if NOT !ERRORLEVEL!==0 (
cl ..\src\win32_platform_client.cpp -Feclient.exe %comp% -Dm_app -link %linker% -PDB:platform_client.pdb gdi32.lib opengl32.lib Xinput.lib Ole32.lib Winmm.lib "..\enet64.lib" Ws2_32.lib > temp_compiler_output.txt
if NOT !ErrorLevel! == 0 (
type temp_compiler_output.txt
popd
goto fail
)
type temp_compiler_output.txt
)
tasklist /fi "ImageName eq server.exe" /fo csv 2>NUL | find /I "server.exe">NUL
if NOT !ERRORLEVEL!==0 (
cl ..\src\win32_platform_server.cpp -Feserver.exe %comp% -Dm_app -link %linker% "..\enet64.lib" Ws2_32.lib Winmm.lib -PDB:platform_server.pdb > temp_compiler_output.txt
if NOT !ErrorLevel! == 0 (
type temp_compiler_output.txt
popd
goto fail
)
type temp_compiler_output.txt
)
..\stamp_timer.exe end
popd
if %errorlevel%==0 goto success
goto fail
:success
copy build\server.exe server.exe > NUL
copy build\client.exe client.exe > NUL
goto end
:fail
:end
copy build\temp_compiler_output.txt compiler_output.txt > NUL