summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2022-07-27 17:48:34 -0500
committerAaron Franke <arnfranke@yahoo.com>2022-07-29 10:24:58 -0500
commit17c4cd6412e3491f33713c63e4d3cc80c959319f (patch)
tree30cf01bbbbc12c6877150a6a9042bfcf85ab11ce /platform
parenta0072ba39fb19158564322ae3f4595512a0c34dc (diff)
Update export dialog to handle many architectures
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export_plugin.cpp2
-rw-r--r--platform/linuxbsd/export/export.cpp2
-rw-r--r--platform/linuxbsd/export/export_plugin.cpp22
-rw-r--r--platform/linuxbsd/export/export_plugin.h2
-rw-r--r--platform/macos/export/export_plugin.cpp15
-rw-r--r--platform/uwp/export/export_plugin.cpp63
-rw-r--r--platform/uwp/export/export_plugin.h10
-rw-r--r--platform/windows/export/export_plugin.cpp1
8 files changed, 42 insertions, 75 deletions
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index bdee68ef34..6f1b4bde40 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -1705,6 +1705,8 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
}
plugins_changed.clear();
+ // Android supports multiple architectures in an app bundle, so
+ // we expose each option as a checkbox in the export dialog.
const Vector<String> abis = get_abis();
for (int i = 0; i < abis.size(); ++i) {
const String abi = abis[i];
diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp
index bc1235bcec..990351d13f 100644
--- a/platform/linuxbsd/export/export.cpp
+++ b/platform/linuxbsd/export/export.cpp
@@ -38,8 +38,6 @@ void register_linuxbsd_exporter() {
platform.instantiate();
platform->set_logo(ImageTexture::create_from_image(memnew(Image(_linuxbsd_logo))));
platform->set_name("Linux/X11");
- platform->set_extension("x86_32");
- platform->set_extension("x86_64", "binary_format/64_bits");
platform->set_os_name("Linux");
platform->set_chmod_flags(0755);
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index d54e07d8a5..4d45d3ba12 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -79,31 +79,21 @@ Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset>
return err;
}
-void EditorExportPlatformLinuxBSD::set_extension(const String &p_extension, const String &p_feature_key) {
- extensions[p_feature_key] = p_extension;
-}
-
String EditorExportPlatformLinuxBSD::get_template_file_name(const String &p_target, const String &p_arch) const {
return "linux_" + p_target + "." + p_arch;
}
List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
List<String> list;
- for (const KeyValue<String, String> &E : extensions) {
- if (p_preset->get(E.key)) {
- list.push_back(extensions[E.key]);
- return list;
- }
- }
-
- if (extensions.has("default")) {
- list.push_back(extensions["default"]);
- return list;
- }
-
+ list.push_back(p_preset->get("binary_format/architecture"));
return list;
}
+void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) {
+ 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"));
+}
+
Error EditorExportPlatformLinuxBSD::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
// Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data
diff --git a/platform/linuxbsd/export/export_plugin.h b/platform/linuxbsd/export/export_plugin.h
index 98e4616035..4d6737498b 100644
--- a/platform/linuxbsd/export/export_plugin.h
+++ b/platform/linuxbsd/export/export_plugin.h
@@ -38,12 +38,12 @@
#include "scene/resources/texture.h"
class EditorExportPlatformLinuxBSD : public EditorExportPlatformPC {
- HashMap<String, String> extensions;
Error _export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path);
public:
void set_extension(const String &p_extension, const String &p_feature_key = "default");
virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override;
+ virtual void get_export_options(List<ExportOption> *r_options) override;
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override;
virtual String get_template_file_name(const String &p_target, const String &p_arch) const override;
virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) override;
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp
index 209a3dee5b..9fd0db4f18 100644
--- a/platform/macos/export/export_plugin.cpp
+++ b/platform/macos/export/export_plugin.cpp
@@ -47,8 +47,7 @@ void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
-
- r_features->push_back("64");
+ r_features->push_back(p_preset->get("binary_format/architecture"));
}
bool EditorExportPlatformMacOS::get_export_option_visibility(const String &p_option, const HashMap<StringName, Variant> &p_options) const {
@@ -69,6 +68,7 @@ bool EditorExportPlatformMacOS::get_export_option_visibility(const String &p_opt
}
void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options) {
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "universal,x86_64,arm64", PROPERTY_USAGE_STORAGE), "universal"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
@@ -766,7 +766,8 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
int ret = unzGoToFirstFile(src_pkg_zip);
- String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + ".universal";
+ String architecture = p_preset->get("binary_format/architecture");
+ String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + "." + architecture;
String pkg_name;
if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") {
@@ -1064,19 +1065,19 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
}
if (data.size() > 0) {
- if (file.find("/data.mono.macos.release_debug.universal/") != -1) {
+ if (file.find("/data.mono.macos.release_debug." + architecture + "/") != -1) {
if (!p_debug) {
ret = unzGoToNextFile(src_pkg_zip);
continue; // skip
}
- file = file.replace("/data.mono.macos.release_debug.universal/", "/GodotSharp/");
+ file = file.replace("/data.mono.macos.release_debug." + architecture + "/", "/GodotSharp/");
}
- if (file.find("/data.mono.macos.release.universal/") != -1) {
+ if (file.find("/data.mono.macos.release." + architecture + "/") != -1) {
if (p_debug) {
ret = unzGoToNextFile(src_pkg_zip);
continue; // skip
}
- file = file.replace("/data.mono.macos.release.universal/", "/GodotSharp/");
+ file = file.replace("/data.mono.macos.release." + architecture + "/", "/GodotSharp/");
}
if (file.ends_with(".dylib")) {
diff --git a/platform/uwp/export/export_plugin.cpp b/platform/uwp/export/export_plugin.cpp
index 7bf8a0f4c7..a99776497b 100644
--- a/platform/uwp/export/export_plugin.cpp
+++ b/platform/uwp/export/export_plugin.cpp
@@ -52,24 +52,14 @@ Ref<Texture2D> EditorExportPlatformUWP::get_logo() const {
void EditorExportPlatformUWP::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
r_features->push_back("s3tc");
r_features->push_back("etc");
- switch ((int)p_preset->get("architecture/target")) {
- case EditorExportPlatformUWP::ARM: {
- r_features->push_back("arm");
- } break;
- case EditorExportPlatformUWP::X86: {
- r_features->push_back("32");
- } break;
- case EditorExportPlatformUWP::X64: {
- r_features->push_back("64");
- } break;
- }
+ r_features->push_back(p_preset->get("binary_format/architecture"));
}
void EditorExportPlatformUWP::get_export_options(List<ExportOption> *r_options) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "arm,x86,x64"), 1));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm32"), "x86_64"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), ""));
@@ -143,23 +133,18 @@ bool EditorExportPlatformUWP::can_export(const Ref<EditorExportPreset> &p_preset
bool valid = false;
// Look for export templates (first official, and if defined custom templates).
-
- Platform arch = (Platform)(int)(p_preset->get("architecture/target"));
- String platform_infix;
- switch (arch) {
- case EditorExportPlatformUWP::ARM: {
- platform_infix = "arm";
- } break;
- case EditorExportPlatformUWP::X86: {
- platform_infix = "x86";
- } break;
- case EditorExportPlatformUWP::X64: {
- platform_infix = "x64";
- } break;
+ String arch = p_preset->get("binary_format/architecture");
+ String arch_infix;
+ if (arch == "arm32") {
+ arch_infix = "arm";
+ } else if (arch == "x86_32") {
+ arch_infix = "x86";
+ } else if (arch == "x86_64") {
+ arch_infix = "x64";
}
- bool dvalid = exists_export_template("uwp_" + platform_infix + "_debug.zip", &err);
- bool rvalid = exists_export_template("uwp_" + platform_infix + "_release.zip", &err);
+ bool dvalid = exists_export_template("uwp_" + arch_infix + "_debug.zip", &err);
+ bool rvalid = exists_export_template("uwp_" + arch_infix + "_release.zip", &err);
if (p_preset->get("custom_template/debug") != "") {
dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
@@ -263,25 +248,21 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p
src_appx = src_appx.strip_edges();
- Platform arch = (Platform)(int)p_preset->get("architecture/target");
+ String arch = p_preset->get("binary_format/architecture");
if (src_appx.is_empty()) {
- String err, infix;
- switch (arch) {
- case ARM: {
- infix = "_arm_";
- } break;
- case X86: {
- infix = "_x86_";
- } break;
- case X64: {
- infix = "_x64_";
- } break;
+ String err, arch_infix;
+ if (arch == "arm32") {
+ arch_infix = "arm";
+ } else if (arch == "x86_32") {
+ arch_infix = "x86";
+ } else if (arch == "x86_64") {
+ arch_infix = "x64";
}
if (p_debug) {
- src_appx = find_export_template("uwp" + infix + "debug.zip", &err);
+ src_appx = find_export_template("uwp_" + arch_infix + "_debug.zip", &err);
} else {
- src_appx = find_export_template("uwp" + infix + "release.zip", &err);
+ src_appx = find_export_template("uwp_" + arch_infix + "_release.zip", &err);
}
if (src_appx.is_empty()) {
EditorNode::add_io_error(err);
diff --git a/platform/uwp/export/export_plugin.h b/platform/uwp/export/export_plugin.h
index 5c50baf9c3..4a3c5db377 100644
--- a/platform/uwp/export/export_plugin.h
+++ b/platform/uwp/export/export_plugin.h
@@ -90,12 +90,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
Ref<ImageTexture> logo;
- enum Platform {
- ARM,
- X86,
- X64
- };
-
bool _valid_resource_name(const String &p_name) const {
if (p_name.is_empty()) {
return false;
@@ -215,8 +209,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
String version = itos(p_preset->get("version/major")) + "." + itos(p_preset->get("version/minor")) + "." + itos(p_preset->get("version/build")) + "." + itos(p_preset->get("version/revision"));
result = result.replace("$version_string$", version);
- Platform arch = (Platform)(int)p_preset->get("architecture/target");
- String architecture = arch == ARM ? "arm" : (arch == X86 ? "x86" : "x64");
+ String arch = p_preset->get("binary_format/architecture");
+ String architecture = arch == "arm32" ? "arm" : (arch == "x86_32" ? "x86" : "x64");
result = result.replace("$architecture$", architecture);
result = result.replace("$display_name$", String(p_preset->get("package/display_name")).is_empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name")));
diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp
index 45bfc761fe..375fddfa41 100644
--- a/platform/windows/export/export_plugin.cpp
+++ b/platform/windows/export/export_plugin.cpp
@@ -123,6 +123,7 @@ bool EditorExportPlatformWindows::get_export_option_visibility(const String &p_o
void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_options) {
EditorExportPlatformPC::get_export_options(r_options);
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32"), "x86_64"));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/enable"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/identity_type", PROPERTY_HINT_ENUM, "Select automatically,Use PKCS12 file (specify *.PFX/*.P12 file),Use certificate store (specify SHA1 hash)"), 0));