Skip to content

Commit

Permalink
Merge pull request #316 from unoplatform/dev/jela/netcore-build
Browse files Browse the repository at this point in the history
fix: Adjust VS build
  • Loading branch information
jeromelaban authored Sep 16, 2024
2 parents fe37862 + 9b869b0 commit bc87481
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ jobs:
name: logs_5_1
path: .\logs

# This step is only used to add a required check for the PR
Validation_Check:
name: Validation Check
runs-on: windows-latest
needs:
- build_tool
- validation_5_1
- validation_5_2_win
- validation_5_2_nix

steps:
- name: Checkout
uses: actions/checkout@v4

sign:
name: Sign
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
Expand Down
29 changes: 29 additions & 0 deletions src/Resizetizer/src/SkiaSharpTools.Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ public static void Initialize()
{
SetupResolver();
}
else
{
SetupWindows();
}
}
}

/// <remarks>
/// Load libraries explicitly on Windows, as search paths may not be available when
/// running inside VS msbuild nodes.
/// </remarks>
private static void SetupWindows()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
foreach (var runtimePath in GetRuntimesFolder())
{
if (Directory.Exists(runtimePath))
{
foreach (var file in Directory.GetFiles(runtimePath, "*.dll"))
{
var r = LoadLibrary(file);
}
}
}
}
}

Expand Down Expand Up @@ -184,6 +209,10 @@ IntPtr localDlOpen(string fileName)
[DllImport("libSystem.dylib", EntryPoint = "dlopen")]
public static extern IntPtr dlopen_macos(string fileName, int flags);

// Declare dllimport for loadlibrary
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr LoadLibrary(string lpFileName);

// Imported from https://github.com/mono/SkiaSharp/blob/482e6ee2913a08a7cad76520ccf5fbce97c7c23b/binding/Binding.Shared/LibraryLoader.cs
private static class Linux
{
Expand Down

0 comments on commit bc87481

Please sign in to comment.