From e2d947ccd6947c9190569fedbb4a90505b5fe9a5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 1 Oct 2018 04:51:42 +0200 Subject: Allow specifying project platform without arch --- include/Platform.hpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/Platform.hpp (limited to 'include/Platform.hpp') 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 + +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_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 &platforms, Platform platform); + const char* asString(Platform platform); + Platform getPlatformByName(StringView name); +} \ No newline at end of file -- cgit v1.2.3