/// <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); } } }
/// <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> /// Processes the preprocessor definitions of a given compiler tool and inherits (from the next property sheets) as necessary. /// </summary> private void parseCompilerSettings_PreprocessorDefinitions(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { List <string> definitions = ToolPropertyCollector.Get(vcConfiguration, "VCCLCompilerTool", (tool) => { var compilerTool = tool as VCCLCompilerTool; string str = Utils.call(() => (compilerTool.PreprocessorDefinitions)); 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, ';')); }); foreach (var definition in definitions) { configurationInfo.addPreprocessorDefinition(definition); } }
/// <summary> /// Finds the collection of additional libraries to link into this project. /// </summary> private void parseLinkerSettings_Libraries(VCConfiguration vcConfiguration, ProjectConfigurationInfo_CPP configurationInfo) { List <string> additionalDepenedencies = ToolPropertyCollector.Get(vcConfiguration, "VCLinkerTool", (tool) => { var linkerTool = tool as VCLinkerTool; string str = Utils.call(() => (linkerTool.AdditionalDependencies)); 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, ' ')); }); foreach (string additionalLibrary in additionalDepenedencies) { // We add the library to the project... string rawName = Path.GetFileNameWithoutExtension(additionalLibrary); configurationInfo.addLibraryRawName(rawName); } }