|
| 1 | +/* |
| 2 | +=========================================================================== |
| 3 | +Daemon BSD Source Code |
| 4 | +Copyright (c) 2022, Daemon Developers |
| 5 | +All rights reserved. |
| 6 | +
|
| 7 | +Redistribution and use in source and binary forms, with or without |
| 8 | +modification, are permitted provided that the following conditions are met: |
| 9 | + * Redistributions of source code must retain the above copyright |
| 10 | + notice, this list of conditions and the following disclaimer. |
| 11 | + * Redistributions in binary form must reproduce the above copyright |
| 12 | + notice, this list of conditions and the following disclaimer in the |
| 13 | + documentation and/or other materials provided with the distribution. |
| 14 | + * Neither the name of the Daemon developers nor the |
| 15 | + names of its contributors may be used to endorse or promote products |
| 16 | + derived from this software without specific prior written permission. |
| 17 | +
|
| 18 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND |
| 19 | +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 | +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | +DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY |
| 22 | +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 | +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 27 | +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | +=========================================================================== |
| 29 | +*/ |
| 30 | + |
| 31 | +/* The qprocessordetection.h file doesn't detect endianness for some |
| 32 | +platforms including ppc64, but we know how to do it for them. */ |
| 33 | + |
| 34 | +#include <stdint.h> |
| 35 | + |
| 36 | +/* This source file includes qprocessordetection.h from Qt: |
| 37 | +
|
| 38 | +- https://github.com/qt/qtbase/blob/dev/src/corelib/global/qprocessordetection.h |
| 39 | + https://raw.githubusercontent.com/qt/qtbase/dev/src/corelib/global/qprocessordetection.h |
| 40 | +
|
| 41 | +Always update by downloading new version from Qt, do not edit by hand. |
| 42 | +
|
| 43 | +This source file and the qprocessordetection.h header do not contribute to the |
| 44 | +produced engine and game binaries in any way that can be subject to copyright. */ |
| 45 | + |
| 46 | +#include "qprocessordetection.h" |
| 47 | + |
| 48 | +/* The architecture names are loosely inspired by Debian conventions: |
| 49 | + https://wiki.debian.org/ArchitectureSpecificsMemo |
| 50 | +
|
| 51 | +Except we don't have the same technical debt so we don't have |
| 52 | +to name i686 as i386 for backward compatibility purpose neither |
| 53 | +care of platform name variants that are meant to distinguish |
| 54 | +platform variants we cannot support anyway. */ |
| 55 | + |
| 56 | +/* PNaCl virtual machines. */ |
| 57 | +#if defined(__native_client__) |
| 58 | + #pragma message("DAEMON_ARCH_nacl") |
| 59 | + |
| 60 | +/* Wasm virtual machines, work in progress. */ |
| 61 | +#elif defined(Q_PROCESSOR_WASM) |
| 62 | + #pragma message("DAEMON_ARCH_wasm") |
| 63 | + |
| 64 | +/* Devices like: |
| 65 | + - IBM PC compatibles and derivatives, |
| 66 | + - Apple Intel-based mac, |
| 67 | + - Steam Deck, Atari VCS consoles… */ |
| 68 | + |
| 69 | +#elif defined(Q_PROCESSOR_X86_64) |
| 70 | + #pragma message("DAEMON_ARCH_amd64") |
| 71 | + |
| 72 | +#elif defined(Q_PROCESSOR_X86_32) |
| 73 | + // Assume at least i686. Detecting older revisions would be unlikely to work here |
| 74 | + // because the revisions are likely configured by flags, but this file is "compiled" |
| 75 | + // without most command-line flags. |
| 76 | + #pragma message("DAEMON_ARCH_i686") |
| 77 | + |
| 78 | +/* Devices like: |
| 79 | + - Raspberry Pi, |
| 80 | + - Apple M1-based mac, |
| 81 | + - Android phones and tablets… */ |
| 82 | + |
| 83 | +#elif defined(Q_PROCESSOR_ARM_64) |
| 84 | + #pragma message("DAEMON_ARCH_arm64") |
| 85 | + |
| 86 | +#elif defined(Q_PROCESSOR_ARM_32) && defined(__ARM_PCS_VFP) |
| 87 | + #pragma message("DAEMON_ARCH_armhf") |
| 88 | + |
| 89 | +#elif defined(Q_PROCESSOR_ARM_32) && !defined(__ARM_PCS_VFP) |
| 90 | + #pragma message("DAEMON_ARCH_armel") |
| 91 | + |
| 92 | +/* Devices like: |
| 93 | + - Raptor Computing Systems Talos, Blackbird… */ |
| 94 | + |
| 95 | +#elif defined(Q_PROCESSOR_POWER_64) && Q_BYTE_ORDER == Q_BIG_ENDIAN |
| 96 | + #pragma message("DAEMON_ARCH_ppc64") |
| 97 | + |
| 98 | +#elif defined(Q_PROCESSOR_POWER_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN |
| 99 | + #pragma message("DAEMON_ARCH_ppc64el") |
| 100 | + |
| 101 | +/* Devices like: |
| 102 | + - SiFive HiFive Unmatched, Horse Creek… */ |
| 103 | + |
| 104 | +#elif defined(Q_PROCESSOR_RISCV_64) |
| 105 | + #pragma message("DAEMON_ARCH_riscv64") |
| 106 | + |
| 107 | +#else |
| 108 | + #pragma message("DAEMON_ARCH_unknown") |
| 109 | +#endif |
| 110 | + |
| 111 | +// Make the compilation succeeds if architecture is supported. |
| 112 | +int main(int argc, char** argv) { |
| 113 | + return 0; |
| 114 | +} |
0 commit comments