@@ -23,6 +23,9 @@ namespace vix::cli::process
2323{
2424 namespace fs = std::filesystem;
2525
26+ /* *
27+ * @brief Selects which linker strategy Vix should use for builds.
28+ */
2629 enum class LinkerMode
2730 {
2831 Auto,
@@ -31,6 +34,9 @@ namespace vix::cli::process
3134 Lld
3235 };
3336
37+ /* *
38+ * @brief Selects which compiler launcher/cache Vix should use.
39+ */
3440 enum class LauncherMode
3541 {
3642 Auto,
@@ -39,66 +45,241 @@ namespace vix::cli::process
3945 Ccache
4046 };
4147
48+ /* *
49+ * @brief Parsed options for the `vix build` command.
50+ *
51+ * This structure stores all user-facing build configuration flags
52+ * after command-line parsing.
53+ */
4254 struct Options
4355 {
44- // required by spec
45- std::string preset = " dev-ninja" ; // dev | dev-ninja | release
46- std::string targetTriple; // --target <triple>
56+ /* *
57+ * @brief Selected embedded preset.
58+ *
59+ * Supported values include:
60+ * - dev
61+ * - dev-ninja
62+ * - release
63+ */
64+ std::string preset = " dev-ninja" ;
65+
66+ /* *
67+ * @brief Cross-compilation target triple passed with `--target`.
68+ */
69+ std::string targetTriple;
70+
71+ /* *
72+ * @brief Optional sysroot path for cross-compilation.
73+ */
4774 std::string sysroot;
48- bool linkStatic = false ; // --static
4975
50- // build controls
51- int jobs = 0 ; // -j / --jobs
52- bool clean = false ; // --clean (force reconfigure)
53- bool quiet = false ; // -q / --quiet
54- std::string dir; // --dir/-d (optional)
76+ /* *
77+ * @brief Enables static linking when supported by the project.
78+ */
79+ bool linkStatic = false ;
80+
81+ /* *
82+ * @brief Number of parallel jobs to use for the build.
83+ *
84+ * A value of 0 means "auto-detect".
85+ */
86+ int jobs = 0 ;
87+
88+ /* *
89+ * @brief Forces a fresh configure step.
90+ */
91+ bool clean = false ;
92+
93+ /* *
94+ * @brief Enables quiet console output.
95+ */
96+ bool quiet = false ;
97+
98+ /* *
99+ * @brief Enables detailed build output.
100+ *
101+ * When false, `vix build` should prefer a minimal product-style output.
102+ */
103+ bool verbose = false ;
104+
105+ /* *
106+ * @brief Optional project directory passed with `--dir`.
107+ */
108+ std::string dir;
109+
110+ /* *
111+ * @brief Enables fast no-op detection before building.
112+ */
113+ bool fast = false ;
55114
56- // performance switches
57- bool fast = false ; // --fast
58- bool useCache = true ; // --no-cache
115+ /* *
116+ * @brief Enables signature/configuration cache reuse.
117+ */
118+ bool useCache = true ;
119+
120+ /* *
121+ * @brief Preferred linker mode.
122+ */
59123 LinkerMode linker = LinkerMode::Auto;
124+
125+ /* *
126+ * @brief Preferred compiler launcher mode.
127+ */
60128 LauncherMode launcher = LauncherMode::Auto;
61- bool status = true ; // --no-status
62- bool dryUpToDate = true ; // --no-up-to-date
63- bool cmakeVerbose = false ; // --cmake-verbose
64- std::string buildTarget; // --build-target <name>
129+
130+ /* *
131+ * @brief Enables Ninja progress status output.
132+ */
133+ bool status = true ;
134+
135+ /* *
136+ * @brief Enables Ninja dry-run up-to-date detection.
137+ */
138+ bool dryUpToDate = true ;
139+
140+ /* *
141+ * @brief Enables raw CMake verbose configure output.
142+ */
143+ bool cmakeVerbose = false ;
144+
145+ /* *
146+ * @brief Builds only a specific CMake target when provided.
147+ */
148+ std::string buildTarget;
149+
150+ /* *
151+ * @brief Extra arguments forwarded directly to CMake.
152+ */
65153 std::vector<std::string> cmakeArgs;
66154 };
67155
156+ /* *
157+ * @brief Result of a spawned child process.
158+ */
68159 struct ExecResult
69160 {
161+ /* *
162+ * @brief Normalized process exit code.
163+ */
70164 int exitCode = 0 ;
165+
166+ /* *
167+ * @brief User-readable reconstructed command line.
168+ */
71169 std::string displayCommand;
170+
171+ /* *
172+ * @brief True if the process produced any stdout/stderr output.
173+ */
72174 bool producedOutput = false ;
175+
176+ /* *
177+ * @brief Captured first output line when available.
178+ */
73179 std::string capturedFirstLine;
74180 };
75181
182+ /* *
183+ * @brief Embedded build preset description.
184+ */
76185 struct Preset
77186 {
187+ /* *
188+ * @brief Preset public name.
189+ */
78190 std::string name;
79- std::string generator; // "Ninja"
80- std::string buildType; // "Debug"/"Release"
81- std::string buildDirName; // "build-dev-ninja"
191+
192+ /* *
193+ * @brief CMake generator name, usually "Ninja".
194+ */
195+ std::string generator;
196+
197+ /* *
198+ * @brief CMake build type, such as "Debug" or "Release".
199+ */
200+ std::string buildType;
201+
202+ /* *
203+ * @brief Build directory name associated with the preset.
204+ */
205+ std::string buildDirName;
82206 };
83207
208+ /* *
209+ * @brief Fully resolved execution plan for a build.
210+ *
211+ * This contains all derived paths, resolved tools, generated files,
212+ * and CMake variables needed to configure and build the project.
213+ */
84214 struct Plan
85215 {
216+ /* *
217+ * @brief Root project directory containing the main CMakeLists.txt.
218+ */
86219 fs::path projectDir;
220+
221+ /* *
222+ * @brief Resolved embedded preset.
223+ */
87224 Preset preset;
225+
226+ /* *
227+ * @brief Build directory used for configure/build artifacts.
228+ */
88229 fs::path buildDir;
230+
231+ /* *
232+ * @brief Path to the configure log file.
233+ */
89234 fs::path configureLog;
235+
236+ /* *
237+ * @brief Path to the build log file.
238+ */
90239 fs::path buildLog;
240+
241+ /* *
242+ * @brief Path to the configuration signature file.
243+ */
91244 fs::path sigFile;
245+
246+ /* *
247+ * @brief Path to the generated toolchain file when cross-compiling.
248+ */
92249 fs::path toolchainFile;
93250
251+ /* *
252+ * @brief Resolved CMake cache variables passed during configure.
253+ */
94254 std::vector<std::pair<std::string, std::string>> cmakeVars;
255+
256+ /* *
257+ * @brief Signature used to detect whether reconfigure is needed.
258+ */
95259 std::string signature;
96260
261+ /* *
262+ * @brief Resolved compiler launcher executable, if any.
263+ */
97264 std::optional<std::string> launcher;
265+
266+ /* *
267+ * @brief Resolved fast-linker compiler flag, if any.
268+ */
98269 std::optional<std::string> fastLinkerFlag;
270+
271+ /* *
272+ * @brief Fingerprint of important project files used for caching.
273+ */
99274 std::string projectFingerprint;
100275 };
101276
277+ /* *
278+ * @brief Normalizes a raw process exit status into a standard exit code.
279+ *
280+ * @param raw Raw process status value returned by the OS.
281+ * @return Normalized integer exit code.
282+ */
102283 [[nodiscard]] int normalize_exit_code (int raw) noexcept ;
103284
104285} // namespace vix::cli::process
0 commit comments