123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- #ifndef QCMake_h
- #define QCMake_h
- #include "cmConfigure.h"
- #include "cmake.h"
- #ifdef _MSC_VER
- #pragma warning(disable : 4127)
- #pragma warning(disable : 4512)
- #endif
- #include <vector>
- #include <QAtomicInt>
- #include <QList>
- #include <QMetaType>
- #include <QObject>
- #include <QString>
- #include <QStringList>
- #include <QVariant>
- struct QCMakeProperty
- {
- enum PropertyType
- {
- BOOL,
- PATH,
- FILEPATH,
- STRING
- };
- QString Key;
- QVariant Value;
- QStringList Strings;
- 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;
- }
- };
- typedef QList<QCMakeProperty> QCMakePropertyList;
- Q_DECLARE_METATYPE(QCMakeProperty)
- Q_DECLARE_METATYPE(QCMakePropertyList)
- class QCMake : public QObject
- {
- Q_OBJECT
- public:
- QCMake(QObject* p = nullptr);
- ~QCMake();
- public slots:
-
- void loadCache(const QString& dir);
-
- void setSourceDirectory(const QString& dir);
-
- void setBinaryDirectory(const QString& dir);
-
- void setGenerator(const QString& generator);
-
- void setToolset(const QString& toolset);
-
- void configure();
-
- void generate();
-
- void open();
-
- void setProperties(const QCMakePropertyList&);
-
-
- void interrupt();
-
- void deleteCache();
-
- void reloadCache();
-
- void setDebugOutput(bool);
-
- bool getSuppressDevWarnings();
-
- void setSuppressDevWarnings(bool value);
-
- bool getSuppressDeprecatedWarnings();
-
- void setSuppressDeprecatedWarnings(bool value);
-
- bool getDevWarningsAsErrors();
-
- void setDevWarningsAsErrors(bool value);
-
- bool getDeprecatedWarningsAsErrors();
-
- void setDeprecatedWarningsAsErrors(bool value);
-
- void setWarnUninitializedMode(bool value);
-
- void setWarnUnusedMode(bool value);
-
- void checkOpenPossible();
- public:
-
- QCMakePropertyList properties() const;
-
- QString binaryDirectory() const;
-
- QString sourceDirectory() const;
-
- QString generator() const;
-
- std::vector<cmake::GeneratorInfo> const& availableGenerators() const;
-
- bool getDebugOutput() const;
- signals:
-
-
- void propertiesChanged(const QCMakePropertyList& vars);
-
- void generatorChanged(const QString& gen);
-
-
- void sourceDirChanged(const QString& dir);
-
- void binaryDirChanged(const QString& dir);
-
- void progressChanged(const QString& msg, float percent);
-
- void configureDone(int error);
-
- void generateDone(int error);
-
- void outputMessage(const QString& msg);
-
- void errorMessage(const QString& msg);
-
- void debugOutputChanged(bool);
-
- void toolsetChanged(const QString& toolset);
-
- void openDone(bool successful);
-
- void openPossible(bool possible);
- protected:
- cmake* CMakeInstance;
- static bool interruptCallback(void*);
- 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;
- bool WarnUnusedMode;
- bool WarnUnusedAllMode;
- QString SourceDirectory;
- QString BinaryDirectory;
- QString Generator;
- QString Toolset;
- std::vector<cmake::GeneratorInfo> AvailableGenerators;
- QString CMakeExecutable;
- QAtomicInt InterruptFlag;
- };
- #endif
|