Skip to content

Commit a92511f

Browse files
committed
[iOS] Fix dotnet export.
1 parent 56a2b14 commit a92511f

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/iOSNativeAOT.targets

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
<Message Importance="normal" Text="Found XCode at $(XcodeSelect)" Condition=" '$(FindXCode)' == 'true' "/>
3434

3535
<ItemGroup>
36-
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
36+
<LinkerArg Include="-mios-simulator-version-min=12.0 -isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
3737
Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
38-
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
38+
<LinkerArg Include="-miphoneos-version-min=12.0 -isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
3939
Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
4040
</ItemGroup>
4141

modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public static void CompileAssembliesForiOS(ExportPlugin exporter, bool isDebug,
195195
bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator
196196
string versionMinName = isSim ? "iphonesimulator" : "iphoneos";
197197
string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS";
198-
const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting
198+
const string versionMin = "12.0"; // TODO: Turn this hard-coded version into an exporter setting
199199
string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
200200
$"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
201201

modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
194194
BundleOutputs = false,
195195
IncludeDebugSymbols = publishConfig.IncludeDebugSymbols,
196196
RidOS = OS.DotNetOS.iOSSimulator,
197-
UseTempDir = true,
197+
UseTempDir = false,
198198
});
199199
}
200200

@@ -361,7 +361,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
361361
}
362362

363363
var xcFrameworkPath = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig,
364-
$"{GodotSharpDirs.ProjectAssemblyName}.xcframework");
364+
$"{GodotSharpDirs.ProjectAssemblyName}_aot.xcframework");
365365
if (!BuildManager.GenerateXCFrameworkBlocking(outputPaths,
366366
Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig, xcFrameworkPath)))
367367
{

modules/mono/mono_gd/gd_mono.h

+2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ class GDMono {
6868

6969
String project_assembly_path;
7070
uint64_t project_assembly_modified_time = 0;
71+
#ifdef GD_MONO_HOT_RELOAD
7172
int project_load_failure_count = 0;
73+
#endif
7274

7375
#ifdef TOOLS_ENABLED
7476
bool _load_project_assembly();

platform/ios/export/export_plugin.cpp

+14-7
Original file line numberDiff line numberDiff line change
@@ -1077,14 +1077,15 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
10771077
return ERR_FILE_NOT_FOUND;
10781078
}
10791079

1080-
String base_dir = p_asset.get_base_dir().replace("res://", "");
1080+
String base_dir = p_asset.get_base_dir().replace("res://", "").replace(".godot/mono/temp/bin/", "");
1081+
String asset = p_asset.ends_with("/") ? p_asset.left(p_asset.length() - 1) : p_asset;
10811082
String destination_dir;
10821083
String destination;
10831084
String asset_path;
10841085

10851086
bool create_framework = false;
10861087

1087-
if (p_is_framework && p_asset.ends_with(".dylib")) {
1088+
if (p_is_framework && asset.ends_with(".dylib")) {
10881089
// For iOS we need to turn .dylib into .framework
10891090
// to be able to send application to AppStore
10901091
asset_path = String("dylibs").path_join(base_dir);
@@ -1103,7 +1104,7 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
11031104
destination_dir = p_out_dir.path_join(asset_path);
11041105
destination = destination_dir.path_join(file_name);
11051106
create_framework = true;
1106-
} else if (p_is_framework && (p_asset.ends_with(".framework") || p_asset.ends_with(".xcframework"))) {
1107+
} else if (p_is_framework && (asset.ends_with(".framework") || asset.ends_with(".xcframework"))) {
11071108
asset_path = String("dylibs").path_join(base_dir);
11081109

11091110
String file_name;
@@ -1147,6 +1148,9 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
11471148
if (err) {
11481149
return err;
11491150
}
1151+
if (asset_path.ends_with("/")) {
1152+
asset_path = asset_path.left(asset_path.length() - 1);
1153+
}
11501154
IOSExportAsset exported_asset = { binary_name.path_join(asset_path), p_is_framework, p_should_embed };
11511155
r_exported_assets.push_back(exported_asset);
11521156

@@ -1213,13 +1217,16 @@ Error EditorExportPlatformIOS::_copy_asset(const String &p_out_dir, const String
12131217
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) {
12141218
for (int f_idx = 0; f_idx < p_assets.size(); ++f_idx) {
12151219
String asset = p_assets[f_idx];
1216-
if (!asset.begins_with("res://")) {
1220+
if (asset.begins_with("res://")) {
1221+
Error err = _copy_asset(p_out_dir, asset, nullptr, p_is_framework, p_should_embed, r_exported_assets);
1222+
ERR_FAIL_COND_V(err, err);
1223+
} else if (ProjectSettings::get_singleton()->localize_path(asset).begins_with("res://")) {
1224+
Error err = _copy_asset(p_out_dir, ProjectSettings::get_singleton()->localize_path(asset), nullptr, p_is_framework, p_should_embed, r_exported_assets);
1225+
ERR_FAIL_COND_V(err, err);
1226+
} else {
12171227
// either SDK-builtin or already a part of the export template
12181228
IOSExportAsset exported_asset = { asset, p_is_framework, p_should_embed };
12191229
r_exported_assets.push_back(exported_asset);
1220-
} else {
1221-
Error err = _copy_asset(p_out_dir, asset, nullptr, p_is_framework, p_should_embed, r_exported_assets);
1222-
ERR_FAIL_COND_V(err, err);
12231230
}
12241231
}
12251232

0 commit comments

Comments
 (0)