Handle simulator platforms when parsing LC_BUILD_VERSION load command

Task-number: QTBUG-85764
Change-Id: Ie46bee0937908e2dfedfa3532394dde015abf891
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3911be61602695ed65e33e54bee38ee8bcd92539)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-08-06 18:12:30 +02:00
parent 77a02f18cd
commit 7ba34cbcb0

View File

@ -185,6 +185,19 @@ QOperatingSystemVersion QMacVersion::currentRuntime()
return QOperatingSystemVersion::current(); return QOperatingSystemVersion::current();
} }
// Mach-O platforms
enum Platform {
macOS = 1,
iOS = 2,
tvOS = 3,
watchOS = 4,
bridgeOS = 5,
macCatalyst = 6,
iOSSimulator = 7,
tvOSSimulator = 8,
watchOSSimulator = 9
};
QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machHeader) QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machHeader)
{ {
static auto osForLoadCommand = [](uint32_t cmd) { static auto osForLoadCommand = [](uint32_t cmd) {
@ -199,11 +212,19 @@ QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machH
static auto osForPlatform = [](uint32_t platform) { static auto osForPlatform = [](uint32_t platform) {
switch (platform) { switch (platform) {
case 1: return QOperatingSystemVersion::MacOS; case Platform::macOS:
case 2: return QOperatingSystemVersion::IOS; return QOperatingSystemVersion::MacOS;
case 3: return QOperatingSystemVersion::TvOS; case Platform::iOS:
case 4: return QOperatingSystemVersion::WatchOS; case Platform::iOSSimulator:
default: return QOperatingSystemVersion::Unknown; return QOperatingSystemVersion::IOS;
case Platform::tvOS:
case Platform::tvOSSimulator:
return QOperatingSystemVersion::TvOS;
case Platform::watchOS:
case Platform::watchOSSimulator:
return QOperatingSystemVersion::WatchOS;
default:
return QOperatingSystemVersion::Unknown;
} }
}; };