NuGet packaging, Dll mapping and general .Net core improvements

This commit is contained in:
cra0zy 2017-10-26 01:42:57 +02:00
parent 6926c9cbf2
commit 46951b3f91
83 changed files with 222 additions and 180 deletions

View File

@ -1,3 +0,0 @@
{
"git.ignoreLimitWarning": true
}

View File

@ -3,7 +3,7 @@ using P = System.IO.Path;
public class GAssembly
{
public static ICakeContext Cake;
private ICakeContext Cake;
public bool Init { get; private set; }
public string Name { get; private set; }
@ -13,12 +13,13 @@ public class GAssembly
public string RawApi { get; private set; }
public string Metadata { get; private set; }
public string[] Includes { get; set; }
public string[] Deps { get; set; }
public string ExtraArgs { get; set; }
public GAssembly(string name)
{
Includes = new string[0];
Cake = Settings.Cake;
Deps = new string[0];
Name = name;
Dir = P.Combine("Source", "Libs", name);
@ -32,20 +33,21 @@ public class GAssembly
public void Prepare()
{
Cake.CreateDirectory(GDir);
// Raw API file found, time to generate some stuff!!!
if (Cake.FileExists(RawApi))
{
Cake.DeleteDirectory(GDir, true);
Cake.CreateDirectory(GDir);
// Fixup API file
var tempapi = P.Combine(GDir, Name + "-api.xml");
var symfile = P.Combine(Dir, Name + "-symbols.xml");
Cake.CopyFile(RawApi, tempapi);
GapiFixup.Run(tempapi, Metadata, Cake.FileExists(symfile) ? symfile : string.Empty);
var extraargs = ExtraArgs + " ";
// Locate APIs to include
foreach(var dep in Includes)
foreach(var dep in Deps)
{
var ipath = P.Combine("Source", "Libs", dep, dep + "-api.xml");
@ -53,17 +55,14 @@ public class GAssembly
ipath = P.Combine("Source", "Libs", dep, "Generated", dep + "-api.xml");
if (Cake.FileExists(ipath))
{
ExtraArgs += "--include=" + ipath + " ";
ExtraArgs += "--include=" + ipath + " ";
}
extraargs += " --include=" + ipath + " ";
}
// Generate code
GAssembly.Cake.DotNetCoreExecute(P.Combine("BuildOutput", "Generator", "GapiCodegen.dll"),
Cake.DotNetCoreExecute("BuildOutput/Generator/GapiCodegen.dll",
"--outdir=" + GDir + " " +
"--schema=" + P.Combine("Source", "Libs", "Gapi.xsd") + " " +
ExtraArgs + " " +
"--schema=Source/Libs/Gapi.xsd " +
extraargs + " " +
"--assembly-name=" + Name + " " +
"--generate=" + tempapi
);
@ -74,6 +73,7 @@ public class GAssembly
public void Clean()
{
Cake.DeleteDirectory(GDir, true);
if (Cake.DirectoryExists(GDir))
Cake.DeleteDirectory(GDir, new DeleteDirectorySettings { Recursive = true, Force = true });
}
}

7
CakeScripts/Settings.cs Executable file
View File

@ -0,0 +1,7 @@
class Settings
{
public static ICakeContext Cake { get; set; }
public static string BuildTarget { get; set; }
public static string Assembly { get; set; }
}

View File

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyDelaySign(false)]
[assembly:AssemblyVersion("3.22.24.0")]

View File

@ -1,5 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly:AssemblyVersion("@API_VERSION@")]
[assembly:AssemblyDelaySign(false)]

View File

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="Atk" library="libatk-1.0-0.dll">
<namespace name="Atk" library="libatk-1.0-0">
<enum name="CoordType" cname="AtkCoordType" gtype="atk_coord_type_get_type" type="enum">
<member cname="ATK_XY_SCREEN" name="Screen" />
<member cname="ATK_XY_WINDOW" name="Window" />

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>netstandard2.0</TargetFramework>
@ -16,5 +15,7 @@
<Name>GLibSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="linux-x64\libatk-1.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

View File

@ -1,8 +0,0 @@
using System;
namespace AtkSharp
{
public class Class1
{
}
}

View File

@ -28,7 +28,7 @@ namespace Atk {
public partial class Global {
[DllImport ("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport ("libatk-1.0-0", CallingConvention = CallingConvention.Cdecl)]
static extern uint atk_add_global_event_listener (GLib.Signal.EmissionHookNative hook, IntPtr event_type);
public static uint AddGlobalEventListener (GLib.Signal.EmissionHook hook, string event_type)

Binary file not shown.

View File

@ -1,5 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly:AssemblyVersion("@CAIRO_API_VERSION@")]
[assembly:AssemblyDelaySign(false)]

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>netstandard2.0</TargetFramework>
@ -11,5 +10,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
</PropertyGroup>
<ItemGroup>
<Content Include="linux-x64\libcairo-2.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

View File

@ -1,8 +0,0 @@
using System;
namespace CairoSharp
{
public class Class1
{
}
}

View File

@ -41,7 +41,7 @@ namespace Cairo
internal static class NativeMethods
{
const string cairo = "libcairo-2.dll";
const string cairo = "libcairo-2";
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_append_path (IntPtr cr, IntPtr path);

Binary file not shown.

View File

@ -1,8 +0,0 @@
using System;
namespace GLibSharp
{
public class Class1
{
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<api>
<namespace name="GLib" library="libglib-2.0-0.dll">
<namespace name="GLib" library="libglib-2.0-0">
<enum name="ConnectFlags" cname="GConnectFlags" type="flags" />
<enum name="IOCondition" cname="GIOCondition" type="enum" />
<enum name="SeekType" cname="GSeekType" type="enum" />

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>netstandard2.0</TargetFramework>
@ -11,5 +10,9 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
</PropertyGroup>
<ItemGroup>
<Content Include="linux-x64\libglib-2.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-x64\libgobject-2.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-x64\libgthread-2.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

View File

@ -31,8 +31,8 @@ namespace GLib {
//this is a static class
private Global () {}
internal const string GLibNativeDll = "libglib-2.0-0.dll";
internal const string GObjectNativeDll = "libgobject-2.0-0.dll";
internal const string GLibNativeDll = "libglib-2.0-0";
internal const string GObjectNativeDll = "libgobject-2.0-0";
internal static bool IsWindowsPlatform {
get {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
using System;
namespace GdkSharp
{
public class Class1
{
}
}

View File

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="Gdk" library="libgdk-3-0.dll">
<namespace name="Gdk" library="libgdk-3-0">
<enum name="AnchorHints" cname="GdkAnchorHints" gtype="gdk_anchor_hints_get_type" type="flags">
<member cname="GDK_ANCHOR_FLIP_X" name="FlipX" value="1 &lt;&lt; 0" />
<member cname="GDK_ANCHOR_FLIP_Y" name="FlipY" value="1 &lt;&lt; 1" />
@ -5301,7 +5301,7 @@
</method>
</class>
</namespace>
<namespace name="Gdk" library="libgdk_pixbuf-2.0-0.dll">
<namespace name="Gdk" library="libgdk_pixbuf-2.0-0">
<enum name="Colorspace" cname="GdkColorspace" gtype="gdk_colorspace_get_type" type="enum">
<member cname="GDK_COLORSPACE_RGB" name="Rgb" />
</enum>

View File

@ -25,5 +25,9 @@
<Name>PangoSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="linux-x64\libgdk_pixbuf-2.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
<Content Include="linux-x64\libgdk-3-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

View File

@ -26,7 +26,7 @@ namespace Gdk {
public partial class Global {
internal const string GdkNativeDll = "libgdk-3-0.dll";
internal const string GdkNativeDll = "libgdk-3-0";
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_list_visuals ();

View File

@ -28,7 +28,7 @@ namespace Gdk {
public partial class PixbufLoader {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport ("libgobject-2.0-0", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_object_ref (IntPtr handle);
internal IntPtr PixbufHandle {

View File

@ -23,7 +23,7 @@ namespace Gdk {
public partial struct Pixdata {
[DllImport ("libgdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport ("libgdk_pixbuf-2.0-0", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_pixdata_serialize (ref Gdk.Pixdata raw, out uint len);
public byte [] Serialize () {

View File

@ -77,7 +77,7 @@ namespace Gdk {
}
}
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport ("libgobject-2.0-0", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_object_ref (IntPtr raw);
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
using System;
namespace GioSharp
{
public class Class1
{
}
}

View File

@ -24,6 +24,6 @@ namespace GLib
{
public partial class GioGlobal
{
internal const string GioNativeDll = "libgio-2.0-0.dll";
internal const string GioNativeDll = "libgio-2.0-0";
}
}

View File

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="G" library="libgio-2.0-0.dll">
<namespace name="G" library="libgio-2.0-0">
<enum name="AppInfoCreateFlags" cname="GAppInfoCreateFlags" gtype="g_app_info_create_flags_get_type" type="flags">
<member cname="G_APP_INFO_CREATE_NONE" name="None" />
<member cname="G_APP_INFO_CREATE_NEEDS_TERMINAL" name="NeedsTerminal" value="1 &lt;&lt; 0" />

View File

@ -16,5 +16,8 @@
<Name>GLibSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="linux-x64\libgio-2.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -1,8 +0,0 @@
using System;
namespace GtkSharp
{
public class Class1
{
}
}

View File

@ -20,7 +20,7 @@ namespace Gtk {
public partial class Global {
internal const string GtkNativeDll = "libgtk-3-0.dll";
internal const string GtkNativeDll = "libgtk-3-0";
public static bool ShowUri (string uri)
{

View File

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="Gtk" library="libgtk-3-0.dll">
<namespace name="Gtk" library="libgtk-3-0">
<enum name="AccelFlags" cname="GtkAccelFlags" gtype="gtk_accel_flags_get_type" type="flags">
<member cname="GTK_ACCEL_VISIBLE" name="Visible" value="1 &lt;&lt; 0" />
<member cname="GTK_ACCEL_LOCKED" name="Locked" value="1 &lt;&lt; 1" />

View File

@ -31,5 +31,7 @@
<Name>PangoSharp</Name>
</ProjectReference>
</ItemGroup>
</Project>
<ItemGroup>
<Content Include="linux-x64\libgtk-3-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrBackground : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_background_new (ushort red, ushort green, ushort blue);
public AttrBackground (ushort red, ushort green, ushort blue) : this (pango_attr_background_new (red, green, blue)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrFallback : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_fallback_new (bool fallback);
public AttrFallback (bool fallback) : this (pango_attr_fallback_new (fallback)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrFamily : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_family_new (IntPtr family);
public AttrFamily (string family) : base (NewAttrFamily (family)) {}

View File

@ -23,10 +23,10 @@ namespace Pango {
public class AttrFontDesc : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_font_desc_new (IntPtr font_desc);
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_font_description_copy(IntPtr raw);
public AttrFontDesc (Pango.FontDescription font_desc) : this (pango_attr_font_desc_new (pango_font_description_copy (font_desc.Handle))) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrForeground : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_foreground_new (ushort red, ushort green, ushort blue);
public AttrForeground (ushort red, ushort green, ushort blue) : this (pango_attr_foreground_new (red, green, blue)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrGravity : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_gravity_new (int gravity);
public AttrGravity (Gravity gravity) : this (pango_attr_gravity_new ((int) gravity)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrGravityHint : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_gravity_hint_new (int hint);
public AttrGravityHint (GravityHint hint) : this (pango_attr_gravity_hint_new ((int) hint)) {}

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class AttrIterator {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_attr_iterator_get_font(IntPtr raw, IntPtr desc, out IntPtr language, out IntPtr extra_attrs);
public void GetFont (out Pango.FontDescription desc, out Pango.Language language, out Pango.Attribute[] extra_attrs)
@ -46,7 +46,7 @@ namespace Pango {
extra_attrs [i++] = Pango.Attribute.GetAttribute (raw_attr);
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_iterator_get_attrs (IntPtr raw);
public Pango.Attribute[] Attrs {

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrLanguage : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_language_new (IntPtr language);
public AttrLanguage (Pango.Language language) : this (pango_attr_language_new (language.Handle)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrLetterSpacing : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_letter_spacing_new (int letter_spacing);
public AttrLetterSpacing (int letter_spacing) : this (pango_attr_letter_spacing_new (letter_spacing)) {}

View File

@ -25,10 +25,10 @@ namespace Pango {
public partial class AttrList {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attribute_copy (IntPtr raw);
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_attr_list_insert (IntPtr raw, IntPtr attr);
public void Insert (Pango.Attribute attr)
@ -36,7 +36,7 @@ namespace Pango {
pango_attr_list_insert (Handle, pango_attribute_copy (attr.Handle));
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_attr_list_insert_before (IntPtr raw, IntPtr attr);
public void InsertBefore (Pango.Attribute attr)

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrRise : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_rise_new (int rise);
public AttrRise (int rise) : this (pango_attr_rise_new (rise)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrScale : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_scale_new (double scale);
public AttrScale (double scale) : this (pango_attr_scale_new (scale)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrShape : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_shape_new (ref Pango.Rectangle ink_rect, ref Pango.Rectangle logical_rect);
public AttrShape (Pango.Rectangle ink_rect, Pango.Rectangle logical_rect) : this (pango_attr_shape_new (ref ink_rect, ref logical_rect)) {}

View File

@ -23,10 +23,10 @@ namespace Pango {
public class AttrSize : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_size_new (int size);
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_size_new_absolute (int size);
public AttrSize (int size) : this (pango_attr_size_new (size)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrStretch : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_stretch_new (Pango.Stretch stretch);
public AttrStretch (Pango.Stretch stretch) : this (pango_attr_stretch_new (stretch)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrStrikethrough : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_strikethrough_new (bool strikethrough);
public AttrStrikethrough (bool strikethrough) : this (pango_attr_strikethrough_new (strikethrough)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrStrikethroughColor : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_strikethrough_color_new (ushort red, ushort green, ushort blue);
public AttrStrikethroughColor (ushort red, ushort green, ushort blue) : this (pango_attr_strikethrough_color_new (red, green, blue)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrStyle : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_style_new (Pango.Style style);
public AttrStyle (Pango.Style style) : this (pango_attr_style_new (style)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrUnderline : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_underline_new (Pango.Underline underline);
public AttrUnderline (Pango.Underline underline) : this (pango_attr_underline_new (underline)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrUnderlineColor : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_underline_color_new (ushort red, ushort green, ushort blue);
public AttrUnderlineColor (ushort red, ushort green, ushort blue) : this (pango_attr_underline_color_new (red, green, blue)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrVariant : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_variant_new (Pango.Variant variant);
public AttrVariant (Pango.Variant variant) : this (pango_attr_variant_new (variant)) {}

View File

@ -23,7 +23,7 @@ namespace Pango {
public class AttrWeight : Attribute {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attr_weight_new (Pango.Weight weight);
public AttrWeight (Pango.Weight weight) : this (pango_attr_weight_new (weight)) {}

View File

@ -93,7 +93,7 @@ namespace Pango {
Dispose ();
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_attribute_destroy (IntPtr raw);
public void Dispose ()
@ -149,14 +149,14 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_attribute_copy (IntPtr raw);
public Pango.Attribute Copy () {
return GetAttribute (pango_attribute_copy (raw));
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool pango_attribute_equal (IntPtr raw1, IntPtr raw2);
public bool Equal (Pango.Attribute attr2) {

View File

@ -1,8 +0,0 @@
using System;
namespace PangoSharp
{
public class Class1
{
}
}

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class Context {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_context_list_families(IntPtr raw, out IntPtr families, out int n_families);
public FontFamily [] Families {
@ -46,7 +46,7 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_context_list_families(IntPtr raw, IntPtr families, out int n_families);
[Obsolete]

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class Coverage {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_coverage_to_bytes (IntPtr raw, out IntPtr bytes, out int n_bytes);
public void ToBytes(out byte[] bytes)

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class FontFamily {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_font_family_list_faces(IntPtr raw, out IntPtr faces, out int n_faces);
public FontFace [] Faces {
@ -46,7 +46,7 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_font_family_list_faces(IntPtr raw, IntPtr faces, out int n_faces);
[Obsolete]

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class FontMap {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_font_map_list_families(IntPtr raw, out IntPtr families, out int n_families);
public FontFamily [] Families {
@ -46,7 +46,7 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_font_map_list_families(IntPtr raw, IntPtr families, out int n_families);
[Obsolete]

View File

@ -25,7 +25,9 @@ namespace Pango {
public partial class Global {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
public static string PangoNativeDll = "libpango-1.0-0";
[DllImport (PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool pango_scan_int(IntPtr pos, out int out_param);
[Obsolete]
@ -37,7 +39,7 @@ namespace Pango {
return ret;
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool pango_parse_markup (IntPtr markup, int length, uint accel_marker, out IntPtr attr_list_handle, out IntPtr text, out uint accel_char, IntPtr err);
public static bool ParseMarkup (string markup, char accel_marker, out Pango.AttrList attrs, out string text, out char accel_char)

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial struct GlyphItem {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_glyph_item_apply_attrs(ref Pango.GlyphItem raw, IntPtr text, IntPtr list);
public GlyphItem[] ApplyAttrs (string text, Pango.AttrList list)

View File

@ -26,7 +26,7 @@ namespace Pango {
public partial class Layout {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_layout_get_lines(IntPtr raw);
public LayoutLine[] Lines {
@ -43,7 +43,7 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_layout_set_markup_with_accel (IntPtr raw, IntPtr markup, int length, uint accel_marker, out uint accel_char);
public void SetMarkupWithAccel (string markup, char accel_marker, out char accel_char)
@ -55,7 +55,7 @@ namespace Pango {
accel_char = GLib.Marshaller.GUnicharToChar (ucs4_accel_char);
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_layout_get_log_attrs (IntPtr raw, out IntPtr attrs, out int n_attrs);
public LogAttr [] LogAttrs {
@ -76,7 +76,7 @@ namespace Pango {
}
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_layout_set_text (IntPtr raw, IntPtr text, int length);
public void SetText (string text)
@ -86,7 +86,7 @@ namespace Pango {
GLib.Marshaller.Free (native_text);
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_layout_set_markup (IntPtr raw, IntPtr markup, int length);
public void SetMarkup (string markup)

View File

@ -26,7 +26,7 @@ namespace Pango {
public partial class LayoutLine {
#if NOT_BROKEN
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_layout_line_get_x_ranges(IntPtr raw, int start_index, int end_index, out IntPtr ranges_handle, out int n_ranges);
#endif

View File

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="Pango" library="libpango-1.0-0.dll">
<namespace name="Pango" library="libpango-1.0-0">
<enum name="Alignment" cname="PangoAlignment" gtype="pango_alignment_get_type" type="enum">
<member cname="PANGO_ALIGN_LEFT" name="Left" />
<member cname="PANGO_ALIGN_CENTER" name="Center" />

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>netstandard2.0</TargetFramework>
@ -19,5 +18,7 @@
<Name>CairoSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="linux-x64\libpango-1.0-0.so" PackagePath="runtimes\linux-x64\native" Visible="false" />
</ItemGroup>
</Project>

View File

@ -36,7 +36,7 @@
<attr path="/api/namespace/class/method[@cname='pango_version_string']" name="name">VersionString</attr>
<attr path="/api/namespace/class[@cname='PangoAttr_']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='PangoCairo_']" name="name">CairoHelper</attr>
<attr path="/api/namespace/class[@cname='PangoCairo_']/method" name="library">libpangocairo-1.0-0.dll</attr>
<attr path="/api/namespace/class[@cname='PangoCairo_']/method" name="library">libpangocairo-1.0-0</attr>
<attr path="/api/namespace/class[@cname='PangoCairo_']/method[@name='ContextGetFontOptions']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='PangoCairo_']/method[@name='ContextSetFontOptions']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='PangoGlobal']/method[@name='ExtentsToPixels']/*/*[@type='PangoRectangle*']" name="pass_as">ref</attr>

View File

@ -27,7 +27,7 @@ namespace Pango {
public ScriptIter(IntPtr raw) : base(raw) {}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_script_iter_new(IntPtr text, int length);
public ScriptIter (string text)
@ -36,7 +36,7 @@ namespace Pango {
Raw = pango_script_iter_new (native_text, -1);
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_script_iter_free (IntPtr raw);
~ScriptIter ()
@ -46,10 +46,10 @@ namespace Pango {
Raw = IntPtr.Zero;
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_script_iter_get_range (IntPtr raw, out IntPtr start, out IntPtr end, out Pango.Script script);
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport ("libglib-2.0-0", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_utf8_pointer_to_offset (IntPtr str, IntPtr pos);
public void GetRange (out int start, out int len, out Pango.Script script)
@ -62,7 +62,7 @@ namespace Pango {
len = (int)g_utf8_pointer_to_offset (start_ptr, end_ptr);
}
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool pango_script_iter_next (IntPtr raw);
public bool Next ()

View File

@ -25,7 +25,7 @@ namespace Pango {
public partial class TabArray {
[DllImport ("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.PangoNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void pango_tab_array_get_tabs (IntPtr raw, out IntPtr alignments, out IntPtr locations);
public void GetTabs (out TabAlign[] alignments, out int[] locations)

Binary file not shown.

31
Source/OldStuff/generate.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
genstub ()
{
DLLNAME=$1
TARGET=$2
rm -f empty.c
touch empty.c
gcc -shared -o ${TARGET} empty.c
gcc -Wl,--no-as-needed -shared -o ${DLLNAME}.so -fPIC -L. -l:${TARGET}
rm -f ${TARGET}
rm -f empty.c
echo "Mapped ${DLLNAME}.dll ==> ${TARGET}"
}
#genstub libglib-2.0-0 libglib-2.0.so.0
#genstub libgobject-2.0-0 libgobject-2.0.so.0
#genstub libgthread-2.0-0 libgthread-2.0.so.0
#genstub libgio-2.0-0 libgio-2.0.so.0
#genstub libatk-1.0-0 libatk-1.0.so.0
#genstub libcairo-2 libcairo.so.2
#genstub libgtk-3-0 libgtk-3.so.0
#genstub libgdk-3-0 libgdk-3.so.0
#genstub libgdk_pixbuf-2.0-0 libgdk_pixbuf-2.0.so.0
#genstub libgtk-3-0 libgtk-3.so.0
genstub libpango-1.0-0 libpango-1.0.so.0

View File

@ -1,73 +1,130 @@
#load CakeScripts\GAssembly.cs
#load CakeScripts\GapiFixup.cs
#load CakeScripts\Settings.cs
#addin "Cake.FileHelpers"
#addin "Cake.Incubator"
// VARS
GAssembly.Cake = Context;
Settings.Cake = Context;
Settings.BuildTarget = Argument("BuildTarget", "Default");
Settings.Assembly = Argument("Assembly", "");
var target = Argument("Target", "Default");
var configuration = Argument("Configuration", "Release");
var list = new List<GAssembly>();
var glist = new List<GAssembly>()
{
new GAssembly("GLibSharp"),
new GAssembly("GioSharp")
{
Includes = new[] { "GLibSharp" }
Deps = new[] { "GLibSharp" }
},
new GAssembly("AtkSharp")
{
Includes = new[] { "GLibSharp" },
Deps = new[] { "GLibSharp" },
ExtraArgs = "--abi-cs-usings=Atk,GLib"
},
new GAssembly("CairoSharp"),
new GAssembly("PangoSharp")
{
Includes = new[] { "GLibSharp", "CairoSharp" }
Deps = new[] { "GLibSharp", "CairoSharp" }
},
new GAssembly("GdkSharp")
{
Includes = new[] { "GLibSharp", "GioSharp", "CairoSharp", "PangoSharp" }
Deps = new[] { "GLibSharp", "GioSharp", "CairoSharp", "PangoSharp" }
},
new GAssembly("GtkSharp")
{
Includes = new[] { "GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
Deps = new[] { "GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
ExtraArgs = "--abi-cs-usings=Gtk,GLib"
}
};
// TASKS
Task("Prepare")
Task("Init")
.Does(() =>
{
// Add stuff to list
foreach(var gassembly in glist)
if(string.IsNullOrEmpty(Settings.Assembly) || Settings.Assembly == gassembly.Name)
list.Add(gassembly);
});
Task("Prepare")
.IsDependentOn("Clean")
.Does(() =>
{
// Build Tools
DotNetCoreRestore("Source/Tools/GapiCodegen/GapiCodegen.csproj");
MSBuild("Source/Tools/GapiCodegen/GapiCodegen.csproj", new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
foreach(var gassembly in glist)
// Generate code and prepare libs projects
foreach(var gassembly in list)
gassembly.Prepare();
DotNetCoreRestore("Source/Libs/GLibSharp.sln");
});
Task("Test")
.Does(() =>
{
});
Task("Clean")
.IsDependentOn("Init")
.Does(() =>
{
foreach(var gassembly in glist)
foreach(var gassembly in list)
gassembly.Clean();
});
Task("FullClean")
.IsDependentOn("Clean")
.Does(() =>
{
DeleteDirectory("BuildOutput", true);
});
Task("Build")
.IsDependentOn("Prepare")
.Does(() =>
{
foreach(var gassembly in glist)
if (list.Count == glist.Count)
{
MSBuild(gassembly.Csproj, new MSBuildSettings {
MSBuild("Source/Libs/GLibSharp.sln", new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
}
else
{
foreach(var gassembly in list)
{
MSBuild(gassembly.Csproj, new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
}
}
});
Task("PackageNuGet")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = "BuildOutput/NugetPackages",
NoBuild = true
};
foreach(var gassembly in list)
DotNetCorePack(gassembly.Csproj, settings);
});
// TASK TARGETS
@ -77,4 +134,4 @@ Task("Default")
// EXECUTION
RunTarget(target);
RunTarget(Settings.BuildTarget);