macOS: Remove code handling Qt Creator running under Rosetta

Remove code that was added to handle the case of Qt Creator running as
an Intel binary on ARM Macs, which required some passing of flags to
qmake/CMake/LLDB.

Nowadays, Qt Creator can be built for the corresponding architecture
(and by default we provide universal binaries).

Partially reverts a71d725e46

Change-Id: I842f85b85a26d09cff72199ae86c602fd8f14e33
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Eike Ziller
2024-07-15 14:30:39 +02:00
parent bd731d213d
commit 81f7325a0c
5 changed files with 6 additions and 39 deletions

View File

@@ -36,17 +36,6 @@ OsArch HostOsInfo::hostArchitecture()
return arch;
}
bool HostOsInfo::isRunningUnderRosetta()
{
#ifdef Q_OS_MACOS
int translated = 0;
auto size = sizeof(translated);
if (sysctlbyname("sysctl.proc_translated", &translated, &size, nullptr, 0) == 0)
return translated;
#endif
return false;
}
void HostOsInfo::setOverrideFileNameCaseSensitivity(Qt::CaseSensitivity sensitivity)
{
m_useOverrideFileNameCaseSensitivity = true;

View File

@@ -55,8 +55,6 @@ public:
#endif
}
static bool isRunningUnderRosetta();
static QString withExecutableSuffix(const QString &executable)
{
return OsSpecificAspects::withExecutableSuffix(hostOs(), executable);

View File

@@ -1455,19 +1455,10 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
return QString();
});
macroExpander()->registerVariable(CMAKE_OSX_ARCHITECTURES_FLAG,
Tr::tr("The CMake flag for the architecture on macOS"),
[target] {
if (HostOsInfo::isRunningUnderRosetta()) {
if (auto *qt = QtSupport::QtKitAspect::qtVersion(target->kit())) {
const Abis abis = qt->qtAbis();
for (const Abi &abi : abis) {
if (abi.architecture() == Abi::ArmArchitecture)
return QLatin1String("-DCMAKE_OSX_ARCHITECTURES=arm64");
}
}
}
return QLatin1String();
macroExpander()->registerVariable(
CMAKE_OSX_ARCHITECTURES_FLAG, Tr::tr("The CMake flag for the architecture on macOS"), [] {
// TODO deprecated since Qt Creator 15, remove later
return QString();
});
macroExpander()->registerVariable(QT_QML_DEBUG_FLAG,
Tr::tr("The CMake flag for QML debugging, if enabled"),
@@ -1568,8 +1559,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
cmd.addArg("%{" + QLatin1String(DEVELOPMENT_TEAM_FLAG) + "}");
cmd.addArg("%{" + QLatin1String(PROVISIONING_PROFILE_FLAG) + "}");
}
} else if (device && device->osType() == Utils::OsTypeMac) {
cmd.addArg("%{" + QLatin1String(CMAKE_OSX_ARCHITECTURES_FLAG) + "}");
}
if (isWebAssembly(k) || isQnx(k) || isWindowsARM64(k)) {

View File

@@ -211,9 +211,6 @@ void LldbEngine::setupEngine()
if (runParameters().debugger.workingDirectory.isDir())
m_lldbProc.setWorkingDirectory(runParameters().debugger.workingDirectory);
if (HostOsInfo::isRunningUnderRosetta())
m_lldbProc.setCommand(CommandLine("/usr/bin/arch", {"-arm64", lldbCmd.toString()}));
else
m_lldbProc.setCommand(CommandLine(lldbCmd));
m_lldbProc.start();

View File

@@ -648,12 +648,6 @@ void QMakeStep::updateAbiWidgets()
}
}
}
} else if (qtVersion->hasAbi(Abi::DarwinOS) && !isIos(target()->kit()) && HostOsInfo::isRunningUnderRosetta()) {
// Automatically select arm64 when running under Rosetta
for (const Abi &abi : abis) {
if (abi.architecture() == Abi::ArmArchitecture)
selectedAbis.append(abi.param());
}
}
}