-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start of Support MoltenVK * Load static library * Add MoltenVk native project * rework checking library name * add MoltenVk as submodule Compile MoltenVK with Nuke take only necessary libraries into MoltenVK package instead of the full xcframework * change path to libraries in package add installing of ninja build system for compiling MoltenVK * add MoltenVK workflows * Use PInvokeOverride for loading libraries on iOS and MacCatalyst * Update src/Vulkan/Silk.NET.Vulkan/PreventSilkTouchBugAttribute.cs Co-authored-by: Dylan Perks <11160611+Perksey@users.noreply.github.com> --------- Co-authored-by: Valentin <valentin.zy@yandex.ru> Co-authored-by: Dylan Perks <11160611+Perksey@users.noreply.github.com>
- Loading branch information
1 parent
59f25bb
commit fdd0f40
Showing
14 changed files
with
168 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: MoltenVK | ||
on: | ||
push: | ||
branches-ignore: | ||
- "ci/*" | ||
- "develop/*" | ||
- "main" | ||
paths: | ||
- build/submodules/MoltenVK | ||
- build/nuke/Native/Core.cs | ||
- build/nuke/Native/MoltenVK.cs | ||
- .github/workflows/moltenvk.yml | ||
jobs: | ||
Build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
env: | ||
- os: macos-latest | ||
name: Darwin | ||
nuke_invoke: ./build.sh | ||
extras: "" | ||
name: ${{ matrix.env.name }} Build | ||
runs-on: ${{ matrix.env.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} | ||
|
||
- name: Checkout submodules, configure git | ||
run: | | ||
git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive build/submodules/MoltenVK | ||
git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" | ||
git config --local user.name "The Silk.NET Automaton" | ||
- name: Extra prerequisites | ||
run: | | ||
echo running extras | ||
${{ matrix.env.extras }} | ||
# Install python | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
# Install CMake and Ninja | ||
- uses: lukka/get-cmake@latest | ||
|
||
- name: Build MoltenVK | ||
run: ${{ matrix.env.nuke_invoke }} MoltenVK | ||
env: | ||
PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Nuke.Common; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Tooling; | ||
using static Nuke.Common.IO.FileSystemTasks; | ||
|
||
partial class Build { | ||
AbsolutePath MoltenVKPath => RootDirectory / "build" / "submodules" / "MoltenVK"; | ||
|
||
Target MoltenVK => CommonTarget | ||
( | ||
x => x.Before(Compile) | ||
.After(Clean) | ||
.Executes | ||
( | ||
() => | ||
{ | ||
if (OperatingSystem.IsMacOS()) | ||
{ | ||
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.MoltenVK.Native" / "runtimes"; | ||
InheritedShell($"./fetchDependencies --ios --iossim --maccat", MoltenVKPath).AssertZeroExitCode(); | ||
InheritedShell($"make ios iossim maccat", MoltenVKPath).AssertZeroExitCode(); | ||
var xcFrameworkDir = MoltenVKPath / "Package" / "Release" / "MoltenVK" / "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); | ||
} | ||
PrUpdatedNativeBinary("MoltenVK"); | ||
} | ||
) | ||
); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Native/Silk.NET.MoltenVK.Native/Silk.NET.MoltenVK.Native.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="..\..\..\build\props\common.props" /> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Authors>.NET Foundation and Contributors</Authors> | ||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/dotnet/Silk.NET</PackageProjectUrl> | ||
<Description>MoltenVK static library.</Description> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/KhronosGroup/MoltenVK</RepositoryUrl> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<IncludeContentInPack>true</IncludeContentInPack> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Include="runtimes\iossimulator\native\libMoltenVK.a" PackagePath="runtimes\iossimulator\native\libMoltenVK.a" /> | ||
<Content Include="runtimes\maccatalyst\native\libMoltenVK.a" PackagePath="runtimes\maccatalyst\native\libMoltenVK.a" /> | ||
<Content Include="runtimes\ios\native\libMoltenVK.a" PackagePath="runtimes\ios\native\libMoltenVK.a" /> | ||
<Content Include="build\netstandard2.0\Silk.NET.MoltenVK.Native.targets" PackagePath="build\netstandard2.0\Silk.NET.MoltenVK.Native.targets" /> | ||
</ItemGroup> | ||
|
||
</Project> |
17 changes: 17 additions & 0 deletions
17
src/Native/Silk.NET.MoltenVK.Native/build/netstandard2.0/Silk.NET.MoltenVK.Native.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project ToolsVersion="15.0"> | ||
<PropertyGroup> | ||
<_LibMoltenVKPath Condition="'$(RuntimeIdentifier)' == 'maccatalyst-x64' OR '$(RuntimeIdentifier)' == 'maccatalyst-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\maccatalyst\native\libMoltenVK.a</_LibMoltenVKPath> | ||
<_LibMoltenVKPath Condition="$(RuntimeIdentifier) == 'iossimulator-x64' OR '$(RuntimeIdentifier)' == 'iossimulator-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\iossimulator\native\libMoltenVK.a</_LibMoltenVKPath> | ||
<_LibMoltenVKPath Condition="'$(RuntimeIdentifier)' == 'ios-arm64'">$(MSBuildThisFileDirectory)..\..\runtimes\ios\native\libMoltenVK.a</_LibMoltenVKPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<NativeReference Include="$(_LibMoltenVKPath)" Condition="'$(_LibMoltenVKPath)' != ''"> | ||
<Kind>Static</Kind> | ||
<Forceload>True</Forceload> | ||
<IsCxx>True</IsCxx> | ||
<SmartLink>False</SmartLink> | ||
<LinkerFlags> -framework Metal -framework IOSurface -framework UIKit -framework QuartzCore -framework CoreGraphics -framework IOKit -framework Foundation </LinkerFlags> | ||
</NativeReference> | ||
</ItemGroup> | ||
</Project> |
Binary file added
BIN
+8.74 MB
src/Native/Silk.NET.MoltenVK.Native/runtimes/ios/native/libMoltenVK.a
Binary file not shown.
Binary file added
BIN
+18.5 MB
src/Native/Silk.NET.MoltenVK.Native/runtimes/iossimulator/native/libMoltenVK.a
Binary file not shown.
Binary file added
BIN
+18.6 MB
src/Native/Silk.NET.MoltenVK.Native/runtimes/maccatalyst/native/libMoltenVK.a
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
src/Vulkan/Silk.NET.Vulkan/PreventSilkTouchBugAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Silk.NET.Vulkan; | ||
|
||
internal class PreventSilkTouchBugAttribute : Attribute | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters