-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
49 lines (42 loc) · 1.35 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
cmake_minimum_required(VERSION 3.12)
if (NOT DEFINED NDK_ROOT)
if (DEFINED ENV{NDK_ROOT})
set(NDK_ROOT "$ENV{NDK_ROOT}")
else ()
message(FATAL_ERROR "Please define NDK_ROOT to point to your NDK path!")
endif ()
endif ()
# Set the tool chain file
set(CMAKE_TOOLCHAIN_FILE ${NDK_ROOT}/build/cmake/android.toolchain.cmake)
set(ANDROID_ABI arm64-v8a)
set(ANDROID_PLATFORM latest)
set(ANDROID_STL none)
set(ANDROID_LD lld)
add_compile_options(-Wall -Wextra -pedantic -Werror)
option(SELF_PACK_EXECUTABLES "Self-pack executables." ON)
project(PitDump)
set(CMAKE_C_FLAGS_RELEASE "-O2 -flto")
set(ANDROID_PIE FALSE)
link_libraries("-static")
add_executable(pitdump pitdump.c)
if (CMAKE_BUILD_TYPE STREQUAL Release)
add_custom_command(
TARGET pitdump
POST_BUILD
COMMAND "${ANDROID_TOOLCHAIN_PREFIX}strip" --strip-all pitdump
COMMENT "Stripping the executables"
VERBATIM
)
if (SELF_PACK_EXECUTABLES)
include("${CMAKE_ROOT}/Modules/FindSelfPackers.cmake")
if (SELF_PACKER_FOR_EXECUTABLE)
add_custom_command(
TARGET pitdump
POST_BUILD
COMMAND ${SELF_PACKER_FOR_EXECUTABLE} -9q ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} pitdump
COMMENT "Packing the executables"
VERBATIM
)
endif ()
endif ()
endif ()