Extracted managed parser code to CppSharp.Parser project.

This commit is contained in:
Joao Matos 2016-08-24 18:01:46 +01:00
Родитель 9710936c7a
Коммит c56b6311ed
11 изменённых файлов: 67 добавлений и 52 удалений

Просмотреть файл

@ -52,6 +52,7 @@ function SetupTestGeneratorProject(name, depends)
"CppSharp.AST",
"CppSharp.Generator",
"CppSharp.Generator.Tests",
"CppSharp.Parser"
}
if depends ~= nil then

Просмотреть файл

@ -54,4 +54,5 @@ solution "CppSharp"
include (srcdir .. "/Generator")
include (srcdir .. "/Generator.Tests")
include (srcdir .. "/Runtime")
include (srcdir .. "/Parser")
include (srcdir .. "/CppParser")

Просмотреть файл

@ -4,8 +4,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using CppSharp.Parser;
using CppSharp.Parser.AST;
using Microsoft.Win32;
namespace CppSharp
@ -524,26 +522,4 @@ namespace CppSharp
return hive;
}
}
public static partial class OptionsExtensions
{
/// Sets up the parser options to work with the given Visual Studio toolchain.
public static void SetupMSVC(this ParserOptions options,
VisualStudioVersion vsVersion = VisualStudioVersion.Latest)
{
options.MicrosoftMode = true;
options.NoBuiltinIncludes = true;
options.NoStandardIncludes = true;
options.Abi = CppAbi.Microsoft;
options.ToolSetToUse = MSVCToolchain.GetCLVersion(vsVersion) * 10000000;
options.addArguments("-fms-extensions");
options.addArguments("-fms-compatibility");
options.addArguments("-fdelayed-template-parsing");
var includes = MSVCToolchain.GetSystemIncludes(vsVersion);
foreach (var include in includes)
options.addSystemIncludeDirs(include);
}
}
}

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using CppSharp.Parser;
namespace CppSharp
{
@ -75,24 +74,4 @@ namespace CppSharp
return Path.Combine(sdkPath, "usr/include");
}
}
public static partial class OptionsExtensions
{
public static void SetupXcode(this ParserOptions options)
{
var builtinsPath = XcodeToolchain.GetXcodeBuiltinIncludesFolder();
options.addSystemIncludeDirs(builtinsPath);
var cppIncPath = XcodeToolchain.GetXcodeCppIncludesFolder();
options.addSystemIncludeDirs(cppIncPath);
var includePath = XcodeToolchain.GetXcodeIncludesFolder();
options.addSystemIncludeDirs(includePath);
options.NoBuiltinIncludes = true;
options.NoStandardIncludes = true;
options.addArguments("-stdlib=libc++");
}
}
}

Просмотреть файл

@ -1,5 +1,3 @@
include("../../build/Parser.lua")
project "CppSharp"
kind "SharedLib"
@ -13,8 +11,4 @@ project "CppSharp"
{
"System",
"System.Core",
"CppSharp.AST",
"CppSharp.Runtime"
}
SetupParser()

Просмотреть файл

@ -9,7 +9,7 @@ project "CppSharp.Generator"
files { "**.cs", "**verbs.txt" }
excludes { "Filter.cs" }
links { "System", "System.Core", "CppSharp", "CppSharp.AST" }
links { "System", "System.Core", "CppSharp", "CppSharp.AST", "CppSharp.Parser" }
SetupParser()

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,43 @@
using CppSharp.Parser;
namespace CppSharp
{
public static partial class OptionsExtensions
{
/// Sets up the parser options to work with the given Visual Studio toolchain.
public static void SetupMSVC(this ParserOptions options,
VisualStudioVersion vsVersion = VisualStudioVersion.Latest)
{
options.MicrosoftMode = true;
options.NoBuiltinIncludes = true;
options.NoStandardIncludes = true;
options.Abi = CppSharp.Parser.AST.CppAbi.Microsoft;
options.ToolSetToUse = MSVCToolchain.GetCLVersion(vsVersion) * 10000000;
options.addArguments("-fms-extensions");
options.addArguments("-fms-compatibility");
options.addArguments("-fdelayed-template-parsing");
var includes = MSVCToolchain.GetSystemIncludes(vsVersion);
foreach (var include in includes)
options.addSystemIncludeDirs(include);
}
public static void SetupXcode(this ParserOptions options)
{
var builtinsPath = XcodeToolchain.GetXcodeBuiltinIncludesFolder();
options.addSystemIncludeDirs(builtinsPath);
var cppIncPath = XcodeToolchain.GetXcodeCppIncludesFolder();
options.addSystemIncludeDirs(cppIncPath);
var includePath = XcodeToolchain.GetXcodeIncludesFolder();
options.addSystemIncludeDirs(includePath);
options.NoBuiltinIncludes = true;
options.NoStandardIncludes = true;
options.addArguments("-stdlib=libc++");
}
}
}

21
src/Parser/premake5.lua Normal file
Просмотреть файл

@ -0,0 +1,21 @@
include("../../build/Parser.lua")
project "CppSharp.Parser"
SetupManagedProject()
kind "SharedLib"
language "C#"
clr "Unsafe"
files { "**.cs" }
links
{
"System",
"System.Core",
"CppSharp",
"CppSharp.AST",
"CppSharp.Runtime"
}
SetupParser()