public void BuildForSourceFile( IEnumerable <CppSharp.AST.Module> modules, string file = null) { // This eventually gets passed to Clang's MSCompatibilityVersion, which // is in turn used to derive the value of the built-in define _MSC_VER. // It used to receive a 4-digit based identifier but now expects a full // version MSVC digit, so check if we still have the old version and // convert to the right format. if (ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4) { ToolSetToUse *= 100000; } foreach (var module in modules.Where( m => file == null || m.Headers.Contains(file))) { foreach (var include in module.IncludeDirs) { AddIncludeDirs(include); } foreach (var define in module.Defines) { AddDefines(define); } foreach (var undefine in module.Undefines) { AddUndefines(undefine); } } }
public ParserOptions BuildForSourceFile( IEnumerable <CppSharp.AST.Module> modules, string file = null) { var options = new ParserOptions(this); // This eventually gets passed to Clang's MSCompatibilityVersion, which // is in turn used to derive the value of the built-in define _MSC_VER. // It used to receive a 4-digit based identifier but now expects a full // version MSVC digit, so check if we still have the old version and // convert to the right format. if (ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4) { ToolSetToUse *= 100000; } for (uint i = 0; i < ArgumentsCount; ++i) { var arg = GetArguments(i); options.AddArguments(arg); } for (uint i = 0; i < IncludeDirsCount; ++i) { var include = GetIncludeDirs(i); options.AddIncludeDirs(include); } for (uint i = 0; i < SystemIncludeDirsCount; ++i) { var include = GetSystemIncludeDirs(i); options.AddSystemIncludeDirs(include); } for (uint i = 0; i < DefinesCount; ++i) { var define = GetDefines(i); options.AddDefines(define); } for (uint i = 0; i < UndefinesCount; ++i) { var define = GetUndefines(i); options.AddUndefines(define); } for (uint i = 0; i < LibraryDirsCount; ++i) { var lib = GetLibraryDirs(i); options.AddLibraryDirs(lib); } foreach (var module in modules.Where( m => file == null || m.Headers.Contains(file))) { foreach (var include in module.IncludeDirs) { options.AddIncludeDirs(include); } foreach (var define in module.Defines) { options.AddDefines(define); } foreach (var undefine in module.Undefines) { options.AddUndefines(undefine); } foreach (var libraryDir in module.LibraryDirs) { options.AddLibraryDirs(libraryDir); } } return(options); }