Skip to content

Commit 0f87e1c

Browse files
committed
Added OpenALLibraryNameContainer.OverridePath to be able to manually override the library search path. (Implemented the same feature for OpenCL)
1 parent fa4cf49 commit 0f87e1c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/OpenAL/OpenTK.Audio.OpenAL/OpenALLibraryNameContainer.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ namespace OpenTK.Audio.OpenAL
1717
/// </summary>
1818
public class OpenALLibraryNameContainer
1919
{
20+
/// <summary>
21+
/// Overrides any platform detection logic and directly searches for the OpenAL library using the provided path.
22+
/// If this is <c>null</c> then no override will happen.
23+
/// </summary>
24+
public static string OverridePath { get; set; } = null;
25+
2026
/// <summary>
2127
/// Gets the library name to use on Windows.
2228
/// </summary>
@@ -44,7 +50,11 @@ public class OpenALLibraryNameContainer
4450

4551
public string GetLibraryName()
4652
{
47-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
53+
if (OverridePath != null)
54+
{
55+
return OverridePath;
56+
}
57+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
4858
{
4959
return Android;
5060
}

src/OpenTK.Compute/OpenCL/OpenCLLibraryNameContainer.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ namespace OpenTK.Compute.OpenCL
55
{
66
public class OpenCLLibraryNameContainer
77
{
8+
/// <summary>
9+
/// Overrides any platform detection logic and directly searches for the OpenCL library using the provided path.
10+
/// If this is <c>null</c> then no override will happen.
11+
/// </summary>
12+
public static string OverridePath { get; set; } = null;
13+
814
public string Linux => "libOpenCL.so.1";
915

1016
public string MacOS => "/System/Library/Frameworks/OpenCL.framework/OpenCL";
@@ -17,7 +23,11 @@ public class OpenCLLibraryNameContainer
1723

1824
public string GetLibraryName()
1925
{
20-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
26+
if (OverridePath != null)
27+
{
28+
return OverridePath;
29+
}
30+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
2131
{
2232
return Android;
2333
}

0 commit comments

Comments
 (0)