diff options
Diffstat (limited to 'src/corelib/global/qsystemdetection.h')
-rw-r--r-- | src/corelib/global/qsystemdetection.h | 217 |
1 files changed, 86 insertions, 131 deletions
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index c8f98042c9..b29f2e9496 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -1,45 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Copyright (C) 2019 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QGLOBAL_H -# include <QtCore/qglobal.h> +#if 0 +#pragma qt_class(QtSystemDetection) +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing #endif #ifndef QSYSTEMDETECTION_H @@ -53,6 +19,7 @@ IOS - iOS WATCHOS - watchOS TVOS - tvOS + VISIONOS - visionOS WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) CYGWIN - Cygwin SOLARIS - Sun Solaris @@ -72,6 +39,7 @@ ANDROID - Android platform HAIKU - Haiku WEBOS - LG WebOS + WASM - WebAssembly The following operating systems have variants: LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android @@ -84,20 +52,18 @@ #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) # include <TargetConditionals.h> +# define Q_OS_APPLE # if defined(TARGET_OS_MAC) && TARGET_OS_MAC # define Q_OS_DARWIN # define Q_OS_BSD4 -# ifdef __LP64__ -# define Q_OS_DARWIN64 -# else -# define Q_OS_DARWIN32 -# endif # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE # define QT_PLATFORM_UIKIT # if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # define Q_OS_WATCHOS # elif defined(TARGET_OS_TV) && TARGET_OS_TV # define Q_OS_TVOS +# elif defined(TARGET_OS_VISION) && TARGET_OS_VISION +# define Q_OS_VISIONOS # else # // TARGET_OS_IOS is only available in newer SDKs, # // so assume any other iOS-based platform is iOS for now @@ -128,8 +94,6 @@ # define Q_OS_SOLARIS #elif defined(hpux) || defined(__hpux) # define Q_OS_HPUX -#elif defined(__native_client__) -# define Q_OS_NACL #elif defined(__EMSCRIPTEN__) # define Q_OS_WASM #elif defined(__linux__) || defined(__linux) @@ -161,7 +125,7 @@ # define Q_OS_INTEGRITY #elif defined(__rtems__) # define Q_OS_RTEMS -#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ +#elif defined(__vxworks) # define Q_OS_VXWORKS #elif defined(__HAIKU__) # define Q_OS_HAIKU @@ -187,93 +151,77 @@ // Compatibility synonyms #ifdef Q_OS_DARWIN -#define Q_OS_MAC -#endif -#ifdef Q_OS_DARWIN32 -#define Q_OS_MAC32 -#endif -#ifdef Q_OS_DARWIN64 -#define Q_OS_MAC64 -#endif -#ifdef Q_OS_MACOS -#define Q_OS_MACX -#define Q_OS_OSX +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunknown-pragmas" +# define Q_OS_MAC // FIXME: Deprecate +# ifdef __LP64__ +# define Q_OS_DARWIN64 +# pragma clang deprecated(Q_OS_DARWIN64, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# define Q_OS_MAC64 +# pragma clang deprecated(Q_OS_MAC64, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# else +# define Q_OS_DARWIN32 +# pragma clang deprecated(Q_OS_DARWIN32, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# define Q_OS_MAC32 +# pragma clang deprecated(Q_OS_MAC32, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# endif +# ifdef Q_OS_MACOS +# define Q_OS_MACX +# pragma clang deprecated(Q_OS_MACX, "use Q_OS_MACOS instead") +# define Q_OS_OSX +# pragma clang deprecated(Q_OS_OSX, "use Q_OS_MACOS instead") +# endif +# pragma clang diagnostic pop #endif #ifdef Q_OS_DARWIN # include <Availability.h> # include <AvailabilityMacros.h> -# -# ifdef Q_OS_MACOS -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6 -# undef __MAC_OS_X_VERSION_MIN_REQUIRED -# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6 -# endif -# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 -# undef MAC_OS_X_VERSION_MIN_REQUIRED -# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -# endif -# endif -# -# // Numerical checks are preferred to named checks, but to be safe -# // we define the missing version names in case Qt uses them. -# -# if !defined(__MAC_10_11) -# define __MAC_10_11 101100 -# endif -# if !defined(__MAC_10_12) -# define __MAC_10_12 101200 -# endif -# if !defined(__MAC_10_13) -# define __MAC_10_13 101300 -# endif -# if !defined(__MAC_10_14) -# define __MAC_10_14 101400 -# endif -# if !defined(__MAC_10_15) -# define __MAC_10_15 101500 -# endif -# if !defined(__MAC_10_16) -# define __MAC_10_16 101600 -# endif -# if !defined(MAC_OS_X_VERSION_10_11) -# define MAC_OS_X_VERSION_10_11 __MAC_10_11 -# endif -# if !defined(MAC_OS_X_VERSION_10_12) -# define MAC_OS_X_VERSION_10_12 __MAC_10_12 -# endif -# if !defined(MAC_OS_X_VERSION_10_13) -# define MAC_OS_X_VERSION_10_13 __MAC_10_13 -# endif -# if !defined(MAC_OS_X_VERSION_10_14) -# define MAC_OS_X_VERSION_10_14 __MAC_10_14 -# endif -# if !defined(MAC_OS_X_VERSION_10_15) -# define MAC_OS_X_VERSION_10_15 __MAC_10_15 -# endif -# if !defined(MAC_OS_X_VERSION_10_16) -# define MAC_OS_X_VERSION_10_16 __MAC_10_16 -# endif -# -# if !defined(__IPHONE_10_0) -# define __IPHONE_10_0 100000 -# endif -# if !defined(__IPHONE_10_1) -# define __IPHONE_10_1 100100 -# endif -# if !defined(__IPHONE_10_2) -# define __IPHONE_10_2 100200 -# endif -# if !defined(__IPHONE_10_3) -# define __IPHONE_10_3 100300 -# endif -# if !defined(__IPHONE_11_0) -# define __IPHONE_11_0 110000 -# endif -# if !defined(__IPHONE_12_0) -# define __IPHONE_12_0 120000 -# endif -#endif + +# define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ + ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= macos) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) || \ + (defined(__TV_OS_VERSION_MAX_ALLOWED) && tvos != __TVOS_NA && __TV_OS_VERSION_MAX_ALLOWED >= tvos) || \ + (defined(__WATCH_OS_VERSION_MAX_ALLOWED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MAX_ALLOWED >= watchos)) + +# define QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, tvos, watchos) \ + ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < macos) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) || \ + (defined(__TV_OS_VERSION_MIN_REQUIRED) && tvos != __TVOS_NA && __TV_OS_VERSION_MIN_REQUIRED < tvos) || \ + (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MIN_REQUIRED < watchos)) + +# define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) +# define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) +# define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) + +# define QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(macos, ios) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_MACOS_DEPLOYMENT_TARGET_BELOW(macos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) +# define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_TVOS_DEPLOYMENT_TARGET_BELOW(tvos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) +# define QT_WATCHOS_DEPLOYMENT_TARGET_BELOW(watchos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) + +#else // !Q_OS_DARWIN + +#define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) (0) +#define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) (0) +#define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) (0) +#define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) (0) +#define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) (0) +#define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) (0) + +#endif // Q_OS_DARWIN #ifdef __LSB_VERSION__ # if __LSB_VERSION__ < 40 @@ -284,4 +232,11 @@ #endif #endif +#if defined (__ELF__) +# define Q_OF_ELF +#endif +#if defined (__MACH__) && defined (__APPLE__) +# define Q_OF_MACH_O +#endif + #endif // QSYSTEMDETECTION_H |