Skip to content

Commit

Permalink
Added support for Windows / Linux and OSX server builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr0n authored Nov 8, 2024
1 parent cdaff02 commit e853b50
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Runtime/LLMLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public static IntPtr LoadLibrary(string libraryName)
throw new ArgumentNullException(nameof(libraryName));

IntPtr handle;
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer)
handle = Win32.LoadLibrary(libraryName);
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
handle = Linux.dlopen(libraryName);
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXServer)
handle = Mac.dlopen(libraryName);
else if (Application.platform == RuntimePlatform.Android)
handle = Android.dlopen(libraryName);
Expand All @@ -159,11 +159,11 @@ public static IntPtr GetSymbol(IntPtr library, string symbolName)
throw new ArgumentNullException(nameof(symbolName));

IntPtr handle;
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer)
handle = Win32.GetProcAddress(library, symbolName);
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
handle = Linux.dlsym(library, symbolName);
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXServer)
handle = Mac.dlsym(library, symbolName);
else if (Application.platform == RuntimePlatform.Android)
handle = Android.dlsym(library, symbolName);
Expand All @@ -182,11 +182,11 @@ public static void FreeLibrary(IntPtr library)
if (library == IntPtr.Zero)
return;

if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer)
Win32.FreeLibrary(library);
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
Linux.dlclose(library);
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXServer)
Mac.dlclose(library);
else if (Application.platform == RuntimePlatform.Android)
Android.dlclose(library);
Expand Down Expand Up @@ -416,8 +416,8 @@ public void Destroy()
public static List<string> PossibleArchitectures(bool gpu = false)
{
List<string> architectures = new List<string>();
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer ||
Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer ||
Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
{
if (gpu)
{
Expand Down Expand Up @@ -475,11 +475,11 @@ public static List<string> PossibleArchitectures(bool gpu = false)
public static string GetArchitectureCheckerPath()
{
string filename;
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer)
{
filename = $"windows-archchecker/archchecker.dll";
}
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
{
filename = $"linux-archchecker/libarchchecker.so";
}
Expand All @@ -498,15 +498,15 @@ public static string GetArchitectureCheckerPath()
public static string GetArchitecturePath(string arch)
{
string filename;
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsServer)
{
filename = $"windows-{arch}/undreamai_windows-{arch}.dll";
}
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
else if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxServer)
{
filename = $"linux-{arch}/libundreamai_linux-{arch}.so";
}
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXServer)
{
filename = $"macos-{arch}/libundreamai_macos-{arch}.dylib";
}
Expand Down

0 comments on commit e853b50

Please sign in to comment.