gwnavruntime/kernel/platforms.h Source File

platforms.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 Autodesk, Inc. All rights reserved.
3  * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4  * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5  */
6 
7 #pragma once
8 
9 //---------------------------------------------------------------------------------------------------------------------------
10 // KY_OS_IOS KY_OS_MAC KY_OS_ANDROID KY_OS_LINUXPC KY_OS_PS4 KY_OS_WEB
11 // KY_OS_MS KY_OS_XBOXONE KY_OS_UWP KY_OS_WINDOWSPC
12 // KY_OS_STRING
13 #if (defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))) || defined(__MACOS__)
14 # if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED))
15 # define KY_OS_IOS
16 # define KY_OS_STRING "ios"
17 # else
18 # define KY_OS_MAC
19 # define KY_OS_STRING "osx"
20 # endif
21 
22 #elif defined(ANDROID)
23 # define KY_OS_ANDROID
24 # define KY_OS_STRING "android"
25 
26 #elif defined(__linux__) || defined(__linux)
27 # define KY_OS_LINUXPC
28 # define KY_OS_STRING "linux"
29 
30 #elif defined(__ORBIS__)
31 # define KY_OS_PS4
32 # define KY_OS_STRING "ps4"
33 
34 #elif defined(__EMSCRIPTEN__)
35 # define KY_OS_WEB
36 # define KY_OS_STRING "web"
37 
38 #elif defined(_WIN32)
39 
41 # define KY_OS_MS
42 
43 # if defined(_DURANGO)
44 # define KY_OS_XBOXONE
45 # define KY_OS_STRING "xb1"
46 
47 # elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
48 # define KY_OS_UWP
49 # if defined(_WIN64)
50 # define KY_OS_STRING "uwp64_mt"
51 # else
52 # define KY_OS_STRING "uwp32_mt"
53 # endif
54 
55 # else
56 # define KY_OS_WINDOWSPC
57 # if defined(_WIN64)
58 # if defined(_DLL)
59 # define KY_OS_STRING "win64_md"
60 # else
61 # define KY_OS_STRING "win64_mt"
62 # endif
63 # else
64 # if defined(_DLL)
65 # define KY_OS_STRING "win32_md"
66 # else
67 # define KY_OS_STRING "win32_mt"
68 # endif
69 # endif
70 # endif
71 
72 #endif
73 
74 #if !defined(KY_OS_STRING)
75 # error "Navigation does not support this platform"
76 #endif
77 
78 
79 //------------------------------------------------------------------------------------------------
80 // KY_OS_DESKTOP
81 #if defined(KY_OS_WINDOWSPC) || defined(KY_OS_LINUXPC) || defined(KY_OS_MAC)
82 # define KY_OS_DESKTOP
83 #endif
84 
85 
86 //---------------------------------------------------------------------------------------------------------------------------
87 // KY_CPU_X86_64 KY_CPU_X86_32 KY_CPU_ARM KY_64BIT_POINTERS
88 // hm this sounds really weird, what about android 64bits, should we use __aarch64__ ?
89 #if defined(__x86_64__) || defined(_WIN64)
90 # define KY_CPU_X86_64
91 # define KY_64BIT_POINTERS
92 #elif defined(__i386__) || defined(KY_OS_MS) && !defined(_M_ARM_FP)
93 # define KY_CPU_X86_32
94 #elif defined(__arm__) || defined(_M_ARM_FP) // __arm__ is defined for 32bit arm only
95 # define KY_CPU_ARM
96 #elif defined (__LP64__) // iOS: arch=arm64
97 # define KY_64BIT_POINTERS
98 #endif
99 
100 
101 //------------------------------------------------------------------------------------------------
102 // KY_ENABLE_GENERATION - platforms for which gwnavgeneration is built
103 #if defined(KY_OS_DESKTOP) || defined(KY_OS_PS4) || defined(KY_OS_XBOXONE)
104 # define KY_ENABLE_GENERATION
105 #endif
106 
107 
108 //---------------------------------------------------------------------------------------------------------------------------
109 // KY_CC_MSVC KY_CC_CLANG KY_CC_GCC
110 
111 #if defined(_MSC_VER)
112 # define KY_CC_MSVC _MSC_VER
113 // MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
114 // MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
115 // MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
116 // MSVC++ 15.0 _MSC_VER >= 1910 (Visual Studio 2017)
117 
118 #elif defined(__clang__)
119 # define KY_CC_CLANG
120 
121 #elif defined(__GNUC__)
122 # define KY_CC_GCC
123 
124 #else
125 # error "Navigation does not support this compiler"
126 #endif
127 
128 
129 // Linux Unicode - must come before Standard Includes
130 // Use glibc unicode functions on linux. <= todo understand
131 #if defined(KY_OS_LINUXPC) || defined(KY_OS_ANDROID)
132 # ifndef _GNU_SOURCE
133 # define _GNU_SOURCE
134 # endif
135 #endif