Files
CMake/Source/cmQtAutoRcc.h
Sebastian Holtermann d867e05892 Autogen: Use JSON instead of CMake script for info files
We used to store information for the _autogen target in a CMake script
file AutogenInfo.cmake, which was imported by a temporary cmake instance in
the _autogen target.  This introduced the overhead of creating a temporary
cmake instance and inherited the limitations of the CMake language which
only supports lists.

This patch introduces JSON files to pass information to AUTORCC and
autogen_ targets.  JSON files are more flexible for passing data, e.g. they
support nested lists.

The patch has the side effects that

- AutogenInfo.cmake is renamed to AutogenInfo.json
- AutogenOldSettings.txt is renamed to AutogenUsed.txt
- RCC<qrcBaseName><checksum>Info.cmake is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Info.json
- RCC<qrcBaseName><checksum>.lock is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Lock.lock
- RCC<qrcBaseName><checksum>Settings.txt is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Used.txt
2019-09-25 10:07:09 -04:00

79 lines
1.9 KiB
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmQtAutoRcc_h
#define cmQtAutoRcc_h
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmFileLock.h"
#include "cmFileTime.h"
#include "cmQtAutoGenerator.h"
#include <string>
#include <vector>
/** \class cmQtAutoRcc
* \brief AUTORCC generator
*/
class cmQtAutoRcc : public cmQtAutoGenerator
{
public:
cmQtAutoRcc();
~cmQtAutoRcc() override;
cmQtAutoRcc(cmQtAutoRcc const&) = delete;
cmQtAutoRcc& operator=(cmQtAutoRcc const&) = delete;
private:
// -- Utility
bool IsMultiConfig() const { return MultiConfig_; }
std::string MultiConfigOutput() const;
// -- Abstract processing interface
bool InitFromInfo() override;
bool Process() override;
// -- Settings file
bool SettingsFileRead();
bool SettingsFileWrite();
// -- Tests
bool TestQrcRccFiles(bool& generate);
bool TestResources(bool& generate);
bool TestInfoFile();
// -- Generation
bool GenerateRcc();
bool GenerateWrapper();
private:
// -- Config settings
bool MultiConfig_ = false;
// -- Directories
std::string AutogenBuildDir_;
std::string IncludeDir_;
// -- Qt environment
std::string RccExecutable_;
cmFileTime RccExecutableTime_;
std::vector<std::string> RccListOptions_;
// -- Job
std::string LockFile_;
cmFileLock LockFileLock_;
std::string QrcFile_;
std::string QrcFileName_;
std::string QrcFileDir_;
cmFileTime QrcFileTime_;
std::string RccPathChecksum_;
std::string RccFileName_;
std::string RccFileOutput_;
std::string RccFilePublic_;
cmFileTime RccFileTime_;
std::string Reason;
std::vector<std::string> Options_;
std::vector<std::string> Inputs_;
// -- Settings file
std::string SettingsFile_;
std::string SettingsString_;
bool SettingsChanged_ = false;
bool BuildFileChanged_ = false;
};
#endif