Skip to content

Commit

Permalink
Some MoltenVK packaging improvements. (#2177)
Browse files Browse the repository at this point in the history
* Native/MoltenVK: Strip and re-sign the macOS universal binary.

* Native/MoltenVK: Build and package tvOS binaries.

* New binaries for MoltenVK on Darwin 22.6.0 Darwin Kernel Version 22.6.0: Mon Feb 19 19:42:47 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_VMAPPLE

---------

Co-authored-by: The Silk.NET Automaton <[email protected]>
  • Loading branch information
alexrp and dotnet-bot authored May 14, 2024
1 parent 52f15a7 commit b6d2aaf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions build/nuke/Native/MoltenVK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,29 @@ partial class Build {
{
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.MoltenVK.Native" / "runtimes";

InheritedShell($"./fetchDependencies --ios --iossim --maccat --macos", MoltenVKPath).AssertZeroExitCode();
InheritedShell($"make ios iossim maccat macos", MoltenVKPath).AssertZeroExitCode();
InheritedShell($"./fetchDependencies --all", MoltenVKPath).AssertZeroExitCode();
InheritedShell($"make", MoltenVKPath).AssertZeroExitCode();

var xcFrameworkDir = MoltenVKPath / "Package" / "Release" / "MoltenVK" / "static" / "MoltenVK.xcframework";

CopyFile(xcFrameworkDir / "ios-arm64" / "libMoltenVK.a", runtimes / "ios" / "native" / "libMoltenVK.a", FileExistsPolicy.Overwrite);
CopyFile(xcFrameworkDir / "ios-arm64_x86_64-simulator" / "libMoltenVK.a", runtimes / "iossimulator" / "native" / "libMoltenVK.a", FileExistsPolicy.Overwrite);
CopyFile(xcFrameworkDir / "ios-arm64_x86_64-maccatalyst" / "libMoltenVK.a", runtimes / "maccatalyst" / "native" / "libMoltenVK.a", FileExistsPolicy.Overwrite);
CopyFile(MoltenVKPath / "Package" / "Release" / "MoltenVK" / "dynamic" / "dylib" / "macOS" / "libMoltenVK.dylib", runtimes / "osx" / "native" / "libMoltenVK.dylib", FileExistsPolicy.Overwrite);
CopyFile(xcFrameworkDir / "tvos-arm64_arm64e" / "libMoltenVK.a", runtimes / "tvos" / "native" / "libMoltenVK.a", FileExistsPolicy.Overwrite);
CopyFile(xcFrameworkDir / "tvos-arm64_x86_64-simulator" / "libMoltenVK.a", runtimes / "tvossimulator" / "native" / "libMoltenVK.a", FileExistsPolicy.Overwrite);

var macOsDylib = runtimes / "osx" / "native" / "libMoltenVK.dylib";

CopyFile(MoltenVKPath / "Package" / "Release" / "MoltenVK" / "dynamic" / "dylib" / "macOS" / "libMoltenVK.dylib", macOsDylib, FileExistsPolicy.Overwrite);
CopyFile(MoltenVKPath / "Package" / "Release" / "MoltenVK" / "dynamic" / "dylib" / "macOS" / "MoltenVK_icd.json", runtimes / "osx" / "native" / "MoltenVK_icd.json", FileExistsPolicy.Overwrite);

// Only strip the macOS binary since stripping static libraries is too involved, and
// the final AOT'd binary can be stripped anyway.
InheritedShell($"strip -Sx -no_code_signature_warning {macOsDylib}").AssertZeroExitCode();

// Re-sign, as stripping a universal binary invalidates the signature.
InheritedShell($"codesign --remove-signature {macOsDylib}").AssertZeroExitCode();
InheritedShell($"codesign --sign - {macOsDylib}").AssertZeroExitCode();
}

PrUpdatedNativeBinary("MoltenVK");
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit b6d2aaf

Please sign in to comment.