fix: apply global C++17/20 compatibility patches to ofxPiMapper source
This commit is contained in:
@ -244,32 +244,32 @@ cd "$REAL_HOME/openFrameworks/addons"
|
|||||||
|
|
||||||
# Apply patches to the addon before building
|
# Apply patches to the addon before building
|
||||||
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper"
|
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper"
|
||||||
if [ -f src/Osc/OscControl.cpp ]; then
|
echo "Applying Global Compatibility Patches..."
|
||||||
echo "Applying highlight patch..."
|
|
||||||
if ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; then
|
# 1. Fix highlight patch (Heredoc fix)
|
||||||
# Create a temporary patch file
|
if [ -f src/Osc/OscControl.cpp ] && ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; then
|
||||||
# terminator MUST NOT be indented
|
cat <<'EOF_PATCH' > /tmp/highlight.patch
|
||||||
cat <<'EOF_PATCH' > /tmp/highlight.patch
|
|
||||||
if (m.getAddress() == "/ofxPiMapper/surface/highlight"){
|
if (m.getAddress() == "/ofxPiMapper/surface/highlight"){
|
||||||
int surfaceIndex = m.getArgAsInt32(0);
|
int surfaceIndex = m.getArgAsInt32(0);
|
||||||
mapper->getSurfaceManager()->selectSurface(surfaceIndex);
|
mapper->getSurfaceManager()->selectSurface(surfaceIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EOF_PATCH
|
EOF_PATCH
|
||||||
sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/r /tmp/highlight.patch' src/Osc/OscControl.cpp
|
sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/r /tmp/highlight.patch' src/Osc/OscControl.cpp
|
||||||
rm -f /tmp/highlight.patch
|
rm -f /tmp/highlight.patch
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f src/Sources/VideoSource.h ]; then
|
# 2. Fix unique_ptr and missing memory headers globally
|
||||||
echo "Applying std:: namespace patch to VideoSource.h..."
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\bunique_ptr\b/std::unique_ptr/g' {} +
|
||||||
sed -i 's/unique_ptr/std::unique_ptr/g' src/Sources/VideoSource.h
|
find src -type f -name "*.h" -exec sed -i '1i #include <memory>' {} +
|
||||||
fi
|
|
||||||
|
|
||||||
# Build Example
|
# 3. Fix missing algorithms (std::find, etc)
|
||||||
|
find src -type f -name "*.cpp" -exec sed -i '1i #include <algorithm>' {} +
|
||||||
|
|
||||||
|
# Build Example (Force C++17 for better compatibility with this addon)
|
||||||
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example_basic"
|
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example_basic"
|
||||||
echo "Starting compilation..."
|
echo "Starting compilation (Forcing C++17)..."
|
||||||
sudo -u "$REAL_USER" make -j1 USER_CFLAGS="-Wno-error -Wno-reorder -Wno-sign-compare -Wno-delete-non-virtual-dtor"
|
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
|
cp bin/example_basic /usr/local/bin/ofxPiMapper
|
||||||
chmod +x /usr/local/bin/ofxPiMapper
|
chmod +x /usr/local/bin/ofxPiMapper
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user