Fixes linking issue with angelscript
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-03-26 17:35:36 +01:00
parent 36b39ba3c4
commit 0486c9cdfb
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 16 additions and 2 deletions

BIN
PkmnLibSharp/Native/Linux/libangelscript.so (Stored with Git LFS) Executable file

Binary file not shown.

View File

@ -22,6 +22,12 @@ namespace PkmnLibSharpTests
NativeLibrary.SetDllImportResolver(assembly, ImportResolver); NativeLibrary.SetDllImportResolver(assembly, ImportResolver);
} }
LoadLibrary("libArbutils");
LoadLibrary("libCreatureLib");
LoadLibrary("libangelscript");
LoadLibrary("libpkmnLib");
LoadLibrary("libpkmnlib_ai");
LogHandler.RegisterListener((level, s) => LogHandler.RegisterListener((level, s) =>
{ {
Console.WriteLine($"[{level.ToString().ToUpperInvariant()}] {s}"); Console.WriteLine($"[{level.ToString().ToUpperInvariant()}] {s}");
@ -31,11 +37,16 @@ namespace PkmnLibSharpTests
} }
private IntPtr ImportResolver(string libraryname, Assembly assembly, DllImportSearchPath? searchpath) private IntPtr ImportResolver(string libraryname, Assembly assembly, DllImportSearchPath? searchpath)
{
return LoadLibrary(libraryname);
}
private IntPtr LoadLibrary(string libraryName)
{ {
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var assemblyFile = Environment.OSVersion.Platform == PlatformID.Unix var assemblyFile = Environment.OSVersion.Platform == PlatformID.Unix
? Path.Join(directory, libraryname + ".so") ? Path.Join(directory, libraryName + ".so")
: Path.Join(directory, libraryname + ".dll"); : Path.Join(directory, libraryName + ".dll");
return NativeLibrary.Load(assemblyFile); return NativeLibrary.Load(assemblyFile);
} }
} }