CMake/Source/QtDialog/QCMake.h

177 lines
5.5 KiB
C
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 22:01:08 +03:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef QCMake_h
#define QCMake_h
2016-09-05 23:12:36 +03:00
#include <cmConfigure.h>
#include "cmake.h"
#ifdef _MSC_VER
#pragma warning(disable : 4127)
#pragma warning(disable : 4512)
#endif
2007-11-02 18:50:17 +03:00
#include <vector>
#include <QAtomicInt>
#include <QList>
#include <QMetaType>
2007-11-02 18:50:17 +03:00
#include <QObject>
#include <QString>
#include <QStringList>
#include <QVariant>
2007-11-02 18:50:17 +03:00
/// struct to represent cmake properties in Qt
/// Value is of type String or Bool
struct QCMakeProperty
2007-11-02 18:50:17 +03:00
{
enum PropertyType
{
BOOL,
PATH,
FILEPATH,
STRING
};
2007-11-02 18:50:17 +03:00
QString Key;
QVariant Value;
QStringList Strings;
2007-11-02 18:50:17 +03:00
QString Help;
PropertyType Type;
bool Advanced;
bool operator==(const QCMakeProperty& other) const
{
return this->Key == other.Key;
}
bool operator<(const QCMakeProperty& other) const
{
return this->Key < other.Key;
}
2007-11-02 18:50:17 +03:00
};
// list of properties
typedef QList<QCMakeProperty> QCMakePropertyList;
// allow QVariant to be a property or list of properties
Q_DECLARE_METATYPE(QCMakeProperty)
Q_DECLARE_METATYPE(QCMakePropertyList)
2007-11-02 18:50:17 +03:00
/// Qt API for CMake library.
/// Wrapper like class allows for easier integration with
/// Qt features such as, signal/slot connections, multi-threading, etc..
2007-11-02 18:50:17 +03:00
class QCMake : public QObject
{
Q_OBJECT
public:
2016-09-05 23:12:36 +03:00
QCMake(QObject* p = CM_NULLPTR);
2007-11-02 18:50:17 +03:00
~QCMake();
public slots:
/// load the cache file in a directory
2007-11-02 18:50:17 +03:00
void loadCache(const QString& dir);
/// set the source directory containing the source
2007-11-02 18:50:17 +03:00
void setSourceDirectory(const QString& dir);
/// set the binary directory to build in
2007-11-02 18:50:17 +03:00
void setBinaryDirectory(const QString& dir);
/// set the desired generator to use
2007-11-02 18:50:17 +03:00
void setGenerator(const QString& generator);
/// set the desired generator to use
void setToolset(const QString& toolset);
/// do the configure step
2007-11-02 18:50:17 +03:00
void configure();
/// generate the files
2007-11-02 18:50:17 +03:00
void generate();
/// set the property values
void setProperties(const QCMakePropertyList&);
/// interrupt the configure or generate process (if connecting, make a direct
/// connection)
2007-11-02 18:50:17 +03:00
void interrupt();
/// delete the cache in binary directory
void deleteCache();
/// reload the cache in binary directory
void reloadCache();
/// set whether to do debug output
void setDebugOutput(bool);
/// get whether to do suppress dev warnings
bool getSuppressDevWarnings();
/// set whether to do suppress dev warnings
void setSuppressDevWarnings(bool value);
/// get whether to do suppress deprecated warnings
bool getSuppressDeprecatedWarnings();
/// set whether to do suppress deprecated warnings
void setSuppressDeprecatedWarnings(bool value);
/// get whether to treat developer (author) warnings as errors
bool getDevWarningsAsErrors();
/// set whether to treat developer (author) warnings as errors
void setDevWarningsAsErrors(bool value);
/// get whether to treat deprecated warnings as errors
bool getDeprecatedWarningsAsErrors();
/// set whether to treat deprecated warnings as errors
void setDeprecatedWarningsAsErrors(bool value);
/// set whether to run cmake with warnings about uninitialized variables
void setWarnUninitializedMode(bool value);
2010-08-25 20:43:02 +04:00
/// set whether to run cmake with warnings about unused variables
void setWarnUnusedMode(bool value);
2007-11-02 18:50:17 +03:00
public:
/// get the list of cache properties
QCMakePropertyList properties() const;
/// get the current binary directory
QString binaryDirectory() const;
/// get the current source directory
QString sourceDirectory() const;
/// get the current generator
QString generator() const;
/// get the available generators
std::vector<cmake::GeneratorInfo> const& availableGenerators() const;
/// get whether to do debug output
bool getDebugOutput() const;
2007-11-02 18:50:17 +03:00
signals:
/// signal when properties change (during read from disk or configure
/// process)
void propertiesChanged(const QCMakePropertyList& vars);
/// signal when the generator changes
2007-11-02 18:50:17 +03:00
void generatorChanged(const QString& gen);
/// signal when the source directory changes (binary directory already
/// containing a CMakeCache.txt file)
2007-11-02 18:50:17 +03:00
void sourceDirChanged(const QString& dir);
/// signal when the binary directory changes
void binaryDirChanged(const QString& dir);
/// signal for progress events
2007-11-02 18:50:17 +03:00
void progressChanged(const QString& msg, float percent);
/// signal when configure is done
2007-11-02 18:50:17 +03:00
void configureDone(int error);
/// signal when generate is done
2007-11-02 18:50:17 +03:00
void generateDone(int error);
/// signal when there is an output message
void outputMessage(const QString& msg);
/// signal when there is an error message
void errorMessage(const QString& msg);
/// signal when debug output changes
void debugOutputChanged(bool);
/// signal when the toolset changes
void toolsetChanged(const QString& toolset);
2007-11-02 18:50:17 +03:00
protected:
cmake* CMakeInstance;
static bool interruptCallback(void*);
2007-11-02 18:50:17 +03:00
static void progressCallback(const char* msg, float percent, void* cd);
static void messageCallback(const char* msg, const char* title, bool&,
void* cd);
static void stdoutCallback(const char* msg, size_t len, void* cd);
static void stderrCallback(const char* msg, size_t len, void* cd);
bool WarnUninitializedMode;
2010-08-25 20:43:02 +04:00
bool WarnUnusedMode;
bool WarnUnusedAllMode;
2007-11-02 18:50:17 +03:00
QString SourceDirectory;
QString BinaryDirectory;
QString Generator;
QString Toolset;
std::vector<cmake::GeneratorInfo> AvailableGenerators;
2007-11-02 18:50:17 +03:00
QString CMakeExecutable;
QAtomicInt InterruptFlag;
2007-11-02 18:50:17 +03:00
};
#endif // QCMake_h