#设置路径,引入Dobby
set(DobbyHome F:/Dobby)
include_directories(
${DobbyHome}/include
${DobbyHome}/source
${DobbyHome}/builtin-plugin
${DobbyHome}/builtin-plugin/AndroidRestriction
${DobbyHome}/builtin-plugin/SymbolResolver
${DobbyHome}/external/logging
)
macro(SET_OPTION option value)
set(${option} ${value} CACHE INTERNAL "" FORCE)
endmacro()
SET_OPTION(DOBBY_DEBUG ON)
SET_OPTION(DOBBY_GENERATE_SHARED ON)
SET_OPTION(Plugin.LinkerLoadCallback OFF)
add_subdirectory(F:/Dobby dobby.build)
将git更新下来的 dobby clone 到本地,直接修改路径就好
可以放到自己项目的目录下,也可以单独开一个文件 git pull时候方便一些。我选择的是后者。
在需要连接的So引用即可。
target_link_libraries( # Specifies the target library. 链接 我们自己生成的库 名字要和add_library 一样
Test
#引用即可
dobby
# Links the target library to the log library
# included in the NDK.
${log-lib})
使用时候直接导入头即可
#include "dobby.h"
RT_SUCCESS为Hook成功返回结果