1、Compiler&GNU

Qt是跨平台的,从下面的编译配置选项(宏)中可以看出Qt支持的编译环境。

// qcompilerdetection.h
/*The compiler, must be one of: (Q_CC_x)SYM      - Digital Mars C/C++ (used to be Symantec C++)MSVC     - Microsoft Visual C/C++, Intel C++ for WindowsBOR      - Borland/Turbo C++WAT      - Watcom C++GNU      - GNU C++COMEAU   - Comeau C++EDG      - Edison Design Group C++OC       - CenterLine C++SUN      - Forte Developer, or Sun Studio C++MIPS     - MIPSpro C++DEC      - DEC C++HPACC    - HP aC++USLC     - SCO OUDK and UDKCDS      - Reliant C++KAI      - KAI C++INTEL    - Intel C++ for Linux, Intel C++ for WindowsHIGHC    - MetaWare High C/C++PGI      - Portland Group C++GHS      - Green Hills Optimizing C++ CompilersRVCT     - ARM Realview Compiler SuiteCLANG    - C++ front-end for the LLVM compilerShould be sorted most to least authoritative.
*/

或者如下所示的Qt支持的OS。

// qsystemdetection.h
/*The operating system, must be one of: (Q_OS_x)DARWIN   - Any Darwin system (macOS, iOS, watchOS, tvOS)MACOS    - macOSIOS      - iOSWATCHOS  - watchOSTVOS     - tvOSMSDOS    - MS-DOS and WindowsOS2      - OS/2OS2EMX   - XFree86 on OS/2 (not PM)WIN32    - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)WINRT    - WinRT (Windows 8 Runtime)CYGWIN   - CygwinSOLARIS  - Sun SolarisHPUX     - HP-UXULTRIX   - DEC UltrixLINUX    - Linux [has variants]FREEBSD  - FreeBSD [has variants]NETBSD   - NetBSDOPENBSD  - OpenBSDBSDI     - BSD/OSINTERIX  - InterixIRIX     - SGI IrixOSF      - HP Tru64 UNIXSCO      - SCO OpenServer 5UNIXWARE - UnixWare 7, Open UNIX 8AIX      - AIXHURD     - GNU HurdDGUX     - DG/UXRELIANT  - Reliant UNIXDYNIX    - DYNIX/ptxQNX      - QNX [has variants]QNX6     - QNX RTP 6.1LYNX     - LynxOSBSD4     - Any BSD 4.4 systemUNIX     - Any UNIX BSD/SYSV systemANDROID  - Android platformHAIKU    - HaikuThe following operating systems have variants:LINUX    - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android- only Q_OS_LINUX is defined if building for other Linux systemsFREEBSD  - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland- Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
*/

以GNU为例,我们来看看Qt通过gcc的特性定义了那些东西,如常见的__attribute__

// qcompilerdetection.h
// ... other compilers
#elif defined(__GNUC__)
#  define Q_CC_GNU          (__GNUC__ * 100 + __GNUC_MINOR__) // gnu
#  if defined(__MINGW32__)
#    define Q_CC_MINGW // mingw
#  endif
#  if defined(__INTEL_COMPILER)
#    define Q_CC_INTEL      (__INTEL_COMPILER) // intel
// ... intel compiler
#  else
/* Plain GCC */
#    if Q_CC_GNU >= 405 // version
#      define Q_ASSUME_IMPL(expr)  if (expr){} else __builtin_unreachable()
#      define Q_UNREACHABLE_IMPL() __builtin_unreachable()
#      define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
#    endif
#  endif#  ifdef Q_OS_WIN // win
#    define Q_DECL_EXPORT     __declspec(dllexport)
#    define Q_DECL_IMPORT     __declspec(dllimport)
#  elif defined(QT_VISIBILITY_AVAILABLE) // linux
#    define Q_DECL_EXPORT     __attribute__((visibility("default")))
#    define Q_DECL_IMPORT     __attribute__((visibility("default")))
#    define Q_DECL_HIDDEN     __attribute__((visibility("hidden")))
#  endif#  define Q_FUNC_INFO       __PRETTY_FUNCTION__
#  define Q_ALIGNOF(type)   __alignof__(type)
#  define Q_TYPEOF(expr)    __typeof__(expr)
#  define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
#  define Q_DECL_ALIGN(n)   __attribute__((__aligned__(n)))
#  define Q_DECL_UNUSED     __attribute__((__unused__))
#  define Q_LIKELY(expr)    __builtin_expect(!!(expr), true)
#  define Q_UNLIKELY(expr)  __builtin_expect(!!(expr), false)
#  define Q_NORETURN        __attribute__((__noreturn__))
#  define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__))
#  define Q_DECL_PURE_FUNCTION __attribute__((pure))
#  define Q_DECL_CONST_FUNCTION __attribute__((const))
#  if !defined(QT_MOC_CPP) // no moc
#    define Q_PACKED __attribute__ ((__packed__))
#    ifndef __ARM_EABI__ // no arm eabi
#      define QT_NO_ARM_EABI
#    endif
#  endif
#  if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG) // version && non-clang
#      define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
#  endif

