Skip to content

Commit

Permalink
chore: 删除子模块,整理cmake,整理文档
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Sep 8, 2023
1 parent 4187e28 commit 275fb4b
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 97 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ enc_temp_folder/*
# Nuke
.nuke/temp/*

build
# Build
deps
build
install

# Tools
tools/CropRoi/**/*.png
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "MaaFramework"]
path = MaaFramework
url = https://github.com/MaaAssistantArknights/MaaFramework.git
[submodule "assets/MaaAgentBinary"]
path = assets/MaaAgentBinary
url = https://github.com/MaaAssistantArknights/MaaAgentBinary.git
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
cmake_minimum_required(VERSION 3.21)
project(MAA1999)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
endif ()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_MAP_IMPORTED_CONFIG_DebWithRelDeps "DebWithRelDeps;Release;")
set(Boost_NO_WARN_NEW_VERSIONS 1)

include(${PROJECT_SOURCE_DIR}/cmake/config.cmake) # Basic compile & link configuration
include(${PROJECT_SOURCE_DIR}/cmake/assets.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/framework.cmake)

# if(USE_MAADEPS)
# include(${PROJECT_SOURCE_DIR}/MaaDeps/maadeps.cmake)
Expand Down
58 changes: 0 additions & 58 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,63 +41,5 @@
"value": "ARM64"
}
}
],
"buildPresets": [
{
"name": "NinjaMulti - Debug",
"displayName": "Ninja MultiConfig Debug",
"description": "Ninja MultiConfig Debug",
"configurePreset": "NinjaMulti",
"configuration": "Debug",
"jobs": 16
},
{
"name": "NinjaMulti - DebWithRelDeps",
"displayName": "Ninja MultiConfig DebWithRelDeps",
"description": "Ninja MultiConfig DebWithRelDeps",
"configurePreset": "NinjaMulti",
"configuration": "RelWithDebInfo",
"jobs": 16
},
{
"name": "NinjaMulti - Release",
"displayName": "Ninja MultiConfig Release",
"description": "Ninja MultiConfig Release",
"configurePreset": "NinjaMulti",
"configuration": "Release",
"jobs": 16
},
{
"name": "MSVC 2022 - Debug",
"displayName": "MSVC 2022 Debug",
"description": "MSVC 2022 Debug",
"configurePreset": "MSVC 2022",
"configuration": "Debug",
"jobs": 16
},
{
"name": "MSVC 2022 - DebWithRelDeps",
"displayName": "MSVC 2022 DebWithRelDeps",
"description": "MSVC 2022 DebWithRelDeps",
"configurePreset": "MSVC 2022",
"configuration": "DebWithRelDeps",
"jobs": 16
},
{
"name": "MSVC 2022 - Release",
"displayName": "MSVC 2022 Release",
"description": "MSVC 2022 Release",
"configurePreset": "MSVC 2022",
"configuration": "Release",
"jobs": 16
},
{
"name": "MSVC 2022 ARM - Release",
"displayName": "MSVC 2022 ARM Release",
"description": "MSVC 2022 ARM Release",
"configurePreset": "MSVC 2022 ARM",
"configuration": "Release",
"jobs": 16
}
]
}
1 change: 0 additions & 1 deletion MaaFramework
Submodule MaaFramework deleted from aa17aa
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,33 @@
**如果你要编译源码才看这节,否则直接 [下载](https://github.com/MaaAssistantArknights/MAA1999/releases) 即可**

1. 下载 MaaFramework 的 [Release 包](https://github.com/MaaAssistantArknights/MaaFramework/releases),解压到 `deps` 文件夹中
2. 使用 cmake 创建工程
2. 配置 cmake

- Windows

```bash
mkdir -p build
cd build
cmake ..
cmake --preset 'MSVC 2022'
```

3. 编译
- Linux / macOS

- Windows
双击打开 `build/MAA1999.sln`, 进行编译
- Linux / macOS
应该不用我教.jpg
```bash
cmake --preset 'NinjaMulti'
```

3. 使用 cmake 构建工程

```bash
cmake --build build --config Release
cmake --install build --prefix install
```

生成的二进制及相关资源文件在 install 目录下

## 开发相关

4. `tools/CropRoi` 是个小工具,可以用来裁剪图片和获取 ROI
- `tools/CropRoi` 可以用来裁剪图片和获取 ROI
- Pipeline 协议可以参考 [MaaFramework 的文档](https://github.com/MaaAssistantArknights/MaaFramework/blob/main/docs/zh_cn/3.3-%E4%BB%BB%E5%8A%A1%E6%B5%81%E6%B0%B4%E7%BA%BF%E5%8D%8F%E8%AE%AE.md)

## Join us

Expand Down
1 change: 0 additions & 1 deletion assets/MaaAgentBinary
Submodule MaaAgentBinary deleted from a1832c
8 changes: 0 additions & 8 deletions cmake/assets.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
set(maa_assets_target ${CMAKE_BINARY_DIR})

add_custom_command(OUTPUT ${maa_assets_target}/MaaAgentBinary
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/assets/MaaAgentBinary ${maa_assets_target}/MaaAgentBinary
)
add_custom_target(AssetsAgentBinary ALL DEPENDS ${maa_assets_target}/MaaAgentBinary)
set_property(TARGET AssetsAgentBinary APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${maa_assets_target}/MaaAgentBinary)
set_target_properties(AssetsAgentBinary PROPERTIES FOLDER Assets)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/assets/MaaAgentBinary DESTINATION share)

add_custom_command(OUTPUT ${maa_assets_target}/resource
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/assets/resource ${maa_assets_target}/resource
)
Expand Down
3 changes: 0 additions & 3 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(debug_comp_defs "_DEBUG;MAA_DEBUG")
add_compile_definitions("$<$<CONFIG:Debug>:${debug_comp_defs}>")

set(rel_debug_comp_defs "MAA_DEBUG")
add_compile_definitions("$<$<CONFIG:DebWithRelDeps>:${rel_debug_comp_defs}>")

if (MSVC)
add_compile_options("/utf-8")
Expand All @@ -12,7 +11,6 @@ if (MSVC)
add_compile_options("/wd4251") # export dll with templates

set(rel_debug_comp_options "/Od")
add_compile_options("$<$<CONFIG:DebWithRelDeps>:${rel_debug_comp_options}>")

set(release_link_options "/OPT:REF;/OPT:ICF")
add_link_options("$<$<CONFIG:Release>:${release_link_options}>")
Expand All @@ -25,7 +23,6 @@ else ()
endif()

set(rel_debug_comp_options "-O0")
add_compile_options("$<$<CONFIG:DebWithRelDeps>:${rel_debug_comp_options}>")
endif ()

if (APPLE)
Expand Down
2 changes: 2 additions & 0 deletions cmake/framework.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install(DIRECTORY "${CMAKE_SOURCE_DIR}/deps/bin/" DESTINATION share)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/deps/share/MaaAgentBinary" DESTINATION share)
6 changes: 4 additions & 2 deletions source/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ else ()
link_directories(${CMAKE_SOURCE_DIR}/deps/bin)
endif ()

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CONFIGURATION_TYPES "Release")

add_executable(MAA1999_CLI main.cpp)
target_link_libraries(MAA1999_CLI PRIVATE MaaFramework MaaToolKit)

add_dependencies(MAA1999_CLI AssetsAgentBinary AssetsResource)
add_dependencies(MAA1999_CLI AssetsResource)

install(TARGETS MAA1999_CLI RUNTIME DESTINATION share)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/deps/bin/" DESTINATION share)

0 comments on commit 275fb4b

Please sign in to comment.