DOTNET := ../../../../.././dotnet.sh
USE_LLVM=True
-all: runtimepack app
+all: runtimepack run
TOOLS_DIR=../../../../../tools-local/tasks/mobile.tasks
appbuilder:
../../../../.././build.sh Mono+Libs -os iOS -arch $(MONO_ARCH) -c $(MONO_CONFIG)
run: clean appbuilder
- $(DOTNET) publish -c $(MONO_CONFIG) /p:TargetArchitecture=$(MONO_ARCH) /p:UseLLVM=$(USE_LLVM)
+ $(DOTNET) publish -c $(MONO_CONFIG) /p:TargetArchitecture=$(MONO_ARCH) \
+ /p:UseLLVM=$(USE_LLVM) /p:UseAotForSimulator=true
clean:
rm -rf bin
<RuntimeIdentifier>ios-$(TargetArchitecture)</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<_TrimmerDefaultAction>link</_TrimmerDefaultAction>
+ <Optimized Condition="'$(Configuration)' == 'Release'">True</Optimized>
</PropertyGroup>
<!-- Redirect 'dotnet publish' to in-tree runtime pack -->
</ItemGroup>
<MonoAOTCompiler
- Condition="'$(IosSimulator)' == ''"
+ Condition="'$(IosSimulator)' == '' or '$(UseAotForSimulator)' == 'true'"
CompilerBinaryPath="$(RuntimePackDir)\native\cross\mono-aot-cross"
Mode="Full"
OutputType="AsmOnly"
BuildAppBundle="True"
DevTeamProvisioning="$(DevTeamProvisioning)"
OutputDirectory="$(AppDir)"
- Optimized="False"
+ Optimized="$(Optimized)"
+ UseAotForSimulator="$(UseAotForSimulator)"
AppDir="$(MSBuildThisFileDirectory)$(PublishDir)">
<Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
<Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
<Exec Condition="'$(IosSimulator)' != ''" Command="xcrun simctl shutdown "$(IosSimulator)"" ContinueOnError="WarnAndContinue" />
<Exec Condition="'$(IosSimulator)' != ''" Command="xcrun simctl boot "$(IosSimulator)"" />
<Exec Condition="'$(IosSimulator)' != ''" Command="open -a Simulator" />
- <Exec Condition="'$(IosSimulator)' != ''" Command="xcrun simctl install "$(IosSimulator)" $(ApkDir)/HelloiOS/Debug-iphonesimulator/HelloiOS.app" />
+ <Exec Condition="'$(IosSimulator)' != ''" Command="xcrun simctl install "$(IosSimulator)" $(AppBundlePath)" />
<Exec Condition="'$(IosSimulator)' != ''" Command="xcrun simctl launch --console booted net.dot.HelloiOS" />
</Target>
</Project>
public string AppBundlePath { get; set; } = ""!;
/// <summary>
+ /// Prefer FullAOT mode for Simulator over JIT
+ /// </summary>
+ public bool UseAotForSimulator { get; set; }
+
+ /// <summary>
/// Path to xcode project
/// </summary>
[Output]
}
}
- if (isDevice && !assemblerFiles.Any())
+ if ((isDevice || UseAotForSimulator) && !assemblerFiles.Any())
{
throw new InvalidOperationException("Need list of AOT files for device builds.");
}
if (GenerateXcodeProject)
{
XcodeProjectPath = Xcode.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles,
- AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, NativeMainSource);
+ AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, UseAotForSimulator, NativeMainSource);
if (BuildAppBundle)
{
.AppendLine("#include <mono/jit/jit.h>")
.AppendLine("#include <TargetConditionals.h>")
.AppendLine()
- .AppendLine("#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR")
+ .AppendLine("#if TARGET_OS_IPHONE && (!TARGET_IPHONE_SIMULATOR || USE_AOT_FOR_SIMULATOR)")
.AppendLine();
var lsUsage = new StringBuilder();
%AotSources%
+%Defines%
+
include_directories("%MonoInclude%")
set_target_properties(%ProjectName% PROPERTIES
summaryLabel.font = [UIFont boldSystemFontOfSize: 12];
summaryLabel.numberOfLines = 2;
summaryLabel.textAlignment = NSTextAlignmentLeft;
-#ifdef TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#ifdef TARGET_OS_IPHONE && (!TARGET_IPHONE_SIMULATOR || USE_AOT_FOR_SIMULATOR)
summaryLabel.text = @"Loading...";
#else
summaryLabel.text = @"Jitting...";
//%DllMap%
}
-#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_IPHONE && (!TARGET_IPHONE_SIMULATOR || USE_AOT_FOR_SIMULATOR)
void mono_jit_set_aot_mode (MonoAotMode mode);
void mono_ios_register_modules (void);
#endif
// TODO: set TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS and NATIVE_DLL_SEARCH_DIRECTORIES
monovm_initialize(0, NULL, NULL);
-#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_IPHONE && (!TARGET_IPHONE_SIMULATOR || USE_AOT_FOR_SIMULATOR)
register_dllmap ();
// register modules
mono_ios_register_modules ();
}
mono_jit_init_version ("dotnet.ios", "mobile");
-#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_IPHONE && (!TARGET_IPHONE_SIMULATOR || USE_AOT_FOR_SIMULATOR)
// device runtimes are configured to use lazy gc thread creation
MONO_ENTER_GC_UNSAFE;
mono_gc_init_finalizer_thread ();
string monoInclude,
bool preferDylibs,
bool useConsoleUiTemplate,
+ bool useAotForSimulator,
string? nativeMainSource = null)
{
// bundle everything as resources excluding native files
cmakeLists = cmakeLists.Replace("%NativeLibrariesToLink%", toLink);
cmakeLists = cmakeLists.Replace("%AotSources%", aotSources);
+ cmakeLists = cmakeLists.Replace("%Defines%",
+ useAotForSimulator ? "add_definitions(-DUSE_AOT_FOR_SIMULATOR=1)" : "");
string plist = Utils.GetEmbeddedResource("Info.plist.template")
.Replace("%BundleIdentifier%", projectName);