public QtModuleInfo ModuleInformation(QtModule moduleId) { QtModuleInfo moduleInfo; dictModuleInfos.TryGetValue(moduleId, out moduleInfo); return(moduleInfo); }
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string[] defines) { QtModuleInfo moduleInfo = new QtModuleInfo(moduleId); moduleInfo.LibraryPrefix = libraryPrefix; moduleInfo.IncludePath = "$(QTDIR)\\include\\" + libraryPrefix; moduleInfo.Defines = new List <string>(); dictModulesByDLL.Add(libraryPrefix, moduleId); foreach (string str in defines) { if (string.IsNullOrEmpty(str)) { continue; } moduleInfo.Defines.Add(str); } dictModuleInfos.Add(moduleId, moduleInfo); if (libraryPrefix.StartsWith("Qt")) { moduleInfo.proVarQT = libraryPrefix.Substring(2).ToLower(); } else { moduleInfo.proVarQT = libraryPrefix.ToLower(); } return(moduleInfo); }
private QtModules() { QtModuleInfo moduleInfo = null; var uri = new Uri( System.Reflection.Assembly.GetExecutingAssembly().EscapedCodeBase); var pkgInstallPath = Path.GetDirectoryName( Uri.UnescapeDataString(uri.AbsolutePath)) + @"\"; var modulesFile = Path.Combine(pkgInstallPath, "qtmodules.xml"); if (File.Exists(modulesFile)) { var xmlText = File.ReadAllText(modulesFile, Encoding.UTF8); XDocument xml = null; try { using (var reader = XmlReader.Create(new StringReader(xmlText))) { xml = XDocument.Load(reader); } } catch { } if (xml != null) { foreach (var xModule in xml.Elements("QtVsTools").Elements("Module")) { var id = (string)xModule.Attribute("Id"); QtModule moduleId = (QtModule)Convert.ToUInt32(id); moduleInfo = new QtModuleInfo(moduleId); moduleInfo.Name = (string)xModule.Element("Name"); moduleInfo.ResourceName = (string)xModule.Element("ResourceName"); moduleInfo.Selectable = ((string)xModule.Element("Selectable") == "true"); moduleInfo.LibraryPrefix = (string)xModule.Element("LibraryPrefix"); moduleInfo.HasDLL = ((string)xModule.Element("HasDLL") == "true"); moduleInfo.proVarQT = (string)xModule.Element("proVarQT"); moduleInfo.proVarCONFIG = (string)xModule.Element("proVarCONFIG"); moduleInfo.IncludePath = xModule.Elements("IncludePath") .Select(x => x.Value).ToList(); moduleInfo.Defines = xModule.Elements("Defines") .Select(x => x.Value).ToList(); moduleInfo.AdditionalLibraries = xModule.Elements("AdditionalLibraries") .Select(x => x.Value).ToList(); moduleInfo.AdditionalLibrariesDebug = xModule.Elements("AdditionalLibrariesDebug") .Select(x => x.Value).ToList(); dictModulesByDLL.Add(moduleInfo.LibraryPrefix, moduleId); dictModuleInfos.Add(moduleId, moduleInfo); } } } }
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string define) { return(InitQtModule(moduleId, libraryPrefix, new string[] { define })); }
public QtModuleInfo ModuleInformation(QtModule moduleId) { QtModuleInfo moduleInfo; dictModuleInfos.TryGetValue(moduleId, out moduleInfo); return moduleInfo; }
public List <QtModule> dependentModules = new List <QtModule>(); // For WinCE deployment. public QtModuleInfo(QtModule id) { moduleId = id; }
public ModuleMapItem(CheckBox cb, QtModule mid) { checkbox = cb; moduleId = mid; initialValue = false; }
private void AddMapping(CheckBox checkbox, QtModule moduleId) { moduleMap.Add(new ModuleMapItem(checkbox, moduleId)); }
public ModuleMapItem(CheckBox cb, QtModule mid) { checkbox = cb; moduleId = mid; initialValue = false; }
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string define) { return InitQtModule(moduleId, libraryPrefix, new string[] { define }); }
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string[] defines) { QtModuleInfo moduleInfo = new QtModuleInfo(moduleId); moduleInfo.LibraryPrefix = libraryPrefix; moduleInfo.IncludePath = "$(QTDIR)\\include\\" + libraryPrefix; moduleInfo.Defines = new List<string>(); dictModulesByDLL.Add(libraryPrefix, moduleId); foreach (string str in defines) { if (string.IsNullOrEmpty(str)) continue; moduleInfo.Defines.Add(str); } dictModuleInfos.Add(moduleId, moduleInfo); if (libraryPrefix.StartsWith("Qt")) moduleInfo.proVarQT = libraryPrefix.Substring(2).ToLower(); else moduleInfo.proVarQT = libraryPrefix.ToLower(); return moduleInfo; }
public QtModuleInfo(QtModule id) { moduleId = id; }
private void AddMapping(CheckBox checkbox, QtModule moduleId) { moduleMap.Add(new ModuleMapItem(checkbox, moduleId)); }
public void AddModule(QtModule module) { if (HasModule(module)) return; QtVersionManager vm = QtVersionManager.The(); VersionInformation versionInfo = vm.GetVersionInfo(this.Project); if (versionInfo == null) versionInfo = vm.GetVersionInfo(vm.GetDefaultVersion()); foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); VCLinkerTool linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool"); QtModuleInfo info = QtModules.Instance.ModuleInformation(module); if (compiler != null) { foreach(string define in info.Defines) compiler.AddPreprocessorDefinition(define); if (!String.IsNullOrEmpty(info.IncludePath)) compiler.AddAdditionalIncludeDirectories(info.IncludePath); } if (linker != null) { List<string> moduleLibs = info.GetLibs(IsDebugConfiguration(config), versionInfo); LinkerToolWrapper linkerWrapper = new LinkerToolWrapper(linker); List<string> additionalDeps = linkerWrapper.AdditionalDependencies; bool dependenciesChanged = false; if (additionalDeps == null || additionalDeps.Count == 0) { additionalDeps = moduleLibs; dependenciesChanged = true; } else { foreach (string moduleLib in moduleLibs) if (!additionalDeps.Contains(moduleLib)) { additionalDeps.Add(moduleLib); dependenciesChanged = true; } } if (dependenciesChanged) linkerWrapper.AdditionalDependencies = additionalDeps; } #if ENABLE_WINCE if (info.HasDLL && config.DeploymentTool != null) AddDeploySettings(null, module, config, info, versionInfo); #endif } }
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); } }
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); }
public void RemoveModule(QtModule module) { foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); VCLinkerTool linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool"); QtModuleInfo info = QtModules.Instance.ModuleInformation(module); if (compiler != null) { foreach (string define in info.Defines) compiler.RemovePreprocessorDefinition(define); List<string> additionalIncludeDirs = compiler.AdditionalIncludeDirectories; if (additionalIncludeDirs != null) { List<string> lst = new List<string>(additionalIncludeDirs); if (!String.IsNullOrEmpty(info.IncludePath)) { lst.Remove(info.IncludePath); lst.Remove('\"' + info.IncludePath + '\"'); } compiler.AdditionalIncludeDirectories = lst; } } if (linker != null && linker.AdditionalDependencies != null) { LinkerToolWrapper linkerWrapper = new LinkerToolWrapper(linker); QtVersionManager vm = QtVersionManager.The(); VersionInformation versionInfo = vm.GetVersionInfo(this.Project); if (versionInfo == null) versionInfo = vm.GetVersionInfo(vm.GetDefaultVersion()); List<string> moduleLibs = info.GetLibs(IsDebugConfiguration(config), versionInfo); List<string> additionalDependencies = linkerWrapper.AdditionalDependencies; bool dependenciesChanged = false; foreach (string moduleLib in moduleLibs) if (additionalDependencies.Remove(moduleLib)) dependenciesChanged = true; if (dependenciesChanged) linkerWrapper.AdditionalDependencies = additionalDependencies; } #if ENABLE_WINCE if (info.HasDLL && config.DeploymentTool != null) RemoveDeploySettings(null, module, config, info); #endif } }
public bool HasModule(QtModule module) { bool foundInIncludes = false; bool foundInLibs = false; QtVersionManager vm = QtVersionManager.The(); VersionInformation versionInfo = vm.GetVersionInfo(this.Project); if (versionInfo == null) versionInfo = vm.GetVersionInfo(vm.GetDefaultVersion()); foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); VCLinkerTool linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool"); QtModuleInfo info = QtModules.Instance.ModuleInformation(module); if (compiler != null) { if (String.IsNullOrEmpty(info.IncludePath)) break; if (compiler.GetAdditionalIncludeDirectories() == null) continue; string fixedIncludeDir = FixFilePathForComparison(info.IncludePath); string[] includeDirs = compiler.GetAdditionalIncludeDirectoriesList(); foreach (string dir in includeDirs) { if (FixFilePathForComparison(dir) == fixedIncludeDir) { foundInIncludes = true; break; } } } if (foundInIncludes) break; List<string> libs = null; if (linker != null) { LinkerToolWrapper linkerWrapper = new LinkerToolWrapper(linker); libs = linkerWrapper.AdditionalDependencies; } if (libs != null) { foundInLibs = true; List<string> moduleLibs = info.GetLibs(IsDebugConfiguration(config), versionInfo); foreach (string moduleLib in moduleLibs) { if (!libs.Contains(moduleLib)) { foundInLibs = false; break; } } } } return foundInIncludes || foundInLibs; }