Skip to content

Commit b1a663e

Browse files
[compile] Feat bazel (ChunelFeng#377)
* feat(bazel) * feat(bazel)
1 parent 2c42a2b commit b1a663e

49 files changed

Lines changed: 194 additions & 42 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@
1111
/.scannerwork/
1212
.vscode/
1313
/.cache/
14+
/bazel-bin
15+
/bazel-CGraph
16+
/bazel-out
17+
/bazel-testlogs
18+
/MODULE.bazel
19+
/MODULE.bazel.lock
20+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#### MyNode.h
4747
```cpp
48-
#include "CGraph.h"
48+
#include "../src/CGraph.h"
4949

5050
class MyNode1 : public CGraph::GNode {
5151
public:

README_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ You can transfer your params in many scenes. It is also possible to extend the f
6767

6868
#### MyNode.h
6969
```cpp
70-
#include "CGraph.h"
70+
#include "../src/CGraph.h"
7171

7272
class MyNode1 : public CGraph::GNode {
7373
public:

WORKSPACE

Whitespace-only changes.

example/BUILD

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# NOET: test all the examples at a time
2+
test_suite(
3+
name = "test_all_examples",
4+
tests = [":E01-AutoPilot",":E02-MockGUI",":E03-ThirdFlow",":E04-MapReduce"],
5+
)
6+
7+
# test-1: E01-AutoPilot
8+
cc_test (
9+
name = "E01-AutoPilot",
10+
srcs = ["E01-AutoPilot.cpp"],
11+
deps = ["//src:CGraph",],
12+
)
13+
14+
# test-2: E02-MockGUI
15+
cc_test (
16+
name = "E02-MockGUI",
17+
srcs = ["E02-MockGUI.cpp"],
18+
deps = ["//src:CGraph",],
19+
)
20+
21+
# test-3: E03-ThirdFlow
22+
cc_test (
23+
name = "E03-ThirdFlow",
24+
srcs = ["E03-ThirdFlow.cpp"],
25+
deps = ["//src:CGraph",],
26+
)
27+
28+
# test-4: E04-MapReduce
29+
cc_test (
30+
name = "E04-MapReduce",
31+
srcs = ["E04-MapReduce.cpp"],
32+
deps = ["//src:CGraph",],
33+
)
34+
35+
# import the CGraph.h from src dir
36+
# cc_import(
37+
# name = "CGraph_h",
38+
# hdrs = ["src/CGraph.h"],
39+
# visibility = ["//visibility:public"],
40+
# )

example/E01-AutoPilot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <cstring>
1313
#include <memory>
1414

15-
#include "CGraph.h"
15+
#include "src/CGraph.h"
1616

1717
using namespace CGraph;
1818

example/E02-MockGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <cmath>
1313
#include <set>
1414

15-
#include "CGraph.h"
15+
#include "src/CGraph.h"
1616

1717
using namespace CGraph;
1818

example/E03-ThirdFlow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <cmath>
1010
#include <memory>
1111

12-
#include "CGraph.h"
12+
#include "src/CGraph.h"
1313

1414
using namespace CGraph;
1515

example/E04-MapReduce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <random>
1010
#include <vector>
1111

12-
#include "CGraph.h"
12+
#include "src/CGraph.h"
1313

1414
using namespace CGraph;
1515

src/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "CGraph",
5+
srcs = glob(["**/*.cpp"]),
6+
hdrs = glob(["**/*.h", "**/*.inl"]),
7+
copts = [
8+
"-D_CGRAPH_SILENCE",
9+
"-D_CGRAPH_SHOW_THREAD_METRICS_",
10+
"-D_ENABLE_LIKELY_",
11+
],
12+
linkstatic = 0,
13+
visibility = ["//visibility:public"],
14+
)

0 commit comments

Comments
 (0)