summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 01:28:48 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 01:28:48 -0500
commit36cb5079f273aaf9a84882749e3e15cd2ca70829 (patch)
treece7a545073f184e1c7e991eb3f9e7f41738685cf
parent978e187043902c1e87a6e9c3d244dabdf6f749c7 (diff)
feat: new `-build-system` switch for NeBuild.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--compile_flags.txt2
-rw-r--r--src/cli/main.cc (renamed from src/cli/AppMain.cc)28
2 files changed, 18 insertions, 12 deletions
diff --git a/compile_flags.txt b/compile_flags.txt
index 460f642..09ae967 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -1,4 +1,4 @@
-std=c++20
--Idev/
+-Iinclude/
-Ivendor
-xc++ \ No newline at end of file
diff --git a/src/cli/AppMain.cc b/src/cli/main.cc
index 173820b..cbce3c0 100644
--- a/src/cli/AppMain.cc
+++ b/src/cli/main.cc
@@ -6,6 +6,7 @@
#include <NeBuildKit/JSONManifestBuilder.h>
#include <NeBuildKit/TOMLManifestBuilder.h>
+#include "NeBuildKit/Defines.h"
static bool kFailed = false;
static bool kDryRun = false;
@@ -26,19 +27,15 @@ int main(int argc, char** argv) {
kDryRun = true;
continue;
} else if (index_path == "-h" || index_path == "-help") {
- NeBuild::Logger::info() << "usage: nebuild <file>\n";
+ NeBuild::Logger::info() << "usage: nebuild <options> <file>.\n";
return EXIT_SUCCESS;
}
- if (index_path.starts_with("-")) {
- NeBuild::Logger::info() << "error: unknown option '" << index_path << "'\n";
-
- return EXIT_FAILURE;
- }
+ auto index_cpy = index;
std::thread job_build_thread(
- [](std::string index_path) -> void {
+ [&index_path, &index, &index_cpy, &argv]() -> void {
NeBuild::IManifestBuilder* builder = nullptr;
const auto kJsonExtension = ".json";
@@ -55,7 +52,7 @@ int main(int argc, char** argv) {
builder = new NeBuild::TOMLManifestBuilder();
if (index_path.ends_with(kTomlExtension)) {
- goto end;
+ goto toml_build;
} else {
NeBuild::Logger::info()
<< "error: file '" << index_path << "' is not a manifest file!" << std::endl;
@@ -64,17 +61,26 @@ int main(int argc, char** argv) {
}
}
- end:
+ toml_build:
+ std::string next_path;
+
+ if (argv[index_cpy + 1]) next_path = argv[index_cpy + 1];
+
+ if (next_path == "-build-system") {
+ NeBuild::Logger::info() << builder->BuildSystem() << std::endl;
+ std::exit(EXIT_SUCCESS);
+ }
+
NeBuild::Logger::info() << "building manifest: " << index_path << std::endl;
if (builder && !builder->BuildTarget(index_path, kDryRun)) {
kFailed = true;
}
+ toml_build_done:
delete builder;
builder = nullptr;
- },
- index_path);
+ });
job_build_thread.join();
}