From d7007090bbc1840f873fd4173de8542cb62206d0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Jan 2025 08:25:45 -0800 Subject: [PATCH] Bootstrap: depopulate qcore_mac.mm to remove QOperatingSystemVersion We don't need anything that the class provided, but we needed it because everything is in a large .mm source file. I've also removed portions of qcore_mac.mm that aren't needed for bootstrapped tools, like telling whether dark mode is in effect (the bootstrapped tools aren't GUI). I've also had to remove the check for running under Rosetta, which hopefully is going to affect no one: running moc & cmake_automoc_parser under Rosetta is going to be mighty slow. Just use a native set of tools instead. Change-Id: I4c0c716a5b57833abf63fffdf0c66b9ebaccffdb Reviewed-by: Ivan Solovev --- src/corelib/kernel/qcore_mac.mm | 6 +++++- src/corelib/text/qregularexpression.cpp | 2 +- src/tools/bootstrap/CMakeLists.txt | 3 --- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm index 0c08d4c1c63..16c35cd3fa7 100644 --- a/src/corelib/kernel/qcore_mac.mm +++ b/src/corelib/kernel/qcore_mac.mm @@ -322,7 +322,7 @@ QDebug operator<<(QDebug debug, const QCFString &string) } #endif // !QT_NO_DEBUG_STREAM -#ifdef Q_OS_MACOS +#if defined(Q_OS_MACOS) && !defined(QT_BOOTSTRAPPED) bool qt_mac_applicationIsInDarkMode() { auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames: @@ -563,6 +563,7 @@ QMacRootLevelAutoReleasePool::~QMacRootLevelAutoReleasePool() // ------------------------------------------------------------------------- +#ifndef QT_BOOTSTRAPPED void qt_apple_check_os_version() { #if defined(__WATCH_OS_VERSION_MIN_REQUIRED) @@ -610,6 +611,7 @@ void qt_apple_check_os_version() } } Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version); +#endif // QT_BOOTSTRAPPED // ------------------------------------------------------------------------- @@ -656,6 +658,7 @@ QT_BEGIN_NAMESPACE // ------------------------------------------------------------------------- +#ifndef QT_BOOTSTRAPPED QOperatingSystemVersion QMacVersion::buildSDK(VersionTarget target) { switch (target) { @@ -775,6 +778,7 @@ QMacVersion::VersionTuple QMacVersion::libraryVersion() }(); return version; } +#endif // QT_BOOTSTRAPPED // ------------------------------------------------------------------------- diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 906fabd2dea..8640dbf265d 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -981,7 +981,7 @@ static bool isJitEnabled() #ifdef QT_DEBUG return false; -#elif defined(Q_OS_MACOS) +#elif defined(Q_OS_MACOS) && !defined(QT_BOOTSTRAPPED) return !qt_mac_runningUnderRosetta(); #else return true; diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt index 914726cc147..b9d487c2f8b 100644 --- a/src/tools/bootstrap/CMakeLists.txt +++ b/src/tools/bootstrap/CMakeLists.txt @@ -127,11 +127,8 @@ qt_internal_extend_target(Bootstrap CONDITION MSVC AND CLANG qt_internal_extend_target(Bootstrap CONDITION APPLE SOURCES - ../../corelib/global/qoperatingsystemversion.cpp - ../../corelib/global/qoperatingsystemversion_darwin.mm ../../corelib/kernel/qcore_foundation.mm ../../corelib/kernel/qcore_mac.mm - ../../corelib/tools/qversionnumber.cpp PUBLIC_LIBRARIES ${FWFoundation} )