- IDE使用CLion
- 新建C++项目CGraphDemo
- 初始化git仓库
git init
- 项目中引入CGraph
git submodule add https://github.com/ChunelFeng/CGraph.git ./CGraph
- 修改项目CGraphDemo的CMakeLists.txt
include(CGraph/cmake/CGraph-env-include.cmake)
add_executable(CGraphDemo
$<TARGET_OBJECTS:CGraph>
main.cpp)
- 修改项目CGraphDemo的main.cpp
#include <iostream>
#include "./CGraph/src/CGraph.h"
using namespace CGraph;
using namespace std;
class CGraphNode : public GNode {
public:
CStatus run() override {
cout << "hello, CGraph" << endl;
return CStatus();
}
};
int main() {
auto pipeline = GPipelineFactory::create();
GElementPtr a = nullptr;
pipeline->registerGElement<CGraphNode>(&a);
pipeline->process();
GPipelineFactory::clear();
return 0;
}
- 编译运行