Requires C++11 or above.
Android API 21 or above for keystone linking.
See how to use KittyMemory in example.cpp.
git clone --recursive https://github.com/MJx0/KittyMemory.git
- In your Android.mk somewhere at top, define:
## it's better to use relative path to $(LOCAL_PATH) and then use subst
KITTYMEMORY_PATH = path/to/KittyMemory
KITTYMEMORY_SRC = $(wildcard $(KITTYMEMORY_PATH)/*.cpp)
- Inlcude Keystone static lib:
include $(CLEAR_VARS)
LOCAL_MODULE := Keystone
LOCAL_SRC_FILES := $(KITTYMEMORY_PATH)/Deps/Keystone/libs-android/$(TARGET_ARCH_ABI)/libkeystone.a
include $(PREBUILT_STATIC_LIBRARY)
- Add KittyMemory source files:
LOCAL_SRC_FILES := example.cpp $(KITTYMEMORY_SRC)
- Finally add keystone static lib:
LOCAL_STATIC_LIBRARIES := Keystone
You can check example here Android.mk.
- In your CMakeLists.txt somewhere at top, define:
set(KITTYMEMORY_PATH path/to/KittyMemory)
file(GLOB KITTYMEMORY_SRC ${KITTYMEMORY_PATH}/*.cpp)
- Inlcude Keystone static lib:
set(KEYSTONE_LIB ${KITTYMEMORY_PATH}/Deps/Keystone/libs-android/${CMAKE_ANDROID_ARCH_ABI}/libkeystone.a)
- Add KittyMemory source files:
add_library(YourProjectName SHARED example.cpp ${KITTYMEMORY_SRC})
- Finally add keystone static lib:
target_link_libraries(YourProjectName ${KEYSTONE_LIB})
## or
link_libraries(${KEYSTONE_LIB})
You can check example here CMakeLists.txt.
NOTE: If you don't want to link keystone and use MemoryPatch::createWithAsm then add definition kNO_KEYSTONE to your cpp flags.