mirror of https://github.com/mono/CppSharp.git
5 changed files with 85 additions and 64 deletions
@ -0,0 +1,13 @@ |
|||||||
|
using System; |
||||||
|
|
||||||
|
public class HelloTests |
||||||
|
{ |
||||||
|
public static void Main (String[] args) |
||||||
|
{ |
||||||
|
var hello = new Hello(); |
||||||
|
hello.PrintHello("Hello world"); |
||||||
|
|
||||||
|
Console.WriteLine("True =" + hello.test1(3, 3.0f).ToString()); |
||||||
|
Console.WriteLine("False =" + hello.test1(2, 3.0f).ToString()); |
||||||
|
} |
||||||
|
} |
@ -1,14 +1,54 @@ |
|||||||
using System; |
using Cxxi.Generators; |
||||||
using CppCsBind; |
using Cxxi.Passes; |
||||||
|
|
||||||
public class HelloExample |
namespace Cxxi.Tests |
||||||
{ |
{ |
||||||
public static void Main (String[] args) { |
class Hello : ILibrary |
||||||
var h = new Hello(); |
{ |
||||||
h.PrintHello ("Hello world"); |
private LanguageGeneratorKind kind; |
||||||
Console.WriteLine("True =" + h.test1(3, 3.0f).ToString()); |
|
||||||
Console.WriteLine("False =" + h.test1(2, 3.0f).ToString()); |
public Hello(LanguageGeneratorKind kind) |
||||||
} |
{ |
||||||
} |
this.kind = kind; |
||||||
|
} |
||||||
|
|
||||||
|
public void Setup(DriverOptions options) |
||||||
|
{ |
||||||
|
options.LibraryName = "Hello"; |
||||||
|
options.GeneratorKind = kind; |
||||||
|
options.OutputDir = kind == LanguageGeneratorKind.CPlusPlusCLI ? |
||||||
|
"cli" : "cs"; |
||||||
|
options.Headers.Add("Hello.h"); |
||||||
|
options.IncludeDirs.Add("../../../examples/Hello"); |
||||||
|
} |
||||||
|
|
||||||
|
public void Preprocess(Library lib) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void Postprocess(Library lib) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void SetupPasses(Driver driver, PassBuilder p) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void GenerateStart(TextTemplate template) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void GenerateAfterNamespaces(TextTemplate template) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
static class Program |
||||||
|
{ |
||||||
|
public static void Main(string[] args) |
||||||
|
{ |
||||||
|
Driver.Run(new Hello(LanguageGeneratorKind.CPlusPlusCLI)); |
||||||
|
Driver.Run(new Hello(LanguageGeneratorKind.CSharp)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
@ -1,34 +1,7 @@ |
|||||||
project "Hello" |
SetupTestGeneratorProject("Hello", "Hello.cs") |
||||||
|
SetupTestNativeProject("Hello.Native", { "Hello.cpp", "Hello.h" }) |
||||||
|
SetupTestProject("Hello.Tests", { "Hello.Tests.cs"}, "Hello") |
||||||
|
|
||||||
SetupNativeProject() |
|
||||||
kind "SharedLib" |
|
||||||
language "C++" |
|
||||||
|
|
||||||
flags { common_flags, "Managed" } |
|
||||||
|
|
||||||
files { "**.h", "**.cpp", "./*.lua" } |
|
||||||
|
|
||||||
-- Autogenerated files, so not available on first build - specify them manually |
|
||||||
excludes { "CppCsBind/*.*" } |
|
||||||
files { "CppCsBind/hello_wrapper.h", "CppCsBind/hello_wrapper.cpp" } |
|
||||||
|
|
||||||
configuration "hello.h" |
|
||||||
buildrule { |
|
||||||
description = "Compiling $(InputFile)...", |
|
||||||
commands = { |
|
||||||
'..\\..\\bin\\generator.exe -D=WIN32 -vs=10 -ns=CppCsBind -outdir=CppCsBind -I. hello.h', |
|
||||||
}, |
|
||||||
outputs = { "CppCsBind\\hello_wrapper.cpp" } |
|
||||||
} |
|
||||||
|
|
||||||
project "SayHello" |
|
||||||
|
|
||||||
kind "ConsoleApp" |
|
||||||
language "C#" |
|
||||||
location "." |
|
||||||
|
|
||||||
files { "**.cs", "./*.lua" } |
|
||||||
|
|
||||||
links { "Hello" } |
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue