Mako 8.2.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007-2025 Global Graphics Software Ltd. All rights reserved.
3 */
4
11
12#ifndef PLATFORM_H
13#define PLATFORM_H
14
15
16/***********************************************************
17 * The target platforms currently supported by Mako consist of:
18 *
19 * Operating System Processor Architecture
20 * ---------------- ----------------------
21 * Windows x86
22 * Windows x64
23 * Windows arm64
24 * Windows Server x64
25 * Windows Server x64
26 * Windows UWP armv7
27 *
28 * macOS x64
29 * macOS arm64
30 * iOS arm64
31 * iOS x64 (simulator)
32 * iOS arm64 (simulator)
33 *
34 * Linux x86
35 * Linux arm32
36 * Linux arm64
37 *
38 * In order to be able to resolve these platforms at compilation time
39 * we are expecting the compilation environment to supply one (or more)
40 * of the following preprocessor symbols:
41 *
42 * _WIN32
43 * _WIN64
44 * __linux
45 * __APPLE__
46 * __ppc__
47 * __i386__
48 * __ppc64__
49 * __amd64__
50 * __x86_64__
51 * __arm__
52 * __arm64__
53 *
54 *
55 * For some of these we additionally define a number of parallel symbols
56 * that are needed by header files provided by other packages whose header files we compile against
57 * and whose libraries we link to build Mako
58 *
59 * WIN32
60 * WIN64
61 * LINUX
62 ***********************************************************/
63
64#ifdef _WIN32
65#ifndef WIN32
66#define WIN32
67#endif
68#endif
69
70#ifdef _WIN64
71#ifndef WIN64
72#define WIN64
73#endif
74#endif
75
76#ifdef __linux
77#ifndef LINUX
78#define LINUX
79#endif
80#endif
81
82
83/***********************************************************
84 * In addition to these operating-system/processor-architecture dependent
85 * switches, where supported by the target platform EDL can also be build
86 * with the "endianness" configured by the setting of the symbol
87 *
88 * EDLENDIAN
89 *
90 * to either eEndianBig or eEndianLittle
91 ***********************************************************/
92
94
95#if defined(_WIN32) || defined(_WIN64)
96// Windows only runs on little endian systems
97#define EDLENDIAN eEndianLittle
98#elif defined(__i386__) || defined(__amd64__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
99#define EDLENDIAN eEndianLittle
100#elif defined(__ppc__) || defined(__ppc64__)
101#define EDLENDIAN eEndianBig
102#else
103#error "Don't know the endianness for this architecture!"
104#endif
105
106/***********************************************************
107 * EDLPTRSIZE indicates the size in bytes of a pointer for this architecture
108 ***********************************************************/
109
110 #if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || defined(__ppc64__) || defined(__arm64__) || defined(__aarch64__)
111 #define EDLPTRSIZE 8
112 #elif defined(_WIN32) || defined(__ppc__) || defined(__i386__) || defined(__arm__)
113 #define EDLPTRSIZE 4
114 #else
115 #error "Don't know the pointer size for this architecture"
116 #endif
117
118
119/**********************************************************
120 * In addition to the target-platform-dependent "switches"
121 * we also define a number of symbols whose values are themselves platform-dependent
122 * These include:
123 *
124 * PATH_SEP_CHAR which defines the character that represents a filestore path separator.
125 *
126 * DRIVE_DELIM which defines the character which separates/identifies
127 * a drive letter at the start of a (Windows) path.
128 *
129 * And the various file permission "masks" like S_IRWXU
130 *********************************************************/
131
132#if defined(_WIN32) || defined(_WIN64)
133
134// Windows dependencies
135#include <limits.h>
136
137#define PATH_SEP_CHAR '\\'
138#if _MSC_VER < 1900
139#define snprintf _snprintf
140#endif
141#define getcwd _getcwd
142
143#ifndef MAXPATHLEN
144#define MAXPATHLEN _MAX_PATH
145#endif /* _WIN32 || _WIN64 */
146
147#if _MSC_VER < 1800
148#define roundf(v) round(v)
149#endif
150
151#define MAKO_DEPRECATED_FUNC(func, msg) __declspec(deprecated(msg)) func
152
153#endif /* _WIN32 || _WIN64 */
154
155
156#ifdef __APPLE__
157
158// OSX OS and iOS dependencies
159
160#include <errno.h>
161#include <unistd.h>
162#include <sys/param.h>
163#include <sys/types.h>
164#include <sys/stat.h> // for the file creation mask symbols S_IRWXU etc. and for mkdir()
165#include <semaphore.h> // for semaphores
166#include <sys/socket.h> // for sockets
167#include <netinet/in.h> // for sockaddr_in
168#include <arpa/inet.h> // for inet_addr
169
170#define PATH_SEP_CHAR '/'
171
172extern const char **environ;
173
174#define MAKO_DEPRECATED_FUNC(func,msg) func __attribute__((deprecated(msg)))
175
176#endif /* __APPLE__ */
177
178
179#ifdef __linux
180
181 // Linux OS dependencies
182
183#include <errno.h>
184#include <unistd.h>
185#include <sys/param.h>
186#include <sys/types.h>
187#include <sys/stat.h> // for the file creation mask symbols S_IRWXU etc. and for mkdir()
188#include <semaphore.h> // for semaphores
189#include <sys/socket.h> // for sockets
190#include <netinet/in.h> // for sockaddr_in
191#include <arpa/inet.h> // for inet_addr
192
193#define PATH_SEP_CHAR '/'
194
195#define MAKO_DEPRECATED_FUNC(func, msg) func __attribute__((deprecated, warning(msg)))
196
197#endif /* __linux */
198
199#if defined(SWIG) || defined(SWIG_VERSION)
200#undef MAKO_DEPRECATED_FUNC
201#define MAKO_DEPRECATED_FUNC(func, msg) func
202#endif
203
204#endif /* __PLATFORM_H__ */
eEDLEndian
Definition platform.h:93
@ eEndianLittle
Definition platform.h:93
@ eEndianBig
Definition platform.h:93