-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
193 lines (162 loc) · 5.15 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
cmake_minimum_required(VERSION 3.15)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr and automatically regenerate CMakeLists.txt
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Create a configure-time dependency on cmake.toml to improve IDE support
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
project(template-project)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(ASMJIT_STATIC ON CACHE BOOL "" FORCE)
if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
# Statically compile runtime
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
message(NOTICE "Building in Release mode")
endif()
if(CMKR_ROOT_PROJECT AND NOT CMKR_DISABLE_VCPKG)
include(FetchContent)
# Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
message(STATUS "Fetching vcpkg (2023.12.12)...")
FetchContent_Declare(vcpkg URL "https://github.com/microsoft/vcpkg/archive/refs/tags/2023.12.12.tar.gz")
FetchContent_GetProperties(vcpkg)
if(NOT vcpkg_POPULATED)
FetchContent_Populate(vcpkg)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin AND CMAKE_OSX_ARCHITECTURES STREQUAL "")
set(CMAKE_OSX_ARCHITECTURES ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "" FORCE)
endif()
include("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake")
endif()
endif()
# Packages
find_package(imgui REQUIRED)
find_package(glad REQUIRED)
find_package(glfw3 REQUIRED)
include(FetchContent)
message(STATUS "Fetching spdlog (ad0e89cbfb4d0c1ce4d097e134eb7be67baebb36)...")
FetchContent_Declare(spdlog
GIT_REPOSITORY
"https://github.com/gabime/spdlog"
GIT_TAG
ad0e89cbfb4d0c1ce4d097e134eb7be67baebb36
)
FetchContent_MakeAvailable(spdlog)
message(STATUS "Fetching bddisasm (v1.34.10)...")
FetchContent_Declare(bddisasm
GIT_REPOSITORY
"https://github.com/bitdefender/bddisasm"
GIT_TAG
v1.34.10
)
FetchContent_MakeAvailable(bddisasm)
message(STATUS "Fetching kananlib (main)...")
FetchContent_Declare(kananlib
GIT_REPOSITORY
"https://github.com/cursey/kananlib.git"
GIT_TAG
main
)
FetchContent_MakeAvailable(kananlib)
set(SAFETYHOOK_FETCH_ZYDIS ON)
message(STATUS "Fetching safetyhook (main)...")
FetchContent_Declare(safetyhook
GIT_REPOSITORY
"https://github.com/cursey/safetyhook"
GIT_TAG
main
)
FetchContent_MakeAvailable(safetyhook)
message(STATUS "Fetching json (bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d)...")
FetchContent_Declare(json
GIT_REPOSITORY
"https://github.com/nlohmann/json"
GIT_TAG
bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d
)
FetchContent_MakeAvailable(json)
set(TRACY_STATIC ON CACHE BOOL "" FORCE)
set(TRACY_ENABLE OFF CACHE BOOL "" FORCE)
message(STATUS "Fetching tracy (897aec5b062664d2485f4f9a213715d2e527e0ca)...")
FetchContent_Declare(tracy
GIT_REPOSITORY
"https://github.com/wolfpld/tracy"
GIT_TAG
897aec5b062664d2485f4f9a213715d2e527e0ca
)
FetchContent_MakeAvailable(tracy)
# Target: vtablemonitor
set(vtablemonitor_SOURCES
cmake.toml
"src/Hooker.cpp"
"src/Hooker.hpp"
"src/Inspector.cpp"
"src/Inspector.hpp"
"src/Main.cpp"
"src/StringReferences.cpp"
"src/StringReferences.hpp"
"src/VtableManager.cpp"
"src/VtableManager.hpp"
)
add_library(vtablemonitor SHARED)
target_sources(vtablemonitor PRIVATE ${vtablemonitor_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vtablemonitor_SOURCES})
target_compile_features(vtablemonitor PUBLIC
cxx_std_23
)
target_compile_options(vtablemonitor PUBLIC
"/GS-"
"/bigobj"
"/EHa"
"/MP"
)
target_include_directories(vtablemonitor PUBLIC
"src/"
"include/"
)
target_link_libraries(vtablemonitor PUBLIC
kananlib
safetyhook
spdlog
imgui::imgui
glad::glad
glfw
)
set_target_properties(vtablemonitor PROPERTIES
OUTPUT_NAME
vtable-monitor
RUNTIME_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
)