summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-22 10:22:16 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-22 10:22:16 +0200
commite0b3869075eb6dd4d2d515f80056e2eeb1128fae (patch)
tree5158781eb6c8513d69c703e1847e1dd84094c42f
parent7927f01e875ef76185535d209c14230fe9be183d (diff)
feat(btb)!: Introducing libBTB, better API.
also: - The Codebase has been improved. - Error codes are now string messages. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--BTBKit/IManifestBuilder.h (renamed from lib/IManifestBuilder.h)6
-rw-r--r--BTBKit/Includes.h (renamed from lib/Includes.h)0
-rw-r--r--BTBKit/JSONManifestBuilder.h (renamed from lib/JSONManifestBuilder.h)4
-rw-r--r--BTBKit/Macros.h (renamed from lib/Macros.h)0
-rw-r--r--GNUmakefile (renamed from makefile)2
-rw-r--r--cli/CommandLine.cc4
-rw-r--r--compile_flags.txt2
-rw-r--r--osx-dylib.json10
-rw-r--r--osx.json10
-rw-r--r--posix.json2
-rw-r--r--src/IManifestBuilder.cc2
-rw-r--r--src/JSONManifestBuilder.cc5
-rw-r--r--win64.json2
13 files changed, 35 insertions, 14 deletions
diff --git a/lib/IManifestBuilder.h b/BTBKit/IManifestBuilder.h
index ed3c30f..41c62df 100644
--- a/lib/IManifestBuilder.h
+++ b/BTBKit/IManifestBuilder.h
@@ -5,8 +5,10 @@
#pragma once
-#include <Includes.h>
-#include <Macros.h>
+#include <BTBKit/Includes.h>
+#include <BTBKit/Macros.h>
+
+#define BTB_MANIFEST_BUILDER : public BTB::IManifestBuilder
namespace BTB {
/// @brief Builder interface class.
diff --git a/lib/Includes.h b/BTBKit/Includes.h
index 3695d53..3695d53 100644
--- a/lib/Includes.h
+++ b/BTBKit/Includes.h
diff --git a/lib/JSONManifestBuilder.h b/BTBKit/JSONManifestBuilder.h
index 93c86e9..6654a9b 100644
--- a/lib/JSONManifestBuilder.h
+++ b/BTBKit/JSONManifestBuilder.h
@@ -5,12 +5,12 @@
#pragma once
-#include <IManifestBuilder.h>
+#include <BTBKit/IManifestBuilder.h>
#include <json.h>
namespace BTB {
/// @brief JSON builder
-class JSONManifestBuilder final : public IManifestBuilder {
+class JSONManifestBuilder final BTB_MANIFEST_BUILDER {
public:
explicit JSONManifestBuilder() = default;
virtual ~JSONManifestBuilder() override = default;
diff --git a/lib/Macros.h b/BTBKit/Macros.h
index 9d51a2f..9d51a2f 100644
--- a/lib/Macros.h
+++ b/BTBKit/Macros.h
diff --git a/makefile b/GNUmakefile
index 8884c33..f3c888f 100644
--- a/makefile
+++ b/GNUmakefile
@@ -1,7 +1,7 @@
SUDO=sudo
GCC=g++
GCC_MINGW=x86_64-w64-mingw32-g++
-CXXFLAGS=-I./lib -I./vendor
+CXXFLAGS=-I./ -I./vendor
CXXSTD= -std=c++20
SRC=$(wildcard cli/*.cc) $(wildcard src/*.cc)
OUT=btb
diff --git a/cli/CommandLine.cc b/cli/CommandLine.cc
index 419f146..300db6f 100644
--- a/cli/CommandLine.cc
+++ b/cli/CommandLine.cc
@@ -4,8 +4,8 @@
// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
// ============================================================= //
-#include <Includes.h>
-#include <JSONManifestBuilder.h>
+#include <BTBKit/Includes.h>
+#include <BTBKit/JSONManifestBuilder.h>
static bool kFailed = false;
static bool kDryRun = false;
diff --git a/compile_flags.txt b/compile_flags.txt
index 32eb651..3edd1b0 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -1,3 +1,3 @@
-std=c++20
--Ilib
+-I./
-Ivendor \ No newline at end of file
diff --git a/osx-dylib.json b/osx-dylib.json
new file mode 100644
index 0000000..80917d2
--- /dev/null
+++ b/osx-dylib.json
@@ -0,0 +1,10 @@
+{
+ "compiler_path": "g++",
+ "compiler_std": "c++20",
+ "headers_path": ["./", "vendor"],
+ "sources_path": ["src/*.cc"],
+ "output_name": "libBTB.dylib",
+ "compiler_flags": ["-fPIC", "-shared"],
+ "cpp_macros": ["BTB_POSIX", "BTB_OSX"],
+ "run_after_build": false
+}
diff --git a/osx.json b/osx.json
new file mode 100644
index 0000000..20d513d
--- /dev/null
+++ b/osx.json
@@ -0,0 +1,10 @@
+{
+ "compiler_path": "g++",
+ "compiler_std": "c++20",
+ "headers_path": ["./", "vendor"],
+ "sources_path": ["src/*.cc", "cli/*.cc"],
+ "output_name": "btb",
+ "compiler_flags": ["-fPIC"],
+ "cpp_macros": ["BTB_POSIX", "BTB_OSX"],
+ "run_after_build": false
+}
diff --git a/posix.json b/posix.json
index 7e4343b..e53cc14 100644
--- a/posix.json
+++ b/posix.json
@@ -1,7 +1,7 @@
{
"compiler_path": "g++",
"compiler_std": "c++20",
- "headers_path": ["lib", "vendor"],
+ "headers_path": ["./", "vendor"],
"sources_path": ["src/*.cc", "cli/*.cc"],
"output_name": "btb",
"compiler_flags": ["-fPIC"],
diff --git a/src/IManifestBuilder.cc b/src/IManifestBuilder.cc
index e3cfc6b..b3f4de8 100644
--- a/src/IManifestBuilder.cc
+++ b/src/IManifestBuilder.cc
@@ -3,4 +3,4 @@
// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
// ============================================================= //
-#include <IManifestBuilder.h>
+#include <BTBKit/IManifestBuilder.h>
diff --git a/src/JSONManifestBuilder.cc b/src/JSONManifestBuilder.cc
index f70450d..46a8518 100644
--- a/src/JSONManifestBuilder.cc
+++ b/src/JSONManifestBuilder.cc
@@ -3,8 +3,7 @@
// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
// ============================================================= //
-#include <JSONManifestBuilder.h>
-#include <initializer_list>
+#include <BTBKit/JSONManifestBuilder.h>
using String = std::string;
using JSON = nlohmann::json;
@@ -91,7 +90,7 @@ bool JSONManifestBuilder::buildTarget(int arg_sz, const char* arg_val, const boo
auto ret_exec = std::system(command.c_str());
if (ret_exec > 0) {
- BTB::Logger::info() << "error: exec exit with code: " << ret_exec << "" << std::endl;
+ BTB::Logger::info() << "error: exit with message: " << std::strerror(ret_exec) << "" << std::endl;
return false;
}
diff --git a/win64.json b/win64.json
index 2dd9527..a4a2ecc 100644
--- a/win64.json
+++ b/win64.json
@@ -1,7 +1,7 @@
{
"compiler_path": "x86_64-w64-mingw32-g++.exe",
"compiler_std": "c++20",
- "headers_path": ["lib", "vendor"],
+ "headers_path": ["./", "vendor"],
"sources_path": ["src/*.cc", "cli/*.cc"],
"output_name": "btb.exe",
"compiler_flags": ["-fPIC"],