From c3ac8b9d40547b81294c18c24328943681b8fb03 Mon Sep 17 00:00:00 2001 From: smityz Date: Mon, 19 Jun 2023 01:01:30 +0800 Subject: [PATCH 1/3] add readme Signed-off-by: Smityz --- .devcontainer/Dockerfile | 24 ++++++++++++++++++++++++ .devcontainer/devcontainer.json | 16 ++++++++++++++++ README.md | 22 +++++++++++++++++++++- 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..cb2637a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +FROM centos:7.9.2009 + +RUN yum -y install centos-release-scl \ + epel-release; \ + yum -y install devtoolset-7-gcc \ + devtoolset-7-gcc-c++ \ + python3 \ + make \ + libtool \ + openssl-devel \ + yum clean all; \ + rm -rf /var/cache/yum; + +ENV PATH /opt/rh/devtoolset-7/root/bin/:$PATH +RUN pip3 install --upgrade pip --no-cache-dir && pip3 install --no-cache-dir cmake==3.26.4 -i https://pypi.tuna.tsinghua.edu.cn/simple + +ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo +ENV PATH $CARGO_HOME/bin:$PATH +RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \ + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.70.0 && \ + chmod -R a=rwX $CARGO_HOME +RUN cargo install cxxbridge-cmd --version 1.0.18 + +WORKDIR /client-cpp \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7f367b6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "tikv/cpp-client", + "dockerFile": "Dockerfile", + "postAttachCommand": "bash", + "customizations": { + "vscode": { + "extensions": [ + "cschleiden.vscode-github-actions", + "vadimcn.vscode-lldb" + ], + "settings": { + "editor.formatOnSave": true + } + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 1cc10dc..a86ff0d 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,13 @@ TiKV client for C++. So far, it only supports synchronous API. It's built on top of -[TiKV Client in Rust](https://github.com/tikv/client-rust) via [cxx](https://github.com/dtolnay/cxx). +[TiKV Client in Rust](https://github.com/tikv/client-cpp) via [cxx](https://github.com/dtolnay/cxx). This client is still in the stage of prove-of-concept and under heavy development. ## Build +### Local Build ```bash # cxxbridge-cmd 1.0.18 requires rustc 1.48+ and c++17 or newer cargo install cxxbridge-cmd --force --version 1.0.18 @@ -23,6 +24,25 @@ Otherwise, you can build release version by the following. The library will be i ```bash make release ``` +### Docker build +**Way 1: Use Visual Studio Code Dev Container** +you can use the dev container to build the project, just open the project in VSCode and press `F1` and select `Dev Containers: Reopen in Container` to open the project in dev container. + +**Way 2: Build Docker Locally Then Compile** +```bash +docker build -t tikv/client-cpp:latest \ -f .devcontainer/Dockerfile . +docker run -v $(pwd):/client-cpp \ + tikv/client-cpp:latest \ + /bin/bash -c "make release" +``` + +**Way3: Use Image to Compile(Image is NOT Official)** +```bash +docker run -v $(pwd):/client-cpp \ + registry.cn-hangzhou.aliyuncs.com/smityz/client-cpp:latest \ + /bin/bash -c "make release" +``` + ## Run example From 31b3e5ef193b66ce7c096d4461061aad2781b577 Mon Sep 17 00:00:00 2001 From: Smityz Date: Mon, 19 Jun 2023 13:48:20 +0800 Subject: [PATCH 2/3] update Signed-off-by: Smityz --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cb2637a..d821370 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -21,4 +21,4 @@ RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \ chmod -R a=rwX $CARGO_HOME RUN cargo install cxxbridge-cmd --version 1.0.18 -WORKDIR /client-cpp \ No newline at end of file +WORKDIR /client-cpp diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7f367b6..8bd1472 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,4 +13,4 @@ } } } -} \ No newline at end of file +} From db013e8e6a10f4560b8a7710d0b989f0e2002cd3 Mon Sep 17 00:00:00 2001 From: Smityz Date: Mon, 19 Jun 2023 13:54:11 +0800 Subject: [PATCH 3/3] update Signed-off-by: Smityz --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a86ff0d..c8554fb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ TiKV client for C++. So far, it only supports synchronous API. It's built on top of -[TiKV Client in Rust](https://github.com/tikv/client-cpp) via [cxx](https://github.com/dtolnay/cxx). +[TiKV Client in Rust](https://github.com/tikv/client-rust) via [cxx](https://github.com/dtolnay/cxx). This client is still in the stage of prove-of-concept and under heavy development.