2、C++11&GNU

下面是gcc各版本对C++11的支持所涉及的宏。

// qcompilerdetection.h
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
#  define Q_COMPILER_RESTRICTED_VLA
#  define Q_COMPILER_THREADSAFE_STATICS
#  if Q_CC_GNU >= 403
//   GCC supports binary literals in C, C++98 and C++11 modes
#    define Q_COMPILER_BINARY_LITERALS
#  endif
#  if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))// Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97)
#    define Q_COMPILER_VARIADIC_MACROS
#  endif
#  if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
#    if Q_CC_GNU >= 403/* C++11 features supported in GCC 4.3: */
#      define Q_COMPILER_DECLTYPE
#      define Q_COMPILER_RVALUE_REFS
#      define Q_COMPILER_STATIC_ASSERT
#    endif
#    if Q_CC_GNU >= 404/* C++11 features supported in GCC 4.4: */
#      define Q_COMPILER_AUTO_FUNCTION
#      define Q_COMPILER_AUTO_TYPE
#      define Q_COMPILER_EXTERN_TEMPLATES
#      define Q_COMPILER_UNIFORM_INIT
#      define Q_COMPILER_UNICODE_STRINGS
#      define Q_COMPILER_VARIADIC_TEMPLATES
#    endif
#    if Q_CC_GNU >= 405/* C++11 features supported in GCC 4.5: */
#      define Q_COMPILER_EXPLICIT_CONVERSIONS/* GCC 4.4 implements initializer_list but does not define typedefs required* by the standard. */
#      define Q_COMPILER_INITIALIZER_LISTS
#      define Q_COMPILER_LAMBDA
#      define Q_COMPILER_RAW_STRINGS
#      define Q_COMPILER_CLASS_ENUM
#    endif
#    if Q_CC_GNU >= 406/* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete* functions are supported only if they are public. Starting from 4.6, GCC handles* final version - the access modifier is not relevant. */
#      define Q_COMPILER_DEFAULT_MEMBERS
#      define Q_COMPILER_DELETE_MEMBERS/* C++11 features supported in GCC 4.6: */
#      define Q_COMPILER_CONSTEXPR
#      define Q_COMPILER_NULLPTR
#      define Q_COMPILER_UNRESTRICTED_UNIONS
#      define Q_COMPILER_RANGE_FOR
#    endif
#    if Q_CC_GNU >= 407/* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.* However, the implementation is incomplete for most platforms until GCC 4.7:* instead, std::atomic would use an external lock. Since we need an std::atomic* that is behavior-compatible with QBasicAtomic, we only enable it here */
#      define Q_COMPILER_ATOMICS/* GCC 4.6.x has problems dealing with noexcept expressions,* so turn the feature on for 4.7 and above, only */
#      define Q_COMPILER_NOEXCEPT/* C++11 features supported in GCC 4.7: */
#      define Q_COMPILER_NONSTATIC_MEMBER_INIT
#      define Q_COMPILER_DELEGATING_CONSTRUCTORS
#      define Q_COMPILER_EXPLICIT_OVERRIDES
#      define Q_COMPILER_TEMPLATE_ALIAS
#      define Q_COMPILER_UDL
#    endif
#    if Q_CC_GNU >= 408
#      define Q_COMPILER_ATTRIBUTES
#      define Q_COMPILER_ALIGNAS
#      define Q_COMPILER_ALIGNOF
#      define Q_COMPILER_INHERITING_CONSTRUCTORS
#      define Q_COMPILER_THREAD_LOCAL
#      if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1
#         define Q_COMPILER_REF_QUALIFIERS
#      endif
#    endif/* C++11 features are complete as of GCC 4.8.1 */
#  endif
#  if __cplusplus > 201103L
#    if Q_CC_GNU >= 409/* C++1y features in GCC 4.9 - deprecated, do not update this list */
//#    define Q_COMPILER_BINARY_LITERALS   // already supported since GCC 4.3 as an extension
#      define Q_COMPILER_LAMBDA_CAPTURES
#      define Q_COMPILER_RETURN_TYPE_DEDUCTION
#    endif
#  endif
#endif

