Skip to content

Commit

Permalink
[mtouch] It seems watchOS simulators can automatically choose the rig…
Browse files Browse the repository at this point in the history
…ht architecture from fat apps.

So we can build a fat simulator app, and not depend on mlaunch copying in the
specific architecture at launch time.

A partial fix for xamarin/maccore#2411.
  • Loading branch information
rolfbjarne committed Apr 21, 2021
1 parent 975114b commit 7649b5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ public bool IsSimulatorBuild {
}
}

// It seems the watch simulator is able to correctly select which architecture to use
// for a fat executable, so limit ourselves to arch-specific executables anymore.
public bool ArchSpecificExecutable {
get {
return !IsWatchExtension;
}
}

public static int Concurrency => Driver.Concurrency;
public Version DeploymentTarget;
public Version SdkVersion;
Expand Down
2 changes: 1 addition & 1 deletion tools/mtouch/Application.mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ void BuildApp ()
link_tasks.AddRange (target.NativeLink (build_tasks));
}

if (IsDeviceBuild || Platform == ApplePlatform.MacCatalyst) {
if (IsDeviceBuild || Platform == ApplePlatform.MacCatalyst || !ArchSpecificExecutable) {
// If building for the simulator, the executable is written directly into the expected location within the .app, and no lipo/file copying is needed.
if (link_tasks.Count > 1) {
// If we have more than one executable, we must lipo them together.
Expand Down
2 changes: 1 addition & 1 deletion tools/mtouch/Target.mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public IDictionary<Abi, string> Executables {
get {
if (executables == null) {
executables = new Dictionary<Abi, string> ();
if (App.IsSimulatorBuild) {
if (App.IsSimulatorBuild && App.ArchSpecificExecutable) {
// When using simlauncher, we copy the executable directly to the target directory.
// When not using the simlauncher, but still building for the simulator, we write the executable to a arch-specific app directory (if building for both 32-bit and 64-bit), or just the app directory (if building for a single architecture)
if (Abis.Count != 1)
Expand Down

0 comments on commit 7649b5a

Please sign in to comment.