C++ Utilities  5.10.5
Useful C++ classes and routines such as argument parser, IO and conversion utilities
global.h
Go to the documentation of this file.
1 #ifndef CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H
2 #define CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H
3 
4 #if defined(_WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
5 #ifndef PLATFORM_WINDOWS
7 #define PLATFORM_WINDOWS
8 #endif
9 #endif
10 #if defined(__CYGWIN__)
11 #ifndef PLATFORM_CYGWIN
13 #define PLATFORM_CYGWIN
14 #endif
15 #endif
16 #if defined(__MINGW32__) || defined(__MINGW64__)
17 #ifndef PLATFORM_MINGW
19 #define PLATFORM_MINGW
20 #endif
21 #endif
22 #if defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
23 #ifndef PLATFORM_LINUX
25 #define PLATFORM_LINUX
26 #endif
27 #if defined(__ANDROID__) || defined(ANDROID)
28 #ifndef PLATFORM_ANDROID
30 #define PLATFORM_ANDROID
31 #endif
32 #endif
33 #endif
34 #if defined(__APPLE__)
35 #include <TargetConditionals.h>
36 #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
37 #ifndef PLATFORM_MAC
39 #define PLATFORM_MAC
40 #endif
41 #ifndef PLATFORM_BSD4
43 #define PLATFORM_BSD4
44 #endif
45 #endif
46 #endif
47 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
48 #ifndef PLATFORM_FREE_BSD
50 #define PLATFORM_FREE_BSD
51 #endif
52 #endif
53 #if defined(__unix__) || defined(PLATFORM_LINUX) || defined(PLATFORM_FREE_BSD) || defined(PLATFORM_MAC)
54 #ifndef PLATFORM_UNIX
56 #define PLATFORM_UNIX
57 #endif
58 #endif
59 
77 #ifdef PLATFORM_WINDOWS
78 #define CPP_UTILITIES_GENERIC_LIB_EXPORT __declspec(dllexport)
79 #define CPP_UTILITIES_GENERIC_LIB_IMPORT __declspec(dllimport)
80 #define CPP_UTILITIES_GENERIC_LIB_HIDDEN
81 #else
82 #define CPP_UTILITIES_GENERIC_LIB_EXPORT __attribute__((visibility("default")))
83 #define CPP_UTILITIES_GENERIC_LIB_IMPORT __attribute__((visibility("default")))
84 #define CPP_UTILITIES_GENERIC_LIB_HIDDEN __attribute__((visibility("hidden")))
85 #endif
86 
92 #define CPP_UTILITIES_UNUSED(x) (void)x;
93 
99 #ifdef CPP_UTILITIES_DEBUG_BUILD
100 #define CPP_UTILITIES_IF_DEBUG_BUILD(x) x
101 #else
102 #define CPP_UTILITIES_IF_DEBUG_BUILD(x)
103 #endif
104 
105 #endif // CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H