3.5 KiB
Linux Compilation Tutorial
The tutorial requires some basic knowledge about Linux OS!
Though it is unclear why it needs to run in Linux... Anyway in case somebody needs it_(:з」∠)_
If you meet any other problems, please feel free to submit issue to us.
Note
Linux build of MAA is still under discussion, some of the content might be outdated, please follow the script in GitHub workflow file
Compiling MAA itself only
Download build depends
-
Ubuntu/Debian
sudo apt install gcc-12 g++-12 cmake zlib1g-dev -
Arch Linux
sudo pacman -S --needed gcc cmake zlib
Build MAA
git clone https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
cd MaaAssistantArknights
mkdir -p build
CC=gcc-12 CXX=g++-12 cmake -B build \
-DINSTALL_THIRD_LIBS=ON \
-DINSTALL_RESOURCE=ON \
-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
cmake --install build --prefix <target_directory>
MAA should be run by setting LD_LIBRARY_PATH, do not attempt to install MAA into / with superuser privilege.
Compiling/specifying third-party libraries
Prebuilt opencv and fastdeploy downloaded by cmake may not compatible with all system, if you ran into abi version issue, the following instructions may help.
OpenCV
Install with package manager of your system, e.g.:
-
Ubuntu/Debian
sudo apt install libopencv libopencv-dev # libopencv-dev 可以在编译完成后移除 -
Arch Linux
sudo pacman -S opencv
Note that MAA on Windows were developed under OpenCV 4.5.3, if you would like to use specific version or statically link to OpenCV, try to compile from source .
FastDeploy
-
Compile and install C++ SDK according to the tutorial, turn on ONNX Runtime (Ort) and Vision switch. Both CPU and GPU version are ok.
git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy mkdir build && cd build cmake .. -DENABLE_ORT_BACKEND=ON \ -DENABLE_PADDLE_BACKEND=ON \ -DENABLE_OPENVINO_BACKEND=OFF \ -DCMAKE_INSTALL_PREFIX=${PWD}/compiled_fastdeploy_sdk \ -DENABLE_VISION=ON \ -DENABLE_TEXT=OFF \ -DOPENCV_DIRECTORY=/ make -j 12 make installin which
-DCMAKE_INSTALL_PREFIXis the directory to install into,-DOPENCV_DIRECTORYshould be set to install directory of OpenCV.
MAA
Similar to above with additional cmake argument
cmake -B build \
-DINSTALL_THIRD_LIBS=OFF \
-DOPENCV_DIRECTORY=path_to_opencv_install_prefix \
-DFASTDEPLOY_DIRECTORY=path_to_compiled_fastdeploy_sdk \
...
cmake --build build
Installing and packaging
Dependencies might depends on compilation argument of opencv and fastdeploy, check manually after cmake --install, copy files if needed.
Integration Documentation
Python
Refer to the implementation of __main__ in Python demo
C
Refer to the implementation of CppSample
C sharp
Refer to the implementation of MaaWpfGui