#!/bin/bash # author: nasr # rebuilds only the ui (build/player_ui.so). a running debug build picks it up instantly: # it watches build/ with inotify and swaps the new code in, audio and downloads keep going. set -e cd "$(dirname "$0")" date echo "Reloading the mp3_player ui" BUILD_DIR=build SOURCE_DIR=source GEN_DIR=${BUILD_DIR}/generated INCLUDES="-I${SOURCE_DIR} -I${SOURCE_DIR}/base -I${SOURCE_DIR}/core -I${SOURCE_DIR}/platform -I${SOURCE_DIR}/render -I${SOURCE_DIR}/audio -I${SOURCE_DIR}/net -I${SOURCE_DIR}/player -I${GEN_DIR}" INCLUDES+=" $(pkg-config --cflags libpipewire-0.3 freetype2 harfbuzz xkbcommon libmpg123 libcurl)" CFLAGS="-std=c++20 -fno-rtti -fno-exceptions -Wall -Wundef -Werror -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-missing-field-initializers -fno-omit-frame-pointer" CFLAGS+=" -DWAYLAND=1 -DVULKAN=1 -O0 -g3 -DDEBUG=1 -DPLAYER_HOT_RELOAD=1 -DPLAYER_UI_DLL=1" LIBS="-pthread -lm -ldl -lvulkan -lwayland-client $(pkg-config --libs libpipewire-0.3 freetype2 harfbuzz xkbcommon libmpg123 libcurl)" if [ ! -f "${GEN_DIR}/catalog_seed.h" ]; then echo "run ./build.sh once first" exit 1 fi time g++ $INCLUDES $CFLAGS -fPIC -shared "${SOURCE_DIR}/player/player.cpp" ${GEN_DIR}/*-protocol.o -fuse-ld=mold -o "${BUILD_DIR}/player_ui.so.tmp" $LIBS mv "${BUILD_DIR}/player_ui.so.tmp" "${BUILD_DIR}/player_ui.so" echo "==== RELOAD BUILT ===="