3、C++11 keywords

下面是与C++11各关键字相关的宏,如常见的= default= delete

// qcompilerdetection.h
/** C++11 keywords and expressions*/
#ifdef Q_COMPILER_NULLPTR
# define Q_NULLPTR         nullptr
#else
# define Q_NULLPTR         NULL
#endif#ifdef Q_COMPILER_DEFAULT_MEMBERS
#  define Q_DECL_EQ_DEFAULT = default
#else
#  define Q_DECL_EQ_DEFAULT
#endif#ifdef Q_COMPILER_DELETE_MEMBERS
# define Q_DECL_EQ_DELETE = delete
#else
# define Q_DECL_EQ_DELETE
#endif// Don't break code that is already using Q_COMPILER_DEFAULT_DELETE_MEMBERS
#if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
#  define Q_COMPILER_DEFAULT_DELETE_MEMBERS
#endif#if defined Q_COMPILER_CONSTEXPR
# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
#  define Q_DECL_CONSTEXPR constexpr
#  define Q_DECL_RELAXED_CONSTEXPR constexpr
#  define Q_CONSTEXPR constexpr
#  define Q_RELAXED_CONSTEXPR constexpr
# else
#  define Q_DECL_CONSTEXPR constexpr
#  define Q_DECL_RELAXED_CONSTEXPR
#  define Q_CONSTEXPR constexpr
#  define Q_RELAXED_CONSTEXPR const
# endif
#else
# define Q_DECL_CONSTEXPR
# define Q_DECL_RELAXED_CONSTEXPR
# define Q_CONSTEXPR const
# define Q_RELAXED_CONSTEXPR const
#endif#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_DECL_OVERRIDE override
# define Q_DECL_FINAL final
#else
# ifndef Q_DECL_OVERRIDE
#  define Q_DECL_OVERRIDE
# endif
# ifndef Q_DECL_FINAL
#  define Q_DECL_FINAL
# endif
#endif#ifdef Q_COMPILER_NOEXCEPT
# define Q_DECL_NOEXCEPT noexcept
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
# ifdef Q_DECL_NOTHROW
#  undef Q_DECL_NOTHROW /* override with C++11 noexcept if available */
# endif
#else
# define Q_DECL_NOEXCEPT
# define Q_DECL_NOEXCEPT_EXPR(x)
#endif
#ifndef Q_DECL_NOTHROW
# define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
#endif#if defined(Q_COMPILER_ALIGNOF)
#  undef Q_ALIGNOF
#  define Q_ALIGNOF(x)  alignof(x)
#endif#if defined(Q_COMPILER_ALIGNAS)
#  undef Q_DECL_ALIGN
#  define Q_DECL_ALIGN(n)   alignas(n)
#endif

4、C++ standard

C++标准参考:https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
下面是sg10-sd6给出的一些C++特性。

// qcompilerdetection.h
#ifdef __has_builtin
#  define QT_HAS_BUILTIN(x)             __has_builtin(x)
#else
#  define QT_HAS_BUILTIN(x)             0
#endif
#ifdef __has_attribute
#  define QT_HAS_ATTRIBUTE(x)           __has_attribute(x)
#else
#  define QT_HAS_ATTRIBUTE(x)           0
#endif
#ifdef __has_cpp_attribute
#  define QT_HAS_CPP_ATTRIBUTE(x)       __has_cpp_attribute(x)
#else
#  define QT_HAS_CPP_ATTRIBUTE(x)       0
#endif
#ifdef __has_include
#  define QT_HAS_INCLUDE(x)             __has_include(x)
#else
#  define QT_HAS_INCLUDE(x)             0
#endif
#ifdef __has_include_next
#  define QT_HAS_INCLUDE_NEXT(x)        __has_include_next(x)
#else
#  define QT_HAS_INCLUDE_NEXT(x)        0
#endif

