From 4c655a0512e53f39e383236b038d4a61129cb042 Mon Sep 17 00:00:00 2001 From: Timothy Hofland Date: Thu, 12 Mar 2026 21:52:19 +0100 Subject: [PATCH] fix: apply global C++17/20 compatibility patches to ofxPiMapper source --- scripts/setup.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 3112258..9e2baed 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -244,32 +244,32 @@ cd "$REAL_HOME/openFrameworks/addons" # Apply patches to the addon before building cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper" -if [ -f src/Osc/OscControl.cpp ]; then - echo "Applying highlight patch..." - if ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; then - # Create a temporary patch file - # terminator MUST NOT be indented - cat <<'EOF_PATCH' > /tmp/highlight.patch +echo "Applying Global Compatibility Patches..." + +# 1. Fix highlight patch (Heredoc fix) +if [ -f src/Osc/OscControl.cpp ] && ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; 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' src/Osc/OscControl.cpp - rm -f /tmp/highlight.patch - fi + sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/r /tmp/highlight.patch' src/Osc/OscControl.cpp + rm -f /tmp/highlight.patch fi -if [ -f src/Sources/VideoSource.h ]; then - echo "Applying std:: namespace patch to VideoSource.h..." - sed -i 's/unique_ptr/std::unique_ptr/g' src/Sources/VideoSource.h -fi +# 2. Fix unique_ptr and missing memory headers globally +find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\bunique_ptr\b/std::unique_ptr/g' {} + +find src -type f -name "*.h" -exec sed -i '1i #include ' {} + -# Build Example +# 3. Fix missing algorithms (std::find, etc) +find src -type f -name "*.cpp" -exec sed -i '1i #include ' {} + + +# Build Example (Force C++17 for better compatibility with this addon) cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example_basic" -echo "Starting compilation..." -sudo -u "$REAL_USER" make -j1 USER_CFLAGS="-Wno-error -Wno-reorder -Wno-sign-compare -Wno-delete-non-virtual-dtor" +echo "Starting compilation (Forcing C++17)..." +sudo -u "$REAL_USER" make -j1 USER_CFLAGS="-Wno-error -std=c++17" USER_CPPFLAGS="-std=c++17" cp bin/example_basic /usr/local/bin/ofxPiMapper chmod +x /usr/local/bin/ofxPiMapper