aboutsummaryrefslogtreecommitdiff
path: root/include/Platform.hpp
blob: ffe7038ebb4368edb9a6a4fcfcc4e48ec6f5dd5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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,

	PLATFORM_HAIKU      = 1 << 20,
	PLATFORM_HAIKU32    = 1 << 21 | PLATFORM_HAIKU,
	PLATFORM_HAIKU64    = 1 << 22 | PLATFORM_HAIKU
    };

    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 },
	{ "haiku", PLATFORM_HAIKU },
	{ "haiku32", PLATFORM_HAIKU32 },
	{ "haiku64", PLATFORM_HAIKU64 },
    };

    bool containsPlatform(const std::vector<Platform> &platforms, Platform platform);
    const char* asString(Platform platform);
    Platform getPlatformByName(StringView name);
    bool isSamePlatformFamily(Platform a, Platform b);
}