Remove the build tree automatically when switching cmk.sh -g/-G

Switching the GUI between Qt5 and Qt6 left moc/ui files and objects from the previous Qt major behind; make clean after a reconfigure could still race with stale targets.  cmk.sh now reads SLS_GUI_QT_MAJOR and SLS_USE_GUI from build/CMakeCache.txt before reconfiguring, and removes build/ when the requested major differs.  Tested in both directions: -G after -g and -g after -G rebuild cleanly with no extra -c.  Docs updated.
This commit is contained in:
Qt6 Port committed 2026-11-12 15:25:46 +01:00
1 parent c7eaa85131
commit 8482cd6d87
4 files changed
+31 -1

No files matched your search

+3
View File
@@ -231,6 +231,9 @@ Usage: $0 [-b] [-c] [-d <HDF5 directory>] [-e] [-g] [-G] [-h] [-i]
./cmk.sh -cbgj9 # Qt 5 GUI (RHEL 7/older)
./cmk.sh -cbGj9 # Qt 6 GUI
# Switching between -g (Qt5) and -G (Qt6) removes the build directory
# automatically, so no separate -c is needed.
#For rebuilding only certain sections
./cmk.sh -tg #text client and Qt5 gui
./cmk.sh -tG #text client and Qt6 gui
+23
View File
@@ -91,6 +91,9 @@ For rebuilding only certain sections
./cmk.sh -tg #text client and Qt5 gui
./cmk.sh -tG #text client and Qt6 gui
./cmk.sh -r #only receiver
Switching between -g and -G removes the build tree automatically
(no extra -c needed).
" ; exit 1; }
@@ -233,6 +236,26 @@ fi
# Switching the GUI between Qt5 and Qt6 in an existing build tree leaves
# generated Qt/moc/ui files and objects from the other major behind; even
# make clean after a reconfigure can race with stale targets, so remove the
# whole build tree. Read the cache before -b removes it.
if [ $GUI -eq 1 ] && [ -f "$BUILDDIR/CMakeCache.txt" ]; then
requested_qt=5
[ $QT6 -eq 1 ] && requested_qt=6
cached_gui=$(grep -E '^SLS_USE_GUI:BOOL=' "$BUILDDIR/CMakeCache.txt" | head -1 | cut -d= -f2 || true)
cached_qt=$(grep -E '^SLS_GUI_QT_MAJOR:STRING=' "$BUILDDIR/CMakeCache.txt" | head -1 | cut -d= -f2 || true)
# Cache from before SLS_GUI_QT_MAJOR existed: that build was Qt6.
if [ "$cached_gui" = "ON" ] && [ -z "$cached_qt" ]; then
cached_qt=6
fi
if [ "$cached_gui" = "ON" ] && [ -n "$cached_qt" ] && [ "$cached_qt" != "$requested_qt" ]; then
echo "Qt major changed from $cached_qt to $requested_qt: removing the build directory"
rm -rf -- "$BUILDDIR"
CLEAN=0
fi
fi
#build dir doesnt exist
if [ ! -d "$BUILDDIR" ] ; then
echo "No Build Directory. Building of Cmake files required"
+2 -1
View File
@@ -134,4 +134,5 @@ a `qwt_*` header. The package metadata and documentation refer to the Qt
runtime packages instead (`qt6-qtbase`/`qt5-qtbase` on RPM based systems,
`qt6-base-dev`/`qtbase5-dev` on Debian/Ubuntu, `qt6-main`/`qt-main` in
conda), selected by `SLS_GUI_QT_MAJOR` (or `cmk.sh -G` for Qt 6 and `-g` for
Qt 5).
Qt 5). Switching between the two cmk flags removes the build tree
automatically, so no extra `-c` is needed.
+3
View File
@@ -237,6 +237,9 @@ Example cmake options Comment
./cmk.sh -cbgj9 # Qt 5 GUI (RHEL 7/older)
./cmk.sh -cbGj9 # Qt 6 GUI
# Switching between -g (Qt5) and -G (Qt6) removes the build directory
# automatically, so no separate -c is needed.
#For rebuilding only certain sections
./cmk.sh -tg #text client and Qt5 gui
./cmk.sh -tG #text client and Qt6 gui