35 lines
1.3 KiB
Bash
Executable File
35 lines
1.3 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
|
|
|
|
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
|
|
# cmake -S . -B build_linux -DCMAKE_BUILD_TYPE=Release -DSDL_PIPEWIRE=OFF
|
|
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=address,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
|
|
|
|
time clang -o te $flags ../src/text_editor.cpp $I -lSDL3 -lm -lbacktrace
|