Skip to content

Commit decb62e

Browse files
[compile] Bazel compile , add compile.md (ChunelFeng#382)
* feat(bazel-compile)
1 parent 7fa2234 commit decb62e

52 files changed

Lines changed: 68 additions & 75 deletions

Some content is hidden

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

COMPILE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@
3838
$ ./CGraph-build.sh # 编译CGraph工程,生成的内容在同级/build/文件夹中
3939
$ ./build/tutorial/T00-HelloCGraph # 运行第一个实例程序,并且在终端输出 Hello, CGraph.
4040
```
41+
42+
* Bazel编译方式(Linux/MacOS/Windows)
43+
```shell
44+
$ git clone https://github.com/ChunelFeng/CGraph.git
45+
$ cd CGraph
46+
$ bazel build //tutorial:T01-Simple -c dbg && bazel run //tutorial:T01-Simple # 编译并运行tutorial路径下的T01-Simple(debug版本)
47+
$ bazel build //tutorial/... -c opt # 编译tutorial路径下的所有targets(release版本)
48+
```

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 "../src/CGraph.h"
48+
#include "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 "../src/CGraph.h"
70+
#include "CGraph.h"
7171

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

cmake/CGraph-env-include.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ ELSEIF(WIN32)
3030
# 本工程也支持在windows平台上的mingw环境使用
3131
ENDIF()
3232

33-
include_directories(${CGRAPH_PROJECT_ROOT_DIR})
3433
include_directories(${CGRAPH_PROJECT_ROOT_DIR}/src/) # 直接加入"CGraph.h"文件对应的位置
3534

3635
# 以下三选一,本地编译执行,推荐OBJECT方式

example/BUILD

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
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-
71
# test-1: E01-AutoPilot
8-
cc_test (
2+
cc_binary (
93
name = "E01-AutoPilot",
104
srcs = ["E01-AutoPilot.cpp"],
5+
copts = ["-Isrc/"],
116
deps = ["//src:CGraph",],
127
)
138

149
# test-2: E02-MockGUI
15-
cc_test (
10+
cc_binary (
1611
name = "E02-MockGUI",
1712
srcs = ["E02-MockGUI.cpp"],
13+
copts = ["-Isrc/"],
1814
deps = ["//src:CGraph",],
1915
)
2016

2117
# test-3: E03-ThirdFlow
22-
cc_test (
18+
cc_binary (
2319
name = "E03-ThirdFlow",
2420
srcs = ["E03-ThirdFlow.cpp"],
21+
copts = ["-Isrc/"],
2522
deps = ["//src:CGraph",],
2623
)
2724

2825
# test-4: E04-MapReduce
29-
cc_test (
26+
cc_binary (
3027
name = "E04-MapReduce",
3128
srcs = ["E04-MapReduce.cpp"],
29+
copts = ["-Isrc/"],
3230
deps = ["//src:CGraph",],
3331
)
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 "src/CGraph.h"
15+
#include "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 "src/CGraph.h"
15+
#include "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 "src/CGraph.h"
12+
#include "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 "src/CGraph.h"
12+
#include "CGraph.h"
1313

1414
using namespace CGraph;
1515

src/BUILD

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,5 @@ cc_library(
44
name = "CGraph",
55
srcs = glob(["**/*.cpp"]),
66
hdrs = glob(["**/*.h", "**/*.inl"]),
7-
copts = [
8-
"-D_CGRAPH_SILENCE",
9-
"-D_ENABLE_LIKELY_",
10-
],
11-
linkstatic = 0,
127
visibility = ["//visibility:public"],
138
)

0 commit comments

Comments
 (0)