60e5a1c8ef
This change implements the required infrastructure to modularize the new configuration system. This requires a hierarchy of configuration files, both for handling multiple repositories and for individual modules inside the same repository. When configuring, they all need to get loaded first, as command line processing needs to know about all possible command line options. When the command line has been processed, the individual configuration files need to get processed one after the other and independently from each other. Configure is now automatically invoked when building the a project tree's "root" project; this works with both modular and top-level builds of Qt (the latter with an according change in the super repo). As an immediate consequence, the -skip option moves to the super repo with a different implementation, as configuration is now done after the repo list is determined. The option belongs there anyway. This commit also adds an optional testDir entry to the json file. Like this, we can still have all configure tests in qtbase/config.tests and the configuration file in, e.g., corelib can reference those. The files section can now be left out as long as a 'module' entry is present, specifying the module name. The names of the files to generate can then be deduced from that name. We still need to be able to specify names directly for the global configuration files. qtConfig() now also queries features which are module-specific. As it is sometimes necessary to query the configuration of modules which should not be actually linked (and cannot in the case of subdirs projects), the new variable QT_FOR_CONFIG which allows specifying configuration-only dependencies is introduced. Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Change-Id: Id1b518a3aa34044748b87fb8fac14d79653f6b18 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
106 lines
2.7 KiB
C++
106 lines
2.7 KiB
C++
/****************************************************************************
|
|
**
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
** Contact: https://www.qt.io/licensing/
|
|
**
|
|
** This file is part of the tools applications of the Qt Toolkit.
|
|
**
|
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
|
** 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 The Qt Company. For licensing terms
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
**
|
|
** GNU General Public License Usage
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
** General Public License version 3 as published by the Free Software
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
** included in the packaging of this file. Please review the following
|
|
** information to ensure the GNU General Public License requirements will
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
**
|
|
** $QT_END_LICENSE$
|
|
**
|
|
****************************************************************************/
|
|
|
|
#include <qmap.h>
|
|
#include <qstring.h>
|
|
#include <qstringlist.h>
|
|
#include <qlist.h>
|
|
#include <qbuffer.h>
|
|
#include <qtextstream.h>
|
|
#include <qdir.h>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class Configure
|
|
{
|
|
public:
|
|
Configure( int& argc, char** argv );
|
|
~Configure();
|
|
|
|
void parseCmdLine();
|
|
|
|
void generateQConfigCpp();
|
|
void buildQmake();
|
|
|
|
void prepareConfigureInput();
|
|
void configure();
|
|
|
|
void generateHeaders();
|
|
void generateQDevicePri();
|
|
void prepareConfigTests();
|
|
|
|
bool showLicense(QString licenseFile);
|
|
void readLicense();
|
|
|
|
bool isDone();
|
|
bool isOk();
|
|
|
|
int platform() const;
|
|
QString platformName() const;
|
|
|
|
private:
|
|
int verbose;
|
|
|
|
// Our variable dictionaries
|
|
QMap<QString,QString> dictionary;
|
|
QStringList configCmdLine;
|
|
|
|
QString outputLine;
|
|
|
|
QTextStream outStream;
|
|
QString sourcePath, buildPath;
|
|
QString sourcePathMangled, buildPathMangled;
|
|
QDir sourceDir, buildDir;
|
|
|
|
QString confStrOffsets[2];
|
|
QString confStrings[2];
|
|
int confStringOff;
|
|
|
|
void addConfStr(int group, const QString &val);
|
|
QString formatPath(const QString &path);
|
|
|
|
bool reloadCmdLine(int idx);
|
|
void saveCmdLine();
|
|
|
|
void applySpecSpecifics();
|
|
|
|
QString formatConfigPath(const char *var);
|
|
};
|
|
|
|
class FileWriter : public QTextStream
|
|
{
|
|
public:
|
|
FileWriter(const QString &name);
|
|
bool flush();
|
|
private:
|
|
QString m_name;
|
|
QBuffer m_buffer;
|
|
};
|
|
|
|
QT_END_NAMESPACE
|