include(CMakePushCheckState)
include(CheckStructHasMember)
include(CheckCXXSourceRuns)
+include(TestBigEndian)
include(FeatureSummary)
include(KatieBuildMacros)
# stored in qconfig.h.cmake
check_type_size(size_t QT_POINTER_SIZE)
+test_big_endian(KATIE_BIG_ENDIAN)
+if(KATIE_BIG_ENDIAN)
+ set(KATIE_BYTE_ORDER "Q_BIG_ENDIAN")
+else()
+ set(KATIE_BYTE_ORDER "Q_LITTLE_ENDIAN")
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(KATIE_OS "LINUX")
+elseif(CMAKE_SYSTEM_NAME MATCHES "GNU")
+ set(KATIE_OS "HURD")
+elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ set(KATIE_OS "FREEBSD")
+elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
+ set(KATIE_OS "DRAGONFLY")
+elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+ set(KATIE_OS "OPENBSD")
+elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ set(KATIE_OS "NETBSD")
+elseif(NOT CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
+ set(KATIE_OS "SOLARIS")
+else()
+ message(FATAL_ERROR "Unknown platform '${CMAKE_SYSTEM_NAME}'")
+endif()
+
+# https://en.wikipedia.org/wiki/Uname
+if(KATIE_PROCESSOR MATCHES "^alpha")
+ set(KATIE_ARCH "ALPHA")
+elseif(KATIE_PROCESSOR MATCHES "^arm64")
+ set(KATIE_ARCH "ARM64")
+elseif(KATIE_PROCESSOR MATCHES "^arm")
+ set(KATIE_ARCH "ARM")
+elseif(KATIE_PROCESSOR MATCHES "^avr")
+ set(KATIE_ARCH "AVR32")
+elseif(KATIE_PROCESSOR MATCHES "^blackfin")
+ set(KATIE_ARCH "BFIN")
+elseif(KATIE_PROCESSOR MATCHES "(x86|i[3-6]86|i86pc)")
+ set(KATIE_ARCH "I386")
+elseif(KATIE_PROCESSOR MATCHES "^ia64")
+ set(KATIE_ARCH "IA64")
+elseif(KATIE_PROCESSOR MATCHES "^m68k")
+ set(KATIE_ARCH "M68K")
+elseif(KATIE_PROCESSOR MATCHES "^mips")
+ set(KATIE_ARCH "MIPS")
+elseif(KATIE_PROCESSOR MATCHES "^hppa")
+ set(KATIE_ARCH "PARISC")
+elseif(KATIE_PROCESSOR MATCHES "^ppc64")
+ set(KATIE_ARCH "POWERPC64")
+elseif(KATIE_PROCESSOR MATCHES "^ppc")
+ set(KATIE_ARCH "POWERPC")
+elseif(KATIE_PROCESSOR MATCHES "^s390")
+ set(KATIE_ARCH "S390")
+elseif(KATIE_PROCESSOR MATCHES "^sparc")
+ set(KATIE_ARCH "SPARC")
+elseif(KATIE_PROCESSOR MATCHES "^sh")
+ # TODO: SH4A
+ set(KATIE_ARCH "SH")
+elseif(KATIE_PROCESSOR MATCHES "(x86_64|amd64)")
+ set(KATIE_ARCH "X86_64")
+else()
+ message(FATAL_ERROR "Unknown CPU '${KATIE_PROCESSOR}'")
+endif()
+
# used in components, tests and JavaScriptCore
katie_check_header("cxxabi.h")
katie_check_function(posix_memalign "stdlib.h")
#define QT_KATIE
#cmakedefine QT_POINTER_SIZE ${QT_POINTER_SIZE}
+// The operating system, must be one of Q_OS_x
+#define Q_OS_${KATIE_OS}
+
+// The architechture, must be one of QT_ARCH_x
+#define QT_ARCH_${KATIE_ARCH}
+
+// Target endianness
+#define Q_BIG_ENDIAN 4321
+#define Q_LITTLE_ENDIAN 1234
+#define Q_BYTE_ORDER ${KATIE_BYTE_ORDER}
+
// No longer supported
#define QT_NO_OPENVG
#define QT_NO_PHONON
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-/*
- The architechture, must be one of: (QT_ARCH_x)
-
- ALPHA - ...
- ARM - ...
- ARM64 - ...
- AVR32 - ...
- BFIN - ...
- I386 - ...
- IA64 - ...
- M68K - ...
- MIPS - ...
- PARISC - ...
- POWERPC - ...
- POWERPC64 - ...
- S390 - ...
- SPARC - ...
- SH - ...
- SH4A - ...
- X86_64 - ...
-
- Useful hyper-links:
-
- https://gcc.gnu.org/backends.html
- https://en.wikipedia.org/wiki/GNU_Compiler_Collection#Architectures
-*/
-#if defined(__alpha__)
-# define QT_ARCH_ALPHA
-#elif defined(__arm__)
-# define QT_ARCH_ARM
-#elif defined(__aarch64__)
-# define QT_ARCH_ARM64
-#elif defined(__avr__)
-# define QT_ARCH_AVR32
-#elif defined(__bfin__)
-# define QT_ARCH_BFIN
-#elif defined(__i386__)
-# define QT_ARCH_I386
-#elif defined(__ia64__)
-# define QT_ARCH_IA64
-#elif defined(__m68k__)
-# define QT_ARCH_M68K
-#elif defined(__mips__)
-# define QT_ARCH_MIPS
-#elif defined(__hppa__)
-# define QT_ARCH_PARISC
-#elif defined(__powerpc__)
-# define QT_ARCH_POWERPC
-#elif defined(__powerpc64__)
-# define QT_ARCH_POWERPC64
-#elif defined(__s390__)
-# define QT_ARCH_S390
-#elif defined(__sparc__)
-# define QT_ARCH_SPARC
-#elif defined(__sh__)
-# define QT_ARCH_SH
-#elif defined(__x86_64__)
-# define QT_ARCH_X86_64
-#else
-# error Unable to detect architecture, please update above list
-#endif
-
-// Detect target endianness
-#if defined (__BYTE_ORDER__) && \
- (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
-# define Q_BYTE_ORDER __BYTE_ORDER__
-# define Q_BIG_ENDIAN __ORDER_BIG_ENDIAN__
-# define Q_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
-#elif defined (__LITTLE_ENDIAN__)
-# define Q_BIG_ENDIAN 1234
-# define Q_LITTLE_ENDIAN 4321
-# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
-#elif defined (__BIG_ENDIAN__)
-# define Q_BIG_ENDIAN 1234
-# define Q_LITTLE_ENDIAN 4321
-# define Q_BYTE_ORDER Q_BIG_ENDIAN
-#else
-# error Unable to detect target endianness
-#endif
+// Compatibility, used to be conditional
+#define Q_WS_X11
+#define Q_OS_UNIX
#include <utility> // std::swap
#include <cstdint> // std::uintptr_t
#define QT_END_INCLUDE_HEADER extern "C++"
/*
- The operating system, must be one of: (Q_OS_x)
-
- LINUX - Linux
- FREEBSD - FreeBSD
- NETBSD - NetBSD
- OPENBSD - OpenBSD
- DRAGONFLY - DragonFly BSD
- HURD - GNU Hurd
- SOLARIS - Sun Solaris
-*/
-
-#if defined(__linux__) || defined(__linux)
-# define Q_OS_LINUX
-#elif defined(__FreeBSD__)
-# define Q_OS_FREEBSD
-#elif defined(__NetBSD__)
-# define Q_OS_NETBSD
-#elif defined(__OpenBSD__)
-# define Q_OS_OPENBSD
-#elif defined(__DragonFly__)
-# define Q_OS_DRAGONFLY
-#elif defined(__GNU__)
-# define Q_OS_HURD
-#elif defined(__sun) || defined(sun)
-# define Q_OS_SOLARIS
-#else
-# error "Katie has not been ported to this OS"
-#endif
-
-// Compatibility, used to be conditional
-#define Q_WS_X11
-#define Q_OS_UNIX
-
-/*
The compiler, must be one of: (Q_CC_x)
GNU - GNU C++
For full listing, see
http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
*/
-
#if defined(__GNUC__)
# define Q_CC_GNU
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)