Beispiel #1
0
        private VersionInformation(string qtDirIn)
        {
            qtDir = qtDirIn;
            SetupPlatformSpecificData();

            // Find version number
            try {
                var qmakeQuery = new QMakeQuery(this);
                var strVersion = qmakeQuery.query("QT_VERSION");
                if (qmakeQuery.ErrorValue == 0 && strVersion.Length > 0)
                {
                    var versionParts = strVersion.Split('.');
                    if (versionParts.Length != 3)
                    {
                        qtDir = null;
                        return;
                    }
                    qtMajor = uint.Parse(versionParts[0]);
                    qtMinor = uint.Parse(versionParts[1]);
                    qtPatch = uint.Parse(versionParts[2]);
                }
                else
                {
                    var inF         = new StreamReader(Locate_qglobal_h());
                    var rgxpVersion = new Regex("#define\\s*QT_VERSION\\s*0x(?<number>\\d+)", RegexOptions.Multiline);
                    var contents    = inF.ReadToEnd();
                    inF.Close();
                    var matchObj = rgxpVersion.Match(contents);
                    if (!matchObj.Success)
                    {
                        qtDir = null;
                        return;
                    }

                    strVersion = matchObj.Groups[1].ToString();
                    var version = Convert.ToUInt32(strVersion, 16);
                    qtMajor = version >> 16;
                    qtMinor = (version >> 8) & 0xFF;
                    qtPatch = version & 0xFF;
                }
                qt5Version = (qtMajor == 5);

                try {
                    QtInstallDocs = qmakeQuery.query("QT_INSTALL_DOCS");
                } catch { }
            } catch {
                qtDir = null;
            }
        }
Beispiel #2
0
        public QMakeConf(VersionInformation versionInfo)
        {
            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))
            {
                var qmakeQuery   = new QMakeQuery(versionInfo);
                var qmakespecDir = qmakeQuery.query("QMAKE_XSPEC");

                if (qmakeQuery.ErrorValue == 0 && !string.IsNullOrEmpty(qmakespecDir))
                {
                    QMakeSpecDirectory = Path.Combine(versionInfo.qtDir, "mkspecs", qmakespecDir);
                    qmakeConf          = Path.Combine(QMakeSpecDirectory, "qmake.conf");
                }

                if (qmakeQuery.ErrorValue != 0 || !File.Exists(qmakeConf))
                {
                    throw new QtVSException("qmake.conf expected at " + qmakeConf + " not found");
                }
            }

            ParseFile(qmakeConf);
        }
Beispiel #3
0
        public bool isWinRT()
        {
            var    qmakeQuery = new QMakeQuery(this);
            string qmakeXSpec;

            try {
                qmakeXSpec = qmakeQuery.query("QMAKE_XSPEC");
            }
            catch {
                throw new QtVSException("Error starting qmake process");
            }

            if (qmakeQuery.ErrorValue != 0 && string.IsNullOrEmpty(qmakeXSpec))
            {
                throw new QtVSException("Error: unexpected result of qmake query");
            }

            return(qmakeXSpec.StartsWith("winrt"));
        }