-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.sh
executable file
·94 lines (73 loc) · 1.83 KB
/
build.sh
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
91
92
93
94
if [ ! -d ./bin ]; then
mkdir bin
fi
cc=clang
# ------------------
# Options
# ------------------
Use_Render2D=false
Use_Physics2D=false
Use_UI=true
# ------------------
# Main Project
# ------------------
# ==============
# Gets list of all C files
c_filenames=
for entry in ./source/*.c
do
c_filenames="$c_filenames $entry"
done
for entry in ./source/base/*.c
do
c_filenames="$c_filenames $entry"
done
for entry in ./source/impl/*.c
do
c_filenames="$c_filenames $entry"
done
for entry in ./source/core/*.c
do
c_filenames="$c_filenames $entry"
done
for entry in ./source/os/*.c
do
c_filenames="$c_filenames $entry"
done
# ==============
# ==============
# optional layers
if $Use_Render2D == true
then
echo Optional Layer Selected: Render2D
c_filenames="$c_filenames source/opt/render_2d.c"
fi
if $Use_Physics2D == true
then
echo Optional Layer Selected: Physics2D
c_filenames="$c_filenames source/opt/phys_2d.c"
fi
if $Use_UI == true
then
echo Optional Layer Selected: UI
c_filenames="$c_filenames source/opt/ui.c"
fi
# ==============
# ==============
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"
include_flags="-Isource -Ithird_party/include -Ithird_party/source"
linker_flags="-g -lm -lX11 -Lthird_party/lib"
defines="-D_DEBUG -D_CRT_SECURE_NO_WARNINGS"
output="-obin/codebase"
backend="-DBACKEND_GL46"
# ==============
# ==============
# TODO(voxel): REMOVE BACKEND SPECIFIC LINKS
if [ "$backend" = "-DBACKEND_D3D11" ]
then
linker_flags="$linker_flags -ldxguid -ld3dcompiler"
fi
# ==============
# compiler_flags="$compiler_flags -fsanitize=address"
echo Building codebase.exe...
$cc $c_filenames $compiler_flags $defines $backend $include_flags $linker_flags $output