main
1#ifndef KC_HEADER_PLATFORM_INFO_INCLUDED
2#define KC_HEADER_PLATFORM_INFO_INCLUDED
3
4/* Operating system */
5
6#if defined(_WIN32) || defined(_WIN64)
7 #define KC_PLATFORM_WINDOWS 1
8
9 #if _WIN64
10 #define KC_PLATFORM_BITNESS 64
11 #define KC_PLATFORM_WIN64 1
12 #else
13 #define KC_PLATFORM_BITNESS 32
14 #define KC_PLATFORM_WIN32 1
15 #endif
16
17#elif defined(__linux__)
18 #define KC_PLATFORM_LINUX 1
19
20 #if __x86_64__
21 #define KC_PLATFORM_BITNESS 64
22 #define KC_PLATFORM_LINUX64 1
23 #define KC_PLATFORM_ARCH_x86_64
24 #elif __i386__
25 #define KC_PLATFORM_BITNESS 32
26 #define KC_PLATFORM_LINUX32 1
27 #define KC_PLATFORM_ARCH_i386
28 #else
29 #error Unknown linux-supported architecture.
30 #endif
31
32#else
33 #error Unknown platform.
34#endif
35
36/* Compiler */
37
38#if defined(__clang__) || defined(__llvm__)
39 #define KC_COMPILER_CLANG
40 #define KC_COMPILER_NAME "clang"
41#elif defined(__INTEL_COMPILER)
42 #define Intel compilers currently unsuppored
43#elif defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__) && !defined(__INTEL_COMPILER)
44 #define KC_COMPILER_GCC
45 #define KC_COMPILER_NAME "gcc"
46#elif defined(__TINYCC__)
47 #define KC_COMPILER_TCC
48 #define KC_COMPILER_NAME "tcc"
49#elif defined( _MSC_VER )
50 #define KC_COMPILER_MSVC
51 #define KC_COMPILER_NAME "msvc"
52#else
53 #error Unidentified compiler.
54#endif
55
56
57/* For future use in osdev. */
58#if defined(KC_USE_PLATFORM_LIBC) && defined(KC_TARGET_BAREMETAL)
59 #error Can not use libc on a bare metal target.
60#endif
61
62
63#endif