diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-16 11:20:03 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-16 11:20:03 +0100 |
| commit | 00b91cf6a99656e244dc4c5d37d645bd5343c040 (patch) | |
| tree | d4adb72a2c04c1dcdf331c4559bde33d591447f4 | |
| parent | 67f502af0e8194d4dfd9010c297e51b40a85e7fc (diff) | |
feat: TOML support.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | dev/src/TOMLManifestBuilder.cc | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/dev/src/TOMLManifestBuilder.cc b/dev/src/TOMLManifestBuilder.cc index d975adf..e35416a 100644 --- a/dev/src/TOMLManifestBuilder.cc +++ b/dev/src/TOMLManifestBuilder.cc @@ -34,39 +34,48 @@ bool TOMLManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr auto toml_file = toml::parse_file(path); std::string compiler = toml_file["compiler_path"].as_string()->get(); - + std::string command = compiler + " "; - auto header_search_path = *toml_file["compiler_headers_path"].as_array(); + auto header_search_path = toml_file["compiler_headers_path"].as_array(); - for (auto& headers : header_search_path) { - command += "-I" + headers.as_string()->get() + " "; + if (header_search_path) { + for (auto& headers : *header_search_path) { + command += "-I" + headers.as_string()->get() + " "; + } } - auto headers_path = *toml_file["headers_path"].as_array(); + auto headers_path = toml_file["headers_path"].as_array(); - for (auto& headers : headers_path) { - command += "-I" + headers.as_string()->get() + " "; + if (headers_path) { + for (auto& headers : *headers_path) { + command += "-I" + headers.as_string()->get() + " "; + } } + auto sources_files = toml_file["sources_path"].as_array(); - auto sources_files = *toml_file["sources_path"].as_array(); - - for (auto& sources : sources_files) { - command += sources.as_string()->get() + " "; + if (sources_files) { + for (auto& sources : *sources_files) { + command += sources.as_string()->get() + " "; + } } - auto macros_list = *toml_file["cpp_macros"].as_array(); + auto macros_list = toml_file["cpp_macros"].as_array(); - for (auto& macro : macros_list) { - command += "-D" + macro.as_string()->get() + " "; + if (macros_list) { + for (auto& macro : *macros_list) { + command += "-D" + macro.as_string()->get() + " "; + } } - auto compiler_flags = *toml_file["compiler_flags"].as_array(); + auto compiler_flags = toml_file["compiler_flags"].as_array(); - for (auto& flag : compiler_flags) { - command += flag.as_string()->get() + " "; - } + if (compiler_flags) { + for (auto& flag : *compiler_flags) { + command += flag.as_string()->get() + " "; + } + } if (toml_file["compiler_std"].is_string()) command += "-std=" + toml_file["compiler_std"].as_string()->get() + " "; |
