Document of c-modernization-kit (util) 1.0.0
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1
41
42#ifndef PLATFORM_H
43#define PLATFORM_H
44
45#include "compiler.h"
46
47#ifdef DOXYGEN
48 #define PLATFORM_WINDOWS
49 #define PLATFORM_LINUX
50 #define PLATFORM_MACOS
51 #define PLATFORM_APPLE_OTHER
52 #define PLATFORM_UNKNOWN
53 #define PLATFORM_NAME \
54 "name"
55#else /* !DOXYGEN */
56 #if defined(_WIN32) || defined(_WIN64)
57 #define PLATFORM_WINDOWS
58 #define PLATFORM_NAME "Windows"
59 #elif defined(__linux__)
60 #define PLATFORM_LINUX
61 #define PLATFORM_NAME "Linux"
62 #elif defined(__APPLE__)
63 #include <TargetConditionals.h>
64 #if TARGET_OS_MAC && !TARGET_OS_IPHONE
65 #define PLATFORM_MACOS
66 #define PLATFORM_NAME "macOS"
67 #else
68 #define PLATFORM_APPLE_OTHER
69 #define PLATFORM_NAME "Apple (non-macOS)"
70 #endif
71 #else
72 #define PLATFORM_UNKNOWN
73 #define PLATFORM_NAME "Unknown"
74 #endif
75#endif /* DOXYGEN */
76
77#ifdef DOXYGEN
78 #define ARCH_X64
79 #define ARCH_X86
80 #define ARCH_ARM64
81 #define ARCH_ARM
82 #define ARCH_UNKNOWN
83 #define ARCH_NAME "name"
84#else /* !DOXYGEN */
85 #if defined(__x86_64__) || defined(_M_X64)
86 #define ARCH_X64
87 #define ARCH_NAME "x64"
88 #elif defined(__i386__) || defined(_M_IX86)
89 #define ARCH_X86
90 #define ARCH_NAME "x86"
91 #elif defined(__aarch64__) || defined(_M_ARM64)
92 #define ARCH_ARM64
93 #define ARCH_NAME "ARM64"
94 #elif defined(__arm__) || defined(_M_ARM)
95 #define ARCH_ARM
96 #define ARCH_NAME "ARM"
97 #else
98 #define ARCH_UNKNOWN
99 #define ARCH_NAME "Unknown"
100 #endif
101#endif /* DOXYGEN */
102
103#endif /* PLATFORM_H */
コンパイラ検出および抽象化マクロのヘッダーファイル。