mirror of https://github.com/mono/CppSharp.git
2 changed files with 110 additions and 0 deletions
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
using CppSharp.AST; |
||||
using CppSharp.Generators; |
||||
|
||||
namespace CppSharp |
||||
{ |
||||
class ParserGen : ILibrary |
||||
{ |
||||
private readonly LanguageGeneratorKind Kind; |
||||
|
||||
public ParserGen(LanguageGeneratorKind kind) |
||||
{ |
||||
Kind = kind; |
||||
} |
||||
|
||||
public void Setup(Driver driver) |
||||
{ |
||||
var options = driver.Options; |
||||
options.LibraryName = "CppSharp"; |
||||
options.GeneratorKind = Kind; |
||||
options.Headers.Add("AST.h"); |
||||
options.Headers.Add("CppParser.h"); |
||||
options.IncludeDirs.Add("../../../src/CppParser/"); |
||||
options.Libraries.Add("CppSharp.CppParser.lib"); |
||||
options.LibraryDirs.Add("."); |
||||
options.OutputDir = "../../../src/CppParser/Bindings/"; |
||||
options.OutputDir += Kind.ToString(); |
||||
options.GenerateLibraryNamespace = false; |
||||
//options.CheckSymbols = false;
|
||||
} |
||||
|
||||
public void SetupPasses(Driver driver) |
||||
{ |
||||
|
||||
} |
||||
|
||||
public void Preprocess(Driver driver, Library lib) |
||||
{ |
||||
lib.SetClassAsValueType("CppSharp::ParserOptions"); |
||||
lib.SetClassAsValueType("CppSharp::ParserDiagnostic"); |
||||
lib.SetClassAsValueType("CppSharp::ParserResult"); |
||||
|
||||
lib.RenameNamespace("CppSharp::CppParser", "Parser"); |
||||
} |
||||
|
||||
public void Postprocess(Library lib) |
||||
{ |
||||
|
||||
} |
||||
|
||||
public static void Main(string[] args) |
||||
{ |
||||
ConsoleDriver.Run(new ParserGen(LanguageGeneratorKind.CLI)); |
||||
ConsoleDriver.Run(new ParserGen(LanguageGeneratorKind.CSharp)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
project "CppSharp.Parser.Gen" |
||||
|
||||
kind "ConsoleApp" |
||||
language "C#" |
||||
location "." |
||||
debugdir "." |
||||
|
||||
files { "ParserGen.cs", "*.lua" } |
||||
links { "CppSharp.AST", "CppSharp.Generator", "CppSharp.Parser" } |
||||
|
||||
project "CppSharp.Parser.CLI" |
||||
|
||||
kind "SharedLib" |
||||
language "C++" |
||||
SetupNativeProject() |
||||
|
||||
dependson { "CppSharp.CppParser" } |
||||
flags { common_flags, "Managed" } |
||||
|
||||
configuration "vs*" |
||||
buildoptions { clang_msvc_flags } |
||||
|
||||
configuration "*" |
||||
|
||||
files |
||||
{ |
||||
"CLI/AST.h", |
||||
"CLI/AST.cpp", |
||||
"CLI/**.h", |
||||
"CLI/**.cpp", |
||||
"**.lua" |
||||
} |
||||
|
||||
includedirs { "../../../include/", "../../../src/CppParser/" } |
||||
|
||||
configuration "*" |
||||
links { "CppSharp.CppParser" } |
||||
|
||||
project "CppSharp.Parser.CSharp" |
||||
|
||||
kind "SharedLib" |
||||
language "C#" |
||||
location "." |
||||
|
||||
dependson { "CppSharp.CppParser" } |
||||
flags { common_flags, "Unsafe" } |
||||
|
||||
files |
||||
{ |
||||
"CSharp/**.cs", |
||||
"**.lua" |
||||
} |
||||
|
||||
links { "CppSharp.Runtime" } |
Loading…
Reference in new issue