/src/CMake/Source/cmInstrumentationQuery.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include <set> |
6 | | #include <string> |
7 | | #include <vector> |
8 | | |
9 | | #include "cmJSONState.h" |
10 | | |
11 | | class cmInstrumentationQuery |
12 | | { |
13 | | |
14 | | public: |
15 | | enum Option |
16 | | { |
17 | | StaticSystemInformation, |
18 | | DynamicSystemInformation, |
19 | | CaptureOutput, |
20 | | ProcessMetrics, |
21 | | CompileTrace, |
22 | | CDashSubmit, |
23 | | CDashVerbose, |
24 | | Trace |
25 | | }; |
26 | | static std::vector<std::string> const OptionString; |
27 | | |
28 | | enum Hook |
29 | | { |
30 | | PostGenerate, |
31 | | PreBuild, |
32 | | PostBuild, |
33 | | PreCMakeBuild, |
34 | | PostCMakeBuild, |
35 | | PostCTest, |
36 | | PostCMakeInstall, |
37 | | PostCMakeWorkflow, |
38 | | PrepareForCDash, |
39 | | Manual |
40 | | }; |
41 | | static std::vector<std::string> const HookString; |
42 | | |
43 | | struct Version |
44 | | { |
45 | | int Major = 0; |
46 | | int Minor = 0; |
47 | | }; |
48 | | |
49 | | struct Callback |
50 | | { |
51 | | std::string Command; |
52 | | Version DataVersion; |
53 | | }; |
54 | | |
55 | | struct QueryJSONRoot |
56 | | { |
57 | | std::vector<cmInstrumentationQuery::Option> options; |
58 | | std::vector<cmInstrumentationQuery::Hook> hooks; |
59 | | std::vector<std::string> callbacks; |
60 | | Version version; |
61 | | }; |
62 | | |
63 | 0 | cmInstrumentationQuery() = default; |
64 | | bool ReadJSON(std::string const& file, std::string& errorMessage, |
65 | | std::set<Option>& options, std::set<Hook>& hooks, |
66 | | std::vector<Callback>& callbacks); |
67 | | QueryJSONRoot queryRoot; |
68 | | cmJSONState parseState; |
69 | | static Version LatestDataVersion(); |
70 | | static bool ValidDataVersion(Version version); |
71 | | }; |