private static void AddSettingsForCompilerTool(CompilerSettings settings, dynamic compilerTool) { settings.compileAs = "" + compilerTool.CompileAs; string fullInclude = compilerTool.FullIncludePath; foreach (var entry in fullInclude.Split(';')) { settings.FullIncludes.Add(entry); } string prePro = compilerTool.PreprocessorDefinitions; if (prePro != null && settings.InheritPreprocessorDefinitions && prePro.Length > 0) { settings.PreprocessorDefinitions.Add(prePro); } string additionalDirs = compilerTool.AdditionalIncludeDirectories; if (additionalDirs != null && settings.InheritAdditionalIncludeDirectories && additionalDirs.Length > 0) { settings.AdditionalIncludeDirectories.Add(additionalDirs); } string forcedIncludes = compilerTool.ForcedIncludeFiles; if (forcedIncludes != null && settings.InheritForcedIncludeFiles && forcedIncludes.Length > 0) { settings.ForcedIncludeFiles.Add(forcedIncludes); } }
private static void AddSettingsFromVCProject(CompilerSettings settings, dynamic Project, string ActiveSetting) { dynamic CollectionOfConfigurations = Project.Configurations; dynamic Configuration = CollectionOfConfigurations.Item(ActiveSetting); dynamic Tools = Configuration.Tools; try { dynamic CompilerTool = Tools.Item("VCCLCompilerTool"); if (CompilerTool != null) { AddSettingsForCompilerTool(settings, CompilerTool); } } catch {} dynamic CollectionOfPropertySheets = Configuration.PropertySheets; var SheetCount = CollectionOfPropertySheets.Count; for (int i = 0; i < SheetCount; i++) { try { dynamic PropertySheet = CollectionOfPropertySheets.Item(i + 1); dynamic CollectionOfTools = PropertySheet.Tools; dynamic CompilerTool = CollectionOfTools.Item("VCCLCompilerTool"); if (CompilerTool != null) { AddSettingsForCompilerTool(settings, CompilerTool); } } catch { } } }
private static void AddSettingsFromVCFile(CompilerSettings settings, dynamic File, string ActiveSetting) { dynamic CollectionOfFileConfigurations = File.FileConfigurations; dynamic FileConfiguration = CollectionOfFileConfigurations.Item(ActiveSetting); try { dynamic CompilerTool = FileConfiguration.Tool; if (CompilerTool != null) { AddSettingsForCompilerTool(settings, CompilerTool); } } catch { } }
public CompileDatabaseEntry(VCFile f, CompilerSettings settings, string compileCommand) { file = f.FullPath; directory = new FileInfo(file).DirectoryName; command = compileCommand; foreach (var include in settings.FullIncludes) { command += " -I\"" + include.TrimEnd('\\').TrimStart('\\') + "\""; } foreach (var def in settings.PreprocessorDefinitions) { command += " -D " + def; } command += " \"" + file + "\""; }
public void EnterProjectItem(ProjectItem item) { ThreadHelper.ThrowIfNotOnUIThread(); var vcFile = item.Object as VCFile; if (vcFile == null) { return; } if (vcFile.ItemType != CompilerSettings.CLCOMPILE) { return; } CompilerSettings settings = new CompilerSettings(m_project, item); CompileDatabaseEntry e = new CompileDatabaseEntry(vcFile, settings, m_compileCommand); CompileDatabase.Add(e); }