@@ -34,22 +34,42 @@ void Target::Build() {
34
34
env::log_trace (name_, __FUNCTION__);
35
35
36
36
// TODO, Optimize these
37
- aggregated_preprocessor_flags_ =
38
- internal::aggregate (current_preprocessor_flags_);
39
37
aggregated_c_compile_flags_ = internal::aggregate (current_c_compile_flags_);
40
38
aggregated_cpp_compile_flags_ =
41
39
internal::aggregate (current_cpp_compile_flags_);
42
- aggregated_link_flags_ = internal::aggregate (current_link_flags_);
43
40
44
- aggregated_lib_deps_ =
41
+ // TODO, Segregate these if required
42
+ const std::string aggregated_lib_deps =
45
43
fmt::format (" {} {}" , internal::aggregate (current_external_lib_deps_),
46
44
internal::aggregate (current_lib_deps_));
47
45
48
- aggregated_include_dirs_ = internal::aggregate_with_prefix (
46
+ const std::string aggregated_preprocessor_flags =
47
+ internal::aggregate (current_preprocessor_flags_);
48
+ const std::string aggregated_link_flags =
49
+ internal::aggregate (current_link_flags_);
50
+
51
+ const std::string aggregated_include_dirs = internal::aggregate_with_prefix (
49
52
prefix_include_dir_, current_include_dirs_);
50
- aggregated_lib_dirs_ =
53
+ const std::string aggregated_lib_dirs =
51
54
internal::aggregate_with_prefix (prefix_lib_dir_, current_lib_dirs_);
52
55
56
+ command_.AddDefaultArguments ({
57
+ fmt::arg (" lib_deps" , aggregated_lib_deps),
58
+
59
+ fmt::arg (" include_dirs" , aggregated_include_dirs),
60
+ fmt::arg (" lib_dirs" , aggregated_lib_dirs),
61
+
62
+ fmt::arg (" preprocessor_flags" , aggregated_preprocessor_flags),
63
+ fmt::arg (" link_flags" , aggregated_link_flags),
64
+
65
+ // Toolchain executables here
66
+ fmt::arg (" asm_compiler" , toolchain_.GetAsmCompiler ()),
67
+ fmt::arg (" c_compiler" , toolchain_.GetCCompiler ()),
68
+ fmt::arg (" cpp_compiler" , toolchain_.GetCppCompiler ()),
69
+ fmt::arg (" archiver" , toolchain_.GetArchiver ()),
70
+ fmt::arg (" linker" , toolchain_.GetLinker ()),
71
+ });
72
+
53
73
const bool is_loaded = loader_.Load ();
54
74
// TODO, Add more checks for build files physically present
55
75
// NOTE, This can go into the recompile logic
@@ -123,16 +143,7 @@ void Target::LinkTarget() {
123
143
const bool success = command_.ConstructAndExecute (
124
144
Link (), {
125
145
fmt::arg (" output" , output_target),
126
- fmt::arg (" link_flags" , aggregated_link_flags_),
127
146
fmt::arg (" compiled_sources" , aggregated_compiled_sources),
128
- fmt::arg (" lib_dirs" , aggregated_lib_dirs_),
129
- fmt::arg (" lib_deps" , aggregated_lib_deps_),
130
- // Toolchain executables here
131
- fmt::arg (" asm_compiler" , toolchain_.GetAsmCompiler ()),
132
- fmt::arg (" c_compiler" , toolchain_.GetCCompiler ()),
133
- fmt::arg (" cpp_compiler" , toolchain_.GetCppCompiler ()),
134
- fmt::arg (" archiver" , toolchain_.GetArchiver ()),
135
- fmt::arg (" linker" , toolchain_.GetLinker ()),
136
147
});
137
148
env::assert_fatal (success, fmt::format (" Compilation failed for: {}" , name_));
138
149
}
0 commit comments