Skip to content

Commit

Permalink
Add loongarch64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
stdmnpkg committed Oct 4, 2024
1 parent 3576e84 commit a44fa4c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions core/config/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ String Engine::get_architecture_name() const {
return "ppc";
#endif

#elif defined(__loongarch__)
return "loongarch64";

#elif defined(__wasm__)
#if defined(__wasm64__)
return "wasm64";
Expand Down
4 changes: 4 additions & 0 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ bool OS::has_feature(const String &p_feature) {
if (p_feature == "wasm") {
return true;
}
#elif defined(__loongarch__)
if (p_feature == "loongarch64") {
return true;
}
#endif

#if defined(IOS_SIMULATOR)
Expand Down
1 change: 1 addition & 0 deletions editor/editor_property_name_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["lod"] = "LOD";
capitalize_string_remaps["lods"] = "LODs";
capitalize_string_remaps["lowpass"] = "Low-pass";
capitalize_string_remaps["loongarch64"] = "loongarch64";
capitalize_string_remaps["macos"] = "macOS";
capitalize_string_remaps["mb"] = "(MB)"; // Unit.
capitalize_string_remaps["mjpeg"] = "MJPEG";
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gdextension_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
all_archs.insert("ppc32");
all_archs.insert("ppc64");
all_archs.insert("wasm32");
all_archs.insert("loongarch64");
all_archs.insert("universal");

HashSet<String> archs;
Expand Down
2 changes: 1 addition & 1 deletion platform/linuxbsd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_flags():

def configure(env: "SConsEnvironment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "loongarch64"]
if env["arch"] not in supported_arches:
print_error(
'Unsupported CPU architecture "%s" for Linux / *BSD. Supported architectures are: %s.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<members>
<member name="binary_format/architecture" type="String" setter="" getter="">
Application executable architecture.
Supported architectures: [code]x86_32[/code], [code]x86_64[/code], [code]arm64[/code], [code]arm32[/code], [code]rv64[/code], [code]ppc64[/code], and [code]ppc32[/code].
Supported architectures: [code]x86_32[/code], [code]x86_64[/code], [code]arm64[/code], [code]arm32[/code], [code]rv64[/code], [code]ppc64[/code], [code]ppc32[/code] and [code]loongarch64[/code].
Official export templates include [code]x86_32[/code] and [code]x86_64[/code] binaries only.
</member>
<member name="binary_format/embed_pck" type="bool" setter="" getter="">
Expand Down
4 changes: 3 additions & 1 deletion platform/linuxbsd/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,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,rv64,ppc64,ppc32,loongarch64"), "x86_64"));

String run_script = "#!/usr/bin/env bash\n"
"export DISPLAY=:0\n"
Expand Down Expand Up @@ -282,6 +282,8 @@ String EditorExportPlatformLinuxBSD::_get_exe_arch(const String &p_path) const {
return "arm64";
case 0x00f3:
return "rv64";
case 0x0102:
return "loongarch64";
default:
return "unknown";
}
Expand Down
3 changes: 2 additions & 1 deletion platform_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


# CPU architecture options.
architectures = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32"]
architectures = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32", "loongarch64"]
architecture_aliases = {
"x86": "x86_32",
"x64": "x86_64",
Expand All @@ -23,6 +23,7 @@
"ppcle": "ppc32",
"ppc": "ppc32",
"ppc64le": "ppc64",
"loong64": "loongarch64",
}


Expand Down

0 comments on commit a44fa4c

Please sign in to comment.