/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 | | CompileTrace, |
21 | | CDashSubmit, |
22 | | CDashVerbose, |
23 | | Trace |
24 | | }; |
25 | | static std::vector<std::string> const OptionString; |
26 | | |
27 | | enum Hook |
28 | | { |
29 | | PostGenerate, |
30 | | PreBuild, |
31 | | PostBuild, |
32 | | PreCMakeBuild, |
33 | | PostCMakeBuild, |
34 | | PostCTest, |
35 | | PostCMakeInstall, |
36 | | PostCMakeWorkflow, |
37 | | PrepareForCDash, |
38 | | Manual |
39 | | }; |
40 | | static std::vector<std::string> const HookString; |
41 | | |
42 | | struct Version |
43 | | { |
44 | | int Major = 0; |
45 | | int Minor = 0; |
46 | | }; |
47 | | |
48 | | struct Callback |
49 | | { |
50 | | std::string Command; |
51 | | Version DataVersion; |
52 | | }; |
53 | | |
54 | | struct QueryJSONRoot |
55 | | { |
56 | | std::vector<cmInstrumentationQuery::Option> options; |
57 | | std::vector<cmInstrumentationQuery::Hook> hooks; |
58 | | std::vector<std::string> callbacks; |
59 | | Version version; |
60 | | }; |
61 | | |
62 | 0 | cmInstrumentationQuery() = default; |
63 | | bool ReadJSON(std::string const& file, std::string& errorMessage, |
64 | | std::set<Option>& options, std::set<Hook>& hooks, |
65 | | std::vector<Callback>& callbacks); |
66 | | QueryJSONRoot queryRoot; |
67 | | cmJSONState parseState; |
68 | | static Version LatestDataVersion(); |
69 | | static bool ValidDataVersion(Version version); |
70 | | }; |