-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.txt
72 lines (62 loc) · 3.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.2.2) # 最低CMake版本要求
##################### ⬇Android设置⬇ #####################
set(CMAKE_SYSTEM_NAME ANDROID) # 设置目标编译平台参数 Android
set(CMAKE_SYSTEM_VERSION 28) # 系统版本
set(ANDROID_PLATFORM 28) # 平台版本
set(ANDROID_ABI arm64-v8a) # 设置目标构架 armeabi-v7a
# set(ANDROID_NDK /Users/hongqing/Library/Android/sdk/ndk/25.0.8775105) # 设置ndk路径
# set(CMAKE_TOOLCHAIN_FILE /Users/hongqing/Library/Android/sdk/ndk/25.0.8775105/build/cmake/android.toolchain.cmake) # 设置交叉编译链的cmake配置
set(ANDROID_NDK /Users/hongqing/Library/Android/sdk/ndk/23.1.7779620) # 设置ndk路径
set(CMAKE_TOOLCHAIN_FILE /Users/hongqing/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake) # 设置交叉编译链的cmake配置
##################### ⬆Android设置⬆ #####################
project(UnityCheat VERSION 0.1.0) # 工程名称 + 版本
##################### ⬇项目相关参数设置⬇ #####################
set(CMAKE_CXX_STANDARD 17) # c++ 标准
set(CMAKE_CXX_FLAGS
"-fno-rtti -fno-exceptions -DNDEBUG -fvisibility=hidden -Wno-narrowing -fdeclspec -pthread -w -s -fexceptions -Wall -O3 -Wno-error=format-security -fpermissive -Xclang -load -Xclang /Users/hongqing/WorkSpace/SsagePass2/build/skeleton/libSkeletonPass.so"
) # 参数
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/outputs/libs/${CMAKE_ANDROID_ARCH_ABI}/) # 重定向输出产物(动态库)
##################### ⬆项目相关参数设置⬆ #####################
##################### ⬇CMake头文件设置⬇ #####################
FILE(GLOB_RECURSE FILE_INCLUDES # 遍历子目录下所有符合情况的头文件
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h*
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h*
)
include_directories( # 设置全局头文件目录 使其他源码文件可在任意目录<头文件.h>
${CMAKE_CURRENT_SOURCE_DIR}/include/AndroidLog/
${CMAKE_CURRENT_SOURCE_DIR}/include/AndroidProp/
${CMAKE_CURRENT_SOURCE_DIR}/include/MemoryTools/
${CMAKE_CURRENT_SOURCE_DIR}/include/MapTools/
${CMAKE_CURRENT_SOURCE_DIR}/include/Dobby/
${CMAKE_CURRENT_SOURCE_DIR}/include/ImGUI/
${CMAKE_CURRENT_SOURCE_DIR}/include/Il2cppResolver/
${CMAKE_CURRENT_SOURCE_DIR}/include/curl/
${CMAKE_CURRENT_SOURCE_DIR}/include/Json/
)
##################### ⬆CMake头文件设置⬆ #####################
##################### ⬇CMake源文件设置⬇ #####################
FILE(GLOB_RECURSE FILE_SOURCES # 遍历子目录下所有符合情况的源文件
${CMAKE_CURRENT_SOURCE_DIR}/src/*.c*
${CMAKE_CURRENT_SOURCE_DIR}/utils/*.c*
)
##################### ⬆CMake源文件设置⬆ #####################
##################### ⬇设置三方库文件目录⬇ #####################
link_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libs/dobby/android/${CMAKE_ANDROID_ARCH_ABI}/
${CMAKE_CURRENT_SOURCE_DIR}/libs/curl/android/${CMAKE_ANDROID_ARCH_ABI}/
)
##################### ⬆设置三方库文件目录⬆ #####################
##################### ⬇添加产物⬇ #####################
add_library(${PROJECT_NAME} SHARED # 生成动态库
${FILE_INCLUDES} # 头文件
${FILE_SOURCES} # 源文件
)
##################### ⬆添加产物⬆ #####################
target_include_directories(${PROJECT_NAME} PRIVATE
${ANDROID_NDK}/sources/android/native_app_glue
)
##################### ⬇连接库文件⬇ #####################
target_link_libraries(${PROJECT_NAME} PRIVATE
m dl log android EGL GLESv2 dobby curl
)
##################### ⬆连接库文件⬆ #####################