From 7927f01e875ef76185535d209c14230fe9be183d Mon Sep 17 00:00:00 2001 From: Amlal Date: Fri, 25 Apr 2025 13:17:33 +0200 Subject: dev: update clang-fornat, and codebase. Signed-off-by: Amlal --- examples/example_01/example.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'examples/example_01/example.cc') diff --git a/examples/example_01/example.cc b/examples/example_01/example.cc index aa2d8b0..ae47ce8 100644 --- a/examples/example_01/example.cc +++ b/examples/example_01/example.cc @@ -1,8 +1,7 @@ -#include #include +#include -int main(int argc, char** argv) -{ - std::cout << "hello, world!\n"; - return 0; +int main(int argc, char** argv) { + std::cout << "hello, world!\n"; + return 0; } -- cgit v1.2.3 From b250a9858728ad9078e482ccf95f938ceb0ae24c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 28 May 2025 03:19:14 +0200 Subject: fix: fix dylib build on POSIX targets. feat: add libBTB example, and updated libBTB version. Signed-off-by: Amlal El Mahrouss --- BTBKit/IManifestBuilder.h | 3 +-- BTBKit/JSONManifestBuilder.h | 9 ++++----- BTBKit/Macros.h | 4 ++-- examples/example_01/example.cc | 7 ------- examples/example_01/posix.json | 10 ---------- examples/example_01/win64.json | 10 ---------- examples/example_01_hello_world/hello_world.cc | 7 +++++++ examples/example_01_hello_world/posix.json | 10 ++++++++++ examples/example_01_hello_world/win64.json | 10 ++++++++++ examples/example_02_libbtb/README.md | 7 +++++++ examples/example_02_libbtb/libbtb.cc | 12 ++++++++++++ examples/example_02_libbtb/posix.json | 20 ++++++++++++++++++++ examples/example_02_libbtb/win64.json | 19 +++++++++++++++++++ 13 files changed, 92 insertions(+), 36 deletions(-) delete mode 100644 examples/example_01/example.cc delete mode 100644 examples/example_01/posix.json delete mode 100644 examples/example_01/win64.json create mode 100644 examples/example_01_hello_world/hello_world.cc create mode 100644 examples/example_01_hello_world/posix.json create mode 100644 examples/example_01_hello_world/win64.json create mode 100644 examples/example_02_libbtb/README.md create mode 100644 examples/example_02_libbtb/libbtb.cc create mode 100644 examples/example_02_libbtb/posix.json create mode 100644 examples/example_02_libbtb/win64.json (limited to 'examples/example_01/example.cc') diff --git a/BTBKit/IManifestBuilder.h b/BTBKit/IManifestBuilder.h index 41c62df..e11d431 100644 --- a/BTBKit/IManifestBuilder.h +++ b/BTBKit/IManifestBuilder.h @@ -15,7 +15,7 @@ namespace BTB { /// @note This class is meant to be used as an interface. class IManifestBuilder { public: - explicit IManifestBuilder() = default; + IManifestBuilder() = default; virtual ~IManifestBuilder() = default; IManifestBuilder& operator=(const IManifestBuilder&) = default; @@ -27,7 +27,6 @@ class IManifestBuilder { /// @retval true succeeded. /// @retval false failed. virtual bool buildTarget(int arg_sz, const char* arg_val, const bool dry_run = false) = 0; - virtual const char* buildSystem() = 0; }; } // namespace BTB \ No newline at end of file diff --git a/BTBKit/JSONManifestBuilder.h b/BTBKit/JSONManifestBuilder.h index 6654a9b..f5d874c 100644 --- a/BTBKit/JSONManifestBuilder.h +++ b/BTBKit/JSONManifestBuilder.h @@ -12,8 +12,8 @@ namespace BTB { /// @brief JSON builder class JSONManifestBuilder final BTB_MANIFEST_BUILDER { public: - explicit JSONManifestBuilder() = default; - virtual ~JSONManifestBuilder() override = default; + JSONManifestBuilder() = default; + ~JSONManifestBuilder() override = default; JSONManifestBuilder& operator=(const JSONManifestBuilder&) = default; JSONManifestBuilder(const JSONManifestBuilder&) = default; @@ -24,8 +24,7 @@ class JSONManifestBuilder final BTB_MANIFEST_BUILDER { /// @param arg_val filename path. /// @retval true build succeeded. /// @retval false failed to build. - virtual bool buildTarget(int arg_sz, const char* arg_val, const bool dry_run = false) override; - - virtual const char* buildSystem() override; + bool buildTarget(int arg_sz, const char* arg_val, const bool dry_run = false) override; + const char* buildSystem() override; }; } // namespace BTB \ No newline at end of file diff --git a/BTBKit/Macros.h b/BTBKit/Macros.h index 8b83037..c2d6194 100644 --- a/BTBKit/Macros.h +++ b/BTBKit/Macros.h @@ -14,9 +14,9 @@ extern "C" { #define LIKELY(ARG) ((ARG) ? assert(false) : ((void) 0)) #define UNLIKELY(ARG) LIKELY(!(ARG)) -#define LIBBTB_VERSION "1.1.0" +#define LIBBTB_VERSION "v0.0.1-libBTB" -#define LIBBTB_VERSION_BCD 0x0110 +#define LIBBTB_VERSION_BCD 0x0001 #define LIBBTB_VERSION_MAJOR 1 #define LIBBTB_VERSION_MINOR 1 diff --git a/examples/example_01/example.cc b/examples/example_01/example.cc deleted file mode 100644 index ae47ce8..0000000 --- a/examples/example_01/example.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int main(int argc, char** argv) { - std::cout << "hello, world!\n"; - return 0; -} diff --git a/examples/example_01/posix.json b/examples/example_01/posix.json deleted file mode 100644 index 17a6022..0000000 --- a/examples/example_01/posix.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compiler_path": "g++", - "compiler_std": "c++20", - "headers_path": ["lib"], - "sources_path": ["example.cc"], - "output_name": "example.elf", - "compiler_flags": ["-fPIC"], - "cpp_macros": ["FOO_MACRO"], - "run_after_build": true -} diff --git a/examples/example_01/win64.json b/examples/example_01/win64.json deleted file mode 100644 index 1712d8b..0000000 --- a/examples/example_01/win64.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compiler_path": "x86_64-w64-mingw32-g++", - "compiler_std": "c++20", - "headers_path": ["lib"], - "sources_path": ["example.cc"], - "output_name": "example.elf", - "compiler_flags": ["-fPIC"], - "cpp_macros": ["FOO_MACRO"], - "run_after_build": true -} diff --git a/examples/example_01_hello_world/hello_world.cc b/examples/example_01_hello_world/hello_world.cc new file mode 100644 index 0000000..ae47ce8 --- /dev/null +++ b/examples/example_01_hello_world/hello_world.cc @@ -0,0 +1,7 @@ +#include +#include + +int main(int argc, char** argv) { + std::cout << "hello, world!\n"; + return 0; +} diff --git a/examples/example_01_hello_world/posix.json b/examples/example_01_hello_world/posix.json new file mode 100644 index 0000000..c3c8151 --- /dev/null +++ b/examples/example_01_hello_world/posix.json @@ -0,0 +1,10 @@ +{ + "compiler_path": "g++", + "compiler_std": "c++20", + "headers_path": ["lib"], + "sources_path": ["hello_world.cc"], + "output_name": "hello_world.elf", + "compiler_flags": ["-fPIC"], + "cpp_macros": ["FOO_MACRO"], + "run_after_build": true +} diff --git a/examples/example_01_hello_world/win64.json b/examples/example_01_hello_world/win64.json new file mode 100644 index 0000000..4af5bdd --- /dev/null +++ b/examples/example_01_hello_world/win64.json @@ -0,0 +1,10 @@ +{ + "compiler_path": "x86_64-w64-mingw32-g++", + "compiler_std": "c++20", + "headers_path": ["lib"], + "sources_path": ["hello_world.cc"], + "output_name": "hello_world.elf", + "compiler_flags": ["-fPIC"], + "cpp_macros": ["FOO_MACRO"], + "run_after_build": true +} diff --git a/examples/example_02_libbtb/README.md b/examples/example_02_libbtb/README.md new file mode 100644 index 0000000..50488a4 --- /dev/null +++ b/examples/example_02_libbtb/README.md @@ -0,0 +1,7 @@ +# Notice for Deployment. + +In order to use libBTB, it shall live on the same directory, +
+or within a directory recognized in the `$PATH` variable. + +## Thanks in advance. \ No newline at end of file diff --git a/examples/example_02_libbtb/libbtb.cc b/examples/example_02_libbtb/libbtb.cc new file mode 100644 index 0000000..f3d45b8 --- /dev/null +++ b/examples/example_02_libbtb/libbtb.cc @@ -0,0 +1,12 @@ +#include + +#ifndef _WIN32 +static auto kPath = "./posix.json"; +#else +static auto kPath = ".\win64.json"; +#endif + +int main(int argc, char** argv) { + auto builder = new BTB::JSONManifestBuilder(); + return builder->buildTarget(strlen(kPath), kPath); +} diff --git a/examples/example_02_libbtb/posix.json b/examples/example_02_libbtb/posix.json new file mode 100644 index 0000000..871712e --- /dev/null +++ b/examples/example_02_libbtb/posix.json @@ -0,0 +1,20 @@ +{ + "compiler_path": "g++", + "compiler_std": "c++20", + "headers_path": [ + "../../", + "../../vendor" + ], + "sources_path": [ + "libbtb.cc" + ], + "output_name": "libbtb.elf", + "compiler_flags": [ + "-L/usr/local/lib", + "-lBTB" + ], + "cpp_macros": [ + "FOO_MACRO" + ], + "run_after_build": true +} \ No newline at end of file diff --git a/examples/example_02_libbtb/win64.json b/examples/example_02_libbtb/win64.json new file mode 100644 index 0000000..658ee0f --- /dev/null +++ b/examples/example_02_libbtb/win64.json @@ -0,0 +1,19 @@ +{ + "compiler_path": "x86_64-w64-mingw32-g++", + "compiler_std": "c++20", + "headers_path": [ + "../../", + "../../vendor" + ], + "sources_path": [ + "libbtb.cc" + ], + "output_name": "libbtb.exe", + "compiler_flags": [ + "-lBTB" + ], + "cpp_macros": [ + "FOO_MACRO" + ], + "run_after_build": true +} \ No newline at end of file -- cgit v1.2.3