5、Warning handling

在编译代码时,常会看到一些Warning,这些Warning可以通过技术手段规避,如下的一些宏定义,将会产生警告的代码置于pushpop之间,或者直接disableignored会产生警告的编译规则。

// qcompilerdetection.h
#define QT_DO_PRAGMA(text)                      _Pragma(#text)
// ... other compilers
#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG)
#  undef QT_DO_PRAGMA                           /* not needed */
#  define QT_WARNING_PUSH                       __pragma(warning(push))
#  define QT_WARNING_POP                        __pragma(warning(pop))
#  define QT_WARNING_DISABLE_MSVC(number)       __pragma(warning(disable: number))
#  define QT_WARNING_DISABLE_INTEL(number)
#  define QT_WARNING_DISABLE_CLANG(text)
#  define QT_WARNING_DISABLE_GCC(text)
#  define QT_WARNING_DISABLE_DEPRECATED         QT_WARNING_DISABLE_MSVC(4996)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
#  define QT_WARNING_PUSH                       QT_DO_PRAGMA(GCC diagnostic push)
#  define QT_WARNING_POP                        QT_DO_PRAGMA(GCC diagnostic pop)
#  define QT_WARNING_DISABLE_GCC(text)          QT_DO_PRAGMA(GCC diagnostic ignored text)
#  define QT_WARNING_DISABLE_CLANG(text)
#  define QT_WARNING_DISABLE_INTEL(number)
#  define QT_WARNING_DISABLE_MSVC(number)
#  define QT_WARNING_DISABLE_DEPRECATED         QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
#else       // All other compilers, GCC < 4.6 and MSVC < 2008
#  define QT_WARNING_DISABLE_GCC(text)
#  define QT_WARNING_PUSH
#  define QT_WARNING_POP
#  define QT_WARNING_DISABLE_INTEL(number)
#  define QT_WARNING_DISABLE_MSVC(number)
#  define QT_WARNING_DISABLE_CLANG(text)
#  define QT_WARNING_DISABLE_GCC(text)
#  define QT_WARNING_DISABLE_DEPRECATED
#endif

6、arch processor

下面是Qt支持的处理器类型(ARCH_PROCESSOR),如常见的i386x86_64等。

// archdetect.cpp
// main part: processor type
#if defined(Q_PROCESSOR_ALPHA)
#  define ARCH_PROCESSOR "alpha"
#elif defined(Q_PROCESSOR_ARM_32)
#  define ARCH_PROCESSOR "arm"
#elif defined(Q_PROCESSOR_ARM_64)
#  define ARCH_PROCESSOR "arm64"
#elif defined(Q_PROCESSOR_AVR32)
#  define ARCH_PROCESSOR "avr32"
#elif defined(Q_PROCESSOR_BLACKFIN)
#  define ARCH_PROCESSOR "bfin"
#elif defined(Q_PROCESSOR_X86_32)
#  define ARCH_PROCESSOR "i386"
#elif defined(Q_PROCESSOR_X86_64)
#  define ARCH_PROCESSOR "x86_64"
#elif defined(Q_PROCESSOR_IA64)
#  define ARCH_PROCESSOR "ia64"
#elif defined(Q_PROCESSOR_MIPS_64)
#  define ARCH_PROCESSOR "mips64"
#elif defined(Q_PROCESSOR_MIPS)
#  define ARCH_PROCESSOR "mips"
#elif defined(Q_PROCESSOR_POWER_32)
#  define ARCH_PROCESSOR "power"
#elif defined(Q_PROCESSOR_POWER_64)
#  define ARCH_PROCESSOR "power64"
#elif defined(Q_PROCESSOR_S390_X)
#  define ARCH_PROCESSOR "s390x"
#elif defined(Q_PROCESSOR_S390)
#  define ARCH_PROCESSOR "s390"
#elif defined(Q_PROCESSOR_SH)
#  define ARCH_PROCESSOR "sh"
#elif defined(Q_PROCESSORS_SPARC_64)
#  define ARCH_PROCESSOR "sparc64"
#elif defined(Q_PROCESSOR_SPARC_V9)
#  define ARCH_PROCESSOR "sparcv9"
#elif defined(Q_PROCESSOR_SPARC)
#  define ARCH_PROCESSOR "sparc"
#else
#  define ARCH_PROCESSOR "unknown"
#endif

