Apple: Don't _debug-suffix libraries in single config framework builds

As part of fee15182949e88682131399c50b679be83a75385 we enabled framework
debug builds, which left us with an inconsistent library naming. The
framework libraries are always unsuffixed, e.g. QtGui.framework/QtGui,
while we were adding _debug suffixes to the plugins and static libs.

This was confusing macdeployqt, as it uses simple string matching logic
for "_debug_" to detect that a Qt build is a debug build, and since
the framework library didn't have a suffix it then failed to deploy
the suffixed plugins.

We now follow the requirement from the framework naming and skip the
suffixing for all libraries in this configuration.

Pick-to: 6.8
Change-Id: I982253fc46c65aa3fab52f8658f62ef63cdac49f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2024-06-20 12:48:26 +02:00
parent 099a622281
commit d3be87ff1d
4 changed files with 17 additions and 5 deletions

View File

@ -494,8 +494,16 @@ function(qt_internal_setup_cmake_config_postfix)
set(default_cmake_debug_postfix "d")
endif()
elseif(APPLE)
# Only add a suffix for explicit no-framework builds.
# For framework builds the library inside the framework
# is always unsuffixed, and we want to match that for
# plugins and other non-framework (static) libraries.
if(NOT (QT_FEATURE_framework OR FEATURE_framework
# Account for default in configure.json being ON
OR (NOT DEFINED QT_FEATURE_framework AND NOT DEFINED FEATURE_framework)))
set(default_cmake_debug_postfix "_debug")
endif()
endif()
set(custom_postfix_vars "")
set(release_configs Release RelWithDebInfo MinSizeRel)

View File

@ -643,6 +643,8 @@ qt_feature("force_asserts" PUBLIC
qt_feature("framework" PUBLIC
LABEL "Build Apple Frameworks"
AUTODETECT ON
# If changing this, please align with logic in
# qt_internal_setup_cmake_config_postfix.
CONDITION APPLE
)
qt_feature_definition("framework" "QT_MAC_FRAMEWORK_BUILD")

View File

@ -50,7 +50,7 @@ endif()
## Scopes:
#####################################################################
qt_internal_extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
qt_internal_extend_target(tst_qpluginloader
LIBRARIES
Qt::CorePrivate
)

View File

@ -12,6 +12,8 @@
#include <QScopeGuard>
#include "theplugin/plugininterface.h"
#include <QtCore/private/qglobal_p.h>
#if defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)
# include <QtCore/private/qmachparser_p.h>
#endif
@ -33,10 +35,10 @@ using namespace Qt::StringLiterals;
# define bundle_VALID true
# define dylib_VALID true
# define so_VALID true
# ifdef QT_NO_DEBUG
# define SUFFIX ".dylib"
# else
# if QT_CONFIG(debug) && !QT_CONFIG(framework)
# define SUFFIX "_debug.dylib"
# else
# define SUFFIX ".dylib"
# endif
# define PREFIX "lib"