-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.bat
More file actions
90 lines (70 loc) · 2.5 KB
/
build.bat
File metadata and controls
90 lines (70 loc) · 2.5 KB
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
88
89
90
@ECHO off
SetLocal EnableDelayedExpansion
IF NOT EXIST bin mkdir bin
IF NOT EXIST bin\int mkdir bin\int
call vcvarsall.bat x64
SET cc=cl.exe
REM ------------------
REM Options
REM ------------------
SET Use_Render2D=false
SET Use_Physics2D=false
SET Use_UI=true
REM ------------------
REM Main Project
REM ------------------
REM ==============
REM Gets list of all C files
SET c_filenames=
FOR %%f in (source\*.c) do SET c_filenames=!c_filenames! %%f
FOR %%f in (source\base\*.c) do SET c_filenames=!c_filenames! %%f
FOR %%f in (source\impl\*.c) do SET c_filenames=!c_filenames! %%f
FOR %%f in (source\core\*.c) do SET c_filenames=!c_filenames! %%f
FOR %%f in (source\os\*.c) do SET c_filenames=!c_filenames! %%f
REM ==============
REM ==============
REM optional layers
if %Use_Render2D% == true (
ECHO Optional Layer Selected: Render2D
SET c_filenames=!c_filenames! source\opt\render_2d.c
)
if %Use_Physics2D% == true (
ECHO Optional Layer Selected: Physics2D
SET c_filenames=!c_filenames! source\opt\phys_2d.c
)
if %Use_UI% == true (
ECHO Optional Layer Selected: UI
SET c_filenames=!c_filenames! source\opt\ui.c
)
REM ==============
SET backend=BACKEND_D3D11
REM ==============
if %cc% == cl.exe (
SET compiler_flags=/Zc:preprocessor /wd4090 /wd5105
SET include_flags=/I.\source\ /I.\third_party\include\ /I.\third_party\source\
SET linker_flags=/link /DEBUG /LIBPATH:.\third_party\lib shell32.lib user32.lib winmm.lib userenv.lib gdi32.lib
SET output=/Fe.\bin\codebase /Fo.\bin\int\
SET defines=/D_DEBUG /D_CRT_SECURE_NO_WARNINGS /D%backend%
)
if %cc% == clang (
SET compiler_flags=-Wall -Wvarargs -Werror -Wno-unused-function -Wno-format-security -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-but-set-variable -Wno-int-to-void-pointer-cast
SET include_flags=-Isource -Ithird_party/include -Ithird_party/source
SET linker_flags=-g -lshell32 -luser32 -lwinmm -luserenv -lgdi32 -Lthird_party/lib
SET output=-obin/codebase.exe
SET defines=-D_DEBUG -D_CRT_SECURE_NO_WARNINGS -D%backend%
)
REM ==============
REM ==============
REM TODO(voxel): REMOVE BACKEND SPECIFIC LINKS
if %backend% == BACKEND_D3D11 (
if %cc% == cl.exe (
SET linker_flags=%linker_flags% dxguid.lib d3dcompiler.lib
)
if %cc% == clang (
SET linker_flags=%linker_flags% -ldxguid -ld3dcompiler
)
)
REM ==============
REM SET compiler_flags=!compiler_flags! -fsanitize=address
ECHO Building codebase.exe...
%cc% %compiler_flags% %c_filenames% %defines% %include_flags% %output% %linker_flags%