2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2013-01-02 11:13:29 +00:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-09-19 12:28:29 +00:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the tools applications of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
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
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
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
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-04-27 10:05:43 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-05-24 09:34:08 +00:00
|
|
|
** GNU General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2012-01-24 06:17:24 +00:00
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** $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 MakeItem;
|
|
|
|
|
|
|
|
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 appendMakeItem(int inList, const QString &item);
|
|
|
|
void generateConfigfiles();
|
2012-02-14 09:01:17 +00:00
|
|
|
void detectArch();
|
|
|
|
void generateQConfigPri();
|
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 {
|
|
|
|
App,
|
|
|
|
Lib,
|
|
|
|
Subdirs
|
|
|
|
};
|
|
|
|
|
|
|
|
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 allConfigs;
|
|
|
|
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;
|
|
|
|
// makeList[0] for qt and qtmain
|
|
|
|
// makeList[1] for subdirs and libs
|
|
|
|
// makeList[2] for the rest
|
|
|
|
QList<MakeItem*> makeList[3];
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
|
|
|
|
QMap<QString,QString> licenseInfo;
|
|
|
|
QString outputLine;
|
|
|
|
|
|
|
|
QTextStream outStream;
|
|
|
|
QString sourcePath, buildPath;
|
|
|
|
QDir sourceDir, buildDir;
|
|
|
|
|
|
|
|
// Variables for usage output
|
|
|
|
int optionIndent;
|
|
|
|
int descIndent;
|
|
|
|
int outputWidth;
|
|
|
|
|
2013-08-09 11:34:04 +00:00
|
|
|
void substPrefix(QString *path);
|
|
|
|
|
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();
|
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
|
|
|
class MakeItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MakeItem( const QString &d, const QString &p, const QString &t, Configure::ProjectType qt )
|
|
|
|
: directory( d ),
|
|
|
|
proFile( p ),
|
|
|
|
target( t ),
|
|
|
|
qmakeTemplate( qt )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
QString directory;
|
|
|
|
QString proFile;
|
|
|
|
QString target;
|
|
|
|
Configure::ProjectType qmakeTemplate;
|
|
|
|
};
|
|
|
|
|
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
|