-
Notifications
You must be signed in to change notification settings - Fork 3
/
build
executable file
·61 lines (46 loc) · 1.43 KB
/
build
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
#!/bin/sh -e
if ! command -v cosmocc > /dev/null
then
echo "You need to add cosmopolitan toolchain to your path:"
echo "export PATH=\$PATH:<path-to-cosmopolitan>/bin"
exit 1
fi
COSMO_HOME=$(dirname $(dirname $(which cosmocc)))
FLAGS="-I deps/sokol \
-I deps/cimgui \
-mcosmo \
-mtiny \
-Wall \
-Werror"
LINUX_FLAGS="${FLAGS} -Ishims/linux"
WIN32_FLAGS="${FLAGS} -Ishims/win32 -I ${COSMO_HOME}/include/libc/nt"
mkdir -p .build
mkdir -p bin
rm -f .build/commands
compile() {
echo scripts/compile "$@" >> .build/commands
}
compile shims/sokol/sokol_windows.c ${WIN32_FLAGS}
compile shims/sokol/sokol_linux.c ${LINUX_FLAGS}
compile shims/sokol/sokol_shared.c ${FLAGS}
compile shims/sokol/sokol_cosmo.c ${FLAGS}
compile deps/cimgui/cimgui.cpp ${FLAGS}
compile deps/cimgui/imgui/imgui.cpp ${FLAGS}
compile deps/cimgui/imgui/imgui_demo.cpp ${FLAGS}
compile deps/cimgui/imgui/imgui_draw.cpp ${FLAGS}
compile deps/cimgui/imgui/imgui_tables.cpp ${FLAGS}
compile deps/cimgui/imgui/imgui_widgets.cpp ${FLAGS}
compile shims/linux/gl.c ${LINUX_FLAGS}
compile shims/linux/x11.c ${LINUX_FLAGS}
compile nvapi/nvapi.c ${WIN32_FLAGS}
compile win32_tweaks.c ${WIN32_FLAGS}
compile main.c ${FLAGS} -Invapi
if [ -t 1 ]
then
PARALLEL_FLAGS="--bar"
else
PARALLEL_FLAGS="--progress"
fi
cat .build/commands | parallel $PARALLEL_FLAGS --max-procs $(nproc)
objects=$(find .build -name '*.o' -not -path '*.aarch64/*')
cosmoc++ ${FLAGS} -o bin/cosmo-sokol $objects