void ValidateOptions() { if (!Options.Compilation.Platform.HasValue) { Options.Compilation.Platform = Platform.Host; } foreach (var module in Options.Modules) { if (string.IsNullOrWhiteSpace(module.LibraryName)) { throw new InvalidOptionException("One of your modules has no library name."); } if (module.OutputNamespace == null) { module.OutputNamespace = module.LibraryName; } for (int i = 0; i < module.IncludeDirs.Count; i++) { var dir = new DirectoryInfo(module.IncludeDirs[i]); module.IncludeDirs[i] = dir.FullName; } } if (Options.NoGenIncludeDirs != null) { foreach (var incDir in Options.NoGenIncludeDirs) { ParserOptions.AddIncludeDirs(incDir); } } }
void ValidateOptions() { foreach (var module in Options.Modules) { if (string.IsNullOrWhiteSpace(module.LibraryName)) { throw new InvalidOptionException("One of your modules has no library name."); } if (module.OutputNamespace == null) { module.OutputNamespace = module.LibraryName; } } if (Options.NoGenIncludeDirs != null) { foreach (var incDir in Options.NoGenIncludeDirs) { ParserOptions.AddIncludeDirs(incDir); } } }
public ParserOptions BuildParserOptions(SourceFile file = null) { var options = new ParserOptions { Abi = ParserOptions.Abi, ToolSetToUse = ParserOptions.ToolSetToUse, TargetTriple = ParserOptions.TargetTriple, NoStandardIncludes = ParserOptions.NoStandardIncludes, NoBuiltinIncludes = ParserOptions.NoBuiltinIncludes, MicrosoftMode = ParserOptions.MicrosoftMode, Verbose = ParserOptions.Verbose, LanguageVersion = ParserOptions.LanguageVersion }; // 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 (ParserOptions.ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4) { ParserOptions.ToolSetToUse *= 100000; } for (uint i = 0; i < ParserOptions.ArgumentsCount; ++i) { var arg = ParserOptions.GetArguments(i); options.AddArguments(arg); } for (uint i = 0; i < ParserOptions.IncludeDirsCount; ++i) { var include = ParserOptions.GetIncludeDirs(i); options.AddIncludeDirs(include); } for (uint i = 0; i < ParserOptions.SystemIncludeDirsCount; ++i) { var include = ParserOptions.GetSystemIncludeDirs(i); options.AddSystemIncludeDirs(include); } for (uint i = 0; i < ParserOptions.DefinesCount; ++i) { var define = ParserOptions.GetDefines(i); options.AddDefines(define); } for (uint i = 0; i < ParserOptions.UndefinesCount; ++i) { var define = ParserOptions.GetUndefines(i); options.AddUndefines(define); } for (uint i = 0; i < ParserOptions.LibraryDirsCount; ++i) { var lib = ParserOptions.GetLibraryDirs(i); options.AddLibraryDirs(lib); } foreach (var module in Options.Modules.Where( m => file == null || m.Headers.Contains(file.Path))) { 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); }