处理器对应的宏有固定的格式,如下所示。

// qprocessordetection.h    Q_PROCESSOR_{FAMILY}Q_PROCESSOR_{FAMILY}_{VARIANT}Q_PROCESSOR_{FAMILY}_{REVISION}// qprocessordetection.h
// ... other arches
/*
ARM family, known revisions: V5, V6, V7, V8
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__X86 family, known variants: 32- and 64-bit
X86 is little-endian
/*
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#  define Q_PROCESSOR_X86_32
#  define Q_BYTE_ORDER Q_LITTLE_ENDIAN
#  define Q_PROCESSOR_WORDSIZE   4
#  if defined(_M_IX86)
#    define Q_PROCESSOR_X86     (_M_IX86/100)
#  elif defined(__i686__) || defined(__athlon__) || defined(__SSE__) || defined(__pentiumpro__)
#    define Q_PROCESSOR_X86     6
#  elif defined(__i586__) || defined(__k6__) || defined(__pentium__)
#    define Q_PROCESSOR_X86     5
#  elif defined(__i486__) || defined(__80486__)
#    define Q_PROCESSOR_X86     4
#  else
#    define Q_PROCESSOR_X86     3
#  endif
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#  define Q_PROCESSOR_X86       6
#  define Q_PROCESSOR_X86_64
#  define Q_BYTE_ORDER Q_LITTLE_ENDIAN
#  define Q_PROCESSOR_WORDSIZE   8
// ... other arches

7、arch endian

大小端字节序(ARCH_ENDIANNESS)定义如下所示。

// archdetect.cpp
// endianness
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
#  define ARCH_ENDIANNESS "little_endian"
#elif Q_BYTE_ORDER == Q_BIG_ENDIAN
#  define ARCH_ENDIANNESS "big_endian"
#endif// qprocessordetection.h
/* Machine byte-order, reuse preprocessor provided macros when available */
#if defined(__ORDER_BIG_ENDIAN__)
#  define Q_BIG_ENDIAN __ORDER_BIG_ENDIAN__
#else
#  define Q_BIG_ENDIAN 4321
#endif
#if defined(__ORDER_LITTLE_ENDIAN__)
#  define Q_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#else
#  define Q_LITTLE_ENDIAN 1234
#endif// qprocessordetection.h
/*NOTE:GCC 4.6 added __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__and __ORDER_PDP_ENDIAN__ in SVN r165881. If you are using GCC 4.6 or newer,this code will properly detect your target byte order; if you are not, andthe __LITTLE_ENDIAN__ or __BIG_ENDIAN__ macros are not defined, then thiscode will fail to detect the target byte order.
*/
// Some processors support either endian format, try to detect which we are using.
#if !defined(Q_BYTE_ORDER)
#  if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == Q_BIG_ENDIAN || __BYTE_ORDER__ == Q_LITTLE_ENDIAN)
// Reuse __BYTE_ORDER__ as-is, since our Q_*_ENDIAN #defines match the preprocessor defaults
#    define Q_BYTE_ORDER __BYTE_ORDER__
#  elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
#    define Q_BYTE_ORDER Q_BIG_ENDIAN
#  elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \|| defined(WINAPI_FAMILY) // WinRT is always little-endian according to MSDN.
#    define Q_BYTE_ORDER Q_LITTLE_ENDIAN
#  else
#    error "Unable to determine byte order!"
#  endif
#endif

8、arch pointer

指针大小(ARCH_POINTER)定义如下所示。

