2 Star 6 Fork 0

Suycx/KVstorageBaseRaft-cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.sh 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
Suycx 提交于 2024-10-17 12:08 +08:00 . 修改一下编译脚本
#!/bin/bash
# 启用调试输出
set -x
# 解析命令行参数
BUILD_TYPE="Debug"
BUILD_DIR="cmake-build-debug"
if [[ "$1" == "Release" ]]; then
BUILD_TYPE="Release"
BUILD_DIR="cmake-build-release"
fi
# 检查是否已经有 spdlog
SPDLOG_DIR="thirdParty/spdlog"
SPDLOG_VERSION="v1.14.0"
if [ ! -d "$SPDLOG_DIR" ]; then
echo "spdlog not found. Cloning spdlog $SPDLOG_VERSION..."
git clone --branch $SPDLOG_VERSION --depth 1 https://github.com/gabime/spdlog.git "$SPDLOG_DIR"
# 进入 spdlog 目录并编译
mkdir -p "$SPDLOG_DIR/build"
cd "$SPDLOG_DIR/build"
cmake ..
make -j2
cd -
fi
# 调用配置 proto 文件的脚本
cd ./src/raftRpcPro
protoc --cpp_out=. --grpc_out=. --plugin=protoc-gen-grpc=$(which grpc_cpp_plugin) raftRPC.proto
protoc --cpp_out=. --grpc_out=. --plugin=protoc-gen-grpc=$(which grpc_cpp_plugin) kvServerRPC.proto
cd ../..
# 检查是否存在构建目录
if [ ! -d "$BUILD_DIR" ]; then
mkdir "$BUILD_DIR"
else
rm -rf "$BUILD_DIR/*"
fi
# 进入构建目录
cd "$BUILD_DIR"
# 根据构建类型生成 Makefile
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
# 编译项目
make -j2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/suycx/KVstorageBaseRaft-cpp.git
git@gitee.com:suycx/KVstorageBaseRaft-cpp.git
suycx
KVstorageBaseRaft-cpp
KVstorageBaseRaft-cpp
grpcbased

搜索帮助