Better way of including Gtk libs
This commit is contained in:
parent
5a179531bb
commit
a32bcb35c7
35 changed files with 35 additions and 189 deletions
|
@ -10,12 +10,15 @@
|
||||||
<Description>GtkSharp is a C# wrapper for the Gtk library.</Description>
|
<Description>GtkSharp is a C# wrapper for the Gtk library.</Description>
|
||||||
<PackageTags>gtk;gtksharp;gtk-sharp;wrapper</PackageTags>
|
<PackageTags>gtk;gtksharp;gtk-sharp;wrapper</PackageTags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<OutputPath>..\..\..\BuildOutput\Debug</OutputPath>
|
<OutputPath>..\..\..\BuildOutput\Debug</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
|
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GLibSharp\GLibSharp.csproj">
|
<ProjectReference Include="..\GLibSharp\GLibSharp.csproj">
|
||||||
<Name>GLibSharp</Name>
|
<Name>GLibSharp</Name>
|
||||||
|
@ -36,173 +39,15 @@
|
||||||
<Name>PangoSharp</Name>
|
<Name>PangoSharp</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Shared\*.cs">
|
<Compile Include="..\Shared\*.cs">
|
||||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="windows-x64\atk-1.dll" />
|
<Content Include="GtkSharp.targets" PackagePath="build\GtkSharp.targets" />
|
||||||
<None Remove="windows-x64\bz2.dll" />
|
|
||||||
<None Remove="windows-x64\cairo-gobject.dll" />
|
|
||||||
<None Remove="windows-x64\cairo.dll" />
|
|
||||||
<None Remove="windows-x64\epoxy-0.dll" />
|
|
||||||
<None Remove="windows-x64\expat.dll" />
|
|
||||||
<None Remove="windows-x64\fontconfig.dll" />
|
|
||||||
<None Remove="windows-x64\freetype.dll" />
|
|
||||||
<None Remove="windows-x64\gailutil-3.dll" />
|
|
||||||
<None Remove="windows-x64\gdk-3.dll" />
|
|
||||||
<None Remove="windows-x64\gdk_pixbuf-2.dll" />
|
|
||||||
<None Remove="windows-x64\gio-2.dll" />
|
|
||||||
<None Remove="windows-x64\glib-2.dll" />
|
|
||||||
<None Remove="windows-x64\gmodule-2.dll" />
|
|
||||||
<None Remove="windows-x64\gobject-2.dll" />
|
|
||||||
<None Remove="windows-x64\gthread-2.dll" />
|
|
||||||
<None Remove="windows-x64\gtk-3.dll" />
|
|
||||||
<None Remove="windows-x64\harfbuzz.dll" />
|
|
||||||
<None Remove="windows-x64\libcharset.dll" />
|
|
||||||
<None Remove="windows-x64\libiconv.dll" />
|
|
||||||
<None Remove="windows-x64\libintl.dll" />
|
|
||||||
<None Remove="windows-x64\libpng16.dll" />
|
|
||||||
<None Remove="windows-x64\pango-1.dll" />
|
|
||||||
<None Remove="windows-x64\pangocairo-1.dll" />
|
|
||||||
<None Remove="windows-x64\pangoft2-1.dll" />
|
|
||||||
<None Remove="windows-x64\pangowin32-1.dll" />
|
|
||||||
<None Remove="windows-x64\pcre.dll" />
|
|
||||||
<None Remove="windows-x64\pcre16.dll" />
|
|
||||||
<None Remove="windows-x64\pcre32.dll" />
|
|
||||||
<None Remove="windows-x64\pcrecpp.dll" />
|
|
||||||
<None Remove="windows-x64\pcreposix.dll" />
|
|
||||||
<None Remove="windows-x64\zlib1.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="windows-x64\atk-1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\bz2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\cairo-gobject.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\cairo.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\epoxy-0.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\expat.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\fontconfig.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\freetype.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gailutil-3.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gdk-3.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gdk_pixbuf-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gio-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\glib-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gmodule-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gobject-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gthread-2.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\gtk-3.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\harfbuzz.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\libcharset.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\libiconv.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\libintl.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\libpng16.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pango-1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pangocairo-1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pangoft2-1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pangowin32-1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pcre.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pcre16.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pcre32.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pcrecpp.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\pcreposix.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="windows-x64\zlib1.dll">
|
|
||||||
<PackagePath>runtimes\win-x64\native</PackagePath>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
16
Source/Libs/GtkSharp/GtkSharp.targets
Normal file
16
Source/Libs/GtkSharp/GtkSharp.targets
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<GtkUrl Condition=" '$(GtkUrl)' == '' ">https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.zip</GtkUrl>
|
||||||
|
<GtkDir Condition=" '$(GtkDir)' == '' ">$(LOCALAPPDATA)\Gtk\3.24</GtkDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="InstallGtk" BeforeTargets="Build" Condition=" '$(SkipGtkInstall)' != 'True' and !Exists('$(GtkDir)/libgtk-3-0.dll') ">
|
||||||
|
<Message Importance="High" Text="Gtk has not been detected, downloading and installing it, set SkipGtkInstall to True to skip theese steps."/>
|
||||||
|
<Message Importance="High" Text="Ignore Gtk extract errors, bug msbuild/issues/3884"/>
|
||||||
|
<MakeDir Directories="$(GtkDir)"/>
|
||||||
|
<DownloadFile SourceUrl="$(GtkUrl)" DestinationFolder="$(GtkDir)" DestinationFileName="gtk.zip" />
|
||||||
|
<Unzip ContinueOnError="true" SourceFiles="$(GtkDir)/gtk.zip" DestinationFolder="$(GtkDir)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -36,17 +36,25 @@ class GLibrary
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (FuncLoader.IsWindows)
|
if (FuncLoader.IsWindows)
|
||||||
ret = LoadLibrary(_libraryDefinitions[library][0]);
|
{
|
||||||
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]);
|
||||||
|
|
||||||
|
if (ret == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24"));
|
||||||
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (FuncLoader.IsOSX)
|
else if (FuncLoader.IsOSX)
|
||||||
ret = LoadLibrary(_libraryDefinitions[library][2]);
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][2]);
|
||||||
else
|
else
|
||||||
ret = LoadLibrary(_libraryDefinitions[library][1]);
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][1]);
|
||||||
|
|
||||||
if (ret == IntPtr.Zero)
|
if (ret == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _libraryDefinitions[library].Length; i++)
|
for (int i = 0; i < _libraryDefinitions[library].Length; i++)
|
||||||
{
|
{
|
||||||
ret = LoadLibrary(_libraryDefinitions[library][i]);
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][i]);
|
||||||
|
|
||||||
if (ret != IntPtr.Zero)
|
if (ret != IntPtr.Zero)
|
||||||
break;
|
break;
|
||||||
|
@ -62,27 +70,4 @@ class GLibrary
|
||||||
_libraries[library] = ret;
|
_libraries[library] = ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IntPtr LoadLibrary(string libname)
|
|
||||||
{
|
|
||||||
var ret = FuncLoader.LoadLibrary(libname);
|
|
||||||
if (ret != IntPtr.Zero)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
// Hacky solution to load libraries on Windows
|
|
||||||
if (FuncLoader.IsWindows)
|
|
||||||
{
|
|
||||||
var assemblyLocation = Path.GetDirectoryName(typeof(GLibrary).Assembly.Location);
|
|
||||||
var assemblyVersionDir = Path.GetDirectoryName(Path.GetDirectoryName(assemblyLocation));
|
|
||||||
var version = Path.GetFileName(assemblyVersionDir);
|
|
||||||
var gtkdir = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(assemblyVersionDir)), "gtksharp");
|
|
||||||
var nativeLibDir = Path.Combine(gtkdir, version, "runtimes", "win-x64", "native");
|
|
||||||
|
|
||||||
SetDllDirectory(nativeLibDir);
|
|
||||||
|
|
||||||
ret = FuncLoader.LoadLibrary(Path.Combine(nativeLibDir, libname));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue