From 4a4491c96feb182d219759de0d9e7655d4ab39ec Mon Sep 17 00:00:00 2001 From: Levi Zim Date: Thu, 5 Dec 2024 23:52:42 +0800 Subject: [PATCH] Add support for riscv64 (#2356) * Add support for riscv64 * Make error message clear when architecture is unknown --- src/_premake_init.lua | 1 + src/base/_foundation.lua | 1 + src/host/premake.h | 4 ++++ website/docs/architecture.md | 1 + 4 files changed, 7 insertions(+) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index ca901ffc..184f0c43 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -28,6 +28,7 @@ p.X86_64, p.ARM, p.ARM64, + p.RISCV64, }, aliases = { i386 = p.X86, diff --git a/src/base/_foundation.lua b/src/base/_foundation.lua index 0c19a861..411eb536 100644 --- a/src/base/_foundation.lua +++ b/src/base/_foundation.lua @@ -61,6 +61,7 @@ premake.X86_64 = "x86_64" premake.ARM = "ARM" premake.ARM64 = "ARM64" + premake.RISCV64 = "RISCV64" diff --git a/src/host/premake.h b/src/host/premake.h index 9bf20380..788f8a38 100644 --- a/src/host/premake.h +++ b/src/host/premake.h @@ -60,6 +60,10 @@ #elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || \ defined(__ARM) || defined(_M_ARM) || defined(_M_ARM_T) || defined(__ARM_ARCH) #define PLATFORM_ARCHITECTURE "ARM" +#elif defined(_M_RISCV64) || (defined(__riscv) && __riscv_xlen == 64) +#define PLATFORM_ARCHITECTURE "RISCV64" +#elif !defined(RC_INVOKED) +#error Unknown architecture detected #endif /* Pull in platform-specific headers required by built-in functions */ diff --git a/website/docs/architecture.md b/website/docs/architecture.md index fb530453..0dbe352e 100644 --- a/website/docs/architecture.md +++ b/website/docs/architecture.md @@ -13,6 +13,7 @@ architecture ("value") * `x86_64` * `ARM` * `ARM64` +* `RISCV64` * `armv5`: Only supported in VSAndroid projects * `armv7`: Only supported in VSAndroid projects * `aarch64`: Only supported in VSAndroid projects -- 2.45.2