// archdetect.cpp
// pointer type
#if defined(Q_OS_WIN64) || (defined(Q_OS_WINRT) && defined(_M_X64))
#  define ARCH_POINTER "llp64"
#elif defined(__LP64__) || QT_POINTER_SIZE - 0 == 8
#  define ARCH_POINTER "lp64"
#else
#  define ARCH_POINTER "ilp32"
#endif// qprocessordetection.h
/*Size of a pointer and the machine register size. We detect a 64-bit system by:* GCC and compatible compilers (Clang, ICC on OS X and Windows) always define__SIZEOF_POINTER__. This catches all known cases of ILP32 builds on 64-bitprocessors.* Most other Unix compilers define __LP64__ or _LP64 on 64-bit mode(Long and Pointer 64-bit)* If Q_PROCESSOR_WORDSIZE was defined above, it's assumed to match the pointersize.Otherwise, we assume to be 32-bit and then check in qglobal.cpp that it is right.
*/#if defined __SIZEOF_POINTER__
#  define QT_POINTER_SIZE           __SIZEOF_POINTER__
#elif defined(__LP64__) || defined(_LP64)
#  define QT_POINTER_SIZE           8
#elif defined(Q_PROCESSOR_WORDSIZE)
#  define QT_POINTER_SIZE           Q_PROCESSOR_WORDSIZE
#else
#  define QT_POINTER_SIZE           4
#endif

9、arch coordinate

浮点数精度(ARCH_COORD_TYPE)定义如下所示。

// archdetect.cpp
// qreal type, if not double (includes the dash)
#ifdef QT_COORD_TYPE_STRING
#  define ARCH_COORD_TYPE   "-qreal_" QT_COORD_TYPE_STRING
#else
#  define ARCH_COORD_TYPE  ""
#endif

10、arch abi

程序二进制接口相关的软、硬浮点(ARCH_ABI)定义如下所示。

// archdetect.cpp
// secondary: ABI string (includes the dash)
#if defined(__ARM_EABI__) || defined(__mips_eabi)
#  define ARCH_ABI1 "-eabi"
#elif defined(_MIPS_SIM)
#  if _MIPS_SIM == _ABIO32
#    define ARCH_ABI1 "-o32"
#  elif _MIPS_SIM == _ABIN32
#    define ARCH_ABI1 "-n32"
#  elif _MIPS_SIM == _ABI64
#    define ARCH_ABI1 "-n64"
#  elif _MIPS_SIM == _ABIO64
#    define ARCH_ABI1 "-o64"
#  endif
#else
#  define ARCH_ABI1 ""
#endif
#if defined(__ARM_PCS_VFP) || defined(__mips_hard_float)
// Use "-hardfloat" for platforms that usually have no FPUs
// (and for the platforms which had "-hardfloat" before we established the rule)
#  define ARCH_ABI2 "-hardfloat"
#elif defined(_SOFT_FLOAT)
// Use "-softfloat" for architectures that usually have FPUs
#  define ARCH_ABI2 "-softfloat"
#else
#  define ARCH_ABI2 ""
#endif#define ARCH_ABI ARCH_ABI1 ARCH_ABI2

