Browse Source

[iOS] Fix dotnet export.

bruvzg 1 year ago
parent
commit
a92511fec3

+ 2 - 2
modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/iOSNativeAOT.targets

@@ -33,9 +33,9 @@
     <Message Importance="normal" Text="Found XCode at $(XcodeSelect)"  Condition=" '$(FindXCode)' == 'true' "/>
     <Message Importance="normal" Text="Found XCode at $(XcodeSelect)"  Condition=" '$(FindXCode)' == 'true' "/>
     
     
     <ItemGroup>
     <ItemGroup>
-      <LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
+      <LinkerArg Include="-mios-simulator-version-min=12.0 -isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
                  Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
                  Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
-      <LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
+      <LinkerArg Include="-miphoneos-version-min=12.0 -isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
                  Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
                  Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
     </ItemGroup>
     </ItemGroup>
 
 

+ 1 - 1
modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs

@@ -195,7 +195,7 @@ namespace GodotTools.Export
                     bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator
                     bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator
                     string versionMinName = isSim ? "iphonesimulator" : "iphoneos";
                     string versionMinName = isSim ? "iphonesimulator" : "iphoneos";
                     string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS";
                     string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS";
-                    const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting
+                    const string versionMin = "12.0"; // TODO: Turn this hard-coded version into an exporter setting
                     string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
                     string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
                             $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
                             $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
 
 

+ 2 - 2
modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs

@@ -194,7 +194,7 @@ namespace GodotTools.Export
                     BundleOutputs = false,
                     BundleOutputs = false,
                     IncludeDebugSymbols = publishConfig.IncludeDebugSymbols,
                     IncludeDebugSymbols = publishConfig.IncludeDebugSymbols,
                     RidOS = OS.DotNetOS.iOSSimulator,
                     RidOS = OS.DotNetOS.iOSSimulator,
-                    UseTempDir = true,
+                    UseTempDir = false,
                 });
                 });
             }
             }
 
 
@@ -361,7 +361,7 @@ namespace GodotTools.Export
                 }
                 }
 
 
                 var xcFrameworkPath = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig,
                 var xcFrameworkPath = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig,
-                    $"{GodotSharpDirs.ProjectAssemblyName}.xcframework");
+                    $"{GodotSharpDirs.ProjectAssemblyName}_aot.xcframework");
                 if (!BuildManager.GenerateXCFrameworkBlocking(outputPaths,
                 if (!BuildManager.GenerateXCFrameworkBlocking(outputPaths,
                         Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig, xcFrameworkPath)))
                         Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig, xcFrameworkPath)))
                 {
                 {

+ 2 - 0
modules/mono/mono_gd/gd_mono.h

@@ -68,7 +68,9 @@ class GDMono {
 
 
 	String project_assembly_path;
 	String project_assembly_path;
 	uint64_t project_assembly_modified_time = 0;
 	uint64_t project_assembly_modified_time = 0;
+#ifdef GD_MONO_HOT_RELOAD
 	int project_load_failure_count = 0;
 	int project_load_failure_count = 0;
+#endif
 
 
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 	bool _load_project_assembly();
 	bool _load_project_assembly();

+ 14 - 7
platform/ios/export/export_plugin.cpp

@@ -1077,14 +1077,15 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
 		return ERR_FILE_NOT_FOUND;
 		return ERR_FILE_NOT_FOUND;
 	}
 	}
 
 
-	String base_dir = p_asset.get_base_dir().replace("res://", "");
+	String base_dir = p_asset.get_base_dir().replace("res://", "").replace(".godot/mono/temp/bin/", "");
+	String asset = p_asset.ends_with("/") ? p_asset.left(p_asset.length() - 1) : p_asset;
 	String destination_dir;
 	String destination_dir;
 	String destination;
 	String destination;
 	String asset_path;
 	String asset_path;
 
 
 	bool create_framework = false;
 	bool create_framework = false;
 
 
-	if (p_is_framework && p_asset.ends_with(".dylib")) {
+	if (p_is_framework && asset.ends_with(".dylib")) {
 		// For iOS we need to turn .dylib into .framework
 		// For iOS we need to turn .dylib into .framework
 		// to be able to send application to AppStore
 		// to be able to send application to AppStore
 		asset_path = String("dylibs").path_join(base_dir);
 		asset_path = String("dylibs").path_join(base_dir);
@@ -1103,7 +1104,7 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
 		destination_dir = p_out_dir.path_join(asset_path);
 		destination_dir = p_out_dir.path_join(asset_path);
 		destination = destination_dir.path_join(file_name);
 		destination = destination_dir.path_join(file_name);
 		create_framework = true;
 		create_framework = true;
-	} else if (p_is_framework && (p_asset.ends_with(".framework") || p_asset.ends_with(".xcframework"))) {
+	} else if (p_is_framework && (asset.ends_with(".framework") || asset.ends_with(".xcframework"))) {
 		asset_path = String("dylibs").path_join(base_dir);
 		asset_path = String("dylibs").path_join(base_dir);
 
 
 		String file_name;
 		String file_name;
@@ -1147,6 +1148,9 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
 	if (err) {
 	if (err) {
 		return err;
 		return err;
 	}
 	}
+	if (asset_path.ends_with("/")) {
+		asset_path = asset_path.left(asset_path.length() - 1);
+	}
 	IOSExportAsset exported_asset = { binary_name.path_join(asset_path), p_is_framework, p_should_embed };
 	IOSExportAsset exported_asset = { binary_name.path_join(asset_path), p_is_framework, p_should_embed };
 	r_exported_assets.push_back(exported_asset);
 	r_exported_assets.push_back(exported_asset);
 
 
@@ -1213,13 +1217,16 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
 Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, bool p_should_embed, Vector<IOSExportAsset> &r_exported_assets) {
 Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, bool p_should_embed, Vector<IOSExportAsset> &r_exported_assets) {
 	for (int f_idx = 0; f_idx < p_assets.size(); ++f_idx) {
 	for (int f_idx = 0; f_idx < p_assets.size(); ++f_idx) {
 		String asset = p_assets[f_idx];
 		String asset = p_assets[f_idx];
-		if (!asset.begins_with("res://")) {
+		if (asset.begins_with("res://")) {
+			Error err = _copy_asset(p_out_dir, asset, nullptr, p_is_framework, p_should_embed, r_exported_assets);
+			ERR_FAIL_COND_V(err, err);
+		} else if (ProjectSettings::get_singleton()->localize_path(asset).begins_with("res://")) {
+			Error err = _copy_asset(p_out_dir, ProjectSettings::get_singleton()->localize_path(asset), nullptr, p_is_framework, p_should_embed, r_exported_assets);
+			ERR_FAIL_COND_V(err, err);
+		} else {
 			// either SDK-builtin or already a part of the export template
 			// either SDK-builtin or already a part of the export template
 			IOSExportAsset exported_asset = { asset, p_is_framework, p_should_embed };
 			IOSExportAsset exported_asset = { asset, p_is_framework, p_should_embed };
 			r_exported_assets.push_back(exported_asset);
 			r_exported_assets.push_back(exported_asset);
-		} else {
-			Error err = _copy_asset(p_out_dir, asset, nullptr, p_is_framework, p_should_embed, r_exported_assets);
-			ERR_FAIL_COND_V(err, err);
 		}
 		}
 	}
 	}