From 311a9a572f4a7cb4cab83a8fa03ed8f731678e85 Mon Sep 17 00:00:00 2001 From: hzq Date: Sat, 6 Jan 2024 12:17:06 +0800 Subject: [PATCH] update window install --- README_CN.md | 29 +++++++++++++++++++++++++++-- README_EN.md | 29 ++++++++++++++++++++++++++++- controller/src/techempower.cpp | 4 ++-- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/README_CN.md b/README_CN.md index 16adbad6..e95e55d6 100644 --- a/README_CN.md +++ b/README_CN.md @@ -78,9 +78,11 @@ Ubuntu>= 20.04 , test on Fedora38 需要按装asan(sudo yum install libasan) - 环境配置 [paozhu 框架linux 环境配置](https://github.com/hggq/paozhu/wiki/linux-%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE) -#### 3.3 Windows +#### 3.3 Windows -安装xmake +支持vcpkg和xmake + +xmake安装 在项目根目录 执行 配置 `conf/server.conf` 替换 /Users/hzq/paozhu 为你的项目目录 @@ -89,6 +91,29 @@ paozhu-main> xmake paozhu-main> .\build\windows\x64\release\paozhu.exe ``` +vcpkg安装 + +``` +Invoke-WebRequest -OutFile vcpkg2023.zip https://github.com/microsoft/vcpkg/archive/refs/tags/2023.12.12.zip + unzip vcpkg2023.zip + cd vcpkg-2023.12.12 + bootstrap-vcpkg.bat + vcpkg integrate install + vcpkg integrate project + vcpkg install +``` + +安装 ninja https://github.com/ninja-build/ninja/releases + +编译项目 注意`CMAKE_TOOLCHAIN_FILE`指定vcpkg位置 + +``` +unzip asio.zip +cmake . -B ${{github.workspace}} -DENABLE_WIN_VCPKG=ON -DENABLE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg-2023.12.12/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Debug -G Ninja +cmake --build . --config Debug +``` + + ### 4.安装方法 下载新版asio到项目根目录 diff --git a/README_EN.md b/README_EN.md index 1629b750..f982c180 100644 --- a/README_EN.md +++ b/README_EN.md @@ -81,7 +81,10 @@ Ubuntu>= 20.04 , test on Fedora38, need install asan(sudo yum install libasan #### 3.3 Windows -- Install xmake + +Supports install methods vcpkg and xmake + +- xmake install Execute at the root directory of the project Config `conf/server.conf` replace /Users/hzq/paozhu path to your project path ``` @@ -89,6 +92,30 @@ paozhu-main> xmake paozhu-main> .\build\windows\x64\release\paozhu.exe ``` +- vcpkg install + +``` +Invoke-WebRequest -OutFile vcpkg2023.zip https://github.com/microsoft/vcpkg/archive/refs/tags/2023.12.12.zip + unzip vcpkg2023.zip + cd vcpkg-2023.12.12 + bootstrap-vcpkg.bat + vcpkg integrate install + vcpkg integrate project + vcpkg install +``` + +Install ninja https://github.com/ninja-build/ninja/releases + +Compile project `CMAKE_TOOLCHAIN_FILE` is vcpkg install localtion path + +``` +unzip asio.zip +cmake . -B ${{github.workspace}} -DENABLE_WIN_VCPKG=ON -DENABLE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg-2023.12.12/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Debug -G Ninja +cmake --build . --config Debug +``` + + + ### 4.Install Download asio new version to project root part diff --git a/controller/src/techempower.cpp b/controller/src/techempower.cpp index e90e48ff..8e7ba2f6 100755 --- a/controller/src/techempower.cpp +++ b/controller/src/techempower.cpp @@ -35,8 +35,8 @@ std::string techempowerdb(std::shared_ptr peer) { peer->type("application/json; charset=UTF-8"); peer->set_header("Date", get_gmttime()); - unsigned int rd_num = rand_range(1, 10000); auto myworld = orm::World(); + unsigned int rd_num = rand_range(1, 10000); myworld.where("id", rd_num).fetch(); peer->output = myworld.data_tojson(); @@ -61,8 +61,8 @@ std::string techempowerqueries(std::shared_ptr peer) auto myworld = orm::World(); for (unsigned int i = 0; i < get_num; i++) { - unsigned int rd_num = rand_range(1, 10000); myworld.wheresql.clear(); + unsigned int rd_num = rand_range(1, 10000); myworld.where("id", rd_num).fetch_append(); }