测试了下 4.2.2-stable 分支
docker run -it ghcr.io/loong64/debian:trixie-slim bash
apt-get update
apt-get install -y build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev libwayland-dev python3-pip
gettext wget git
pip install scons==4.4.0 --break-system-packages
cd /opt
git clone -b 4.2.2-stable --depth=1 https://github.com/godotengine/godot
# pcre2 10.43 补丁 https://github.com/godotengine/godot/pull/89371
wget https://github.com/godotengine/godot/commit/dab95993c6c8ebd4fb439385a892dabda22698a2.patch
# loong64 架构补丁
cat loong64.patch
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 24080c0..2c550b8 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -212,6 +212,9 @@ String Engine::get_architecture_name() const {
#elif defined(__arm__) || defined(_M_ARM)
return "arm32";
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+ return "loong64";
+
#elif defined(__riscv)
#if __riscv_xlen == 8
return "rv64";
diff --git a/core/os/os.cpp b/core/os/os.cpp
index f5d55ca..36b45f7 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -465,6 +465,10 @@ bool OS::has_feature(const String &p_feature) {
if (p_feature == "arm") {
return true;
}
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+ if (p_feature == "loong64") {
+ return true;
+ }
#elif defined(__riscv)
#if __riscv_xlen == 8
if (p_feature == "rv64") {
diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index c56591c..293bdc9 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -68,6 +68,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
all_archs.insert("x86_64");
all_archs.insert("arm32");
all_archs.insert("arm64");
+ all_archs.insert("loong64");
all_archs.insert("rv64");
all_archs.insert("ppc32");
all_archs.insert("ppc64");
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 59cc6e7..e3fc5d3 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -65,12 +65,13 @@ def get_doc_path():
def get_flags():
return [
("arch", detect_arch()),
+ ("builtin_pcre2_with_jit", False),
]
def configure(env: "Environment"):
# Validate arch.
- supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
+ supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64"]
if env["arch"] not in supported_arches:
print(
'Unsupported CPU architecture "%s" for Linux / *BSD. Supported architectures are: %s.'
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index 9d1e058..83e781a 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -159,7 +159,7 @@ bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExpo
void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) const {
EditorExportPlatformPC::get_export_options(r_options);
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,ppc32"), "x86_64"));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,loong64,rv64,ppc64,ppc32"), "x86_64"));
String run_script = "#!/usr/bin/env bash\n"
"export DISPLAY=:0\n"
diff --git a/platform_methods.py b/platform_methods.py
index 8b2c62a..3bae7f9 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -79,7 +79,7 @@ def subprocess_main(namespace):
# CPU architecture options.
-architectures = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32"]
+architectures = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64", "wasm32"]
architecture_aliases = {
"x86": "x86_32",
"x64": "x86_64",
@@ -88,6 +88,7 @@ architecture_aliases = {
"armv8": "arm64",
"arm64v8": "arm64",
"aarch64": "arm64",
+ "loongarch64": "loong64",
"rv": "rv64",
"riscv": "rv64",
"riscv64": "rv64",
diff --git a/thirdparty/openxr/src/common/platform_utils.hpp b/thirdparty/openxr/src/common/platform_utils.hpp
index 0b295f5..01b0c24 100644
--- a/thirdparty/openxr/src/common/platform_utils.hpp
+++ b/thirdparty/openxr/src/common/platform_utils.hpp
@@ -71,6 +71,8 @@
#define XR_ARCH_ABI "riscv64"
#elif defined(__sparc__) && defined(__arch64__)
#define XR_ARCH_ABI "sparc64"
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+#define XR_ARCH_ABI "loongarch64"
#else
#error "No architecture string known!"
#endif
cd /opt/godot
# 应用补丁
git apply ../*.patch
scons platform=linuxbsd production=yes
scons platform=linuxbsd target=template_release production=yes
scons platform=linuxbsd target=template_debug production=yes
生成的文件在 bin 目录下,简单测试了下项目编译导出没问题。没太深入使用