Skip to content

Commit

Permalink
Add support for Apple Silicon with Mac64 target
Browse files Browse the repository at this point in the history
- Build unified .app bundle from arm64 and x64 bundles.
- Create a single file when creating unified .app bundle by default as this is the only supported way currently.
- Report errors when notarization fails. Fixes picoe#1862
- Fix NUnit discovering tests when in single file bundle.
- Sdk will now create unified bundles by default for Mac
- Added SdkTest to test the sdk
- Updated monomac to fix issues running on ARM64 as it does not use stret methods for larger struct return values.
  • Loading branch information
cwensley committed Jan 3, 2022
1 parent 84b2f0c commit d03ff20
Show file tree
Hide file tree
Showing 18 changed files with 591 additions and 17 deletions.
14 changes: 13 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"request": "launch",
"preLaunchTask": "build-mac64",
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net6.0/Eto.Test.Mac64.app/Contents/MacOS/Eto.Test.Mac64",
// "targetArchitecture": "x86_64", // uncomment to test intel on M1
"args": [],
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -28,7 +29,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-xammac2",
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net6.0-macos/osx-x64/Eto.Test.XamMac2.app/Contents/MacOS/Eto.Test.XamMac2",
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net6.0-macos/Eto.Test.XamMac2.app/Contents/MacOS/Eto.Test.XamMac2",
"args": [],
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -52,6 +53,11 @@
"preLaunchTask": "build-gtk",
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net6.0/Eto.Test.Gtk.dll",
"args": [],
"osx": {
"env": {
"DYLD_FALLBACK_LIBRARY_PATH": "/opt/homebrew/lib"
}
},
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -64,6 +70,11 @@
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net48/Eto.Test.Gtk.exe",
"passDebugOptionsViaEnvironmentVariable": true,
"args": [],
"osx": {
"env": {
"DYLD_FALLBACK_LIBRARY_PATH": "/opt/homebrew/lib"
}
},
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
},
Expand All @@ -84,6 +95,7 @@
"request": "launch",
"preLaunchTask": "build-wpf",
"program": "${workspaceFolder}/artifacts/test/${config:var.configuration}/net6.0-windows/Eto.Test.Wpf.exe",
"targetArchitecture": "x86_64",
"args": [],
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
Expand Down
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@
"clear": true
}
},
{
"label": "build-sdk-test",
"command": "dotnet build ${config:var.buildProperties} /p:Configuration=${config:var.configuration} ${workspaceFolder}/samples/SdkTest/SdkTest.csproj",
"type": "shell",
"group": "build",
"dependsOn": "build-packages",
"problemMatcher": "$msCompile",
"presentation": {
"clear": true
}
},
{
"label": "restore",
"command": "dotnet restore /v:Minimal ${workspaceFolder}/src/Eto.sln",
Expand Down
2 changes: 1 addition & 1 deletion lib/monomac
20 changes: 20 additions & 0 deletions samples/SdkTest/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>SdkTest</string>
<key>CFBundleIdentifier</key>
<string>ca.picoe.SdkTest</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.14</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleIconFile</key>
<string>MacIcon.icns</string>
</dict>
</plist>
Binary file added samples/SdkTest/MacIcon.icns
Binary file not shown.
57 changes: 57 additions & 0 deletions samples/SdkTest/MainForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using Eto.Forms;
using Eto.Drawing;

namespace Sdk
{
public partial class MainForm : Form
{
public MainForm()
{
Title = "My Eto Form";
MinimumSize = new Size(200, 200);

Content = new StackLayout
{
Padding = 10,
Items =
{
"Hello World!",
// add more controls here
}
};

// create a few commands that can be used for the menu and toolbar
var clickMe = new Command { MenuText = "Click Me!", ToolBarText = "Click Me!" };
clickMe.Executed += (sender, e) => MessageBox.Show(this, "I was clicked!");

var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q };
quitCommand.Executed += (sender, e) => Application.Instance.Quit();

var aboutCommand = new Command { MenuText = "About..." };
aboutCommand.Executed += (sender, e) => new AboutDialog().ShowDialog(this);

// create menu
Menu = new MenuBar
{
Items =
{
// File submenu
new SubMenuItem { Text = "&File", Items = { clickMe } },
// new SubMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
// new SubMenuItem { Text = "&View", Items = { /* commands/items */ } },
},
ApplicationItems =
{
// application (OS X) or file menu (others)
new ButtonMenuItem { Text = "&Preferences..." },
},
QuitItem = quitCommand,
AboutItem = aboutCommand
};

// create toolbar
ToolBar = new ToolBar { Items = { clickMe } };
}
}
}
15 changes: 15 additions & 0 deletions samples/SdkTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Eto.Forms;
using Eto.Drawing;

namespace Sdk
{
class Program
{
[STAThread]
static void Main(string[] args)
{
new Application(Eto.Platform.Detect).Run(new MainForm());
}
}
}
22 changes: 22 additions & 0 deletions samples/SdkTest/SdkTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Eto.Forms/2.6.1-dev">

<!--
Set the BuildPlatform property to the Eto platform you wish to build for.
The default is the platform you are building on.
Valid values: Wpf, Windows, Mac64, XamMac2, Gtk, Direct2D
-->

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

<!-- <EnableDmgBuild>True</EnableDmgBuild> -->
<!-- <EnableCompressionInSingleFile>True</EnableCompressionInSingleFile> -->
<!-- <EnableCodeSigning>True</EnableCodeSigning> -->
<!-- <EnableNotarization>True</EnableNotarization> -->
<!-- <PublishTrimmed>True</PublishTrimmed> -->
<!-- <MacBundleDotNet>False</MacBundleDotNet> -->
<!-- <PublishSingleFile>True</PublishSingleFile> -->
<!-- <IncludeAllContentForSelfExtract>False</IncludeAllContentForSelfExtract> -->
</PropertyGroup>

</Project>
11 changes: 11 additions & 0 deletions samples/SdkTest/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="../../artifacts/packages" />
</config>
<packageSources>
<clear />
<add key="eto-dev" value="../../artifacts/nuget" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Loading

0 comments on commit d03ff20

Please sign in to comment.