-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
120 lines (101 loc) · 4.16 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.27)
project(x8A4 C)
set(CMAKE_C_STANDARD 17)
string(COMPARE EQUAL "${CMAKE_OSX_ARCHITECTURES}" "" arch_not_set)
if(NOT DEFINED CMAKE_OSX_ARCHITECTURES OR arch_not_set)
set(CMAKE_OSX_ARCHITECTURES arm64 arm64e)
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
execute_process(COMMAND xcrun --sdk iphoneos --show-sdk-path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT DEFINED VERSION_COMMIT_COUNT)
execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE VERSION_COMMIT_COUNT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT DEFINED VERSION_COMMIT_SHA)
execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE VERSION_COMMIT_SHA ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
add_library(x8A4 STATIC SHARED x8A4.c
Logger/logger.c
Include/x8A4/Logger/logger.h
Kernel/slide.c
Include/x8A4/Kernel/slide.h
Services/services.c
Include/x8A4/Services/services.h
Registry/registry.c
Include/x8A4/Registry/registry.h
Kernel/kernel.c
Include/x8A4/Kernel/kernel.h
Kernel/offsets.c
Include/x8A4/Kernel/offsets.h
Kernel/kpf.c
Include/x8A4/Kernel/kpf.h
Kernel/osobject.c
Include/x8A4/Kernel/osobject.h
Kernel/nvram.c
Include/x8A4/Kernel/nvram.h)
target_include_directories(x8A4 PRIVATE
"${CMAKE_SOURCE_DIR}/include")
set(RPATH "/var/jb/usr/lib")
set(RPATH2 "/usr/lib")
set_target_properties(x8A4
PROPERTIES
# LINK_FLAGS "-Wl,-rpath,${RPATH} -Wl,-rpath,${RPATH2} -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/ -lclang_rt.asan_abi_ios -lclang_rt.asan_ios_dynamic")
LINK_FLAGS "-Wl,-rpath,${RPATH} -Wl,-rpath,${RPATH2} ")
set_target_properties(x8A4
PROPERTIES
# COMPILE_FLAGS "-Wall -Werror -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
COMPILE_FLAGS "-Wall -Werror")
set(SOVERSION 1)
set_target_properties(x8A4 PROPERTIES SOVERSION ${SOVERSION})
target_link_directories(x8A4 PRIVATE
"${CMAKE_SOURCE_DIR}/Lib")
target_link_libraries(x8A4
"-framework CoreFoundation"
"-framework IOKit"
krw
compression
choma
XPF)
add_executable(x8A4_CLI x8A4_CLI.c)
add_definitions(
-DVERSION_COMMIT_COUNT="${VERSION_COMMIT_COUNT}"
-DVERSION_COMMIT_SHA="${VERSION_COMMIT_SHA}"
-DSOVERSION=${SOVERSION}
)
if(DEFINED RELEASE)
add_definitions(-DRELEASE="1")
endif()
target_include_directories(x8A4_CLI PRIVATE "${CMAKE_SOURCE_DIR}/include")
set(RPATH "/var/jb/usr/lib")
set(RPATH2 "/usr/lib")
set_target_properties(x8A4_CLI
PROPERTIES
# LINK_FLAGS "-Wl,-rpath,${RPATH} -Wl,-rpath,${RPATH2} -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin -lclang_rt.asan_abi_ios -lclang_rt.asan_ios_dynamic")
LINK_FLAGS "-Wl,-rpath,${RPATH} -Wl,-rpath,${RPATH2}")
set_target_properties(x8A4_CLI
PROPERTIES
# COMPILE_FLAGS "-Wall -Werror -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
COMPILE_FLAGS "-Wall -Werror")
target_link_directories(x8A4_CLI PRIVATE
"${CMAKE_SOURCE_DIR}/Lib")
target_link_libraries(x8A4_CLI
"x8A4")
add_custom_command(TARGET x8A4 POST_BUILD
COMMAND ldid -S -Hsha256 -Cadhoc ${CMAKE_CURRENT_BINARY_DIR}/libx8A4.${SOVERSION}.dylib
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Signing libx8A4.${SOVERSION}.dylib..."
)
add_custom_command(TARGET x8A4_CLI POST_BUILD
COMMAND ldid -Stfp0.plist -Hsha256 -Cadhoc ${CMAKE_CURRENT_BINARY_DIR}/x8A4_CLI
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Signing x8A4_CLI"
)
#
#SET(CMAKE_EXPORT_COMPILE_COMMANDS 1)
#get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()