commit 2c016e0ccd34875239cf39329a09d45c847e4d96
parent e46b20ede24948dce26d128b3ff904f875601f36
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 5 Jan 2020 13:07:11 -0500
platform: add linux-armv7 and linux-aarch64
Diffstat:
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/platform.cpp b/src/platform.cpp
@@ -35,6 +35,10 @@ const Platform::Enum Platform::Current = Platform::
Linux_x86_64
# elif __i686__
Linux_i686
+# elif __ARM_ARCH_7A__
+ Linux_armv7l
+# elif __aarch64__
+ Linux_aarch64
# else
Unknown
# endif
@@ -66,6 +70,8 @@ auto Platform::parse(const char *platform) -> Enum
{ "linux", Linux_Any },
{ "linux32", Linux_i686 },
{ "linux64", Linux_x86_64 },
+ { "linux-armv7l", Linux_armv7l },
+ { "linux-aarch64", Linux_aarch64 },
{ "windows", Windows_Any },
{ "win32", Windows_x86 },
diff --git a/src/platform.hpp b/src/platform.hpp
@@ -29,10 +29,12 @@ public:
Linux_i686 = 1<<2,
Linux_x86_64 = 1<<3,
- Linux_Any = Linux_i686 | Linux_x86_64,
+ Linux_armv7l = 1<<4,
+ Linux_aarch64 = 1<<5,
+ Linux_Any = Linux_i686 | Linux_x86_64 | Linux_armv7l | Linux_aarch64,
- Windows_x86 = 1<<4,
- Windows_x64 = 1<<5,
+ Windows_x86 = 1<<6,
+ Windows_x64 = 1<<7,
Windows_Any = Windows_x86 | Windows_x64,
Generic = Darwin_Any | Linux_Any | Windows_Any,
diff --git a/test/platform.cpp b/test/platform.cpp
@@ -35,6 +35,8 @@ TEST_CASE("platform from string", M) {
REQUIRE(Platform("linux") == Platform::Linux_Any);
REQUIRE(Platform("linux32") == Platform::Linux_i686);
REQUIRE(Platform("linux64") == Platform::Linux_x86_64);
+ REQUIRE(Platform("linux-armv7l") == Platform::Linux_armv7l);
+ REQUIRE(Platform("linux-aarch64") == Platform::Linux_aarch64);
}
}
@@ -47,6 +49,8 @@ TEST_CASE("test platform", M) {
{Platform::Linux_Any, false},
{Platform::Linux_x86_64, false},
{Platform::Linux_i686, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
{Platform::Windows_Any, false},
{Platform::Windows_x64, false},
{Platform::Windows_x86, false},
@@ -74,9 +78,23 @@ TEST_CASE("test platform", M) {
# ifdef __x86_64__
{Platform::Linux_i686, false},
{Platform::Linux_x86_64, true },
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
# elif __i686__
{Platform::Linux_i686, true },
{Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
+# elif __ARM_ARCH_7A__
+ {Platform::Linux_i686, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, true },
+ {Platform::Linux_aarch64, false},
+# elif __aarch64__
+ {Platform::Linux_i686, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, true },
# else
# error Untested architecture
# endif
@@ -88,6 +106,8 @@ TEST_CASE("test platform", M) {
{Platform::Linux_Any, false},
{Platform::Linux_x86_64, false},
{Platform::Linux_i686, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
{Platform::Windows_Any, true },
# ifdef _WIN64