2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2015-01-28 08:44:43 +00:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
** Contact: http://www.qt.io/licensing/
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the tools applications of the Qt Toolkit.
|
|
|
|
**
|
2014-08-21 13:51:22 +00:00
|
|
|
** $QT_BEGIN_LICENSE:LGPL21$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see http://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at http://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-08-21 13:51:22 +00:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2015-01-28 08:44:43 +00:00
|
|
|
** As a special exception, The Qt Company gives you certain additional
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2011-04-27 10:05:43 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <qmap.h>
|
|
|
|
#include <qstring.h>
|
|
|
|
#include <qstringlist.h>
|
|
|
|
#include <qlist.h>
|
2013-07-15 14:45:44 +00:00
|
|
|
#include <qbuffer.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <qtextstream.h>
|
|
|
|
#include <qdir.h>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
class Configure
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Configure( int& argc, char** argv );
|
|
|
|
~Configure();
|
|
|
|
|
|
|
|
void parseCmdLine();
|
|
|
|
void validateArgs();
|
|
|
|
bool displayHelp();
|
|
|
|
|
|
|
|
QString defaultTo(const QString &option);
|
|
|
|
bool checkAvailability(const QString &part);
|
2012-06-14 14:17:11 +00:00
|
|
|
void generateQConfigCpp();
|
|
|
|
void buildQmake();
|
2011-04-27 10:05:43 +00:00
|
|
|
void autoDetection();
|
|
|
|
bool verifyConfiguration();
|
|
|
|
|
|
|
|
void generateOutputVars();
|
|
|
|
void generateHeaders();
|
|
|
|
void generateCachefile();
|
|
|
|
void displayConfig();
|
|
|
|
void generateMakefiles();
|
|
|
|
void generateConfigfiles();
|
2012-02-14 09:01:17 +00:00
|
|
|
void detectArch();
|
|
|
|
void generateQConfigPri();
|
2013-08-09 12:10:15 +00:00
|
|
|
void generateQDevicePri();
|
2013-05-17 15:53:03 +00:00
|
|
|
void prepareConfigTests();
|
2011-04-27 10:05:43 +00:00
|
|
|
void showSummary();
|
|
|
|
QString firstLicensePath();
|
|
|
|
|
|
|
|
bool showLicense(QString licenseFile);
|
|
|
|
void readLicense();
|
|
|
|
|
|
|
|
QString addDefine(QString def);
|
|
|
|
|
|
|
|
enum ProjectType {
|
2014-01-13 14:48:44 +00:00
|
|
|
App,
|
|
|
|
Lib,
|
|
|
|
Subdirs
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ProjectType projectType( const QString& proFileName );
|
|
|
|
bool isDone();
|
|
|
|
bool isOk();
|
2012-06-08 13:20:35 +00:00
|
|
|
|
|
|
|
int platform() const;
|
|
|
|
QString platformName() const;
|
|
|
|
QString qpaPlatformName() const;
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
2012-11-02 09:41:22 +00:00
|
|
|
bool checkAngleAvailability(QString *errorMessage = 0) const;
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
// Our variable dictionaries
|
|
|
|
QMap<QString,QString> dictionary;
|
2013-06-17 09:21:40 +00:00
|
|
|
QStringList allBuildParts;
|
2012-03-21 10:09:59 +00:00
|
|
|
QStringList defaultBuildParts;
|
|
|
|
QStringList buildParts;
|
|
|
|
QStringList nobuildParts;
|
2013-02-18 16:37:21 +00:00
|
|
|
QStringList skipModules;
|
2011-04-27 10:05:43 +00:00
|
|
|
QStringList licensedModules;
|
|
|
|
QStringList allSqlDrivers;
|
|
|
|
QStringList disabledModules;
|
|
|
|
QStringList enabledModules;
|
|
|
|
QStringList modules;
|
|
|
|
// QStringList sqlDrivers;
|
|
|
|
QStringList configCmdLine;
|
|
|
|
QStringList qmakeConfig;
|
|
|
|
QStringList qtConfig;
|
|
|
|
|
|
|
|
QStringList qmakeSql;
|
|
|
|
QStringList qmakeSqlPlugins;
|
|
|
|
|
|
|
|
QStringList qmakeStyles;
|
|
|
|
QStringList qmakeStylePlugins;
|
|
|
|
|
|
|
|
QStringList qmakeVars;
|
|
|
|
QStringList qmakeDefines;
|
|
|
|
QStringList qmakeIncludes;
|
|
|
|
QStringList qmakeLibs;
|
|
|
|
QString opensslLibs;
|
2012-07-26 15:16:29 +00:00
|
|
|
QString opensslLibsDebug;
|
|
|
|
QString opensslLibsRelease;
|
2012-08-06 18:34:34 +00:00
|
|
|
QString opensslPath;
|
|
|
|
QString dbusPath;
|
2014-07-09 09:58:44 +00:00
|
|
|
QString dbusHostPath;
|
2012-08-06 18:34:34 +00:00
|
|
|
QString mysqlPath;
|
2011-04-27 10:05:43 +00:00
|
|
|
QString psqlLibs;
|
2012-08-20 17:54:58 +00:00
|
|
|
QString zlibLibs;
|
2011-04-27 10:05:43 +00:00
|
|
|
QString sybase;
|
|
|
|
QString sybaseLibs;
|
|
|
|
|
|
|
|
QString outputLine;
|
|
|
|
|
|
|
|
QTextStream outStream;
|
|
|
|
QString sourcePath, buildPath;
|
|
|
|
QDir sourceDir, buildDir;
|
|
|
|
|
|
|
|
// Variables for usage output
|
|
|
|
int optionIndent;
|
|
|
|
int descIndent;
|
|
|
|
int outputWidth;
|
|
|
|
|
2014-12-04 15:03:13 +00:00
|
|
|
QString confStrOffsets[2];
|
|
|
|
QString confStrings[2];
|
|
|
|
int confStringOff;
|
2013-08-09 11:34:04 +00:00
|
|
|
|
2014-12-04 15:03:13 +00:00
|
|
|
void addConfStr(int group, const QString &val);
|
2012-03-28 14:00:06 +00:00
|
|
|
QString formatPath(const QString &path);
|
|
|
|
QString formatPaths(const QStringList &paths);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-11-01 13:31:16 +00:00
|
|
|
QString locateFile(const QString &fileName) const;
|
|
|
|
bool findFile(const QString &fileName) const { return !locateFile(fileName).isEmpty(); }
|
|
|
|
static QString findFileInPaths(const QString &fileName, const QStringList &paths);
|
2011-04-27 10:05:43 +00:00
|
|
|
void reloadCmdLine();
|
|
|
|
void saveCmdLine();
|
|
|
|
|
2014-07-02 12:43:18 +00:00
|
|
|
void addSysroot(QString *command);
|
2011-12-30 00:44:16 +00:00
|
|
|
bool tryCompileProject(const QString &projectPath, const QString &extraOptions = QString());
|
2012-09-20 12:11:25 +00:00
|
|
|
bool compilerSupportsFlag(const QString &compilerAndArgs);
|
2011-12-30 00:44:16 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
void desc(const char *description, int startingAt = 0, int wrapIndent = 0);
|
|
|
|
void desc(const char *option, const char *description, bool skipIndent = false, char fillChar = '.');
|
|
|
|
void desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar = '.');
|
|
|
|
void applySpecSpecifics();
|
2015-02-05 14:45:53 +00:00
|
|
|
|
|
|
|
QString formatConfigPath(const char *var);
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
2013-07-15 14:45:44 +00:00
|
|
|
class FileWriter : public QTextStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FileWriter(const QString &name);
|
|
|
|
bool flush();
|
|
|
|
private:
|
|
|
|
QString m_name;
|
|
|
|
QBuffer m_buffer;
|
|
|
|
};
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QT_END_NAMESPACE
|