diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 48c843a1b..b17a0d1e9 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,18 +1,22 @@ add_library(HeaderOnlyLibraries INTERFACE) target_include_directories(HeaderOnlyLibraries INTERFACE include) -add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/MaaAgentBinary - COMMAND - ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/MaaAgentBinary - ${CMAKE_BINARY_DIR}/MaaAgentBinary) -add_custom_target(AgentBinary ALL - DEPENDS ${CMAKE_BINARY_DIR}/MaaAgentBinary) -set_property( - TARGET AgentBinary - APPEND - PROPERTY ADDITIONAL_CLEAN_FILES ${CMAKE_BINARY_DIR}/MaaAgentBinary) -set_target_properties(AgentBinary PROPERTIES FOLDER Assets) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MaaAgentBinary - DESTINATION share) +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/MaaAgentBinary/README.md) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/MaaAgentBinary + COMMAND + ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/MaaAgentBinary + ${CMAKE_BINARY_DIR}/MaaAgentBinary) + add_custom_target(AgentBinary ALL + DEPENDS ${CMAKE_BINARY_DIR}/MaaAgentBinary) + set_property( + TARGET AgentBinary + APPEND + PROPERTY ADDITIONAL_CLEAN_FILES ${CMAKE_BINARY_DIR}/MaaAgentBinary) + set_target_properties(AgentBinary PROPERTIES FOLDER Assets) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MaaAgentBinary + DESTINATION share) +else() + message(STATUS "MaaAgentBinary not found, skipping") +endif() \ No newline at end of file diff --git a/README.md b/README.md index cb1b6d885..077cf74e5 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,42 @@ MAA 正计划建设为一类项目,而非舟的单一软件。 ## 本地构建 -请参考 [Build CI](https://github.com/MaaAssistantArknights/MaaFramework/blob/main/.github/workflows/build.yml). +1. 下载 MaaDeps prebuilt + + ```sh + python3 tools/maadeps-download.py + ``` + +2. _(macOS only)_ 下载 fmt + + ```sh + sh tools/fetch-fmt.sh + ``` + +3. 配置 cmake + + - Windows + + ```bash + cmake --preset "MSVC 2022" + ``` + + - Linux / macOS + + ```bash + cmake --preset "NinjaMulti" + ``` + +4. 使用 cmake 构建工程 + + ```bash + cmake --build build --config Release + cmake --install build --prefix install + ``` + +生成的二进制及相关文件在 `install` 目录下 + +详情请参考 [Build CI](https://github.com/MaaAssistantArknights/MaaFramework/blob/main/.github/workflows/build.yml). ## 鸣谢