aboutsummaryrefslogtreecommitdiff
path: root/include/Platform.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-01 04:51:42 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commite2d947ccd6947c9190569fedbb4a90505b5fe9a5 (patch)
tree943167a2aae91af3164e5cd80a96b08826952d23 /include/Platform.hpp
parent63cedcab19474cae0a4b1322600355ddc23d56d0 (diff)
Allow specifying project platform without arch
Diffstat (limited to 'include/Platform.hpp')
-rw-r--r--include/Platform.hpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/Platform.hpp b/include/Platform.hpp
new file mode 100644
index 0000000..995d307
--- /dev/null
+++ b/include/Platform.hpp
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "types.hpp"
+#include "StringView.hpp"
+#include <vector>
+
+namespace sibs
+{
+ enum Platform : u32
+ {
+ PLATFORM_INVALID = 0x00000000,
+
+ PLATFORM_ANY = 0xFFFFFFFF,
+
+ PLATFORM_LINUX = 1 << 1,
+ PLATFORM_LINUX32 = 1 << 2 | PLATFORM_LINUX,
+ PLATFORM_LINUX64 = 1 << 3 | PLATFORM_LINUX,
+
+ PLATFORM_WIN = 1 << 4,
+ PLATFORM_WIN32 = 1 << 5 | PLATFORM_WIN,
+ PLATFORM_WIN64 = 1 << 6 | PLATFORM_WIN,
+
+ PLATFORM_MACOS = 1 << 7,
+ PLATFORM_MACOS32 = 1 << 8 | PLATFORM_MACOS,
+ PLATFORM_MACOS64 = 1 << 9 | PLATFORM_MACOS,
+
+ PLATFORM_BSD = 1 << 10,
+ PLATFORM_OPENBSD = 1 << 11 | PLATFORM_BSD,
+ PLATFORM_OPENBSD32 = 1 << 12 | PLATFORM_OPENBSD,
+ PLATFORM_OPENBSD64 = 1 << 13 | PLATFORM_OPENBSD
+ };
+
+ const StringViewMap<Platform> PLATFORM_BY_NAME = {
+ { "any", PLATFORM_ANY },
+ { "linux", PLATFORM_LINUX },
+ { "linux32", PLATFORM_LINUX32 },
+ { "linux64", PLATFORM_LINUX64 },
+ { "win", PLATFORM_WIN },
+ { "win32", PLATFORM_WIN32 },
+ { "win64", PLATFORM_WIN64 },
+ { "macos", PLATFORM_MACOS },
+ { "macos32", PLATFORM_MACOS32 },
+ { "macos64", PLATFORM_MACOS64 },
+ { "bsd", PLATFORM_BSD },
+ { "openbsd", PLATFORM_OPENBSD },
+ { "openbsd32", PLATFORM_OPENBSD32 },
+ { "openbsd64", PLATFORM_OPENBSD64 }
+ };
+
+ bool containsPlatform(const std::vector<Platform> &platforms, Platform platform);
+ const char* asString(Platform platform);
+ Platform getPlatformByName(StringView name);
+} \ No newline at end of file