fix: implement surgical cleanup of old patches to resolve C++ syntax errors in ofxPiMapper
This commit is contained in:
@ -244,12 +244,14 @@ 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"
|
||||||
echo "Cleaning up previous patches and applying clean Global Compatibility Patches..."
|
echo "Performing surgical cleanup and applying clean Global Compatibility Patches..."
|
||||||
|
|
||||||
# SCRUB: Remove any previous injections of make_unique or cpp11_compat
|
# SURGICAL SCRUB: Remove EXACT lines injected previously without breaking braces
|
||||||
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/namespace std {/,/}/d' {} +
|
|
||||||
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/#if __cplusplus < 201402L/,/#endif/d' {} +
|
|
||||||
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/#include "cpp11_compat.h"/d' {} +
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/#include "cpp11_compat.h"/d' {} +
|
||||||
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/template<typename T, typename... Args>/d' {} +
|
||||||
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/unique_ptr<T> make_unique(Args&&... args)/d' {} +
|
||||||
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/return unique_ptr<T>(new T(std::forward<Args>(args)...));/d' {} +
|
||||||
|
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i '/#if __cplusplus < 201402L/,/#endif/d' {} +
|
||||||
|
|
||||||
# 1. Fix highlight patch (Heredoc fix)
|
# 1. Fix highlight patch (Heredoc fix)
|
||||||
if [ -f src/Osc/OscControl.cpp ] && ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; then
|
if [ -f src/Osc/OscControl.cpp ] && ! grep -q "ofxPiMapper/surface/highlight" src/Osc/OscControl.cpp; then
|
||||||
@ -286,13 +288,15 @@ namespace std {
|
|||||||
#endif
|
#endif
|
||||||
EOF_COMPAT
|
EOF_COMPAT
|
||||||
|
|
||||||
# Include the compat header in the main addon header ONLY
|
# Include the compat header in the main addon header ONLY (Top of file)
|
||||||
sed -i '1i #include "cpp11_compat.h"' src/ofxPiMapper.h
|
if ! grep -q "cpp11_compat.h" src/ofxPiMapper.h; then
|
||||||
|
sed -i '1i #include "cpp11_compat.h"' src/ofxPiMapper.h
|
||||||
|
fi
|
||||||
|
|
||||||
# Also ensure unique_ptr and make_unique are namespaced in the source
|
# Also ensure unique_ptr and make_unique are namespaced in the source
|
||||||
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\([^:a-zA-Z0-9]\)make_unique\b/\1std::make_unique/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' {} +
|
||||||
|
|
||||||
# Add memory header to all headers to be safe
|
# Add memory header to all headers only if missing
|
||||||
for f in $(find src -type f -name "*.h"); do
|
for f in $(find src -type f -name "*.h"); do
|
||||||
grep -q "<memory>" "$f" || sed -i '1i #include <memory>' "$f"
|
grep -q "<memory>" "$f" || sed -i '1i #include <memory>' "$f"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user