private static VCTool GetToolFromActiveConfiguration <VCTool>(Project project, out string reasonForFailure) where VCTool : class { VCProject vcProject = project?.Object as VCProject; if (vcProject == null) { reasonForFailure = $"Failed to retrieve VCCLCompilerTool since project \"{project.Name}\" is not a VCProject."; return(null); } VCConfiguration activeConfiguration = vcProject.ActiveConfiguration; VCTool compilerTool = null; foreach (var tool in activeConfiguration.Tools) { compilerTool = tool as VCTool; if (compilerTool != null) { break; } } if (compilerTool == null) { reasonForFailure = $"Couldn't find a {typeof(VCTool).Name} in active configuration of VC++ Project \"{vcProject.Name}\""; return(null); } reasonForFailure = ""; return(compilerTool); }
/// <summary> /// compile a single VCFile, do nothing with the OBJ /// </summary> public bool CompileSingleFile(VCFile vcFile, VCProject vcProject, VCConfiguration vcCfg, String additionalCmds = "") { CVXBuildSystem buildSystem; try { buildSystem = new CVXBuildSystem(_vsOutputWindow, _outputPane); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "ClangVSx Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } try { return(buildSystem.CompileSingleFile(vcFile, vcProject, vcCfg, additionalCmds)); } catch (System.Exception ex) { WriteToOutputPane("Exception During File Compile : \n" + ex.Message + "\n"); } return(false); }
public void Compile(VCFile file) { VCConfiguration configuration = file.project.ActiveConfiguration; VCFileConfiguration fileConfiguration = file.GetFileConfigurationForProjectConfiguration(configuration); string toolchainConfDirs = configuration.Platform.ExecutableDirectories; toolchainConfDirs = configuration.Evaluate(toolchainConfDirs); string[] toolchainDirs = toolchainConfDirs.Split(ConfigurationSeparators, StringSplitOptions.RemoveEmptyEntries); VCCLCompilerTool cl = fileConfiguration.Tool; foreach (string dir in toolchainDirs) { string compilerPath = Path.Combine(dir, cl.ToolPath); if (File.Exists(compilerPath)) { EnsureAsmDirectoryExists(configuration); string compilerQuotedPath = CLCommandLineBuilder.SurroundWithQuotes(compilerPath); string filePath = CLCommandLineBuilder.SurroundWithQuotes(file.FullPath); string args = ComposeCommandLine(file, cl); Compile(compilerQuotedPath, args + " " + filePath, file); return; } } OnMissingCompiler(); }
private String GetProcessArgument(VCFile vcFile, VCConfiguration vcConfiguration) { VCFileConfiguration vcFileConfiguration = DTE2Utils.GetVcFileConfiguration(vcFile, vcConfiguration); if (vcFileConfiguration == null) { ts.TraceData(TraceEventType.Error, 1, "GetProcessArgument cannot get VcFileConfiguration "); return(""); } StringBuilder stringBuilder = new StringBuilder(); //stringBuilder.Append(" -Xclang -analyzer-display-progress "); stringBuilder.Append(" --analyze "); //stringBuilder.Append(" -o " + GetReportFile() + " "); if (!vcFile.Name.EndsWith(".c")) { stringBuilder.Append(" -x c++ "); } stringBuilder.Append(DTE2Utils.GetIncludesForProject(vcConfiguration)); stringBuilder.Append(DTE2Utils.GetDefinesForProject(vcConfiguration)); stringBuilder.Append(DTE2Utils.GetIncludesForFile(vcFileConfiguration)); stringBuilder.Append(DTE2Utils.GetDefinesForFile(vcFileConfiguration)); stringBuilder.Append(GetArgumentMicrosoftCompilerSpecific()); stringBuilder.Append(" -pedantic "); stringBuilder.Append(" -ferror-limit=0 "); stringBuilder.Append("\"" + vcFile.FullPath + "\""); return(stringBuilder.ToString()); }
/// <summary> /// Constructor /// </summary> /// <param name="configuration">The base Visual Studio project configuration which is to be adapted</param> public ProjectConfiguration(VCConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); this._configuration = configuration; this.PrimaryOutput = configuration.PrimaryOutput; }
public void AnalyzeFile(Solution solution, VCFile vcFile, VCConfiguration vcConfiguration) { try { ts.TraceInformation("AnalyzeFile"); ts.TraceInformation("AnalyzeFile name " + vcFile.Name); ts.TraceInformation("AnalyzeFile item name " + vcFile.ItemName); ts.TraceInformation("AnalyzeFile item type " + vcFile.ItemType); ts.TraceInformation("AnalyzeFile extension " + vcFile.Extension); ts.TraceInformation("AnalyzeFile config name " + vcConfiguration.ConfigurationName); ts.TraceInformation("AnalyzeFile config type " + vcConfiguration.ConfigurationType); _analyzeType = AnalyzeType.FILE; _solution = solution; _vcFile = vcFile; _vcConfiguration = vcConfiguration; _report = Reporting.ReportFactory.CreateReportSingleFile(solution, vcFile); OnStartAnalyze(); DoAnalyzeFile(vcFile, vcConfiguration); } catch (Exception exception) { ts.TraceData(TraceEventType.Error, 1, "AnalyzeFile exception: " + exception.Message); OnStopFile(true); } }
private void DoAnalyzeProject(VCProject vcProject) { ts.TraceInformation("DoAnalyzeProject " + vcProject.Name); ts.TraceInformation("DoAnalyzeProject #files " + _report.SolutionCurrent.ProjectCurrent.Files.Count); OutputPaneWriteln("Analyzing project " + vcProject.Name + " " + _report.SolutionCurrent.ProjectCurrent.Files.Count + " files to analyze"); OnStartProject(); ts.TraceInformation("DoAnalyzeProject " + vcProject.Name + " getting vc conf"); _vcConfiguration = DTE2Utils.GetVcConfiguratioForVcProject(vcProject); if (_vcConfiguration == null) { ts.TraceInformation("DoAnalyzeProject cannot get c++ project configuration" + vcProject.Name); OnStopProject(true); return; } ts.TraceInformation("DoAnalyzeProject " + vcProject.Name + " create file queue"); _vcProject = vcProject; _vcFileQueue = DTE2Utils.CreateFileQueue(vcProject); ts.TraceInformation("DoAnalyzeProject " + vcProject.Name + " file queue created"); if (_vcFileQueue.Count == 0) { ts.TraceInformation("DoAnalyzeProject no c++ file in project " + vcProject.Name); OnStopProject(false); return; } AnalyseNextFile(); }
/// <summary> /// We parse the librarian settings, ie link options for libraries. /// </summary> private void parseConfiguration_LibrarianSettings(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // We get the librarian 'tool'... IVCCollection tools = Utils.call(() => (vcConfiguration.Tools as IVCCollection)); VCLibrarianTool librarianTool = Utils.call(() => (tools.Item("VCLibrarianTool") as VCLibrarianTool)); if (librarianTool == null) { // Not all projects have a librarian tool... return; } // We find if this library is set to link together other libraries it depends on... // (We are assuming that all configurations of the project have the same link-library-dependencies setting.) m_projectInfo.LinkLibraryDependencies = Utils.call(() => (librarianTool.LinkLibraryDependencies)); // - Target Machine (TODO: complete the machine type) string platform = Utils.call(() => (vcConfiguration.Evaluate("$(Platform)"))); if (!string.IsNullOrEmpty(platform)) { configurationInfo.Platform = platform; configurationInfo.addLinkerFlag("/MACHINE:X64"); } // - Import Library configurationInfo.DynamicLibOutputPath = configurationInfo.OutputFolderAbsolute + m_projectInfo.Name + ".lib"; }
public static VCLinkerTool GetLinkerTool(Project project) { VCProject vcProject = project?.Object as VCProject; if (vcProject == null) { throw new VCQueryFailure("Failed to retrieve VCLinkerTool since project is not a VCProject."); } VCConfiguration activeConfiguration = vcProject.ActiveConfiguration; var tools = activeConfiguration.Tools; VCLinkerTool linkerTool = null; foreach (var tool in activeConfiguration.Tools) { linkerTool = tool as VCLinkerTool; if (linkerTool != null) { break; } } if (linkerTool == null) { throw new VCQueryFailure("Couldn't file a VCLinkerTool in VC++ Project."); } return(linkerTool); }
private static VCTool GetToolFromActiveConfiguration <VCTool>(Project project) where VCTool : class { ThreadHelper.ThrowIfNotOnUIThread(); VCProject vcProject = project?.Object as VCProject; if (vcProject == null) { throw new VCQueryFailure($"Failed to retrieve VCCLCompilerTool since project \"{project.Name}\" is not a VCProject."); } VCConfiguration activeConfiguration = vcProject.ActiveConfiguration; VCTool compilerTool = null; foreach (var tool in activeConfiguration.Tools) { compilerTool = tool as VCTool; if (compilerTool != null) { break; } } if (compilerTool == null) { throw new VCQueryFailure($"Couldn't find a {typeof(VCTool).Name} in active configuration of VC++ Project \"{vcProject.Name}\""); } return(compilerTool); }
private void CleanLibraries(VCProject oProject, VCConfiguration oConfiguration) { VCLinkerTool Linker = (VCLinkerTool)((IVCCollection)oConfiguration.Tools).Item("VCLinkerTool"); if (Linker != null) { List<String> Libraries = GetLibraries(Linker); for (int i=0; i<Libraries.Count; i++) { List<String> NewLibs = Libraries.GetRange(i, 1); Libraries.RemoveRange(i, 1); Linker.AdditionalDependencies = String.Join(" ", Libraries.ToArray()); oProject.Save(); if (BuildOperations.BuildConfiguration(oProject, oConfiguration)) { i--; mLogger.PrintMessage("Library " + String.Join(" ", NewLibs.ToArray()) + " in project '" + oProject.Name + "'has been found unnesessary and removed."); } else { Libraries.InsertRange(i, NewLibs); } } Libraries.Sort(); Linker.AdditionalDependencies = String.Join(" ", Libraries.ToArray()); oProject.Save(); } }
static private VCCLCompilerTool GetVCCLCompilerToolForProject(VCConfiguration vcConfiguration) { IVCCollection fTools = (IVCCollection)vcConfiguration.Tools; VCCLCompilerTool vcCTool = (VCCLCompilerTool)fTools.Item("VCCLCompilerTool"); return(vcCTool); }
protected void QueryStatus(object sender, EventArgs e) { if (sender is OleMenuCommand cmd) { try { Project project = GetProject(); if (project != null) { if (project.Object is VCProject p) { VCConfiguration configuration = p.ActiveConfiguration; IVCRulePropertyStorage plcnextRule = configuration.Rules.Item("PLCnextCommonProperties"); string projectType = plcnextRule.GetUnevaluatedPropertyValue("ProjectType_"); if (!string.IsNullOrEmpty(projectType)) { cmd.Visible = true; return; } } } } catch (Exception) { //cmd visibility will be set to false } cmd.Visible = false; } }
/// <summary> /// Gets the TargetName from the project and returns it /// </summary> private string parseConfiguration_TargetName(VCConfiguration vcConfiguration) { string[] PrimaryOutput = vcConfiguration.PrimaryOutput.Split('\\'); string[] TargetName = PrimaryOutput[PrimaryOutput.Length - 1].Split('.'); return(TargetName[0]); }
/// <summary> /// Finds the collection of include paths for the configuration passed in. /// </summary> private void parseCompilerSettings_IncludePath(VCConfiguration vcConfiguration, VCCLCompilerTool compilerTool, ProjectConfigurationInfo_CPP configurationInfo) { // We: // 1. Read the additional include paths (which are in a semi-colon-delimited string) // 2. Split it into separate paths // 3. Resolve any symbols // 4. Make sure all paths are relative to the project root folder // 1 & 2... string strAdditionalIncludeDirectories = Utils.call(() => (compilerTool.AdditionalIncludeDirectories)); if (strAdditionalIncludeDirectories == null) { return; } List <string> additionalIncludeDirectories = Utils.split(strAdditionalIncludeDirectories, ';', ','); foreach (string additionalIncludeDirectory in additionalIncludeDirectories) { // The string may be quoted. We need to remove the quotes... string unquotedIncludeDirectory = additionalIncludeDirectory.Trim('"'); // 3 & 4... string resolvedPath = Utils.call(() => (vcConfiguration.Evaluate(unquotedIncludeDirectory))); if (resolvedPath != "") { string relativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, resolvedPath); configurationInfo.addIncludePath(relativePath); } } }
/// <summary> /// Sets the target project, platform, and configuration to get settings from. /// </summary> /// <param name="proj">Project to read settings from.</param> /// <param name="targetPlatformName">Platform type to read settings from.</param> /// <param name="targetConfigName">Configuration to read from (Debug or Release).</param> public void SetTarget(Project proj, string targetPlatformName, string targetConfigName) { // Set the project platform. If it is set to Other then no settings are valid to be read. SetPlatform(targetPlatformName); if (!IsPepperPlatform(targetPlatformName) && !IsNaClPlatform(targetPlatformName)) { return; } // We don't support non-visual C/C++ projects. if (!Utility.IsVisualCProject(proj)) { PlatformType = ProjectPlatformType.Other; return; } // Set the member variables for configuration and project to the target. project_ = (VCProject)proj.Object; foreach (VCConfiguration config in project_.Configurations) { if (config.ConfigurationName == targetConfigName && config.Platform.Name == targetPlatformName) { configuration_ = config; break; } } }
private void TestSettingsVisiblityCallback(object caller, EventArgs args) { OleMenuCommand command = caller as OleMenuCommand; if (command == null) { return; } if (command.CommandID.Guid != GuidList.GUIDTestPackageCmdSet) { return; } Project p = _dte.SelectedItems.Item(1).Project; //only used with c++ projects! Unsure why this should ever be null... I think this called when it shouldn't be some time! if (p == null || p.Kind != GuidList.CPPProject) { command.Visible = false; } else { //tests can only appear on executables. VCProject vcProject = (VCProject)p.Object; VCConfiguration vcC = (VCConfiguration) (((IVCCollection)vcProject.Configurations).Item(p.ConfigurationManager.ActiveConfiguration.ConfigurationName)); command.Visible = vcC.PrimaryOutput.EndsWith("exe", true, CultureInfo.CurrentCulture); } }
private void AnalyzeCurrentFile() { ts.TraceInformation("AnalyzeCurrentFile"); try { VCFile vcFile = DTE2Utils.GetVcCppFile(_applicationObject.ActiveDocument); if (vcFile == null) { return; } VCConfiguration vcConfiguration = DTE2Utils.GetVcConfigurationForDocument(_applicationObject.ActiveDocument, vcFile.project); if (vcConfiguration == null) { return; } ClangAnalyzer.AnalyzeFile(_applicationObject.Solution, vcFile, vcConfiguration); } catch (Exception exception) { ts.TraceData(TraceEventType.Error, 1, "AnalyzeFile exception: " + exception.Message); MessageBox.Show(exception.Message, _addInName + " System Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static VCLinkerTool GetLinkerTool(Project project, out string reasonForFailure) { VCProject vcProject = project?.Object as VCProject; if (vcProject == null) { reasonForFailure = "Failed to retrieve VCLinkerTool since project is not a VCProject."; return(null); } VCConfiguration activeConfiguration = vcProject.ActiveConfiguration; var tools = activeConfiguration.Tools; VCLinkerTool linkerTool = null; foreach (var tool in activeConfiguration.Tools) { linkerTool = tool as VCLinkerTool; if (linkerTool != null) { break; } } if (linkerTool == null) { reasonForFailure = "Couldn't file a VCLinkerTool in VC++ Project."; return(null); } reasonForFailure = ""; return(linkerTool); }
static public string GetDefinesForProject(VCConfiguration vcConfiguration) { StringBuilder defines = new StringBuilder(); VCCLCompilerTool vcCTool = GetVCCLCompilerToolForProject(vcConfiguration); if (String.IsNullOrEmpty(vcCTool.PreprocessorDefinitions) == false) { ts.TraceInformation("GetDefinesForProject: PreprocessorDefinitions\n" + vcCTool.PreprocessorDefinitions); defines.Append(BuildDefines(vcCTool.PreprocessorDefinitions)); } switch (vcCTool.RuntimeLibrary) { case runtimeLibraryOption.rtMultiThreaded: defines.Append("-D_MT "); break; case runtimeLibraryOption.rtMultiThreadedDebug: defines.Append("-D_MT -D_DEBUG "); break; case runtimeLibraryOption.rtMultiThreadedDLL: defines.Append("-D_MT -D_DLL "); break; case runtimeLibraryOption.rtMultiThreadedDebugDLL: defines.Append("-D_MT -D_DLL -D_DEBUG "); break; } ts.TraceInformation("GetDefinesForProject: " + defines.ToString()); return(defines.ToString()); }
/// <summary> /// Gets the configuration type. /// </summary> private ProjectInfo.ProjectTypeEnum parseConfiguration_Type(VCConfiguration vcConfiguration) { ProjectInfo.ProjectTypeEnum result = ProjectInfo.ProjectTypeEnum.INVALID; // We get the Visual Studio confiuration type... ConfigurationTypes configurationType = Utils.call(() => (vcConfiguration.ConfigurationType)); // And convert it to our enum type... switch (configurationType) { case ConfigurationTypes.typeApplication: result = ProjectInfo.ProjectTypeEnum.CPP_EXECUTABLE; break; case ConfigurationTypes.typeStaticLibrary: result = ProjectInfo.ProjectTypeEnum.CPP_STATIC_LIBRARY; break; case ConfigurationTypes.typeDynamicLibrary: result = ProjectInfo.ProjectTypeEnum.CPP_DLL; break; } return(result); }
static public string GetIncludesForProject(VCConfiguration vcConfiguration) { StringBuilder includes = new StringBuilder(); VCCLCompilerTool vcCTool = GetVCCLCompilerToolForProject(vcConfiguration); if (String.IsNullOrEmpty(vcCTool.FullIncludePath) == false) { ts.TraceInformation("GetIncludesForProject: FullIncludePath\n" + vcCTool.FullIncludePath); includes.Append(BuildIncludes(vcCTool.FullIncludePath, "-I")); } if (String.IsNullOrEmpty(vcCTool.AdditionalIncludeDirectories) == false) { ts.TraceInformation("GetIncludesForProject: AdditionalIncludeDirectories\n" + vcCTool.AdditionalIncludeDirectories); includes.Append(BuildIncludes(vcConfiguration.Evaluate(vcCTool.AdditionalIncludeDirectories), "-I")); } if (String.IsNullOrEmpty(vcCTool.ForcedIncludeFiles) == false) { ts.TraceInformation("GetIncludesForProject: ForcedIncludeFiles\n" + vcCTool.ForcedIncludeFiles); //TODO HEEM includes.Append(BuildIncludes(vcCTool.ForcedIncludeFiles, "-include")); } ts.TraceInformation("GetIncludesForProject: \n" + includes.ToString()); return(includes.ToString()); }
/// <summary> /// Finds the library path for the configuration passed in. /// </summary> private void parseLinkerSettings_LibraryPath(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // Get the library paths across all property sheets List <string> libraryPaths = ToolPropertyCollector.Get(vcConfiguration, "VCLinkerTool", (tool) => { var linkerTool = tool as VCLinkerTool; string str = Utils.call(() => (linkerTool.AdditionalLibraryDirectories)); if (str == null) { return(null); } // The string may be quoted. We need to remove the quotes. // (TODO: We might need to handle quotes in a smarter manner.) return(Utils.split(str, ';').Select(s => s.Trim('"')).ToList()); }); // Process the library paths foreach (string libraryPath in libraryPaths) { if (libraryPath == "") { continue; } string resolvedPath = Utils.call(() => (vcConfiguration.Evaluate(libraryPath))); if (resolvedPath == "") { continue; } string relativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, resolvedPath); configurationInfo.addLibraryPath(relativePath); } }
/// <summary> /// Finds the collection of include paths for the configuration passed in. /// </summary> private void parseCompilerSettings_IncludePath(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { List <string> paths = ToolPropertyCollector.Get(vcConfiguration, "VCCLCompilerTool", (tool) => { var compilerTool = tool as VCCLCompilerTool; string strAdditionalIncludeDirectories = Utils.call(() => (compilerTool.AdditionalIncludeDirectories)); if (strAdditionalIncludeDirectories == null) { return(null); } // The string may be quoted. We need to remove the quotes. // (TODO: We might need to handle quotes in a smarter manner.) return(Utils.split(strAdditionalIncludeDirectories, ';', ',').Select(s => s.Trim('"')).ToList()); }); foreach (var path in paths) { // Resolve variables string resolvedPath = Utils.call(() => (vcConfiguration.Evaluate(path))); if (resolvedPath != "") { // Make sure all paths are relative to the project root folder string relativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, resolvedPath); configurationInfo.addIncludePath(relativePath); } } }
private void IntegrateIntoConfiguration(VCConfiguration configuration) { string absPropFilePath = GetPropsFilePath(configuration); string relativePropFilePath = ConanPathHelper.GetRelativePath(configuration.project.ProjectDirectory, absPropFilePath); IVCCollection tools = (IVCCollection)configuration.Tools; if (tools != null) { VCLinkerTool ltool = (VCLinkerTool)tools.Item("VCLinkerTool"); if (ltool != null) { string deps = ltool.AdditionalDependencies; ltool.AdditionalDependencies = deps.Replace("$(NOINHERIT)", ""); } } foreach (VCPropertySheet sheet in configuration.PropertySheets) { if (ConanPathHelper.NormalizePath(sheet.PropertySheetFile) == ConanPathHelper.NormalizePath(absPropFilePath)) { return; } } configuration.AddPropertySheet(relativePropFilePath); configuration.CollectIntelliSenseInfo(); }
/// <summary> /// compile a single VCFile, do nothing with the OBJ /// </summary> public bool CompileSingleFile(VCFile vcFile, VCProject vcProject, VCConfiguration vcCfg, String additionalCmds = "") { CVXBuildSystem buildSystem; try { buildSystem = new CVXBuildSystem(_vsOutputWindow, _outputPane); } catch (Exception ex) { MessageBox.Show(ex.Message, "ClangVSx Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } String prevEnv = Environment.CurrentDirectory; try { Environment.CurrentDirectory = vcProject.ProjectDirectory; WriteToOutputPane("Project Directory : " + Environment.CurrentDirectory + "\n"); return(buildSystem.CompileSingleFile(vcFile, vcProject, vcCfg, additionalCmds)); } catch (Exception ex) { WriteToOutputPane("Exception During File Compile : \n" + ex.Message + "\n"); } finally { Environment.CurrentDirectory = prevEnv; } return(false); }
/// <summary> /// Tests that a given property contains a specific string in a certain VCConfiguration /// </summary> /// <param name="configuration">Gives the platform and configuration type</param> /// <param name="pageName">Property page name where property resides.</param> /// <param name="propertyName">Name of the property to check.</param> /// <param name="expectedValue">Expected string to contain.</param> /// <param name="ignoreCase">Ignore case when comparing the expected and actual values.</param> public static void AssertPropertyContains( VCConfiguration configuration, string pageName, string propertyName, string expectedValue, bool ignoreCase, bool expand = false) { StringComparison caseSensitive = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; IVCRulePropertyStorage rule = configuration.Rules.Item(pageName); string propertyValue; if (expand) { propertyValue = rule.GetEvaluatedPropertyValue(propertyName); } else { propertyValue = rule.GetUnevaluatedPropertyValue(propertyName); } string message = string.Format( "{0} should be contained in {1}. Page: {2}, Property: {3}, Configuration: {4}", expectedValue, propertyValue, pageName, propertyName, configuration.ConfigurationName); Assert.IsTrue(propertyValue.Contains(expectedValue, caseSensitive), message); }
private ProjectProperties.StandardVersion GetStandardVersion(VCConfiguration config) { IVCRulePropertyStorage generalRule = config.Rules.Item("ConfigurationGeneral"); string value = null; try { value = generalRule == null ? null : generalRule.GetEvaluatedPropertyValue("LanguageStandard"); } catch (Exception) { } if (value == "Default") { return(ProjectProperties.StandardVersion.Default); } else if (value == "stdcpp14") { return(ProjectProperties.StandardVersion.Cpp14); } else if (value == "stdcpp17") { return(ProjectProperties.StandardVersion.Cpp17); } else if (value == "stdcpplatest") { return(ProjectProperties.StandardVersion.Latest); } return(ProjectProperties.StandardVersion.Latest); }
/// <summary> /// Get the active code file, project and configuration /// </summary> /// <returns>true if we have found an active C/C++ document</returns> private bool GetActiveVCFile(out VCFile vcFile, out VCProject vcProject, out VCConfiguration vcCfg) { vcFile = null; vcProject = null; vcCfg = null; if (_applicationObject.ActiveDocument != null) { // GUID equates to 'code file' as far as I can make out if (_applicationObject.ActiveDocument.Kind == "{8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A}" && _applicationObject.ActiveDocument.Language == "C/C++") { // GUID equates to physical file on disk [http://msdn.microsoft.com/en-us/library/z4bcch80(VS.80).aspx] if (_applicationObject.ActiveDocument.ProjectItem.Kind == "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}") { // leap of faith vcFile = (VCFile)_applicationObject.ActiveDocument.ProjectItem.Object; vcProject = (VCProject)vcFile.project; if (vcFile.FileType != eFileType.eFileTypeCppCode && // *.cpp vcFile.FileType != eFileType.eFileTypeCppHeader) // *.h { return(false); } // save the file (should be optional!) if (!_applicationObject.ActiveDocument.Saved) { _applicationObject.ActiveDocument.Save(vcFile.FullPath); } // get current configuration to pass to the bridge Configuration cfg = _applicationObject.ActiveDocument.ProjectItem.ConfigurationManager.ActiveConfiguration; try { var cfgArray = (IVCCollection)vcProject.Configurations; foreach (VCConfiguration vcr in cfgArray) { if (vcr.ConfigurationName == cfg.ConfigurationName && vcr.Platform.Name == cfg.PlatformName) { vcCfg = vcr; } } } catch (Exception) { return(false); } return(true); } } } return(false); }
public UnityManager(VCProject vcproject) { this.Project = vcproject.Object as Project; this.VCProject = vcproject; this.VCConfig = Connect.GetActiveVCConfig(this.VCProject); this.Filter = new UnityFilter(this.Project); }
public void ClearTheFakeObject() { _fackProjObj = null; _fakeActiveConfiguration = null; _fakeConfigurationManager = null; _fakeCollection = null; _fakeVcConfiguration = null; }
public static IVCRulePropertyStorage GetPropertyStorage(Solution2 solution, string projectName, string buildConfig, string ruleName, string property) { VCProject fsgdGameProject = solution.Projects.Item(projectName).Object as VCProject; VCConfiguration config = fsgdGameProject.Configurations.Item(buildConfig) as VCConfiguration; IVCRulePropertyStorage propertyStorage = config.Rules.Item(ruleName); return(propertyStorage); }
public static VCCLCompilerTool GetCompilerTool(Solution2 solution, string projectName, string buildConfig) { VCProject fsgdGameProject = solution.Projects.Item(solution).Object as VCProject; VCConfiguration debug32 = fsgdGameProject.Configurations.Item(buildConfig) as VCConfiguration; VCCLCompilerTool tool = debug32.Tools.Item("VCCLCompilerTool"); return(tool); }
public CompilerToolWrapper(VCConfiguration config) { compilerTool = ((IVCCollection)config.Tools).Item("VCCLCompilerTool") as VCCLCompilerTool; if (compilerTool == null) { compilerObj = ((IVCCollection)config.Tools).Item("VCCLCompilerTool"); compilerType = compilerObj.GetType(); } }
public static DeploymentToolWrapper Create(VCConfiguration config) { DeploymentToolWrapper wrapper = null; try { wrapper = new DeploymentToolWrapper(config.DeploymentTool); } catch { } return (wrapper.deploymentToolObj == null) ? null : wrapper; }
/// <summary> /// Finds compiler flags. /// </summary> private void parseCompilerSettings_CompilerFlags(VCConfiguration vcConfiguration, VCCLCompilerTool compilerTool, ProjectConfigurationInfo_CPP configurationInfo) { // Warning level... warningLevelOption warningLevel = Utils.call(() => (compilerTool.WarningLevel)); switch (warningLevel) { case warningLevelOption.warningLevel_0: configurationInfo.addCompilerFlag("-w"); break; case warningLevelOption.warningLevel_4: configurationInfo.addCompilerFlag("-Wall"); break; } // Warnings as errors... bool warningsAsErrors = Utils.call(() => (compilerTool.WarnAsError)); if (warningsAsErrors == true) { configurationInfo.addCompilerFlag("-Werror"); } // Optimization... optimizeOption optimization = Utils.call(() => (compilerTool.Optimization)); switch (optimization) { case optimizeOption.optimizeDisabled: configurationInfo.addCompilerFlag("-O0"); break; case optimizeOption.optimizeMinSpace: configurationInfo.addCompilerFlag("-Os"); break; case optimizeOption.optimizeMaxSpeed: configurationInfo.addCompilerFlag("-O2"); break; case optimizeOption.optimizeFull: configurationInfo.addCompilerFlag("-O3"); break; } }
/// <summary> /// compile a single VCFile, do nothing with the OBJ /// </summary> public bool CompileSingleFile(VCFile vcFile, VCProject vcProject, VCConfiguration vcCfg, String additionalCmds = "") { CVXBuildSystem buildSystem; try { buildSystem = new CVXBuildSystem(_vsOutputWindow, _outputPane); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "ClangVSx Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } try { return buildSystem.CompileSingleFile(vcFile, vcProject, vcCfg, additionalCmds); } catch (System.Exception ex) { WriteToOutputPane("Exception During File Compile : \n" + ex.Message + "\n"); } return false; }
/// <summary> /// Finds the library path for the configuration passed in. /// </summary> private void parseLinkerSettings_LibraryPath(VCConfiguration vcConfiguration, VCLinkerTool linkerTool, ProjectConfigurationInfo_CPP configurationInfo) { // We: // 1. Read the additional library paths (which are in a semi-colon-delimited string) // 2. Split it into separate paths // 3. Resolve any symbols // 4. Make sure all paths are relative to the project root folder // 1 & 2... string strAdditionalLibraryDirectories = Utils.call(() => (linkerTool.AdditionalLibraryDirectories)); if (strAdditionalLibraryDirectories == null) { return; } List<string> additionalLibraryDirectories = Utils.split(strAdditionalLibraryDirectories, ';', ','); foreach (string additionalLibraryDirectory in additionalLibraryDirectories) { // The string may be quoted. We need to remove the quotes... string unquotedLibraryDirectory = additionalLibraryDirectory.Trim('"'); if (unquotedLibraryDirectory == "") { continue; } // 3 & 4... string resolvedPath = Utils.call(() => (vcConfiguration.Evaluate(unquotedLibraryDirectory))); if (resolvedPath != "") { string relativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, resolvedPath); configurationInfo.addLibraryPath(relativePath); } } }
/// <summary> /// Finds the collection of preprocessor definitions for the configuration passed in. /// </summary> private void parseCompilerSettings_PreprocessorDefinitions(VCConfiguration vcConfiguration, VCCLCompilerTool compilerTool, ProjectConfigurationInfo_CPP configurationInfo) { // We read the delimited string of preprocessor definitions, and // split them... string strPreprocessorDefinitions = Utils.call(() => (compilerTool.PreprocessorDefinitions)); if (strPreprocessorDefinitions == null) { return; } List<string> preprocessorDefinitions = Utils.split(strPreprocessorDefinitions, ';'); // We add the definitions to the parsed configuration (removing ones that // aren't relevant to a linux build)... foreach (string definition in preprocessorDefinitions) { configurationInfo.addPreprocessorDefinition(definition); } }
public void FakeTheProjectInterface() { _fackProjObj = A.Fake<Project>(); _fakeConfigurationManager = A.Fake<ConfigurationManager>(); _fakeActiveConfiguration = A.Fake<Configuration>(); _fackVcProject = A.Fake<VCProject>(); _fakeCollection = A.Fake<IVCCollection>(); _fakeVcConfiguration = A.Fake<VCConfiguration>(); }
/// <summary> /// We parse the librarian settings, ie link options for libraries. /// </summary> private void parseConfiguration_LibrarianSettings(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // We get the librarian 'tool'... IVCCollection tools = Utils.call(() => (vcConfiguration.Tools as IVCCollection)); VCLibrarianTool librarianTool = Utils.call(() => (tools.Item("VCLibrarianTool") as VCLibrarianTool)); if (librarianTool == null) { // Not all projects have a librarian tool... return; } // We find if this library is set to link together other libraries it depends on... // (We are assuming that all configurations of the project have the same link-library-dependencies setting.) m_projectInfo.LinkLibraryDependencies = Utils.call(() => (librarianTool.LinkLibraryDependencies)); parseLibrarianSettings_LibraryPath(vcConfiguration, librarianTool, configurationInfo); parseLibrarianSettings_Libraries(vcConfiguration, librarianTool, configurationInfo); }
/// <summary> /// Finds compiler settings, such as the include path, for the configuration /// passed in. /// </summary> private void parseConfiguration_CompilerSettings(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // We get the compiler-settings 'tool'... IVCCollection tools = Utils.call(() => (vcConfiguration.Tools as IVCCollection)); VCCLCompilerTool compilerTool = Utils.call(() => (tools.Item("VCCLCompilerTool") as VCCLCompilerTool)); // And extract various details from it... parseCompilerSettings_IncludePath(vcConfiguration, compilerTool, configurationInfo); parseCompilerSettings_PreprocessorDefinitions(vcConfiguration, compilerTool, configurationInfo); parseCompilerSettings_CompilerFlags(vcConfiguration, compilerTool, configurationInfo); IVCCollection sheets = Utils.call(() => (vcConfiguration.PropertySheets as IVCCollection)); int numSheets = Utils.call(() => (sheets.Count)); for (int i = 1; i <= numSheets; ++i) { VCPropertySheet sheet = Utils.call(() => (sheets.Item(i) as VCPropertySheet)); if (!sheet.IsSystemPropertySheet) { // 1. The thing is that VCPropertySheet and VCConfiguration have more-or-less // identical interfaces. So we should be able to merge them fairly easily. // // 2. We should try multiple layers of inheritance IVCCollection toolsInSheet = Utils.call(() => (sheet.Tools as IVCCollection)); VCCLCompilerTool compilerToolInSheet = Utils.call(() => (toolsInSheet.Item("VCCLCompilerTool") as VCCLCompilerTool)); // And extract various details from it... if (compilerToolInSheet != null) { parseCompilerSettings_IncludePath(vcConfiguration, compilerToolInSheet, configurationInfo); parseCompilerSettings_PreprocessorDefinitions(vcConfiguration, compilerToolInSheet, configurationInfo); //parseCompilerSettings_CompilerFlags(vcConfiguration, compilerToolInSheet, configurationInfo); } } } }
/// <summary> /// Get the active code file, project and configuration /// </summary> /// <returns>true if we have found an active C/C++ document</returns> private bool GetActiveVCFile(out VCFile vcFile, out VCProject vcProject, out VCConfiguration vcCfg) { vcFile = null; vcProject = null; vcCfg = null; if (_applicationObject.ActiveDocument != null) { // GUID equates to 'code file' as far as I can make out if (_applicationObject.ActiveDocument.Kind == "{8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A}" && _applicationObject.ActiveDocument.Language == "C/C++") { // GUID equates to physical file on disk [http://msdn.microsoft.com/en-us/library/z4bcch80(VS.80).aspx] if (_applicationObject.ActiveDocument.ProjectItem.Kind == "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}") { // leap of faith vcFile = (VCFile)_applicationObject.ActiveDocument.ProjectItem.Object; vcProject = (VCProject)vcFile.project; if (vcFile.FileType != eFileType.eFileTypeCppCode) return false; // save the file (should be optional!) if (!_applicationObject.ActiveDocument.Saved) _applicationObject.ActiveDocument.Save(vcFile.FullPath); // get current configuration to pass to the bridge Configuration cfg = _applicationObject.ActiveDocument.ProjectItem.ConfigurationManager.ActiveConfiguration; try { var cfgArray = (IVCCollection)vcProject.Configurations; foreach (VCConfiguration vcr in cfgArray) { if (vcr.ConfigurationName == cfg.ConfigurationName && vcr.Platform.Name == cfg.PlatformName) { vcCfg = vcr; } } } catch (Exception) { return false; } return true; } } } return false; }
/// <summary> /// We parse the pre-build events. /// </summary> private void parseConfiguration_PreBuildEvent(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // We see if there is a pre-build event... IVCCollection tools = Utils.call(() => (vcConfiguration.Tools as IVCCollection)); VCPreBuildEventTool preBuildEvent = Utils.call(() => (tools.Item("VCPreBuildEventTool") as VCPreBuildEventTool)); if (preBuildEvent == null) { return; } string commandLine = Utils.call(() => (preBuildEvent.CommandLine)); configurationInfo.PreBuildEvent = convertBuildEventCommandLine(commandLine); }
private static void RemoveQtDeploys(VCConfiguration config) { DeploymentToolWrapper deploymentTool = DeploymentToolWrapper.Create(config); if (deploymentTool == null) return; string additionalFiles = deploymentTool.GetAdditionalFiles(); additionalFiles = Regex.Replace(additionalFiles, "Qt[^\\|]*\\|[^\\|]*\\|[^\\|]*\\|[^;^$]*[;$]{0,1}", ""); if (additionalFiles.EndsWith(";")) additionalFiles = additionalFiles.Substring(0, additionalFiles.Length - 1); deploymentTool.SetAdditionalFiles(additionalFiles); }
private void RemoveDeploySettings(DeploymentToolWrapper deploymentTool, QtModule module, VCConfiguration config, QtModuleInfo moduleInfo) { if (moduleInfo == null) moduleInfo = QtModules.Instance.ModuleInformation(module); if (deploymentTool == null) deploymentTool = DeploymentToolWrapper.Create(config); if (deploymentTool == null) return; string destDir = deploymentTool.RemoteDirectory; const string qtSrcDir = "$(QTDIR)\\lib"; string filename = moduleInfo.GetDllFileName(IsDebugConfiguration(config)); if (deploymentTool.GetAdditionalFiles().IndexOf(filename) >= 0) deploymentTool.Remove(filename, qtSrcDir, destDir); // remove dependent modules foreach (QtModule dependentModule in moduleInfo.dependentModules) { if (!HasModule(dependentModule)) RemoveDeploySettings(deploymentTool, dependentModule, config, null); } }
/// <summary> /// Gets the configuration type. /// </summary> private ProjectInfo.ProjectTypeEnum parseConfiguration_Type(VCConfiguration vcConfiguration) { ProjectInfo.ProjectTypeEnum result = ProjectInfo.ProjectTypeEnum.INVALID; // We get the Visual Studio confiuration type... ConfigurationTypes configurationType = Utils.call(() => (vcConfiguration.ConfigurationType)); // And convert it to our enum type... switch (configurationType) { case ConfigurationTypes.typeApplication: result = ProjectInfo.ProjectTypeEnum.CPP_EXECUTABLE; break; case ConfigurationTypes.typeStaticLibrary: result = ProjectInfo.ProjectTypeEnum.CPP_STATIC_LIBRARY; break; case ConfigurationTypes.typeDynamicLibrary: result = ProjectInfo.ProjectTypeEnum.CPP_DLL; break; } return result; }
/// <summary> /// Parses the configuration (e.g. Debug, Release) passed in. /// </summary> private void parseConfiguration(VCConfiguration vcConfiguration) { ProjectConfigurationInfo_CPP configurationInfo = new ProjectConfigurationInfo_CPP(); configurationInfo.ParentProjectInfo = m_projectInfo; // The configuration name... configurationInfo.Name = Utils.call(() => (vcConfiguration.ConfigurationName)); // The project type. // Note: we are assuming that all the configurations for the project build the // same type of target. m_projectInfo.ProjectType = parseConfiguration_Type(vcConfiguration); // We get the intermediates and output folder, and the Target Name. configurationInfo.IntermediateFolder = parseConfiguration_Folder(vcConfiguration, () => (vcConfiguration.IntermediateDirectory)); configurationInfo.OutputFolder = parseConfiguration_Folder(vcConfiguration, () => (vcConfiguration.OutputDirectory)); configurationInfo.TargetName = parseConfiguration_TargetName(vcConfiguration); // We get compiler settings, such as the include path and // preprocessor definitions... parseConfiguration_CompilerSettings(vcConfiguration, configurationInfo); // We get linker settings, such as any libs to link and the library path... parseConfiguration_LinkerSettings(vcConfiguration, configurationInfo); // We parse librarian settings (how libraries are linked)... parseConfiguration_LibrarianSettings(vcConfiguration, configurationInfo); // We see if there are any pre- or post- build events set up for this // configuration. The only types of events we know how to deal with are // ones that invoke a .cmd file. For these we convert them to invoke // a .sh file with the same name. parseConfiguration_PreBuildEvent(vcConfiguration, configurationInfo); parseConfiguration_PostBuildEvent(vcConfiguration, configurationInfo); // We add the configuration to the collection of them for the project... m_projectInfo.addConfigurationInfo(configurationInfo); }
public static string GetPrecompiledHeaderThrough(VCConfiguration config) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); return GetPrecompiledHeaderThrough(compiler); }
/// <summary> /// Gets a folder name from the function passed in, and returns it as a path /// relative to the project root folder. /// </summary> private string parseConfiguration_Folder(VCConfiguration vcConfiguration, Func<string> folderFn) { // We get the folder name, which may contain symbols e.g. £(ConfgurationName)... string pathWithSymbols = Utils.call(folderFn); // We resolve the symbols... string evaluatedPath = Utils.call(() => (vcConfiguration.Evaluate(pathWithSymbols))); // If we ave an absolute path, we convert it to a relative one... string relativePath = evaluatedPath; if (Path.IsPathRooted(evaluatedPath)) { relativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, evaluatedPath); } return relativePath; }
public static void RemovePlatformDependencies(VCConfiguration config, VersionInformation viOld) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); SimpleSet minuend = new SimpleSet(compiler.PreprocessorDefinitions); SimpleSet subtrahend = new SimpleSet(viOld.GetQMakeConfEntry("DEFINES").Split(new char[] { ' ', '\t' })); compiler.SetPreprocessorDefinitions(minuend.Minus(subtrahend).JoinElements(',')); }
/// <summary> /// Finds the linker settings, such as the collection of libraries to link, /// for the configuration passed in. /// </summary> private void parseConfiguration_LinkerSettings(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { // We get the linker-settings 'tool'... IVCCollection tools = Utils.call(() => (vcConfiguration.Tools as IVCCollection)); VCLinkerTool linkerTool = Utils.call(() => (tools.Item("VCLinkerTool") as VCLinkerTool)); if (linkerTool == null) { // Not all projects have a linker tools... return; } // And extract various details from it... parseLinkerSettings_LibraryPath(vcConfiguration, linkerTool, configurationInfo); parseLinkerSettings_Libraries(vcConfiguration, linkerTool, configurationInfo); parseLinkerSettings_Misc(vcConfiguration, linkerTool, configurationInfo); IVCCollection sheets = Utils.call(() => (vcConfiguration.PropertySheets as IVCCollection)); int numSheets = Utils.call(() => (sheets.Count)); for (int i = 1; i <= numSheets; ++i) { VCPropertySheet sheet = Utils.call(() => (sheets.Item(i) as VCPropertySheet)); if (!sheet.IsSystemPropertySheet) { // 1. The thing is that VCPropertySheet and VCConfiguration have more-or-less // identical interfaces. So we should be able to merge them fairly easily. // // 2. We should try multiple layers of inheritance IVCCollection toolsInSheet = Utils.call(() => (sheet.Tools as IVCCollection)); VCLinkerTool linkerToolInSheet = Utils.call(() => (toolsInSheet.Item("VCLinkerTool") as VCLinkerTool)); // And extract various details from it... if (linkerToolInSheet != null) { parseLinkerSettings_LibraryPath(vcConfiguration, linkerToolInSheet, configurationInfo); parseLinkerSettings_Libraries(vcConfiguration, linkerToolInSheet, configurationInfo); } } } }
private static bool IsDebugConfiguration(VCConfiguration conf) { VCCLCompilerTool compiler = (VCCLCompilerTool)((IVCCollection)conf.Tools).Item("VCCLCompilerTool"); if (compiler != null && (compiler.RuntimeLibrary == runtimeLibraryOption.rtMultiThreadedDebug || compiler.RuntimeLibrary == runtimeLibraryOption.rtMultiThreadedDebugDLL)) return true; return false; }
/// <summary> /// Gets the TargetName from the project and returns it /// </summary> private string parseConfiguration_TargetName(VCConfiguration vcConfiguration) { string[] PrimaryOutput = vcConfiguration.PrimaryOutput.Split('\\'); string[] TargetName = PrimaryOutput[PrimaryOutput.Length - 1].Split('.'); return TargetName[0]; }
public static bool UsesPrecompiledHeaders(VCConfiguration config) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); return UsesPrecompiledHeaders(compiler); }
/// <summary> /// Finds the collection of additional libraries to link into this project. /// </summary> private void parseLinkerSettings_Libraries(VCConfiguration vcConfiguration, VCLinkerTool linkerTool, ProjectConfigurationInfo_CPP configurationInfo) { // The collection of libraries is stored in a space-delimited string... string strAdditionalLibraries = Utils.call(() => (linkerTool.AdditionalDependencies)); if (strAdditionalLibraries == null) { return; } List<string> additionalLibraries = Utils.split(strAdditionalLibraries, ' '); foreach (string additionalLibrary in additionalLibraries) { // We add the library to the project... string rawName = Path.GetFileNameWithoutExtension(additionalLibrary); configurationInfo.addLibraryRawName(rawName); } }
private void AddDeploySettings(DeploymentToolWrapper deploymentTool, QtModule module, VCConfiguration config, QtModuleInfo moduleInfo, VersionInformation versionInfo) { // for static Qt builds it doesn't make sense // to add deployment settings for Qt modules if (versionInfo.IsStaticBuild()) return; if (moduleInfo == null) moduleInfo = QtModules.Instance.ModuleInformation(module); if (moduleInfo == null || !moduleInfo.HasDLL) return; if (deploymentTool == null) deploymentTool = DeploymentToolWrapper.Create(config); if (deploymentTool == null) return; string destDir = deploymentTool.RemoteDirectory; const string qtSrcDir = "$(QTDIR)\\lib"; string filename = moduleInfo.GetDllFileName(IsDebugConfiguration(config)); if (deploymentTool.GetAdditionalFiles().IndexOf(filename) < 0) deploymentTool.Add(filename, qtSrcDir, destDir); // add dependent modules foreach (QtModule dependentModule in moduleInfo.dependentModules) AddDeploySettings(deploymentTool, dependentModule, config, null, versionInfo); }
/// <summary> /// Reads miscellaneous linker settings. /// </summary> private void parseLinkerSettings_Misc(VCConfiguration vcConfiguration, VCLinkerTool linkerTool, ProjectConfigurationInfo_CPP configurationInfo) { // Whether we implicitly link in libraries we depend on. // (We are assuming that all configurations of the project have the // same link-library-dependencies setting.) m_projectInfo.LinkLibraryDependencies = Utils.call(() => (linkerTool.LinkLibraryDependencies)); // Generate debug info... bool debugInfo = Utils.call(() => (linkerTool.GenerateDebugInformation)); if (debugInfo == true && configurationInfo.getPreprocessorDefinitions().Contains("NDEBUG") == false) { configurationInfo.addCompilerFlag("-g"); } }
public void SetupConfiguration(VCConfiguration config, VersionInformation viNew) { bool isWinPlatform = (!viNew.IsWinCEVersion()); CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); SimpleSet ppdefs = new SimpleSet(compiler.PreprocessorDefinitions); ICollection newPPDefs = viNew.GetQMakeConfEntry("DEFINES").Split(new char[] { ' ', '\t' }); compiler.SetPreprocessorDefinitions(ppdefs.Union(newPPDefs).JoinElements(',')); #if ENABLE_WINCE // search prepocessor definitions for Qt modules and add deployment settings if (!isWinPlatform) { DeploymentToolWrapper deploymentTool = DeploymentToolWrapper.Create(config); if (deploymentTool != null) { deploymentTool.Clear(); deploymentTool.AddWinCEMSVCStandardLib(IsDebugConfiguration(config), dte); List<QtModuleInfo> availableQtModules = QtModules.Instance.GetAvailableModuleInformation(); foreach (string s in ppdefs.Elements) { foreach (QtModuleInfo moduleInfo in availableQtModules) { if (moduleInfo.Defines.Contains(s)) AddDeploySettings(deploymentTool, moduleInfo.ModuleId, config, null, viNew); } } } } #endif VCLinkerTool linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool"); if (linker == null) return; if (isWinPlatform) linker.SubSystem = subSystemOption.subSystemWindows; else linker.SubSystem = subSystemOption.subSystemNotSet; SetTargetMachine(linker, viNew); }