本文整理汇总了C#中VCConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# VCConfiguration类的具体用法?C# VCConfiguration怎么用?C# VCConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VCConfiguration类属于命名空间,在下文中一共展示了VCConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectConfiguration
/// <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;
}
示例2: CleanLibraries
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();
}
}
示例3: CompilerToolWrapper
public CompilerToolWrapper(VCConfiguration config)
{
compilerTool = ((IVCCollection)config.Tools).Item("VCCLCompilerTool") as VCCLCompilerTool;
if (compilerTool == null)
{
compilerObj = ((IVCCollection)config.Tools).Item("VCCLCompilerTool");
compilerType = compilerObj.GetType();
}
}
示例4: Create
public static DeploymentToolWrapper Create(VCConfiguration config)
{
DeploymentToolWrapper wrapper = null;
try
{
wrapper = new DeploymentToolWrapper(config.DeploymentTool);
}
catch
{
}
return (wrapper.deploymentToolObj == null) ? null : wrapper;
}
示例5: parseConfiguration_Folder
/// <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;
}
示例6: parseConfiguration
/// <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);
}
示例7: parseConfiguration_CompilerSettings
/// <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);
}
}
}
}
示例8: parseCompilerSettings_CompilerFlags
/// <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;
}
}
示例9: parseCompilerSettings_PreprocessorDefinitions
/// <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);
}
}
示例10: parseConfiguration_PreBuildEvent
/// <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);
}
示例11: RemovePlatformDependencies
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(','));
}
示例12: GetActiveVCFile
/// <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;
}
示例13: parseLinkerSettings_LibraryPath
/// <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);
}
}
}
示例14: RemoveDeploySettings
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);
}
}
示例15: RemoveQtDeploys
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);
}