Merge topic 'ci-macos-qt-6.9.3'

3f21bf9f0a ci: Restore packaging with macOS SDK from Xcode
c1ee4d57dc Utilities/Release: Remove unused Qt 5.15.2 build script for macOS
0f18aa010e ci: Update to Qt 6.9.3 on macOS
2ae318bb5d cmake-gui: Install only necessary plugins for Qt 6
74dec2c7fd cmake-gui: Detect Qt lib directory on macOS more robustly
0d1321770d cmake-gui: Clarify signature of QCheckBox::checkStateChanged callbacks
a49e5c8eb9 Utilities/Release: Teach macOS notarization script to sign Qt artifacts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11386
This commit is contained in:
Brad King
2025-11-05 15:21:59 +00:00
committed by Kitware Robot
16 changed files with 100 additions and 235 deletions

View File

@@ -1,6 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
if(CMake_GUI_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${CMake_GUI_OSX_DEPLOYMENT_TARGET}")
endif()
project(QtDialog)
CMake_OPTIONAL_COMPONENT(cmake-gui)
set(QT_COMPONENTS
@@ -69,7 +73,7 @@ if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
endif()
# We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows.
if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32) AND NOT COMMAND qt_generate_deploy_app_script)
function(_qt_get_plugin_name_with_version target out_var)
string(REGEX REPLACE "^Qt::(.+)" "Qt${CMake_QT_MAJOR_VERSION}::\\1"
qt_plugin_with_version "${target}")
@@ -105,32 +109,15 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
"${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
endif()
endmacro()
macro(install_qt_plugins _comps _plugins_var)
foreach(_qt_comp IN LISTS ${_comps})
if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
set(_qt_module_plugins ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_PLUGINS})
else()
get_target_property(_qt_module_plugins Qt${CMake_QT_MAJOR_VERSION}::${_qt_comp} QT_PLUGINS)
endif()
foreach(_qt_plugin IN LISTS _qt_module_plugins)
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
# Qt6 provides the plugins as individual packages that need to be found.
find_package(Qt${CMake_QT_MAJOR_VERSION}${_qt_plugin} QUIET
PATHS ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_DIR})
endif()
install_qt_plugin("${_qt_plugin}" "${_plugins_var}")
endforeach()
endforeach()
endmacro()
if(APPLE)
if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
install_qt_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
if(TARGET Qt5::QMacStylePlugin)
install_qt_plugin("Qt5::QMacStylePlugin" QT_PLUGINS)
endif()
else()
# FIXME: Minimize plugins for Qt6.
install_qt_plugins(QT_COMPONENTS QT_PLUGINS)
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
# Qt6 provides the plugins as individual packages that need to be found.
find_package(Qt${CMake_QT_MAJOR_VERSION}QCocoaIntegrationPlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Gui_DIR})
find_package(Qt${CMake_QT_MAJOR_VERSION}QMacStylePlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Widgets_DIR})
endif()
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QCocoaIntegrationPlugin" QT_PLUGINS)
if(TARGET Qt${CMake_QT_MAJOR_VERSION}::QMacStylePlugin)
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QMacStylePlugin" QT_PLUGINS)
endif()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPlugins = ${_qt_plugin_dir}\n")
@@ -138,12 +125,11 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
DESTINATION "${CMake_INSTALL_APP_DIR_SLASH}Resources"
${COMPONENT})
elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
install_qt_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS)
else()
# FIXME: Minimize plugins for Qt6.
install_qt_plugins(QT_COMPONENTS QT_PLUGINS)
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
# Qt6 provides the plugins as individual packages that need to be found.
find_package(Qt${CMake_QT_MAJOR_VERSION}QWindowsIntegrationPlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Gui_DIR})
endif()
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QWindowsIntegrationPlugin" QT_PLUGINS)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPlugins = ../${_qt_plugin_dir}\n")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
@@ -152,12 +138,6 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endif()
endif()
get_property(_Qt_Core_LOCATION TARGET Qt${CMake_QT_MAJOR_VERSION}::Core PROPERTY LOCATION)
get_filename_component(Qt_BIN_DIR "${_Qt_Core_LOCATION}" PATH)
if(APPLE)
get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(
@@ -356,17 +336,33 @@ if(APPLE)
endif()
if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
# install rules for including 3rd party libs such as Qt
# if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMake_INSTALL_BIN_DIR}/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}")
if(APPLE)
set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMake_INSTALL_APP_DIR_SLASH}MacOS/CMake")
if(COMMAND qt_generate_deploy_app_script)
# Qt libraries are found via @rpath, so point the runtime path at them.
set_property(TARGET cmake-gui PROPERTY INSTALL_RPATH "@executable_path/../Frameworks")
qt_generate_deploy_app_script(
TARGET cmake-gui
OUTPUT_SCRIPT qt_deploy_script
)
install(SCRIPT "${qt_deploy_script}")
else()
# install rules for including 3rd party libs such as Qt
# if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMake_INSTALL_BIN_DIR}/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}")
if(APPLE)
set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMake_INSTALL_APP_DIR_SLASH}MacOS/CMake")
endif()
get_property(_Qt_Core_LOCATION TARGET Qt${CMake_QT_MAJOR_VERSION}::Core PROPERTY LOCATION)
if(APPLE AND _Qt_Core_LOCATION MATCHES [[^(.*)/[^/]*\.framework/]])
set(Qt_LIB_DIR "${CMAKE_MATCH_1}")
else()
get_filename_component(Qt_LIB_DIR "${_Qt_Core_LOCATION}" PATH)
endif()
install(CODE "
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${Qt_LIB_DIR};${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
" ${COMPONENT})
endif()
install(CODE "
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${Qt_BIN_DIR};${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
" ${COMPONENT})
endif()
set(CMAKE_PACKAGE_QTGUI TRUE)

View File

@@ -26,7 +26,7 @@ void WarningMessagesDialog::setInitialValues()
void WarningMessagesDialog::setupSignals()
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
static auto const checkStateChanged = &QCheckBox::checkStateChanged;
#else
static auto const checkStateChanged = &QCheckBox::stateChanged;
@@ -59,7 +59,8 @@ void WarningMessagesDialog::doAccept()
this->deprecatedWarningsAsErrors->isChecked());
}
void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state)
void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(
CheckState state)
{
// no warnings implies no errors either
if (state) {
@@ -67,7 +68,8 @@ void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state)
}
}
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state)
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(
CheckState state)
{
// no warnings implies no errors either
if (state) {
@@ -75,7 +77,8 @@ void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state)
}
}
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state)
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(
CheckState state)
{
// warnings as errors implies warnings are not suppressed
if (state) {
@@ -83,7 +86,8 @@ void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state)
}
}
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state)
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(
CheckState state)
{
// warnings as errors implies warnings are not suppressed
if (state) {

View File

@@ -17,6 +17,12 @@ class WarningMessagesDialog
{
Q_OBJECT
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
using CheckState = Qt::CheckState;
#else
using CheckState = int;
#endif
public:
WarningMessagesDialog(QWidget* prnt, QCMake* instance);
@@ -30,23 +36,23 @@ private slots:
* Handler for checked state changed event of the suppress developer warnings
* checkbox.
*/
void doSuppressDeveloperWarningsChanged(int state);
void doSuppressDeveloperWarningsChanged(CheckState state);
/**
* Handler for checked state changed event of the suppress deprecated
* warnings checkbox.
*/
void doSuppressDeprecatedWarningsChanged(int state);
void doSuppressDeprecatedWarningsChanged(CheckState state);
/**
* Handler for checked state changed event of the developer warnings as
* errors checkbox.
*/
void doDeveloperWarningsAsErrorsChanged(int state);
void doDeveloperWarningsAsErrorsChanged(CheckState state);
/**
* Handler for checked state changed event of the deprecated warnings as
* errors checkbox.
*/
void doDeprecatedWarningsAsErrorsChanged(int state);
void doDeprecatedWarningsAsErrorsChanged(CheckState state);
private:
QCMake* cmakeInstance;