瑶光·捕梦网 C++ 框架
面向服务端程序的 C++11 基础框架。它在 libhv 之上提供路由、中间件、HTTP/HTTPS/TCP/WebSocket 传输、文件发送、异步任务和常用工具组件。
公开 API 位于 intertwine::fw,CMake 包与链接目标为 intertwine_cpp_framework。
| 能力 | 组件 |
|---|---|
| HTTP 服务 | Application、Router、Context、MiddlewareChain |
| 客户端通信 | ITransport、TransportFactory |
| 文件发送 | IFileTransfer、FileTransferFactory |
| 并发控制 | SupervisedThreadPool、LockfreeQueue、SPSCQueue、FlowController |
| 基础工具 | 配置、日志、JWT、密码哈希、证书、JSON、ID 和时间处理 |
git clone --recursive https://github.com/AlkaidLab/intertwine-cpp-framework.git
cd intertwine-cpp-framework
./build.sh --testWindows:
git clone --recursive https://github.com/AlkaidLab/intertwine-cpp-framework.git
Set-Location intertwine-cpp-framework
.\build.ps1 -Test构建脚本会准备 vcpkg 与 libhv 依赖。可按需要指定 vcpkg 或安装目录:
./build.sh --vcpkg-root ../vcpkg
./build.sh --install-dir ./out/install#include <intertwine/fw/Application.hpp>
#include <intertwine/fw/Context.hpp>
#include <intertwine/fw/Router.hpp>
namespace fw = intertwine::fw;
int main() {
fw::Application app;
fw::Router router;
router.get("/hello", [](fw::Context& ctx) {
ctx.json(200, "{\"message\":\"hello\"}");
});
app.mount(router);
app.setPort(8080);
return app.start();
}安装框架后,在项目中查找并链接 intertwine_cpp_framework:
find_package(intertwine_cpp_framework REQUIRED)
target_link_libraries(your_target PRIVATE intertwine_cpp_framework)若安装位置不在 CMake 的默认搜索路径中,配置项目时传入该前缀:
cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/framework-installgit submodule add \
https://github.com/AlkaidLab/intertwine-cpp-framework.git \
third_party/intertwine-cpp-framework
git submodule update --init --recursive中文(默认):
English:
依赖由 vcpkg 构建流程解析;测试使用 GTest。