Skip to content

Commit

Permalink
chore: skip MaaAgentBinary if not found, and update "local build" of …
Browse files Browse the repository at this point in the history
…docs
  • Loading branch information
MistEO committed Oct 25, 2023
1 parent 217ab8b commit cc935b2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 16 deletions.
34 changes: 19 additions & 15 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## 鸣谢

Expand Down

0 comments on commit cc935b2

Please sign in to comment.