Skip to content

Commit

Permalink
[doc] add COMPILE.md file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Dec 20, 2023
1 parent e83a46b commit 5661c4c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
40 changes: 40 additions & 0 deletions COMPILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<h1 align="center">
CGraph 编译说明
</h1>

* 本工程支持`MacOS``Linux``Windows``Android`系统,无任何第三方依赖。默认使用C++11版本,推荐使用C++17版本,暂不支持C++11以下的版本


* 使用`CLion`(推荐)作为IDE的开发者,打开`CMakeLists.txt`文件作为工程,即可编译通过。本项目已经获得 [Jetbrains 开源开发许可证](https://www.jetbrains.com/zh-cn/community/opensource/#support ),感谢 Jetbrains 提供优秀的IDE,和对项目的认可


* Windows环境中,使用`Visual Studio`(2013版或以上版本)作为IDE的开发者,安装cmake之后,输入以下指令,即可生成`CGraph.sln`文件
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ cmake . -Bbuild # 在 build 文件夹下,生成对应的 CGraph.sln 文件
```

* MacOS环境中,使用`Xcode`作为IDE的开发者,安装cmake之后,输入以下指令,即可生成`CGraph.xcodeproj`文件
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ mkdir build && cd build
$ cmake .. -G Xcode # 在 build 文件夹下,生成对应的 CGraph.xcodeproj 文件
```

* Linux环境开发者,在命令行模式下,输入以下指令,即可编译通过
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ cmake . -Bbuild
$ cd build
$ make -j8
```

* 提供online版本的编译调试环境,点击进入页面:[CGraph env online](https://gitpod.io/#/github.com/ChunelFeng/CGraph) ,通过github账号登录。进入后,输入以下指令,即可编译通过,并查看执行结果
```shell
$ sudo apt-get install cmake -y # 安装cmake
$ ./CGraph-build.sh # 编译CGraph工程,生成的内容在同级/build/文件夹中
$ ./build/tutorial/T00-HelloCGraph # 运行第一个实例程序,并且在终端输出 Hello, CGraph.
```
45 changes: 6 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,43 +37,10 @@
* [【B站视频】CGraph 应用篇](https://www.bilibili.com/video/BV1B84y1D7Hs) <br>
* [【B站视频】CGraph 分享篇](https://www.bilibili.com/video/BV1dh4y1i78u) <br>

## 二. 编译说明
* 本工程支持`MacOS``Linux``Windows``Android`系统,无任何第三方依赖。默认使用C++11版本,推荐使用C++17版本,暂不支持C++11以下的版本

* 使用`CLion`(推荐)作为IDE的开发者,打开`CMakeLists.txt`文件作为工程,即可编译通过

* Windows环境中,使用`Visual Studio`(2013版或以上版本)作为IDE的开发者,安装cmake之后,输入以下指令,即可生成`CGraph.sln`文件
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ cmake . -Bbuild # 在 build 文件夹下,生成对应的 CGraph.sln 文件
```

* MacOS环境中,使用`Xcode`作为IDE的开发者,安装cmake之后,输入以下指令,即可生成`CGraph.xcodeproj`文件
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ mkdir build && cd build
$ cmake .. -G Xcode # 在 build 文件夹下,生成对应的 CGraph.xcodeproj 文件
```

* Linux环境开发者,在命令行模式下,输入以下指令,即可编译通过
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph
$ cmake . -Bbuild
$ cd build
$ make -j8
```

* 提供online版本的编译调试环境,点击进入页面:[CGraph env online](https://gitpod.io/#/github.com/ChunelFeng/CGraph) ,通过github账号登录。进入后,输入以下指令,即可编译通过,并查看执行结果
```shell
$ sudo apt-get install cmake -y # 安装cmake
$ ./CGraph-build.sh # 编译CGraph工程,生成的内容在同级/build/文件夹中
$ ./build/tutorial/T00-HelloCGraph # 运行第一个实例程序,并且在终端输出 Hello, CGraph.
```

## 三. 使用Demo
本工程使用纯C++11标准库编写,无任何第三方依赖。兼容`MacOS``Linux``Windows``Android`系统,支持通过 `CLion``VSCode``Xcode``Visual Studio``Code::Blocks``Qt Creator`等多款IDE进行本地编译和二次开发,具体编译方式请参考 [CGraph 编译说明](https://github.com/ChunelFeng/CGraph/blob/main/COMPILE.md )


## 二. 使用Demo

#### MyNode.h
```cpp
Expand Down Expand Up @@ -127,7 +94,7 @@ int main() {
<br>
如上图所示,图结构执行的时候,首先执行`a`节点。`a`节点执行完毕后,并行执行`b``c`节点。`b``c`节点全部执行完毕后,再执行`d`节点。

## . 推荐阅读
## . 推荐阅读

* [纯序员给你介绍图化框架的简单实现——执行逻辑](http://www.chunel.cn/archives/cgraph-run-introduce)
* [纯序员给你介绍图化框架的简单实现——循环逻辑](http://www.chunel.cn/archives/cgraph-loop-introduce)
Expand Down Expand Up @@ -155,7 +122,7 @@ int main() {
* [一文带你了解练习时长两年半的CGraph](http://www.chunel.cn/archives/cgraph-kunanniversary-introduce)
<br><br>

## . 关联项目
## . 关联项目

* [GraphANNS](https://github.com/whenever5225/GraphANNS) : Graph-based Approximate Nearest Neighbor Search Working off CGraph
* [CThreadPool](https://github.com/ChunelFeng/CThreadPool) : 一个简单好用、功能强大、性能优异、跨平台的C++线程池
Expand Down
5 changes: 2 additions & 3 deletions src/CBasic/CStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ CGRAPH_INTERNAL_NAMESPACE_BEGIN
static const int STATUS_OK = 0; /** 正常流程返回值 */
static const int STATUS_ERR = -1; /** 异常流程返回值 */
static const int STATUS_CRASH = -996; /** 异常流程返回值 */
static const char* STATUS_ERROR_INFO_CONNECTOR = " && "; /** 多异常信息连接符号 */

class CSTATUS {
public:
Expand All @@ -47,7 +46,7 @@ class CSTATUS {
}

CSTATUS(const CSTATUS &status) {
if (status.isOK()) {
if (status.error_code_ == error_code_) {
return;
}

Expand All @@ -57,7 +56,7 @@ class CSTATUS {
}

CSTATUS(const CSTATUS &&status) noexcept {
if (status.isOK()) {
if (status.error_code_ == error_code_) {
return;
}

Expand Down

0 comments on commit 5661c4c

Please sign in to comment.