-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CppSharp Generator code for generating Spout.cs #1
Comments
Here's the code. I will not add the code below into this repo or create a new repo to store this code. One reason is that it's simple and anyone can write such generator code following the Generating Bindings Tutorial provided by But I will pin this issue for latecomers. Feel free to comment below if you have more questions. using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
namespace CXPlayground
{
public class CppSharpLibrary : ILibrary
{
public void Preprocess(Driver driver, ASTContext ctx)
{
}
public void Postprocess(Driver driver, ASTContext ctx)
{
}
public const string SpoutSourcePath = @"D:\SpoutSDK\";
public void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = GeneratorKind.CSharp;
options.OutputDir = $"{SpoutSourcePath}output";
options.Compilation.Platform = TargetPlatform.Windows;
options.Compilation.VsVersion = VisualStudioVersion.Latest;
options.GenerateFinalizers = true;
options.GenerateSingleCSharpFile = true;
var module = options.AddModule("Spout.Interop");
module.IncludeDirs.Add($"{SpoutSourcePath}include");
foreach (string file in Directory.GetFiles($"{SpoutSourcePath}include"))
if (file.EndsWith(".h"))
module.Headers.Add(file);
module.LibraryDirs.Add($"{SpoutSourcePath}lib");
module.Libraries.Add("Spout.dll");
}
public void SetupPasses(Driver driver)
{
}
}
class Program
{
static void Main(string[] args)
{
ConsoleDriver.Run(new CppSharpLibrary());
}
}
} |
Sure thing I'd use the nuget package when needed, I was just curious to see how did that go. Thanks for the info, great work! |
Hi! I noticed CppSharp was used to generate
Interop/Spout.cs
. Is it possible to include the code generator project as well in this or a different repo?The text was updated successfully, but these errors were encountered: