@@ -31,66 +31,59 @@ namespace fs = std::filesystem;
3131
3232namespace buildcc {
3333
34- class Args {
35- public:
36- /* *
37- * @brief Toolchain State used by the Register module to selectively build or
38- * test targets
39- */
40- struct ToolchainState {
41- bool build{false };
42- bool test{false };
43- };
34+ /* *
35+ * @brief Toolchain State used by the Register module to selectively build or
36+ * test targets
37+ */
38+ struct ArgToolchainState {
39+ bool build{false };
40+ bool test{false };
41+ };
42+
43+ /* *
44+ * @brief Toolchain Arg used to receive toolchain information through the
45+ * command line
46+ * Bundled with Toolchain State
47+ */
48+ struct ArgToolchain {
49+ ArgToolchain (){};
50+ ArgToolchain (ToolchainId initial_id, const std::string &initial_name,
51+ const std::string &initial_asm_compiler,
52+ const std::string &initial_c_compiler,
53+ const std::string &initial_cpp_compiler,
54+ const std::string &initial_archiver,
55+ const std::string &initial_linker)
56+ : id(initial_id), name(initial_name), asm_compiler(initial_asm_compiler),
57+ c_compiler (initial_c_compiler), cpp_compiler(initial_cpp_compiler),
58+ archiver(initial_archiver), linker(initial_linker) {}
59+
60+ BaseToolchain ConstructToolchain () const {
61+ BaseToolchain toolchain (id, name, asm_compiler, c_compiler, cpp_compiler,
62+ archiver, linker);
63+ return toolchain;
64+ }
65+
66+ ArgToolchainState state;
67+ ToolchainId id{ToolchainId::Undefined};
68+ std::string name{" " };
69+ std::string asm_compiler{" " };
70+ std::string c_compiler{" " };
71+ std::string cpp_compiler{" " };
72+ std::string archiver{" " };
73+ std::string linker{" " };
74+ };
4475
45- // TODO, Rename to Toolchain
46- // TODO, Put ToolchainState into Args::Toolchain
47- // TODO, Add operator() overload and remove ConstructToolchain
76+ // NOTE, Incomplete without pch_compile_command
77+ // TODO, Update this for PCH
78+ struct ArgTarget {
79+ ArgTarget (){};
4880
49- /* *
50- * @brief Toolchain Arg used to receive toolchain information through the
51- * command line
52- * Bundled with Toolchain State
53- */
54- struct ToolchainArg {
55- ToolchainArg (){};
56-
57- ToolchainArg (base::Toolchain::Id initial_id,
58- const std::string &initial_name,
59- const std::string &initial_asm_compiler,
60- const std::string &initial_c_compiler,
61- const std::string &initial_cpp_compiler,
62- const std::string &initial_archiver,
63- const std::string &initial_linker)
64- : id(initial_id), name(initial_name),
65- asm_compiler (initial_asm_compiler), c_compiler(initial_c_compiler),
66- cpp_compiler(initial_cpp_compiler), archiver(initial_archiver),
67- linker(initial_linker) {}
68-
69- base::Toolchain ConstructToolchain () const {
70- base::Toolchain toolchain (id, name, asm_compiler, c_compiler,
71- cpp_compiler, archiver, linker);
72- return toolchain;
73- }
74-
75- ToolchainState state;
76- base::Toolchain::Id id{base::Toolchain::Id::Undefined};
77- std::string name{" " };
78- std::string asm_compiler{" " };
79- std::string c_compiler{" " };
80- std::string cpp_compiler{" " };
81- std::string archiver{" " };
82- std::string linker{" " };
83- };
84-
85- // NOTE, Incomplete without pch_compile_command
86- // TODO, Update this for PCH
87- struct TargetArg {
88- TargetArg (){};
89-
90- std::string compile_command{" " };
91- std::string link_command{" " };
92- };
81+ std::string compile_command{" " };
82+ std::string link_command{" " };
83+ };
9384
85+ class Args {
86+ public:
9487public:
9588 Args () { Initialize (); }
9689 Args (const Args &) = delete ;
@@ -110,13 +103,13 @@ class Args {
110103 * @param initial Set the default toolchain information as a fallback
111104 */
112105 void AddToolchain (const std::string &name, const std::string &description,
113- ToolchainArg &out,
114- const ToolchainArg &initial = ToolchainArg ());
106+ ArgToolchain &out,
107+ const ArgToolchain &initial = ArgToolchain ());
115108
116109 // NOTE, Incomplete TargetArg
117110 // TODO, Update for pch_compile_command
118111 void AddTarget (const std::string &name, const std::string &description,
119- TargetArg &out, const TargetArg &initial = TargetArg ());
112+ ArgTarget &out, const ArgTarget &initial = ArgTarget ());
120113
121114 // Getters
122115 bool Clean () const { return clean_; }
0 commit comments