diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-01 04:51:42 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | e2d947ccd6947c9190569fedbb4a90505b5fe9a5 (patch) | |
tree | 943167a2aae91af3164e5cd80a96b08826952d23 /src/Platform.cpp | |
parent | 63cedcab19474cae0a4b1322600355ddc23d56d0 (diff) |
Allow specifying project platform without arch
Diffstat (limited to 'src/Platform.cpp')
-rw-r--r-- | src/Platform.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/Platform.cpp b/src/Platform.cpp new file mode 100644 index 0000000..44f42db --- /dev/null +++ b/src/Platform.cpp @@ -0,0 +1,44 @@ +#include "../include/Platform.hpp" + +namespace sibs +{ + bool containsPlatform(const std::vector<Platform> &platforms, Platform platform) + { + for (Platform vecPlatform : platforms) + { + if(platform & vecPlatform) + return true; + } + return false; + } + + const char* asString(Platform platform) + { + switch (platform) + { + case PLATFORM_ANY: return "any"; + case PLATFORM_LINUX: return "linux"; + case PLATFORM_LINUX32: return "linux32"; + case PLATFORM_LINUX64: return "linux64"; + case PLATFORM_WIN: return "win"; + case PLATFORM_WIN32: return "win32"; + case PLATFORM_WIN64: return "win64"; + case PLATFORM_MACOS: return "macos"; + case PLATFORM_MACOS32: return "macos32"; + case PLATFORM_MACOS64: return "macos64"; + case PLATFORM_BSD: return "bsd"; + case PLATFORM_OPENBSD: return "openbsd"; + case PLATFORM_OPENBSD32: return "openbsd32"; + case PLATFORM_OPENBSD64: return "openbsd64"; + default: return nullptr; + } + } + + Platform getPlatformByName(StringView name) + { + auto it = PLATFORM_BY_NAME.find(name); + if(it != PLATFORM_BY_NAME.end()) + return it->second; + return PLATFORM_INVALID; + } +}
\ No newline at end of file |