mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.8 KiB
52 lines
1.8 KiB
using System.IO; |
|
using CppSharp.AST; |
|
using CppSharp.Generators; |
|
using CppSharp.Utils; |
|
|
|
namespace CppSharp.Tests |
|
{ |
|
public class NamespacesDerivedTests : GeneratorTest |
|
{ |
|
public NamespacesDerivedTests(GeneratorKind kind) |
|
: base("NamespacesDerived", kind) |
|
{ |
|
} |
|
|
|
public override void Setup(Driver driver) |
|
{ |
|
base.Setup(driver); |
|
driver.Options.GenerateDefaultValuesForArguments = true; |
|
driver.Options.GenerateClassTemplates = true; |
|
driver.Options.CompileCode = true; |
|
driver.Options.DependentNameSpaces.Add("System.Runtime.CompilerServices"); |
|
driver.Options.Modules[1].IncludeDirs.Add(GetTestsDirectory("NamespacesDerived")); |
|
var @base = "NamespacesBase"; |
|
var module = driver.Options.AddModule(@base); |
|
module.IncludeDirs.Add(Path.GetFullPath(GetTestsDirectory(@base))); |
|
module.Headers.Add($"{@base}.h"); |
|
module.OutputNamespace = @base; |
|
module.LibraryDirs.Add(driver.Options.OutputDir); |
|
module.Libraries.Add($"{@base}.Native"); |
|
driver.Options.Modules[1].Dependencies.Add(module); |
|
} |
|
|
|
public override void Postprocess(Driver driver, ASTContext ctx) |
|
{ |
|
driver.Generator.OnUnitGenerated += o => |
|
{ |
|
Block firstBlock = o.Outputs[0].RootBlock.Blocks[1]; |
|
firstBlock.NewLine(); |
|
firstBlock.WriteLine("[assembly:InternalsVisibleTo(\"NamespacesDerived.CSharp\")]"); |
|
}; |
|
} |
|
} |
|
|
|
public class NamespacesDerived |
|
{ |
|
public static void Main(string[] args) |
|
{ |
|
ConsoleDriver.Run(new NamespacesDerivedTests(GeneratorKind.CSharp)); |
|
} |
|
} |
|
} |
|
|
|
|