migration(grantlee): add script to patch installed GrantleeConfig to use Qt6
This commit is contained in:
1 parent
f18fce26e2
commit
2793db9d9d
1 file changed
+33
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
GRANTLEE_INSTALL_DIR="${1:-./external/grantlee}"
|
||||
CONFIG_FILE="$GRANTLEE_INSTALL_DIR/lib/cmake/Grantlee5/Grantlee5Config.cmake"
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Grantlee config not found at $CONFIG_FILE" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Replace Qt5 -> Qt6 in the installed Grantlee config to match Qt6 migration.
|
||||
# Be conservative: only replace find_package(Qt5 with find_package(Qt6
|
||||
# and occurrences of find_package(Qt5 REQUIRED X) -> find_package(Qt6 REQUIRED COMPONENTS X)
|
||||
|
||||
cp "$CONFIG_FILE" "$CONFIG_FILE.bak"
|
||||
|
||||
# handle common patterns
|
||||
sed -E -e 's/find_package\(Qt5Required Gui\)/find_package(Qt6 REQUIRED Gui)/g' \
|
||||
-e 's/find_package\(Qt5 REQUIRED Gui\)/find_package(Qt6 REQUIRED COMPONENTS Gui)/g' \
|
||||
-e 's/find_package\(Qt5 REQUIRED Core\)/find_package(Qt6 REQUIRED COMPONENTS Core)/g' \
|
||||
-e 's/find_package\(Qt5 REQUIRED Qml\)/find_package(Qt6 REQUIRED COMPONENTS Qml)/g' \
|
||||
-e 's/find_package\(Qt5 REQUIRED Qml\)/find_package(Qt6 REQUIRED COMPONENTS Qml)/g' \
|
||||
-e 's/find_package\(Qt5 REQUIRED /find_package(Qt6 REQUIRED COMPONENTS /g' \
|
||||
"$CONFIG_FILE.bak" > "$CONFIG_FILE"
|
||||
|
||||
# quick sanity check
|
||||
if grep -q "find_package(Qt5" "$CONFIG_FILE"; then
|
||||
echo "Warning: Some Qt5 references remain in $CONFIG_FILE" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
echo "Patched $CONFIG_FILE to use Qt6 (backup at $CONFIG_FILE.bak)"
|
||||
Reference in new issue
Block a user