From 46b5361ef7d29dfede509d3da140735d9375eb04 Mon Sep 17 00:00:00 2001 From: Timothy Hofland Date: Sun, 15 Mar 2026 23:13:12 +0100 Subject: [PATCH] feat: skip compilation and use pre-compiled ofxPiMapper binary for instant setup --- scripts/setup.sh | 56 +++++------------------------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index c77985e..f78107a 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -215,58 +215,12 @@ MPVJ_SSID=$WIFI_SSID MPVJ_MEDIA_DIR=$REAL_HOME/media EOF -# 4.5 THE PRE-BUILT ENGINE SOLUTION -echo "Installing Pre-compiled OpenFrameworks (FAST TRACK)..." -cd "$REAL_HOME" -if [ ! -d "openFrameworks" ]; then - echo "Downloading OpenFrameworks v0.12.1..." - ARCH=$(uname -m) - OF_FILE="of_v0.12.1_linuxaarch64_release.tar.gz" - [ "$ARCH" != "aarch64" ] && [ "$ARCH" != "x86_64" ] && OF_FILE="of_v0.12.1_linuxarmv6l_release.tar.gz" - DOWNLOAD_URL="https://github.com/openframeworks/openFrameworks/releases/download/0.12.1/$OF_FILE" - if ! sudo -u "$REAL_USER" wget "$DOWNLOAD_URL"; then - sudo -u "$REAL_USER" curl -L -O "$DOWNLOAD_URL" - fi - sudo -u "$REAL_USER" tar -xzf "$OF_FILE" - sudo -u "$REAL_USER" mv of_v0.12.1_linux*_release openFrameworks - sudo -u "$REAL_USER" rm "$OF_FILE" +# 4.5 THE PRE-BUILT ENGINE SOLUTION (FASTEST) +echo "Installing Pre-compiled ofxPiMapper Binary..." +BINARY_URL="https://gitea.superwcpot.nl/timothy/mapper/raw/branch/main/bin/ofxPiMapper" +if ! curl -sSL -o /usr/local/bin/ofxPiMapper "$BINARY_URL"; then + wget -O /usr/local/bin/ofxPiMapper "$BINARY_URL" fi - -echo "Downloading and patching ofxPiMapper..." -cd "$REAL_HOME/openFrameworks/addons" -rm -rf ofxPiMapper -sudo -u "$REAL_USER" git clone --depth 1 https://github.com/kr15h/ofxPiMapper.git - -# Apply patches locally to addon ONLY -cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper" -# 1. Highlight Patch -OSC_FILE=$(find src -name "OscControl.cpp" | head -n 1) -if [ -n "$OSC_FILE" ]; then - cat <<'EOF_PATCH' > /tmp/highlight.patch - if (m.getAddress() == "/ofxPiMapper/surface/highlight"){ - int surfaceIndex = m.getArgAsInt32(0); - mapper->getSurfaceManager()->selectSurface(surfaceIndex); - return; - } -EOF_PATCH - sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/r /tmp/highlight.patch' "$OSC_FILE" - rm -f /tmp/highlight.patch -fi - -# 2. Namespace Patches (Idempotent) -find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\([^:a-zA-Z0-9]\)unique_ptr\b/\1std::unique_ptr/g' {} + -find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\([^:a-zA-Z0-9]\)make_unique\b/\1std::make_unique/g' {} + - -# 3. Add memory headers to addon files only -for f in $(grep -l "unique_ptr" src/*.h 2>/dev/null || true); do - sed -i '1i #include ' "$f" -done - -# Build Example (NO GLOBAL FLAGS to avoid re-compiling the core) -cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example_basic" -echo "Compiling Engine (This should only take 5-10 minutes)..." -sudo -u "$REAL_USER" make -j1 -cp bin/example_basic /usr/local/bin/ofxPiMapper chmod +x /usr/local/bin/ofxPiMapper # 5. FINALIZATION