Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57a26a5

Browse files
authored
[Serialization] Removing flatbuffer/flexbuffer usage and library from BuildCC (#226)
1 parent 2c2337e commit 57a26a5

33 files changed

+74
-158
lines changed

.gitmodules

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[submodule "flatbuffers"]
2-
path = third_party/flatbuffers
3-
url = https://github.com/google/flatbuffers.git
1+
[submodule "json"]
2+
path = third_party/json
3+
url = https://github.com/nlohmann/json.git
44
[submodule "spdlog"]
55
path = third_party/spdlog
66
url = https://github.com/gabime/spdlog.git
@@ -22,6 +22,3 @@
2222
[submodule "optional"]
2323
path = third_party/tl_optional
2424
url = https://github.com/TartanLlama/optional.git
25-
[submodule "json"]
26-
path = third_party/json
27-
url = https://github.com/nlohmann/json.git

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ project(BuildCC
1212

1313
# User options
1414
option(BUILDCC_INSTALL "Enable BuildCC Installation" ON)
15-
option(BUILDCC_FLATBUFFERS_FLATC "Build Flatbuffer::Flatc Compiler" ON)
16-
1715
option(BUILDCC_BUILD_AS_SINGLE_LIB "Build all internal libs and modules as part of the buildcc library" ON)
1816
option(BUILDCC_BUILD_AS_INTERFACE "Build all internal libs and modules seperately and link" OFF)
1917

@@ -34,7 +32,6 @@ option(BUILDCC_DOCUMENTATION "Enable Documentation" OFF)
3432

3533
# Compiler options
3634
# NOTE, This option is required for clang compilers, architecture x86_64-pc-windows-msvc
37-
# Flatbuffers library uses `std::system` internally which causes a deprecated error
3835
option(BUILDCC_NO_DEPRECATED "Disable Deprecated" OFF)
3936
if (${BUILDCC_NO_DEPRECATED})
4037
add_compile_options("-Wno-deprecated")
@@ -72,9 +69,7 @@ include(cmake/tool/cppcheck.cmake)
7269
include(cmake/tool/doxygen.cmake)
7370

7471
# Libraries
75-
include(cmake/target/flatbuffers.cmake)
7672
include(cmake/target/json.cmake)
77-
7873
include(cmake/target/fmt.cmake)
7974
include(cmake/target/spdlog.cmake)
8075
include(cmake/target/cli11.cmake)

CMakePresets.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"CMAKE_C_COMPILER": "gcc",
1818
"CMAKE_CXX_COMPILER": "g++",
1919
"BUILDCC_INSTALL": true,
20-
"BUILDCC_FLATBUFFERS_FLATC": true,
2120
"BUILDCC_BUILD_AS_SINGLE_LIB": true,
2221
"BUILDCC_BUILD_AS_INTERFACE": true,
2322
"BUILDCC_BUILDEXE": true,
@@ -42,7 +41,6 @@
4241
"CMAKE_C_COMPILER": "gcc",
4342
"CMAKE_CXX_COMPILER": "g++",
4443
"BUILDCC_INSTALL": true,
45-
"BUILDCC_FLATBUFFERS_FLATC": true,
4644
"BUILDCC_BUILD_AS_SINGLE_LIB": true,
4745
"BUILDCC_BUILD_AS_INTERFACE": false,
4846
"BUILDCC_BUILDEXE": true,
@@ -67,7 +65,6 @@
6765
"CMAKE_C_COMPILER": "gcc",
6866
"CMAKE_CXX_COMPILER": "g++",
6967
"BUILDCC_INSTALL": true,
70-
"BUILDCC_FLATBUFFERS_FLATC": true,
7168
"BUILDCC_BUILD_AS_SINGLE_LIB": false,
7269
"BUILDCC_BUILD_AS_INTERFACE": true,
7370
"BUILDCC_BUILDEXE": false,
@@ -92,7 +89,6 @@
9289
"CMAKE_C_COMPILER": "clang",
9390
"CMAKE_CXX_COMPILER": "clang++",
9491
"BUILDCC_INSTALL": true,
95-
"BUILDCC_FLATBUFFERS_FLATC": true,
9692
"BUILDCC_BUILD_AS_SINGLE_LIB": true,
9793
"BUILDCC_BUILD_AS_INTERFACE": true,
9894
"BUILDCC_BUILDEXE": true,
@@ -114,7 +110,6 @@
114110
"binaryDir": "${sourceDir}/_build_msvc_dev_all",
115111
"cacheVariables": {
116112
"BUILDCC_INSTALL": true,
117-
"BUILDCC_FLATBUFFERS_FLATC": true,
118113
"BUILDCC_BUILD_AS_SINGLE_LIB": true,
119114
"BUILDCC_BUILD_AS_INTERFACE": true,
120115
"BUILDCC_BUILDEXE": true,
@@ -136,7 +131,6 @@
136131
"binaryDir": "${sourceDir}/_build_msvc_analysis",
137132
"cacheVariables": {
138133
"BUILDCC_INSTALL": false,
139-
"BUILDCC_FLATBUFFERS_FLATC": true,
140134
"BUILDCC_BUILD_AS_SINGLE_LIB": true,
141135
"BUILDCC_BUILD_AS_INTERFACE": false,
142136
"BUILDCC_BUILDEXE": false,

DEPENDENCIES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

33
These third party libraries are added as submodules since they aren't meant to be modified by this project.
44

5+
### Adding a submodule
6+
57
`git submodule add [git_url] third_party/[foldername]`
68

9+
### Removing a submodule
10+
11+
- `git rm --cached path_to_submodule` (no trailing slash)
12+
- Delete relevant line from `.gitmodules` file
13+
- Delete relevant section from `.git/config` file
14+
715
## Main
816

917
- fmt (Formatting)
1018
- spdlog (Logging)
11-
- flatbuffers (Serialization)
19+
- json (Serialization)
1220
- CLI11 (Argument Parsing)
1321
- Taskflow (Parallel Programming)
1422

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Build C, C++ and ASM files in C++
2727
- `C++17 filesystem` library support
2828
- `C++11 thread` library support
2929
- Third Party Libraries (See License below)
30-
- Flatbuffers v2.0.0
3130
- Nlohmann::Json v3.11.2
3231
- Taskflow v3.1.0
3332
- CLI11 v2.1.0
@@ -178,7 +177,6 @@ _BuildCC_ is licensed under the Apache License, Version 2.0. See [LICENSE](LICEN
178177
- [Taskflow](https://github.com/taskflow/taskflow) (Parallel Programming) [MIT License] [Header Only]
179178
- See also [3rd-Party](https://github.com/taskflow/taskflow/tree/master/3rd-party) used by Taskflow
180179
- [Nlohmann::Json](https://github.com/nlohmann/json) (JSON Serialization) [MIT License] [Header Only]
181-
- [Flatbuffers](https://github.com/google/flatbuffers) (Serialization) [Apache-2.0 License]
182180
- [CLI11](https://github.com/CLIUtils/CLI11) (Argument Parsing) [BSD-3-Clause License] [Header Only]
183181
- [CppUTest](https://github.com/cpputest/cpputest) (Unit Testing/Mocking) [BSD-3-Clause License]
184182
- [Tl::Optional](https://github.com/TartanLlama/optional) (Optional support) [CC0-1.0 License]

bootstrap/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ add_executable(buildcc_lib_bootstrap
22
main.buildcc.cpp
33
)
44
target_sources(buildcc_lib_bootstrap PRIVATE
5-
src/build_flatbuffers.cpp
65
src/build_nlohmann_json.cpp
76
src/build_cli11.cpp
87
src/build_fmtlib.cpp

bootstrap/include/bootstrap/build_buildcc.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "buildcc.h"
2121

2222
#include "build_cli11.h"
23-
#include "build_flatbuffers.h"
2423
#include "build_fmtlib.h"
2524
#include "build_nlohmann_json.h"
2625
#include "build_spdlog.h"
@@ -30,11 +29,10 @@
3029

3130
namespace buildcc {
3231

33-
void buildcc_cb(BaseTarget &target, const TargetInfo &flatbuffers_ho,
34-
const TargetInfo &nlohmann_json_ho, const TargetInfo &fmt_ho,
35-
const TargetInfo &spdlog_ho, const TargetInfo &cli11_ho,
36-
const TargetInfo &taskflow_ho, const TargetInfo &tl_optional_ho,
37-
const BaseTarget &tpl);
32+
void buildcc_cb(BaseTarget &target, const TargetInfo &nlohmann_json_ho,
33+
const TargetInfo &fmt_ho, const TargetInfo &spdlog_ho,
34+
const TargetInfo &cli11_ho, const TargetInfo &taskflow_ho,
35+
const TargetInfo &tl_optional_ho, const BaseTarget &tpl);
3836

3937
/**
4038
* @brief
@@ -43,7 +41,6 @@ void buildcc_cb(BaseTarget &target, const TargetInfo &flatbuffers_ho,
4341
class BuildBuildCC {
4442
public:
4543
// TargetInfo / Header Only
46-
static constexpr const char *const kFlatbuffersHoName = "flatbuffers_ho";
4744
static constexpr const char *const kNlohmannJsonHoName = "nlohmann_json_ho";
4845
static constexpr const char *const kCli11HoName = "cli11_ho";
4946
static constexpr const char *const kFmtHoName = "fmtlib_ho";
@@ -77,12 +74,6 @@ class BuildBuildCC {
7774

7875
private:
7976
void Initialize();
80-
ExecutableTarget_generic &GetFlatc() {
81-
return storage_.Ref<ExecutableTarget_generic>(kFlatcExeName);
82-
}
83-
TargetInfo &GetFlatbuffersHo() {
84-
return storage_.Ref<TargetInfo>(kFlatbuffersHoName);
85-
}
8677
TargetInfo &GetNlohmannJsonHo() {
8778
return storage_.Ref<TargetInfo>(kNlohmannJsonHoName);
8879
}

bootstrap/main.buildcc.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "buildcc.h"
1818

1919
#include "bootstrap/build_cli11.h"
20-
#include "bootstrap/build_flatbuffers.h"
2120
#include "bootstrap/build_fmtlib.h"
2221
#include "bootstrap/build_spdlog.h"
2322
#include "bootstrap/build_taskflow.h"

bootstrap/src/build_buildcc.cpp

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818

1919
namespace buildcc {
2020

21-
void buildcc_cb(BaseTarget &target, const TargetInfo &flatbuffers_ho,
22-
const TargetInfo &nlohmann_json_ho, const TargetInfo &fmt_ho,
23-
const TargetInfo &spdlog_ho, const TargetInfo &cli11_ho,
24-
const TargetInfo &taskflow_ho, const TargetInfo &tl_optional_ho,
25-
const BaseTarget &tpl) {
21+
void buildcc_cb(BaseTarget &target, const TargetInfo &nlohmann_json_ho,
22+
const TargetInfo &fmt_ho, const TargetInfo &spdlog_ho,
23+
const TargetInfo &cli11_ho, const TargetInfo &taskflow_ho,
24+
const TargetInfo &tl_optional_ho, const BaseTarget &tpl) {
2625
// NOTE, Build as single lib
2726
target.AddIncludeDir("", true);
2827

@@ -88,9 +87,6 @@ void buildcc_cb(BaseTarget &target, const TargetInfo &flatbuffers_ho,
8887
SyncOption::HeaderFiles,
8988
};
9089

91-
// FLATBUFFERS HO
92-
target.Insert(flatbuffers_ho, kInsertOptions);
93-
9490
// NLOHMANN JSON HO
9591
target.Insert(nlohmann_json_ho, kInsertOptions);
9692

@@ -175,17 +171,6 @@ static void global_flags_cb(TargetInfo &global_info,
175171
}
176172

177173
void BuildBuildCC::Initialize() {
178-
(void)storage_.Add<ExecutableTarget_generic>(
179-
kFlatcExeName, kFlatcExeName, toolchain_,
180-
TargetEnv(env_.GetTargetRootDir() / "third_party" / "flatbuffers",
181-
env_.GetTargetBuildDir()));
182-
183-
// Flatbuffers HO lib
184-
(void)storage_.Add<TargetInfo>(
185-
kFlatbuffersHoName, toolchain_,
186-
TargetEnv(env_.GetTargetRootDir() / "third_party" / "flatbuffers",
187-
env_.GetTargetBuildDir()));
188-
189174
// Nlohmann json HO lib
190175
(void)storage_.Add<TargetInfo>(
191176
kNlohmannJsonHoName, toolchain_,
@@ -240,7 +225,6 @@ void BuildBuildCC::Initialize() {
240225
}
241226

242227
void BuildBuildCC::Setup(const ArgToolchainState &state) {
243-
auto &flatbuffers_ho_lib = GetFlatbuffersHo();
244228
auto &nlohmann_json_ho_lib = GetNlohmannJsonHo();
245229
auto &cli11_ho_lib = GetCli11Ho();
246230
auto &fmt_ho_lib = GetFmtHo();
@@ -250,7 +234,6 @@ void BuildBuildCC::Setup(const ArgToolchainState &state) {
250234
auto &tpl_lib = GetTpl();
251235
auto &buildcc_lib = GetBuildcc();
252236
Reg::Toolchain(state)
253-
.Func(flatbuffers_ho_cb, flatbuffers_ho_lib)
254237
.Func(nlohmann_json_ho_cb, nlohmann_json_ho_lib)
255238
.Func(cli11_ho_cb, cli11_ho_lib)
256239
.Func(fmt_ho_cb, fmt_ho_lib)
@@ -260,9 +243,9 @@ void BuildBuildCC::Setup(const ArgToolchainState &state) {
260243
.Func(global_flags_cb, tpl_lib, toolchain_)
261244
.Build(tpl_cb, tpl_lib)
262245
.Func(global_flags_cb, buildcc_lib, toolchain_)
263-
.Build(buildcc_cb, buildcc_lib, flatbuffers_ho_lib, nlohmann_json_ho_lib,
264-
fmt_ho_lib, spdlog_ho_lib, cli11_ho_lib, taskflow_ho_lib,
265-
tl_optional_ho_lib, tpl_lib)
246+
.Build(buildcc_cb, buildcc_lib, nlohmann_json_ho_lib, fmt_ho_lib,
247+
spdlog_ho_lib, cli11_ho_lib, taskflow_ho_lib, tl_optional_ho_lib,
248+
tpl_lib)
266249
.Dep(buildcc_lib, tpl_lib);
267250
}
268251

buildcc/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ if(${BUILDCC_BUILD_AS_SINGLE_LIB})
1313
target_link_libraries(buildcc PUBLIC
1414
fmt::fmt
1515
tl::optional
16-
flatbuffers
1716
nlohmann_json::nlohmann_json
1817
Taskflow
1918
CLI11::CLI11
@@ -29,7 +28,7 @@ if(${BUILDCC_BUILD_AS_SINGLE_LIB})
2928
endif()
3029
endif()
3130

32-
# Flatbuffers schema
31+
# Schema
3332
add_subdirectory(schema)
3433

3534
# Environment

0 commit comments

Comments
 (0)