-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_compile_libs.sh
More file actions
executable file
·65 lines (54 loc) · 1.27 KB
/
Copy path_compile_libs.sh
File metadata and controls
executable file
·65 lines (54 loc) · 1.27 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
#!/bin/sh
set -e
: "${CC:=}"
: "${CXX:=}"
: "${AR:=ar}"
detect_cc() {
if [ -n "$CC" ]; then
return 0
fi
for c in gcc clang cc; do
if command -v "$c" >/dev/null 2>&1; then
CC="$c"
return 0
fi
done
echo "Error: C compiler not found."
exit 1
}
detect_cxx() {
if [ -n "$CXX" ]; then
return 0
fi
for c in g++ clang++ c++; do
if command -v "$c" >/dev/null 2>&1; then
CXX="$c"
return 0
fi
done
echo "Error: C++ compiler not found."
exit 1
}
ensure_imgui() {
if [ -f vendor/imgui/imgui.a ]; then
return 0
fi
detect_cxx
echo "Compiling ImGui + backends from source..."
IMGUI=vendor/imgui
SDL3INC=vendor/sdl3_headers
CFLAGS="-std=c++17 -O2 -DIMGUI_ENABLE_DOCKING -DIMGUI_IMPL_API="
INC="-I$IMGUI -I$IMGUI/backends -I$SDL3INC"
$CXX -c $CFLAGS $INC \
"$IMGUI/imgui.cpp" \
"$IMGUI/imgui_draw.cpp" \
"$IMGUI/imgui_tables.cpp" \
"$IMGUI/imgui_widgets.cpp" \
"$IMGUI/imgui_demo.cpp" \
"$IMGUI/dcimgui.cpp" \
"$IMGUI/backends/imgui_impl_sdl3.cpp" \
"$IMGUI/backends/imgui_impl_opengl3.cpp"
$AR rcs "$IMGUI/imgui.a" *.o
rm -f *.o
}
ensure_imgui