Hubris Engine Dev
A Project to learn and get into Game Engine developement.
 
Loading...
Searching...
No Matches
Platform.h
Go to the documentation of this file.
1// File: Hubris/include/Platform.h
2#pragma once
3
4enum class Hbr_Platform : unsigned short {
6};
7
8[[nodiscard]] consteval inline Hbr_Platform GetPlatform() noexcept{
9#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
10 #define HBR_WINDOWS
11 #define WIN32_LEAN_AND_MEAN
12 //#include "Windows.h"
14#elif __APPLE__
15#include <TargetConditionals.h>
16#define HBR_APPLE
17#if TARGET_IPHONE_SIMULATOR
18 #define HBR_IOS
19 return Hbr_Platform::IOS; // iOS Simulator
20#elif TARGET_OS_MACCATALYST
21 #define HBR_MACOS
22 return Hbr_Platform::MacOS; // Mac Catalyst
23#elif TARGET_OS_IPHONE
24 #define HBR_IOS
25 return Hbr_Platform::IOS; // iOS device
26#elif TARGET_OS_MAC
27 #define HBR_MACOS
28 return Hbr_Platform::MacOS; // macOS
29#else
30#error "Unknown Apple platform"
31#endif
32#elif __ANDROID__
33 #define HBR_ANDROID
35#elif __linux__
36 #define HBR_LINUX
38#elif __unix__ // all unices not caught above
39 #define HBR_LINUX
40 return Hbr_Platform::Linux; // Assuming Unix-like systems are similar to Linux
41#elif defined(_POSIX_VERSION)
42 return Hbr_Platform::Linux; // POSIX systems
43#else
45#endif
46}
47
48constinit const Hbr_Platform Platform = GetPlatform();
Hbr_Platform
Definition Platform.h:4
consteval Hbr_Platform GetPlatform() noexcept
Definition Platform.h:8
constinit const Hbr_Platform Platform
Definition Platform.h:48