private FileInfo RunQmake(FileInfo mainInfo, string ext, bool recursive, VersionInformation vi) { ThreadHelper.ThrowIfNotOnUIThread(); var name = mainInfo.Name.Remove(mainInfo.Name.IndexOf('.')); var VCInfo = new FileInfo(mainInfo.DirectoryName + "\\" + name + ext); if (!VCInfo.Exists || DialogResult.Yes == MessageBox.Show(SR.GetString("ExportProject_ProjectExistsRegenerateOrReuse", VCInfo.Name), SR.GetString("ProjectExists"), MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Messages.Print("--- (Import): Generating new project of " + mainInfo.Name + " file"); var waitDialog = WaitDialog.Start( "Open Qt Project File", "Generating Visual Studio project...", delay: 2); var qmake = new QMakeImport(vi, mainInfo.FullName, recursive, dteObject); int exitCode = qmake.Run(setVCVars: true); waitDialog.Stop(); if (exitCode == 0) { return(VCInfo); } } return(null); }
public QMakeImport( VersionInformation qtVersion, string proFilePath, bool recursiveRun = false, EnvDTE.DTE dte = null) : base(qtVersion, dte) { ProFile = proFilePath; TemplatePrefix = "vc"; if (recursiveRun) { Recursive = true; } else { OutputFile = Path.ChangeExtension(proFilePath, ".vcxproj"); } Vars = new Dictionary <string, string> { { "QMAKE_INCDIR_QT", @"$(QTDIR)\include" }, { "QMAKE_LIBDIR", @"$(QTDIR)\lib" }, { "QMAKE_MOC", @"$(QTDIR)\bin\moc.exe" }, { "QMAKE_QMAKE", @"$(QTDIR)\bin\qmake.exe" }, }; }
public static VersionInformation Get(string qtDir) { qtDir = qtDir ?? Environment.GetEnvironmentVariable("QTDIR"); if (qtDir == null) { return(null); } try { qtDir = new FileInfo(qtDir).FullName.ToUpperInvariant(); } catch { return(null); } var versionInfo = _cache[qtDir] as VersionInformation; if (versionInfo == null) { versionInfo = new VersionInformation(qtDir); _cache.Add(qtDir, versionInfo); } else if (versionInfo.qtDir == null) { versionInfo = new VersionInformation(qtDir); _cache[qtDir] = versionInfo; } return(versionInfo); }
public VersionInformation GetVersionInfo(string name) { if (name == "$(DefaultQtVersion)") { name = GetDefaultVersion(); } if (name == null) { return(null); } if (versionCache == null) { versionCache = new Hashtable(); } var vi = versionCache[name] as VersionInformation; if (vi == null) { var qtdir = GetInstallPath(name); versionCache[name] = vi = VersionInformation.Get(qtdir); if (vi != null) { vi.name = name; } } return(vi); }
private static bool CheckQtVersion(VersionInformation vi) { if (vi.qtMajor < 5) { Messages.DisplayWarningMessage(SR.GetString("ExportProject_EditProjectFileManually")); return(false); } return(true); }
private void ImportQMakeSolution(FileInfo solutionFile, VersionInformation vi) { var projects = ParseProjectsFromSolution(solutionFile); foreach (var project in projects) { var projectInfo = new FileInfo(project); ImportQMakeProject(projectInfo, vi); } }
public QMakeConf(VersionInformation versionInfo, QMakeQuery qmakeQuery = null) { Entries = new Hashtable(); QMakeSpecDirectory = Path.Combine(versionInfo.qtDir, "mkspecs", "default"); var qmakeConf = Path.Combine(QMakeSpecDirectory, "qmake.conf"); // Starting from Qt5 beta2 there is no more "\\mkspecs\\default" folder available // To find location of "qmake.conf" there is a need to run "qmake -query" command // This is what happens below. if (!File.Exists(qmakeConf)) { if (qmakeQuery == null) { qmakeQuery = new QMakeQuery(versionInfo); } string qtPrefix = qmakeQuery["QT_INSTALL_PREFIX"]; if (string.IsNullOrEmpty(qtPrefix)) { throw new QtVSException("qmake error: no value for QT_INSTALL_PREFIX"); } string qtArchData = qmakeQuery["QT_INSTALL_ARCHDATA"]; if (string.IsNullOrEmpty(qtArchData)) { throw new QtVSException("qmake error: no value for QT_INSTALL_ARCHDATA"); } string qmakeXSpec = qmakeQuery["QMAKE_XSPEC"]; if (string.IsNullOrEmpty(qtArchData)) { throw new QtVSException("qmake error: no value for QMAKE_XSPEC"); } qmakeConf = Path.Combine(qtPrefix, qtArchData, "mkspecs", qmakeXSpec, "qmake.conf"); if (!File.Exists(qmakeConf)) { throw new QtVSException("qmake.conf expected at " + qmakeConf + " not found"); } } ParseFile(qmakeConf); }
private void ImportQMakeProject(FileInfo projectFile, VersionInformation vi) { var xmlProject = MsBuildProject.Load(projectFile.FullName); xmlProject.ReplacePath(vi.qtDir, "$(QTDIR)"); xmlProject.ReplacePath(projectFile.DirectoryName, "."); bool ok = xmlProject.AddQtMsBuildReferences(); if (ok) { ok = xmlProject.ConvertCustomBuildToQtMsBuild(); } if (ok) { ok = xmlProject.EnableMultiProcessorCompilation(); } if (ok) { string versionWin10SDK = HelperFunctions.GetWindows10SDKVersion(); if (!string.IsNullOrEmpty(versionWin10SDK)) { ok = xmlProject.SetDefaultWindowsSDKVersion(versionWin10SDK); } } if (ok) { ok = xmlProject.UpdateProjectFormatVersion(); } if (!ok) { Messages.Print( SR.GetString("ImportProject_CannotConvertProject", projectFile.Name)); } xmlProject.Save(); // Initialize Qt variables xmlProject.BuildTarget("QtVarsDesignTime"); }
public QMake(VersionInformation qtVersion, EnvDTE.DTE dte = null) { Debug.Assert(qtVersion != null); QtVersion = qtVersion; Dte = dte ?? VsServiceProvider.GetService <EnvDTE.DTE>(); }
public QMakeQuery(VersionInformation vi) : base(vi) { }
public List <string> GetLibs(bool isDebugCfg, VersionInformation vi) { return(GetLibs(isDebugCfg, vi.IsStaticBuild(), vi.LibInfix())); }