Files
text_editor/build.sh
2026-06-30 10:25:15 +02:00

38 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/bash
for arg in "$@"; do declare $arg='1'; done
if [ ! -v release ]; then debug=1; fi
if [ -v debug ]; then echo "[debug build]"; fi
if [ -v release ]; then echo "[release build]"; fi
if [ -v slow ]; then echo "[slow build]"; fi
if [ -v addr ]; then echo "[address sanitizer build]"; fi
mkdir -p build
# if [ ! -e "src/external/SDL" ]; then
# cd src/external
# git clone https://github.com/libsdl-org/SDL.git
# cd SDL
# git checkout release-3.2.30
# # We need older version of SDL3 because there is a bug on wayland that
# # doubles click events and it's kind of unusable
# cmake -S . -B build_linux -DSDL_PIPEWIRE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
# cd build_linux
# sudo make -j16 install
# cd ../../../..
# fi
cd build
I="-I../src/external/SDL/include -I../src/external/glad"
flags="-Wall -Wextra -Werror -Wformat=2 -Wundef -Wshadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-writable-strings \
-g -fdiagnostics-absolute-paths \
-nostdlib++ -fno-exceptions"
if [ -v debug ]; then flags="$flags -fsanitize=undefined -fno-omit-frame-pointer -DDEBUG_BUILD=1"; fi
if [ -v release ]; then flags="$flags -DDEBUG_BUILD=0 -O2"; fi
if [ -v slow ]; then flags="$flags -DSLOW_BUILD=1"; fi
if [ -v addr ]; then flags="$flags -fsanitize=address"; fi
time clang -o te $flags ../src/text_editor.cpp $I -lSDL3 -lm -lbacktrace
./te :RunTests