aboutsummaryrefslogtreecommitdiff
path: root/include/env.hpp
blob: 8037f26165eb60c5ba4a3e91962b17d6499be909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef SIBS_ENV_HPP
#define SIBS_ENV_HPP

#define OS_FAMILY_WINDOWS 0
#define OS_FAMILY_POSIX 1

#define OS_TYPE_WINDOWS 0
#define OS_TYPE_LINUX 1
#define OS_TYPE_APPLE 2
#define OS_TYPE_OPENBSD 3
#define OS_TYPE_HAIKU 10

#if defined(_WIN32) || defined(_WIN64)
    #define OS_FAMILY OS_FAMILY_WINDOWS
    #define OS_TYPE OS_TYPE_WINDOWS

	#ifndef UNICODE
	#define UNICODE
	#endif

	#ifndef _UNICODE
	#define _UNICODE
	#endif

	#ifndef WIN32_LEAN_AND_MEAN
	#define WIN32_LEAN_AND_MEAN
	#endif

	#include <windows.h>
#endif

#ifdef __linux__
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_LINUX
#endif

#if defined(__APPLE__) || defined(__MACOSX__)
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_APPLE
#endif

#ifdef __OpenBSD__
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_OPENBSD
#endif

#ifdef __HAIKU__
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_HAIKU
#endif

#ifdef __CYGWIN__
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_LINUX
#endif

#ifdef __EMSCRIPTEN__
    #define OS_FAMILY OS_FAMILY_POSIX
    #define OS_TYPE OS_TYPE_LINUX
#endif

#if defined(__aarch64__)
    #define SIBS_ARCH_ARM
    #define SIBS_ENV_64BIT
#elif defined(__arm__) || defined(_ARM) || defined(_M_ARM) || defined(__arm)
    #define SIBS_ARCH_ARM
    #define SIBS_ENV_32BIT
#elif defined(__x86_64__) || defined(__amd64__) || defined(__amd64) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
    #define SIBS_ARCH_X86
    #define SIBS_ENV_64BIT
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__IA32__) || defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_)
    #define SIBS_ARCH_X86
    #define SIBS_ENV_32BIT
#endif

#if !defined(SIBS_ENV_32BIT) && !defined(SIBS_ENV_64BIT)
    #error "System is not detected as either 32-bit or 64-bit"
#endif

#if !defined(OS_FAMILY)
    #error "System not supported. Only Windows and Posix systems supported right now"
#endif

#if !defined(OS_TYPE)
    #error "System not supported. Only Windows, linux, macos and openbsd systems supported right now"
#endif

#if !defined(SIBS_ARCH_ARM) && !defined(SIBS_ARCH_X86)
    #error "System is not detected as either arm or x86"
#endif

#if !defined(DEBUG) && !defined(NDEBUG)
#define DEBUG
#endif

#endif // SIBS_ENV_HPP