【QT】Qt Compiler Detection(编译)相关推荐

  1. Qt 之 Qt/Qt Lite 自编译详解(VS/MinGW/...)

    2018/3/24 目前QT更新到了5.10.1.文章增加了对该版本的说明. 2020/9/5 目前QT更新到了5.15.0.文章更新了部分内容 写在前面   现在,网上关于 Qt 编译的文章数不胜数 ...

  2. QT学习笔记(二):QT MinGW 和 MSVC 编译方式

    QT学习笔记(二):QT MinGW 和 MSVC 编译方式 Qt 中有两种方式编译:一种是MinGW ,另一种MSVC,是使用两种不同的编译器. 1.MSVC是指微软的VC编译器: 2.MingGW ...

  3. anno arm移植Qt环境后,编译正常,程序无法正常启动问题的记录

    anno arm移植Qt环境后,编译正常,程序无法正常启动问题的记录 Cannot load library libqxcb.so: (libQt5XcbQpa.so.5: symbol , vers ...

  4. 【网络通信 -- 直播】OBS -- 基于 Visual Studio 2019 + Qt 5.15.2 编译调试 OBS studio 源码

    [网络通信 -- 直播]OBS -- 基于 Visual Studio 2019 + Qt 5.15.2 编译调试 OBS studio 源码 [1]OBS 代码获取 github : git clo ...

  5. CentOS编译安装Qt(Qt可使用静态编译编译器)

    CentOS编译安装Qt(Qt可使用静态编译编译器) 文章目录 前言 下载Qt源码 编译安装--以4.7.4为例 安装QtCreator 设置编译器 附加--Windows Qt静态编译的方法(以5. ...

  6. 关于vs qt 64位程序 编译文件0xc000007b错误的解决方案

    最近经常遇到这个问题,用QT的命令窗口编译的程序,在别人电脑上有些能正常运行有些就会出现0xc000007bde的错误,或者提示缺少xxxxx.dll文件缺失的错误,然后你将将这个动态库文件复制过去你 ...

  7. QT - QT中配置MSVC编译环境 以及 VS中配置QT开发环境

    本文主要记录一下如何在 QT5.14.2 中配置 MSVC2017 构建套件,以及在VS2017中配置QT的开发环境.开发环境为 Win10 +  QT5.14.2 + Visual Studio 2 ...

  8. QT qt 3d 绘图

    qt 3d 绘图 首先不得不说,要感谢北京邮电大学的阿科.感谢他慷慨的分享和极具科学态度的记录,将自己搜集到的众多资料收集整理发布,拯救众多苦逼寻找方案的程序员于苦海之中.因为最近接手新的项目,涉及到 ...

  9. Qt | Qt For Android、Qt5.14.2安卓开发环境搭建详细步骤

    Qt | Qt For Android.Qt5.14.2安卓开发环境搭建详细步骤 目录 Qt | Qt For Android.Qt5.14.2安卓开发环境搭建详细步骤 1.简介 2.软件下载 1.J ...

  10. QT——Qt QtCreator 官方下载地址

    [系列专栏]:博主结合工作实践输出的,解决实际问题的专栏,朋友们看过来! <项目案例分享> <极客DIY开源分享> <嵌入式通用开发实战> <C++语言开发基 ...

最新文章

  1. IPRO_DOCXCC_EXTRACT_PARTBODY
  2. 嵌入式软件工程师2021面试指南【转】
  3. python自动填日志_Selenium3+python自动化012+日志logging基本用法、高级用法
  4. 小米5s升级Android8,小米5s、小米5s Plus升级8.0提前,好消息!
  5. 企业软件定制开发的流程,有五点是需要注意的!
  6. Csrf漏洞概述及其原理
  7. HDU - 4780费用流
  8. 人脸方向学习(十二):Face Detection-Tiny-DSOD解读
  9. c语言数学函数库根号程序,数学函数8.2.3次方与开根号C语言入门经典.ppt
  10. NetApp存储术语介绍
  11. acm:C语言程序设计:求圆柱的体积等,去除小数点后两位最后一位的四舍五入
  12. 基于SSM框架CRM客户管理系统
  13. 搭建自己的wiki知识管理系统
  14. 论QQ如何发大菜狗表情
  15. 专访CAPA梁振宇:信息无障碍是互联网产品的必选项
  16. 基于切比雪夫逼近法的滤波器的matlab设计与实现
  17. Flutter factory关键字
  18. java 实体转map
  19. 小龙虾壳做环保包装袋,用计算机视觉来远程监考……这些公司好好玩!
  20. MySQL 09 DQL → select 初识查询数据和别名的使用

热门文章

  1. FlexRay总线的基本注意事项1——总线拓扑
  2. SpringBoot + Redis实现事件的发布订阅功能
  3. 计算机桌面太大了,电脑显示器显示太大怎么办
  4. 李宏毅机器学习作业6-使用GAN生成动漫人物脸
  5. IDEA快捷键高清壁纸
  6. ecshop支持mysql_ecshop安装不支持MySQL
  7. 数据库的增删改查的一个例题
  8. 关于在POI以SAX方式解析,会导出拼音(音标)的问题解决
  9. 机器学习常用算法原理及优缺点
  10. 汉语言文学专业c学校,理科生能报汉语言文学专业吗?哪些学校找理科生