diff options
Diffstat (limited to 'dev/src')
| -rw-r--r-- | dev/src/JSONManifestBuilder.cc | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/dev/src/JSONManifestBuilder.cc b/dev/src/JSONManifestBuilder.cc index 0b010fe..5ea96a7 100644 --- a/dev/src/JSONManifestBuilder.cc +++ b/dev/src/JSONManifestBuilder.cc @@ -9,8 +9,7 @@ #include <dlfcn.h> #endif -using JSON = nlohmann::json; - +using JSON = nlohmann::json; namespace FS = std::filesystem; using namespace NeBuild; @@ -49,19 +48,27 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr std::string compiler = json_obj["compiler_path"].get<std::string>(); - JSON header_search_path = json_obj["headers_path"]; - JSON sources_files = json_obj["sources_path"]; + if (compiler != "g++" || !compiler.starts_with("clang")) { + NeBuild::Logger::info() << "nebuild: error: compiler '" << compiler << "' is not a valid C/C++ compiler!" + << std::endl; + return false; + } std::string command = compiler + " "; - for (auto& sources : sources_files) { - command += sources.get<std::string>() + " "; - } + JSON header_search_path = json_obj["compiler_headers_path"]; for (auto& headers : header_search_path) { command += "-I" + headers.get<std::string>() + " "; } + JSON headers_path = json_obj["headers_path"]; + JSON sources_files = json_obj["sources_path"]; + + for (auto& sources : sources_files) { + command += sources.get<std::string>() + " "; + } + JSON macros_list = json_obj["cpp_macros"]; for (auto& macro : macros_list) { @@ -109,7 +116,7 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr if (dll) { int (*entrypoint)(void) = nullptr; - entrypoint = (decltype(entrypoint))dlsym(dll, "shared_runner"); + entrypoint = (decltype(entrypoint)) dlsym(dll, "shared_runner"); if (entrypoint) entrypoint(); @@ -121,21 +128,6 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr return false; } else { - std::ifstream file = std::ifstream(target); - std::stringstream ss; - - ss << file.rdbuf(); - - if (ss.str()[0] == 'O' && ss.str()[1] == 'p' && ss.str()[2] == 'e' && ss.str()[3] == 'n') - NeBuild::Logger::info() - << "error: can't open PEF dynamic library, it mayn't contain an entrypoint" - << std::endl; - else if (ss.str()[0] == 'n' && ss.str()[1] == 'e' && ss.str()[2] == 'p' && - ss.str()[3] == 'O') - NeBuild::Logger::info() - << "error: can't open FEP dynamic library, it mayn't contain an entrypoint" - << std::endl; - return false; } |
