File indexing completed on 2024-05-19 04:48:24
0001 #ifndef CMAKEDATA_H 0002 #define CMAKEDATA_H 0003 0004 #include <QHash> 0005 #include <QList> 0006 #include <QString> 0007 #include <QUrl> 0008 #include <QObject> 0009 #include <QVector> 0010 0011 struct CMakeFile 0012 { 0013 QList<QUrl> includes; 0014 QList<QUrl> frameworkDirectories; 0015 QString compileFlags; 0016 QString language; 0017 QString group; 0018 QHash<QString, QString> defines; 0019 0020 void addDefine(const QString& define); 0021 0022 bool isEmpty() const 0023 { 0024 return includes.isEmpty() && frameworkDirectories.isEmpty() 0025 && compileFlags.isEmpty() && defines.isEmpty(); 0026 } 0027 }; 0028 Q_DECLARE_TYPEINFO(CMakeFile, Q_MOVABLE_TYPE); 0029 0030 struct CMakeFilesCompilationData 0031 { 0032 QHash<QUrl, CMakeFile> files; 0033 bool isValid = false; 0034 /// lookup table to quickly find a file path for a given folder path 0035 /// this greatly speeds up fallback searching for information on untracked files 0036 /// based on their folder path 0037 QHash<QUrl, QUrl> fileForFolder; //folder - file 0038 void rebuildFileForFolderMapping(); 0039 }; 0040 0041 struct CMakeTarget 0042 { 0043 Q_GADGET 0044 public: 0045 enum Type { Library, Executable, Custom }; 0046 Q_ENUM(Type) 0047 0048 static Type typeToEnum(const QString& target); 0049 0050 Type type; 0051 QString name; 0052 QList<QUrl> artifacts; 0053 QList<QUrl> sources; 0054 // see https://cmake.org/cmake/help/latest/prop_tgt/FOLDER.html 0055 QString folder; 0056 }; 0057 Q_DECLARE_TYPEINFO(CMakeTarget, Q_MOVABLE_TYPE); 0058 0059 typedef QHash<QUrl, QVector<CMakeTarget>> CMakeProjectTargets; 0060 0061 struct CMakeProjectData 0062 { 0063 QString name; 0064 CMakeFilesCompilationData compilationData; 0065 CMakeProjectTargets targets; 0066 struct CMakeFileFlags 0067 { 0068 bool isGenerated = false; 0069 bool isExternal = false; 0070 bool isCMake = false; 0071 }; 0072 QHash<QUrl, CMakeFileFlags> cmakeFiles; 0073 }; 0074 0075 Q_DECLARE_METATYPE(CMakeProjectData) 0076 Q_DECLARE_METATYPE(CMakeTarget) 0077 Q_DECLARE_METATYPE(CMakeProjectTargets) 0078 Q_DECLARE_METATYPE(CMakeFile) 0079 0080 #endif // CMAKEDATA_H