From efb02212ee4214cd142ec7667d4730d502912b2b Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 9 Jan 2023 16:16:05 +0800 Subject: [PATCH] docs: format linux tutorial --- docs/2.1-Linux编译教程.md | 19 +++++++++++++++++-- docs/en-us/2.1-LINUX_TUTORIAL.md | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/2.1-Linux编译教程.md b/docs/2.1-Linux编译教程.md index 94c8d8ede0..d679b8a3ff 100644 --- a/docs/2.1-Linux编译教程.md +++ b/docs/2.1-Linux编译教程.md @@ -12,15 +12,21 @@ ## 仅编译 MAA 本体 下载编译所需的依赖 + - Ubuntu/Debian + ```bash sudo apt install gcc-12 g++-12 cmake zlib1g-dev ``` + - Arch Linux + ```bash sudo pacman -S --needed gcc cmake zlib ``` + 编译 MAA + ```bash git clone https://github.com/MaaAssistantArknights/MaaAssistantArknights.git cd MaaAssistantArknights @@ -31,11 +37,14 @@ CC=gcc-12 CXX=g++-12 cmake -B build \ -DINSTALL_PYTHON=ON cmake --build build ``` + `cmake` 将自动下载所需的 `opencv` 和 `fastdeploy` 依赖并编译, 如果编译正常完成, 可以运行 + ```bash cmake --install build --prefix ``` -来将 MAA 安装到目标位置, 注意 MAA 推荐通过指定 `LD_LIBRARY_PATH` 来运行, 不要使用管理员权限将 MAA 装入 `/`. + +来将 MAA 安装到目标位置, 注意 MAA 推荐通过指定 `LD_LIBRARY_PATH` 来运行, 不要使用管理员权限将 MAA 装入 `/` ## 编译或指定第三方库 @@ -46,11 +55,14 @@ cmake --install build --prefix 可以使用发行版的包管理器安装,如 - Ubuntu/Debian + ```bash sudo apt install libopencv libopencv-dev # libopencv-dev 可以在编译完成后移除 ``` + - Arch Linux + ```bash sudo pacman -S opencv ``` @@ -60,6 +72,7 @@ cmake --install build --prefix ### FastDeploy 1. 参考 [这个教程](https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/cpu.md),编译并安装 C++ SDK, 只需要打开 ONNX Runtime (Ort) 和 Vision。CPU 版比较方便,GPU 版本可能更折腾一点,可自行选择 + ```bash git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy @@ -74,11 +87,13 @@ cmake --install build --prefix make -j 12 make install ``` + 其中 `-DCMAKE_INSTALL_PREFIX` 为安装路径,`-DOPENCV_DIRECTORY` 设为自定义的 OpenCV 安装路径 ### MAA -与上面提到的相同, 增加 `cmake` 参数 +与上面提到的相同, 增加 `cmake` 参数 + ```bash cmake -B build \ -DINSTALL_THIRD_LIBS=OFF \ diff --git a/docs/en-us/2.1-LINUX_TUTORIAL.md b/docs/en-us/2.1-LINUX_TUTORIAL.md index ec356d59c2..e2b2f20107 100644 --- a/docs/en-us/2.1-LINUX_TUTORIAL.md +++ b/docs/en-us/2.1-LINUX_TUTORIAL.md @@ -12,15 +12,21 @@ If you meet any other problems, please feel free to submit issue to us. ## Compiling MAA itself only Download build depends + - Ubuntu/Debian + ```bash sudo apt install gcc-12 g++-12 cmake zlib1g-dev ``` + - Arch Linux + ```bash sudo pacman -S --needed gcc cmake zlib ``` + Build MAA + ```bash git clone https://github.com/MaaAssistantArknights/MaaAssistantArknights.git cd MaaAssistantArknights @@ -31,10 +37,13 @@ CC=gcc-12 CXX=g++-12 cmake -B build \ -DINSTALL_PYTHON=ON cmake --build build ``` + `cmake` would download `opencv` and `fastdeploy` automatically before compiling by default. Run the following command to install MAA to the target directory after build + ```bash cmake --install build --prefix ``` + MAA should be run by setting `LD_LIBRARY_PATH`, do not attempt to install MAA into `/` with superuser privilege. ## Compiling/specifying third-party libraries @@ -46,11 +55,14 @@ Prebuilt `opencv` and `fastdeploy` downloaded by `cmake` may not compatible with Install with package manager of your system, e.g.: - Ubuntu/Debian + ```bash sudo apt install libopencv libopencv-dev # libopencv-dev 可以在编译完成后移除 ``` + - Arch Linux + ```bash sudo pacman -S opencv ``` @@ -60,6 +72,7 @@ Note that MAA on Windows were developed under OpenCV `4.5.3`, if you would like ### FastDeploy 1. Compile and install C++ SDK according to [the tutorial](https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/en/build_and_install/cpu.md), turn on ONNX Runtime (Ort) and Vision switch. Both CPU and GPU version are ok. + ```bash git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy @@ -74,11 +87,13 @@ Note that MAA on Windows were developed under OpenCV `4.5.3`, if you would like make -j 12 make install ``` + in which `-DCMAKE_INSTALL_PREFIX` is the directory to install into, `-DOPENCV_DIRECTORY` should be set to install directory of OpenCV. ### MAA -Similar to above with additional `cmake` argument +Similar to above with additional `cmake` argument + ```bash cmake -B build \ -DINSTALL_THIRD_LIBS=OFF \