dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
ArchDetection.hpp
1// SPDX-FileCopyrightText: 2025 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11#if defined(__x86_64__)
12#define DFX_PLATFORM_ARCH_X86_64
13#elif defined(__i386__)
14#define DFX_PLATFORM_ARCH_X86_32
15#elif defined(__aarch64__)
16#define DFX_PLATFORM_ARCH_ARM_64
17#elif defined(__arm__)
18#define DFX_PLATFORM_ARCH_ARM_32
19#else
20#error "Unsupported architecture"
21#endif
22
23#if defined(__x86_64__) || defined(__aarch64__)
24#define DFX_PLATFORM_64BIT
25#elif defined(__i386__) || defined(__arm__)
26#define DFX_PLATFORM_32BIT
27#else
28#error "Cannot determine pointer size"
29#endif
30
31#if defined(__clang__)
32#define DFX_PLATFORM_COMPILER_CLANG
33#elif defined(__GNUC__)
34#define DFX_PLATFORM_COMPILER_GCC
35#else
36#error "Unsupported compiler"
37#endif
38
39#if defined(DFX_PLATFORM_COMPILER_CLANG) || defined(DFX_PLATFORM_COMPILER_GCC)
40#define DFX_PLATFORM_COMPILER_CLANG_OR_GCC
41#endif
42
43#if defined(DFX_PLATFORM_ARCH_X86_64) || defined(DFX_PLATFORM_ARCH_X86_32)
44#define DFX_PLATFORM_ARCH_X86
45#endif
46
47#if defined(DFX_PLATFORM_ARCH_ARM_64) || defined(DFX_PLATFORM_ARCH_ARM_32)
48#define DFX_PLATFORM_ARCH_ARM
49#endif