1
+ # For more information about using CMake with Android Studio, read the
2
+ # documentation: https://d.android.com/studio/projects/add-native-code.html
3
+
4
+ # Sets the minimum version of CMake required to build the native library.
5
+
6
+ cmake_minimum_required (VERSION 3.4.1)
7
+
8
+ # Creates and names a library, sets it as either STATIC
9
+ # or SHARED, and provides the relative paths to its source code.
10
+ # You can define multiple libraries, and CMake builds them for you.
11
+ # Gradle automatically packages shared libraries with your APK.
12
+ if (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a" )
13
+ set (OS_DEPENDENDED_SRC
14
+ archs/arm/arm64/assembler/assembler_arm64.cpp
15
+ archs/arm/arm64/inst/inst_arm64.cpp
16
+ archs/arm/arm64/register/register_arm64.cpp
17
+ archs/arm/arm64/register/register_list_arm64.cpp
18
+ archs/arm/arm64/decoder/decoder_arm64.cpp
19
+ archs/arm/arm64/relocate/code_relocate_arm64.cpp
20
+ archs/arm/arm64/hook/hook_arm64.cpp)
21
+
22
+ elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi-v7a" )
23
+ set (OS_DEPENDENDED_SRC
24
+ archs/arm/arm32/inst/inst_arm32.cpp
25
+ archs/arm/arm32/inst/inst_t32.cpp
26
+ archs/arm/arm32/inst/inst_t16.cpp
27
+ archs/arm/arm32/register/register_arm32.cpp
28
+ archs/arm/arm32/register/register_list_arm32.cpp
29
+ archs/arm/arm32/assembler/assembler_arm32.cpp
30
+ archs/arm/arm32/decoder/decoder_arm32.cpp
31
+ archs/arm/arm32/hook/hook_arm32.cpp
32
+ archs/arm/arm32/hook/breakpoint_shellcode.S
33
+ archs/arm/arm32/relocate/code_relocate_arm32.cpp)
34
+ endif ()
35
+
36
+ add_library ( # Sets the name of the library.
37
+ sandhook-native
38
+
39
+ # Sets the library as a shared library.
40
+ SHARED
41
+
42
+ # Provides a relative path to your source file(s).
43
+ sandhook_native.cpp
44
+ decoder/decoder.cpp
45
+ relocate/code_relocate.cpp
46
+ elf/elf.cpp
47
+ assembler/assembler.cpp
48
+ buffer/code_buffer.cpp
49
+ utils/platform.cpp
50
+ hook/hook.cpp
51
+ ${OS_DEPENDENDED_SRC} )
52
+
53
+
54
+ include_directories (
55
+ asm
56
+ decoder
57
+ elf
58
+ utils
59
+ includes
60
+ buffer
61
+ archs/arm
62
+ archs/arm/arm64/inst
63
+ archs/arm/arm64/register
64
+ archs/arm/arm64/decoder
65
+ archs/arm/arm64/assembler
66
+ archs/arm/arm64/relocate
67
+ archs/arm/arm64/hook
68
+ archs/arm/arm32/inst
69
+ archs/arm/arm32/register
70
+ archs/arm/arm32/assembler
71
+ archs/arm/arm32/decoder
72
+ archs/arm/arm32/hook
73
+ archs/arm/arm32/relocate
74
+ src/main/cpp/antihook
75
+ )
76
+
77
+ # Searches for a specified prebuilt library and stores the path as a
78
+ # variable. Because CMake includes system libraries in the search path by
79
+ # default, you only need to specify the name of the public NDK library
80
+ # you want to add. CMake verifies that the library exists before
81
+ # completing its build.
82
+
83
+ find_library ( # Sets the name of the path variable.
84
+ log -lib
85
+
86
+ # Specifies the name of the NDK library that
87
+ # you want CMake to locate.
88
+ log )
89
+
90
+ # Specifies libraries CMake should link to your target library. You
91
+ # can link multiple libraries, such as libraries you define in this
92
+ # build script, prebuilt third-party libraries, or system libraries.
93
+
94
+ target_link_libraries ( # Specifies the target library.
95
+ sandhook-native
96
+
97
+ # Links the target library to the log library
98
+ # included in the NDK.
99
+ ${log -lib})
100
+
101
+
102
+ add_definitions (-std=c++11)
103
+
104
+ ENABLE_LANGUAGE (ASM)
0 commit comments