diff options
| author | Amlal <amlal@zka.com> | 2024-07-19 15:53:09 +0200 |
|---|---|---|
| committer | Amlal <amlal@zka.com> | 2024-07-19 15:53:09 +0200 |
| commit | e631e5c0ceda0301a49a879178ba93c5141dccff (patch) | |
| tree | 2fff4b551db117da01f0e74044f99c6c30e79301 /src | |
| parent | 1aa25fbdb92ed6d24be1433f004ddba9bd6f1c3d (diff) | |
[IMP] many improvements and complete implementation of btb.
Signed-off-by: Amlal <amlal@zka.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/manifest_builder.cxx | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/manifest_builder.cxx b/src/manifest_builder.cxx index a18dc72..7a6ee2a 100644 --- a/src/manifest_builder.cxx +++ b/src/manifest_builder.cxx @@ -16,12 +16,10 @@ using json = nlohmann::json; bool ManifestBuilder::buildJson(int arg_sz, const char* arg_val) { - std::cout << "buildme: "; std::string path; if (arg_sz < 0) { - std::cout << "no files provided.\n"; return false; } else @@ -35,22 +33,15 @@ bool ManifestBuilder::buildJson(int arg_sz, const char* arg_val) if (!json_obj.good()) { - std::cout << "buildme: no files provided.\n"; - perror("buildme"); - return false; } json buildme = json::parse(json_obj); std::string compiler = buildme["compiler_path"].get<std::string>(); - std::cout << "choose toolchain: " << compiler << std::endl; json headerSearchPath = buildme["headers_path"]; - std::cout << "buildme: search path: " << headerSearchPath.dump() << std::endl; - json sourceFiles = buildme["sources_path"]; - std::cout << "buildme: source files: " << sourceFiles.dump() << std::endl; std::string cmdLine = compiler + " "; @@ -61,21 +52,32 @@ bool ManifestBuilder::buildJson(int arg_sz, const char* arg_val) for (auto& headers : headerSearchPath) { - cmdLine += "-include=" + headers.get<std::string>() + " "; + cmdLine += "-I" + headers.get<std::string>() + " "; } - cmdLine += "-std=" + buildme["compiler_std"].get<std::string>() + " "; + json macrosList = buildme["cpp_macros"]; - cmdLine += "-o " + buildme["output_name"].get<std::string>(); + for (auto& macro : macrosList) + { + cmdLine += "-D" + macro.get<std::string>() + " "; + } + + json compilerFlags = buildme["compiler_flags"]; - std::cout << "buildme: running: '" << cmdLine << "'" << std::endl; + for (auto& flag : compilerFlags) + { + cmdLine += flag.get<std::string>() + " "; + } + + cmdLine += "-std=" + buildme["compiler_std"].get<std::string>() + " "; + cmdLine += "-o " + buildme["output_name"].get<std::string>(); std::system(cmdLine.c_str()); } catch (std::runtime_error& err) { - perror("buildme"); std::cout << "buildme: error: " << err.what() << std::endl; + perror("buildme"); return false; } |
