This commit is contained in:
theolivenbaum
2022-06-09 10:22:54 +02:00
parent 68c9e80417
commit 576140474e
3 changed files with 26 additions and 5 deletions

View File

@@ -27,6 +27,10 @@ namespace ElectronNET.CLI.Commands.Actions
netCorePublishRid = "osx-x64";
electronPackerPlatform = "mac";
break;
case "osx-arm64":
netCorePublishRid = "osx-arm64";
electronPackerPlatform = "mac";
break;
case "linux":
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";
@@ -46,12 +50,22 @@ namespace ElectronNET.CLI.Commands.Actions
netCorePublishRid = $"win-x{(Environment.Is64BitOperatingSystem ? "64" : "86")}";
electronPackerPlatform = "win";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
netCorePublishRid = "osx-x64";
electronPackerPlatform = "mac";
if (RuntimeInformation.OSArchitecture.Equals(Architecture.Arm64))
{
//Apple Silicon Mac:
netCorePublishRid = "osx-arm64";
electronPackerPlatform = "mac";
}
else
{
//Intel Mac:
netCorePublishRid = "osx-x64";
electronPackerPlatform = "mac";
}
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";

View File

@@ -178,6 +178,12 @@ Full example for a 32bit debug build with electron prune: build /target custom w
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
string electronArch = "x64";
if (platformInfo.NetCorePublishRid == "osx-arm64") //Apple Silicon Mac
{
electronArch = "arm64";
}
if (parser.Arguments.ContainsKey(_paramElectronArch))
{
electronArch = parser.Arguments[_paramElectronArch][0];

View File

@@ -137,10 +137,11 @@ There are additional platforms available:
```
electronize build /target win
electronize build /target osx
electronize build /target osx-arm64
electronize build /target linux
```
Those three "default" targets will produce x64 packages for those platforms.
Those four "default" targets will produce packages for those platforms. Note that the `osx-arm64` is for Apple Silicon Macs.
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this: