Skip to content

Commit

Permalink
Upgrade Mac Editor to net8.0-macos. Upgrade Eto.Forms (MonoGame#8505)
Browse files Browse the repository at this point in the history
Fixes MonoGame#8469

Upgrade Eto.Forms to the latest stable version.
Switch to using `net8.0-macos` for the mac editor so we can support both
x64 and arm64 architectures.
Upgrade AssimpNet to 5.0.x
Switch over to using MonoGame.Library.Assimp to get macOS arm64 support.
  • Loading branch information
dellis1972 authored Oct 6, 2024
1 parent 5e918e9 commit 5fa2fac
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 18 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,19 @@ jobs:
run: wget -qO- https://monogame.net/downloads/net9_mgfxc_wine_setup.sh | bash
if: runner.os != 'Windows'

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
if: runner.os == 'macOS'

- name: Install required workloads
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
dotnet workload install android
elif [ "$RUNNER_OS" == "Windows" ]; then
dotnet.exe workload install android ios macos
else
dotnet workload install android
dotnet workload install android macos ios
fi
shell: bash

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@


<ItemGroup>
<PackageReference Include="AssimpNet" Version="4.1.0" />
<PackageReference Include="AssimpNet" Version="5.0.0-beta1" IncludeAssets="compile;runtime;build" ExcludeAssets="native" />
<PackageReference Include="MonoGame.Library.Assimp" Version="5.3.1.1" />
<PackageReference Include="BCnEncoder.Net" Version="2.1.0" />
<PackageReference Include="BCnEncoder.Net.ImageSharp" Version="1.1.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.1.30" />
<PackageReference Include="RoyT.TrueType" Version="0.2.0" />
<PackageReference Include="SharpDX" Version="4.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<AssemblyName>mgcb-editor-mac</AssemblyName>
<ImplicitUsings>true</ImplicitUsings>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<Content Include="..\..\Artifacts\MonoGame.Content.Builder.Editor\Mac\Release\MGCB Editor.app\**\*">
<Content Include="..\..\Artifacts\MonoGame.Content.Builder.Editor\Mac\Release\mgcb-editor-mac.app\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>MGCB Editor.app\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ public partial class PipelineController : IController
#if DEBUG
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "../../../MonoGame.Content.Builder/Debug/mgcb.dll"),
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "../../../../../../MonoGame.Content.Builder/Debug/mgcb.dll"),
#else
#if MAC
Path.Combine(Path.GetDirectoryName(System.AppContext.BaseDirectory) ?? "", "../../../MonoGame.Content.Builder/Release/mgcb.dll"),
Path.Combine(Path.GetDirectoryName(System.AppContext.BaseDirectory) ?? "", "../../../../../../MonoGame.Content.Builder/Release/mgcb.dll"),
#else
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "../../../MonoGame.Content.Builder/Release/mgcb.dll"),
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "../../../../../../MonoGame.Content.Builder/Release/mgcb.dll"),
#endif
#endif
};

Expand Down Expand Up @@ -108,7 +113,11 @@ private PipelineController(IView view)
ProjectOpen = false;

_templateItems = new List<ContentItemTemplate>();
#if MAC
var root = Path.GetDirectoryName(System.AppContext.BaseDirectory) ?? "";
#else
var root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";
#endif
var templatesPath = Path.Combine(root, "Templates");

#if IDE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.6.0" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.6.0" />
<PackageReference Include="GtkSharp" Version="3.24.24.34" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.8.3" />
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net8.0-macos</TargetFramework>
<RollForward>Major</RollForward>
<BaseOutputPath>..\..\Artifacts\MonoGame.Content.Builder.Editor\Mac</BaseOutputPath>
<DefineConstants>MONOMAC;MAC</DefineConstants>
Expand All @@ -11,9 +11,7 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<AssemblyName>mgcb-editor-mac</AssemblyName>
<AssemblyTitle>MGCB Editor</AssemblyTitle>
<MacBundleName>$(AssemblyTitle)</MacBundleName>
<PublishSingleFile>false</PublishSingleFile>
<RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,8 +29,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.6.1" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.6.1" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="Eto.Platform.macOS" Version="2.8.3" />
<PackageReference Include="AssimpNet" Version="5.0.0-beta1" ExcludeAssets="runtime;native" />
<PackageReference Include="MonoGame.Library.Assimp" Version="5.3.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.6.0" />
<PackageReference Include="Eto.Platform.Wpf" Version="2.6.0" />
<PackageReference Include="Eto.Forms" Version="2.8.3" />
<PackageReference Include="Eto.Platform.Wpf" Version="2.8.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

using Eto;
using Eto.Mac.Forms;
using MonoMac.AppKit;
using MonoMac.Foundation;
using AppKit;
using Foundation;

namespace MonoGame.Tools.Pipeline
{
Expand Down
2 changes: 1 addition & 1 deletion Tools/MonoGame.Content.Builder.Editor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void Main(string[] args)
#elif WPF
var app = new Application(Platforms.Wpf);
#else
var app = new Application(Platforms.Mac64);
var app = new Application(Platforms.macOS);
#endif

app.Style = "PipelineTool";
Expand Down
9 changes: 9 additions & 0 deletions build/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ public BuildContext(ICakeContext context) : base(context)
Configuration = buildConfiguration,
SelfContained = false
};
// SelfContained needs to be default for MacOS
DotNetPublishSettingsForMac = new DotNetPublishSettings
{
MSBuildSettings = DotNetMSBuildSettings,
Verbosity = DotNetVerbosity.Minimal,
Configuration = buildConfiguration
};

Console.WriteLine($"Version: {Version}");
Console.WriteLine($"RepositoryUrl: {repositoryUrl}");
Expand Down Expand Up @@ -142,6 +149,8 @@ public BuildContext(ICakeContext context) : base(context)

public DotNetPublishSettings DotNetPublishSettings { get; }

public DotNetPublishSettings DotNetPublishSettingsForMac { get; }

public MSBuildSettings MSBuildSettings { get; }

public MSBuildSettings MSPackSettings { get; }
Expand Down
5 changes: 4 additions & 1 deletion build/BuildToolsTasks/BuildMGCBEditorTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public override void Run(BuildContext context)
_ => "Linux"
};

context.DotNetPublish(context.GetProjectPath(ProjectType.MGCBEditor, platform), context.DotNetPublishSettings);
if (context.Environment.Platform.Family != PlatformFamily.OSX)
context.DotNetPublish(context.GetProjectPath(ProjectType.MGCBEditor, platform), context.DotNetPublishSettings);
else
context.DotNetPublish(context.GetProjectPath(ProjectType.MGCBEditor, platform), context.DotNetPublishSettingsForMac);
context.DotNetPack(context.GetProjectPath(ProjectType.Tools, "MonoGame.Content.Builder.Editor.Launcher.Bootstrap"), context.DotNetPackSettings);
context.DotNetPack(context.GetProjectPath(ProjectType.MGCBEditorLauncher, platform), context.DotNetPackSettings);
}
Expand Down

0 comments on commit 5fa2fac

Please sign in to comment.