GlistEngine
Loading...
Searching...
No Matches
gTargetDefines.h
Go to the documentation of this file.
1/*
2 * gTargetDefines.h
3 *
4 * Created on: Sep 20, 2026
5 * Author: cogwright
6 *
7 * The one place the engine's short build target names are derived from the
8 * macros the compiler defines: WIN32, WIN64, APPLE, ANDROID, LINUX, EMSCRIPTEN,
9 * and the GLIST_* flags built on top of them. Compile time only, and unrelated
10 * to gBasePlatform, which is the runtime platform abstraction.
11 *
12 * The build force includes this into every translation unit, so a header can
13 * guard on these names without having to include anything first. See the
14 * GLIST_TARGET_DEFINES block in engine/CMakeLists.txt.
15 *
16 * Names only. Anything that needs the GL headers includes gRenderer.h, which is
17 * where those live and where their per target paths are handled.
18 */
19
20#pragma once
21
22#ifndef TYPES_GTARGETDEFINES_H_
23#define TYPES_GTARGETDEFINES_H_
24
25#if defined(__EMSCRIPTEN__)
26 // Web. Checked first because Emscripten also defines __unix__, so the unix
27 // arm at the end of this chain would otherwise swallow it.
28 #ifndef EMSCRIPTEN
29 #define EMSCRIPTEN 1
30 #endif
31#elif defined(_WIN64)
32 //define something for Windows (64-bit)
33 #ifndef WIN64
34 #define WIN64 _WIN32
35 #endif
36#elif _WIN32
37 //define something for Windows (32-bit)
38 #ifndef WIN32
39 #define WIN32 _WIN32
40 #endif
41#elif __APPLE__
42 #include "TargetConditionals.h"
43 #if TARGET_IPHONE_SIMULATOR
44 // define something for simulator
45 #elif TARGET_OS_IPHONE
46 // define something for iphone
47 #else
48 #ifndef TARGET_OS_OSX
49 #define TARGET_OS_OSX 1
50 #endif
51 #ifndef APPLE
52 #define APPLE __APPLE__
53 #endif
54 // define something for OSX
55 #endif
56#elif defined(__ANDROID__)
57 // Android
58 #ifndef ANDROID
59 #define ANDROID 1
60 #endif
61#elif __linux
62 // Linux
63 #ifndef LINUX
64 #define LINUX __linux__
65 #endif
66#elif __unix // all unices not caught above
67 // Unix
68#elif __posix
69 // POSIX
70#endif
71
72#if defined(ANDROID) || defined(__ANDROID__) || TARGET_OS_IPHONE || TARGET_OS_SIMULATOR || EMSCRIPTEN
73#ifndef GLIST_OPENGLES
74#define GLIST_OPENGLES 1
75#endif
76#endif
77
78#if EMSCRIPTEN
79#ifndef GLIST_WEB
80#define GLIST_WEB 1
81#endif
82#endif
83#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
84#ifndef GLIST_IOS
85#define GLIST_IOS 1
86#endif
87#endif
88#if defined(ANDROID) || defined(__ANDROID__)
89#ifndef GLIST_ANDROID
90#define GLIST_ANDROID 1
91#endif
92#endif
93
94#endif /* TYPES_GTARGETDEFINES_H_ */