From b2c3e134b968e75faf6db29536755f0304c63b64 Mon Sep 17 00:00:00 2001 From: Amlal Date: Tue, 22 Oct 2024 21:15:15 +0200 Subject: IMP: Refactor: Rename inc/ folder to BTBKit/ Signed-off-by: Amlal --- .gitignore | 2 +- BTBKit/IManifestBuilder.h | 24 ++++++++++++++++++++++++ BTBKit/JSONManifestBuilder.h | 27 +++++++++++++++++++++++++++ BTBKit/Macros.h | 21 +++++++++++++++++++++ cli/compile_flags.txt | 2 +- inc/IManifestBuilder.h | 24 ------------------------ inc/JSONManifestBuilder.h | 27 --------------------------- inc/Macros.h | 21 --------------------- makefile | 6 +++--- posix.json | 2 +- src/compile_flags.txt | 4 ++-- tests/posix.json | 2 +- tests/win64.json | 2 +- win64.json | 2 +- 14 files changed, 83 insertions(+), 83 deletions(-) create mode 100644 BTBKit/IManifestBuilder.h create mode 100644 BTBKit/JSONManifestBuilder.h create mode 100644 BTBKit/Macros.h delete mode 100644 inc/IManifestBuilder.h delete mode 100644 inc/JSONManifestBuilder.h delete mode 100644 inc/Macros.h diff --git a/.gitignore b/.gitignore index a98e0c5..ddeacca 100644 --- a/.gitignore +++ b/.gitignore @@ -195,7 +195,7 @@ local.properties *.la *.lo -# Shared objects (inc. Windows DLLs) +# Shared objects (BTBKit. Windows DLLs) *.dll *.so *.so.* diff --git a/BTBKit/IManifestBuilder.h b/BTBKit/IManifestBuilder.h new file mode 100644 index 0000000..0a821d5 --- /dev/null +++ b/BTBKit/IManifestBuilder.h @@ -0,0 +1,24 @@ +// ============================================================= // +// btb +// Copyright ZKA Web Services. +// ============================================================= // + +#pragma once + +/// @brief Builder interface class +class IManifestBuilder +{ +public: + explicit IManifestBuilder() = default; + virtual ~IManifestBuilder() = default; + + IManifestBuilder& operator=(const IManifestBuilder&) = default; + IManifestBuilder(const IManifestBuilder&) = default; + + /// @brief Builds a target. + /// @param arg_sz filename size + /// @param arg_val filename path. + /// @retval true succeeded. + /// @retval false failed. + virtual bool Build(int arg_sz, const char* arg_val) = 0; +}; diff --git a/BTBKit/JSONManifestBuilder.h b/BTBKit/JSONManifestBuilder.h new file mode 100644 index 0000000..290d7bb --- /dev/null +++ b/BTBKit/JSONManifestBuilder.h @@ -0,0 +1,27 @@ +// ============================================================= // +// btb +// Copyright ZKA Web Services. +// ============================================================= // + +#pragma once + +#include + +/// @brief JSON builder +class JSONManifestBuilder final : public IManifestBuilder +{ +public: + explicit JSONManifestBuilder() = default; + virtual ~JSONManifestBuilder() override = default; + + JSONManifestBuilder& operator=(const JSONManifestBuilder&) = default; + JSONManifestBuilder(const JSONManifestBuilder&) = default; + +public: + /// @brief Builds a JSON target. + /// @param arg_sz filename size + /// @param arg_val filename path. + /// @retval true succeeded. + /// @retval false failed. + virtual bool Build(int arg_sz, const char* arg_val) override; +}; diff --git a/BTBKit/Macros.h b/BTBKit/Macros.h new file mode 100644 index 0000000..f2d0f87 --- /dev/null +++ b/BTBKit/Macros.h @@ -0,0 +1,21 @@ +// ============================================================= // +// btb +// Copyright ZKA Web Services. +// ============================================================= // + +#pragma once + +#include + +#define LIKELY(ARG) (ARG) ? assert(false) : (void)0 +#define UNLIKELY(ARG) LIKELY(!(ARG)) + +#define BTBKIT_VERSION "1.0.0" + +#define BTBKIT_VERSION_BCD 0x0100 + +#define BTBKIT_VERSION_MAJOR 1 +#define BTBKIT_VERSION_MINOR 0 +#define BTBKIT_VERSION_PATCH 0 + +#define BTB_UNUSED(X) ((void)X) diff --git a/cli/compile_flags.txt b/cli/compile_flags.txt index f6d73f3..0a19b37 100644 --- a/cli/compile_flags.txt +++ b/cli/compile_flags.txt @@ -1,2 +1,2 @@ -std=c++20 --I../inc +-I../BTBKit diff --git a/inc/IManifestBuilder.h b/inc/IManifestBuilder.h deleted file mode 100644 index 0a821d5..0000000 --- a/inc/IManifestBuilder.h +++ /dev/null @@ -1,24 +0,0 @@ -// ============================================================= // -// btb -// Copyright ZKA Web Services. -// ============================================================= // - -#pragma once - -/// @brief Builder interface class -class IManifestBuilder -{ -public: - explicit IManifestBuilder() = default; - virtual ~IManifestBuilder() = default; - - IManifestBuilder& operator=(const IManifestBuilder&) = default; - IManifestBuilder(const IManifestBuilder&) = default; - - /// @brief Builds a target. - /// @param arg_sz filename size - /// @param arg_val filename path. - /// @retval true succeeded. - /// @retval false failed. - virtual bool Build(int arg_sz, const char* arg_val) = 0; -}; diff --git a/inc/JSONManifestBuilder.h b/inc/JSONManifestBuilder.h deleted file mode 100644 index 290d7bb..0000000 --- a/inc/JSONManifestBuilder.h +++ /dev/null @@ -1,27 +0,0 @@ -// ============================================================= // -// btb -// Copyright ZKA Web Services. -// ============================================================= // - -#pragma once - -#include - -/// @brief JSON builder -class JSONManifestBuilder final : public IManifestBuilder -{ -public: - explicit JSONManifestBuilder() = default; - virtual ~JSONManifestBuilder() override = default; - - JSONManifestBuilder& operator=(const JSONManifestBuilder&) = default; - JSONManifestBuilder(const JSONManifestBuilder&) = default; - -public: - /// @brief Builds a JSON target. - /// @param arg_sz filename size - /// @param arg_val filename path. - /// @retval true succeeded. - /// @retval false failed. - virtual bool Build(int arg_sz, const char* arg_val) override; -}; diff --git a/inc/Macros.h b/inc/Macros.h deleted file mode 100644 index f2d0f87..0000000 --- a/inc/Macros.h +++ /dev/null @@ -1,21 +0,0 @@ -// ============================================================= // -// btb -// Copyright ZKA Web Services. -// ============================================================= // - -#pragma once - -#include - -#define LIKELY(ARG) (ARG) ? assert(false) : (void)0 -#define UNLIKELY(ARG) LIKELY(!(ARG)) - -#define BTBKIT_VERSION "1.0.0" - -#define BTBKIT_VERSION_BCD 0x0100 - -#define BTBKIT_VERSION_MAJOR 1 -#define BTBKIT_VERSION_MINOR 0 -#define BTBKIT_VERSION_PATCH 0 - -#define BTB_UNUSED(X) ((void)X) diff --git a/makefile b/makefile index c789bf4..d8851f1 100644 --- a/makefile +++ b/makefile @@ -1,16 +1,16 @@ .PHONY: build-btb-core build-btb-core: - sudo g++ -I./inc I./vendor $(wildcard src/*.cxx) -std=c++20 -fPIC -shared -o libbtb.so + sudo g++ -I./BTBKit I./vendor $(wildcard src/*.cxx) -std=c++20 -fPIC -shared -o libbtb.so sudo cp libbtb.so /usr/local/lib .PHONY: build-btb build-btb: - sudo g++ -I./inc I./vendor $(wildcard cli/*.cxx) $(wildcard src/*.cxx) -std=c++20 -L/usr/local -lbtb -o btb + sudo g++ -I./BTBKit I./vendor $(wildcard cli/*.cxx) $(wildcard src/*.cxx) -std=c++20 -L/usr/local -lbtb -o btb sudo cp btb /usr/local/bin .PHONY: build-btb-windows build-btb-windows: - x86_64-w64-mingw32-g++.exe -I./inc -I./vendor $(wildcard cli/*.cxx) $(wildcard src/*.cxx) -std=c++20 -o btb.exe + x86_64-w64-mingw32-g++.exe -I./BTBKit -I./vendor $(wildcard cli/*.cxx) $(wildcard src/*.cxx) -std=c++20 -o btb.exe .PHONY: help help: diff --git a/posix.json b/posix.json index 785b7b1..f8a9232 100644 --- a/posix.json +++ b/posix.json @@ -1,7 +1,7 @@ { "compiler_path": "g++", "compiler_std": "c++20", - "headers_path": ["inc", "vendor"], + "headers_path": ["BTBKit", "vendor"], "sources_path": ["src/*.cc", "cli/*.cc"], "output_name": "btb", "compiler_flags": ["-fPIC"], diff --git a/src/compile_flags.txt b/src/compile_flags.txt index 6790690..b90486b 100644 --- a/src/compile_flags.txt +++ b/src/compile_flags.txt @@ -1,4 +1,4 @@ -std=c++20 --I../inc +-I../BTBKit -fPIC --shared \ No newline at end of file +-shared diff --git a/tests/posix.json b/tests/posix.json index 944b320..90a94a1 100644 --- a/tests/posix.json +++ b/tests/posix.json @@ -1,7 +1,7 @@ { "compiler_path": "g++", "compiler_std": "c++20", - "headers_path": ["inc"], + "headers_path": ["BTBKit"], "sources_path": ["example.cc"], "output_name": "example.elf", "compiler_flags": ["-fPIC"], diff --git a/tests/win64.json b/tests/win64.json index cba2af7..718c9c5 100644 --- a/tests/win64.json +++ b/tests/win64.json @@ -1,7 +1,7 @@ { "compiler_path": "x86_64-w64-mingw32-g++", "compiler_std": "c++20", - "headers_path": ["inc"], + "headers_path": ["BTBKit"], "sources_path": ["example.cc"], "output_name": "example.elf", "compiler_flags": ["-fPIC"], diff --git a/win64.json b/win64.json index 23a32ea..d7c4966 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": ["inc", "vendor"], + "headers_path": ["BTBKit", "vendor"], "sources_path": ["src/*.cc", "cli/*.cc"], "output_name": "btb.exe", "compiler_flags": ["-fPIC"], -- cgit v1.2.3