diff --git a/Source/Libs/AtkSharp/AtkSharp.csproj b/Source/Libs/AtkSharp/AtkSharp.csproj index be81b8e01..d8f39de67 100755 --- a/Source/Libs/AtkSharp/AtkSharp.csproj +++ b/Source/Libs/AtkSharp/AtkSharp.csproj @@ -20,6 +20,8 @@ - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/CairoSharp/CairoSharp.csproj b/Source/Libs/CairoSharp/CairoSharp.csproj index f99f19984..bbc9e0ec4 100755 --- a/Source/Libs/CairoSharp/CairoSharp.csproj +++ b/Source/Libs/CairoSharp/CairoSharp.csproj @@ -15,6 +15,8 @@ ..\..\..\BuildOutput\Release - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/GLibSharp/GLibSharp.csproj b/Source/Libs/GLibSharp/GLibSharp.csproj index d49d0758d..9461e9422 100755 --- a/Source/Libs/GLibSharp/GLibSharp.csproj +++ b/Source/Libs/GLibSharp/GLibSharp.csproj @@ -15,6 +15,8 @@ ..\..\..\BuildOutput\Release - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/GdkSharp/GdkSharp.csproj b/Source/Libs/GdkSharp/GdkSharp.csproj index 349c26f27..d04f1ce00 100755 --- a/Source/Libs/GdkSharp/GdkSharp.csproj +++ b/Source/Libs/GdkSharp/GdkSharp.csproj @@ -29,6 +29,8 @@ - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/GioSharp/GioSharp.csproj b/Source/Libs/GioSharp/GioSharp.csproj index 0c85f7736..bdccbd34b 100755 --- a/Source/Libs/GioSharp/GioSharp.csproj +++ b/Source/Libs/GioSharp/GioSharp.csproj @@ -20,6 +20,8 @@ - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/GtkSharp/GtkSharp.csproj b/Source/Libs/GtkSharp/GtkSharp.csproj index e02c9f837..557cfd20d 100755 --- a/Source/Libs/GtkSharp/GtkSharp.csproj +++ b/Source/Libs/GtkSharp/GtkSharp.csproj @@ -37,6 +37,8 @@ - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/PangoSharp/PangoSharp.csproj b/Source/Libs/PangoSharp/PangoSharp.csproj index 30a71b6e0..fc0c831dd 100755 --- a/Source/Libs/PangoSharp/PangoSharp.csproj +++ b/Source/Libs/PangoSharp/PangoSharp.csproj @@ -23,6 +23,8 @@ - + + %(RecursiveDir)%(Filename)%(Extension) + diff --git a/Source/Libs/Shared/FuncLoader.cs b/Source/Libs/Shared/FuncLoader.cs index 2b85cf703..4b384e8c6 100644 --- a/Source/Libs/Shared/FuncLoader.cs +++ b/Source/Libs/Shared/FuncLoader.cs @@ -1,82 +1,5 @@ using System; using System.Runtime.InteropServices; -using System.Collections.Generic; -using System.Linq; - -enum Library -{ - GLib, - GObject, - Cairo, - Gio, - Atk, - Pango, - Gdk, - GdkPixbuf, - Gtk -} - -class GLibrary -{ - private static Dictionary _libraries; - private static Dictionary _customlibraries; - private static List<(Library Library, string WindowsLib, string LinuxLib, string OSXLib)> _libdict; - - static GLibrary() - { - _customlibraries = new Dictionary(); - _libraries = new Dictionary(); - _libdict = new List<(Library, string, string, string)>(); - _libdict.Add((Library.GLib, "libglib-2.0-0.dll", "libglib-2.0.so.0", "libglib-2.0.0.dylib")); - _libdict.Add((Library.GObject, "libgobject-2.0-0.dll", "libgobject-2.0.so.0", "libgobject-2.0.0.dylib")); - _libdict.Add((Library.Cairo, "libcairo-2.dll", "libcairo.so.2", "libcairo.2.dylib")); - _libdict.Add((Library.Gio, "libgio-2.0-0.dll", "libgio-2.0.so.0", "libgio-2.0.0.dylib")); - _libdict.Add((Library.Atk, "libatk-1.0-0.dll", "libatk-1.0.so.0", "libatk-1.0.0.dylib")); - _libdict.Add((Library.Pango, "libpango-1.0-0.dll", "libpango-1.0.so.0", "libpango-1.0.0.dylib")); - _libdict.Add((Library.Gdk, "libgdk-3-0.dll", "libgdk-3.so.0", "libgdk-3.0.dylib")); - _libdict.Add((Library.GdkPixbuf, "libgdk_pixbuf-2.0-0.dll", "libgdk_pixbuf-2.0.so.0", "libgdk_pixbuf-2.0.dylib")); - _libdict.Add((Library.Gtk, "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib")); - } - - public static IntPtr Load(string libname) - { - var index = _libdict.FindIndex((e) => (e.WindowsLib == libname || e.LinuxLib == libname || e.OSXLib == libname)); - - if (index != -1) - return Load(_libdict[index].Library); - - var ret = IntPtr.Zero; - if (!_customlibraries.TryGetValue(libname, out ret)) - _customlibraries[libname] = ret = FuncLoader.LoadLibrary(libname); - - return ret; - } - - public static IntPtr Load(Library library) - { - IntPtr ret = IntPtr.Zero; - if (!_libraries.TryGetValue(library, out ret)) - { - var i = _libdict.Find((e) => e.Library == library); - var s = i.LinuxLib; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - s = i.WindowsLib; - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - s = i.OSXLib; - - _libraries[library] = ret = FuncLoader.LoadLibrary(s); - } - - if (ret == IntPtr.Zero) - { - Console.WriteLine("Error: " + library); - throw new Exception(); - } - - return ret; - } -} class FuncLoader { @@ -138,10 +61,7 @@ class FuncLoader ret = Linux.dlsym(library, function); if (ret == IntPtr.Zero) - { - Console.WriteLine("Error: " + function); - throw new Exception(); - } + throw new EntryPointNotFoundException(function); return ret; } diff --git a/Source/Libs/Shared/GLibrary.cs b/Source/Libs/Shared/GLibrary.cs new file mode 100644 index 000000000..71b6bba30 --- /dev/null +++ b/Source/Libs/Shared/GLibrary.cs @@ -0,0 +1,62 @@ +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +class GLibrary +{ + private static Dictionary _libraries; + private static Dictionary _customlibraries; + private static List<(Library Library, string WindowsLib, string LinuxLib, string OSXLib)> _libdict; + + static GLibrary() + { + _customlibraries = new Dictionary(); + _libraries = new Dictionary(); + _libdict = new List<(Library, string, string, string)>(); + _libdict.Add((Library.GLib, "libglib-2.0-0.dll", "libglib-2.0.so.0", "libglib-2.0.0.dylib")); + _libdict.Add((Library.GObject, "libgobject-2.0-0.dll", "libgobject-2.0.so.0", "libgobject-2.0.0.dylib")); + _libdict.Add((Library.Cairo, "libcairo-2.dll", "libcairo.so.2", "libcairo.2.dylib")); + _libdict.Add((Library.Gio, "libgio-2.0-0.dll", "libgio-2.0.so.0", "libgio-2.0.0.dylib")); + _libdict.Add((Library.Atk, "libatk-1.0-0.dll", "libatk-1.0.so.0", "libatk-1.0.0.dylib")); + _libdict.Add((Library.Pango, "libpango-1.0-0.dll", "libpango-1.0.so.0", "libpango-1.0.0.dylib")); + _libdict.Add((Library.Gdk, "libgdk-3-0.dll", "libgdk-3.so.0", "libgdk-3.0.dylib")); + _libdict.Add((Library.GdkPixbuf, "libgdk_pixbuf-2.0-0.dll", "libgdk_pixbuf-2.0.so.0", "libgdk_pixbuf-2.0.dylib")); + _libdict.Add((Library.Gtk, "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib")); + } + + public static IntPtr Load(string libname) + { + var index = _libdict.FindIndex((e) => (e.WindowsLib == libname || e.LinuxLib == libname || e.OSXLib == libname)); + + if (index != -1) + return Load(_libdict[index].Library); + + var ret = IntPtr.Zero; + if (!_customlibraries.TryGetValue(libname, out ret)) + _customlibraries[libname] = ret = FuncLoader.LoadLibrary(libname); + + return ret; + } + + public static IntPtr Load(Library library) + { + IntPtr ret = IntPtr.Zero; + if (!_libraries.TryGetValue(library, out ret)) + { + var i = _libdict.Find((e) => e.Library == library); + var s = i.LinuxLib; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + s = i.WindowsLib; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + s = i.OSXLib; + + _libraries[library] = ret = FuncLoader.LoadLibrary(s); + } + + if (ret == IntPtr.Zero) + throw new DllNotFoundException(library.ToString()); + + return ret; + } +} \ No newline at end of file diff --git a/Source/Libs/Shared/Library.cs b/Source/Libs/Shared/Library.cs new file mode 100644 index 000000000..78c8a0afc --- /dev/null +++ b/Source/Libs/Shared/Library.cs @@ -0,0 +1,13 @@ + +enum Library +{ + GLib, + GObject, + Cairo, + Gio, + Atk, + Pango, + Gdk, + GdkPixbuf, + Gtk +} \ No newline at end of file diff --git a/build.cake b/build.cake index be39d7fd8..29e95e789 100755 --- a/build.cake +++ b/build.cake @@ -6,7 +6,7 @@ // VARS Settings.Cake = Context; -Settings.Version = "3.22.24.22"; +Settings.Version = "3.22.24.23"; Settings.BuildTarget = Argument("BuildTarget", "Default"); Settings.Assembly = Argument("Assembly", "");