-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
256 lines (237 loc) · 8.3 KB
/
Copy pathCMakeLists.txt
File metadata and controls
256 lines (237 loc) · 8.3 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# 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.21)
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("cmake/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
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS cmake.toml)
endif()
# Variables
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(binprotect
LANGUAGES
CXX
)
include(FetchContent)
# Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
message(STATUS "Fetching spdlog (v1.17.0)...")
FetchContent_Declare(spdlog
GIT_REPOSITORY
"https://github.com/gabime/spdlog.git"
GIT_TAG
v1.17.0
GIT_SHALLOW
ON
)
FetchContent_MakeAvailable(spdlog)
message(STATUS "Fetching Zydis (v4.1.1)...")
FetchContent_Declare(Zydis
GIT_REPOSITORY
"https://github.com/zyantific/zydis.git"
GIT_TAG
v4.1.1
GIT_SHALLOW
ON
)
FetchContent_MakeAvailable(Zydis)
message(STATUS "Fetching argparse (v3.2)...")
FetchContent_Declare(argparse
GIT_REPOSITORY
"https://github.com/p-ranav/argparse.git"
GIT_TAG
v3.2
GIT_SHALLOW
ON
)
FetchContent_MakeAvailable(argparse)
# Target: binprotect
set(binprotect_SOURCES
cmake.toml
"ext/binwrite/arch/instruction/basic_block.cpp"
"ext/binwrite/arch/instruction/basic_block.hpp"
"ext/binwrite/arch/instruction/instruction.hpp"
"ext/binwrite/arch/mnemonic/mnemonic.cpp"
"ext/binwrite/arch/mnemonic/mnemonic.hpp"
"ext/binwrite/arch/register/register.cpp"
"ext/binwrite/arch/register/register.hpp"
"ext/binwrite/assembler/assembler.cpp"
"ext/binwrite/assembler/assembler.hpp"
"ext/binwrite/binary/binary.cpp"
"ext/binwrite/binary/binary.hpp"
"ext/binwrite/binary/binary_disassembly.cpp"
"ext/binwrite/binary/binary_jump_table.cpp"
"ext/binwrite/binary/binary_rvas.cpp"
"ext/binwrite/binary/function/function.cpp"
"ext/binwrite/binary/function/function.hpp"
"ext/binwrite/binary/pe/cxx_frame_handler3.hpp"
"ext/binwrite/binary/pe/cxx_frame_handler4.hpp"
"ext/binwrite/binary/pe/pe.cpp"
"ext/binwrite/binary/pe/pe.hpp"
"ext/binwrite/binary/pe/pe_exception_directory.cpp"
"ext/binwrite/binary/pe/pe_exceptions.hpp"
"ext/binwrite/binary/pe/pe_frame_pointer.cpp"
"ext/binwrite/binary/pe/pe_frame_pointer_scan.cpp"
"ext/binwrite/binary/pe/pe_rtti.cpp"
"ext/binwrite/binary/pe/pe_rtti.hpp"
"ext/binwrite/binary/pe/pe_runtime_function.cpp"
"ext/binwrite/binary/pe/pe_rvas.cpp"
"ext/binwrite/binary/pe/pe_sections.cpp"
"ext/binwrite/binary/pe/pe_throw_info.cpp"
"ext/binwrite/binary/relocation/relocation.hpp"
"ext/binwrite/binary/rva/rva.cpp"
"ext/binwrite/binary/rva/rva.hpp"
"ext/binwrite/binary/section/section.cpp"
"ext/binwrite/binary/section/section.hpp"
"ext/binwrite/binary/symbols/map_parsing.cpp"
"ext/binwrite/binary/symbols/map_parsing.hpp"
"ext/binwrite/binary/symbols/pdb_parsing.cpp"
"ext/binwrite/binary/symbols/pdb_parsing.hpp"
"ext/binwrite/disassembler/decoded_operand.cpp"
"ext/binwrite/disassembler/decoded_operand.hpp"
"ext/binwrite/disassembler/disassembled_instruction.cpp"
"ext/binwrite/disassembler/disassembled_instruction.hpp"
"ext/binwrite/disassembler/disassembler.cpp"
"ext/binwrite/disassembler/disassembler.hpp"
"ext/binwrite/util/file.hpp"
"ext/binwrite/util/random.hpp"
"ext/binwrite/util/serialize.hpp"
"ext/portable-executable/data_directory.cpp"
"ext/portable-executable/data_directory.hpp"
"ext/portable-executable/debug_directory.hpp"
"ext/portable-executable/delay_load_directory.hpp"
"ext/portable-executable/dos_header.cpp"
"ext/portable-executable/dos_header.hpp"
"ext/portable-executable/exception_directory.cpp"
"ext/portable-executable/exception_directory.hpp"
"ext/portable-executable/export_directory.cpp"
"ext/portable-executable/export_directory.hpp"
"ext/portable-executable/file.cpp"
"ext/portable-executable/file.hpp"
"ext/portable-executable/file_header.hpp"
"ext/portable-executable/image.cpp"
"ext/portable-executable/image.hpp"
"ext/portable-executable/imports_directory.hpp"
"ext/portable-executable/load_config_directory.hpp"
"ext/portable-executable/nt_headers.cpp"
"ext/portable-executable/nt_headers.hpp"
"ext/portable-executable/optional_header.hpp"
"ext/portable-executable/relocations_directory.cpp"
"ext/portable-executable/relocations_directory.hpp"
"ext/portable-executable/resource_directory.hpp"
"ext/portable-executable/section_header.cpp"
"ext/portable-executable/section_header.hpp"
"ext/raw_pdb/Foundation/PDB_ArrayView.h"
"ext/raw_pdb/Foundation/PDB_Assert.h"
"ext/raw_pdb/Foundation/PDB_BitOperators.h"
"ext/raw_pdb/Foundation/PDB_BitUtil.h"
"ext/raw_pdb/Foundation/PDB_CRT.h"
"ext/raw_pdb/Foundation/PDB_Forward.h"
"ext/raw_pdb/Foundation/PDB_Log.h"
"ext/raw_pdb/Foundation/PDB_Macros.h"
"ext/raw_pdb/Foundation/PDB_Memory.h"
"ext/raw_pdb/Foundation/PDB_Move.h"
"ext/raw_pdb/Foundation/PDB_Platform.h"
"ext/raw_pdb/Foundation/PDB_PointerUtil.h"
"ext/raw_pdb/Foundation/PDB_TypeTraits.h"
"ext/raw_pdb/Foundation/PDB_Warnings.h"
"ext/raw_pdb/PDB.cpp"
"ext/raw_pdb/PDB.h"
"ext/raw_pdb/PDB_CoalescedMSFStream.cpp"
"ext/raw_pdb/PDB_CoalescedMSFStream.h"
"ext/raw_pdb/PDB_DBIStream.cpp"
"ext/raw_pdb/PDB_DBIStream.h"
"ext/raw_pdb/PDB_DBITypes.cpp"
"ext/raw_pdb/PDB_DBITypes.h"
"ext/raw_pdb/PDB_DirectMSFStream.cpp"
"ext/raw_pdb/PDB_DirectMSFStream.h"
"ext/raw_pdb/PDB_ErrorCodes.h"
"ext/raw_pdb/PDB_GlobalSymbolStream.cpp"
"ext/raw_pdb/PDB_GlobalSymbolStream.h"
"ext/raw_pdb/PDB_IPIStream.cpp"
"ext/raw_pdb/PDB_IPIStream.h"
"ext/raw_pdb/PDB_IPITypes.h"
"ext/raw_pdb/PDB_ImageSectionStream.cpp"
"ext/raw_pdb/PDB_ImageSectionStream.h"
"ext/raw_pdb/PDB_InfoStream.cpp"
"ext/raw_pdb/PDB_InfoStream.h"
"ext/raw_pdb/PDB_ModuleInfoStream.cpp"
"ext/raw_pdb/PDB_ModuleInfoStream.h"
"ext/raw_pdb/PDB_ModuleLineStream.cpp"
"ext/raw_pdb/PDB_ModuleLineStream.h"
"ext/raw_pdb/PDB_ModuleSymbolStream.cpp"
"ext/raw_pdb/PDB_ModuleSymbolStream.h"
"ext/raw_pdb/PDB_NamesStream.cpp"
"ext/raw_pdb/PDB_NamesStream.h"
"ext/raw_pdb/PDB_PCH.cpp"
"ext/raw_pdb/PDB_PCH.h"
"ext/raw_pdb/PDB_PublicSymbolStream.cpp"
"ext/raw_pdb/PDB_PublicSymbolStream.h"
"ext/raw_pdb/PDB_RawFile.cpp"
"ext/raw_pdb/PDB_RawFile.h"
"ext/raw_pdb/PDB_SectionContributionStream.cpp"
"ext/raw_pdb/PDB_SectionContributionStream.h"
"ext/raw_pdb/PDB_SourceFileStream.cpp"
"ext/raw_pdb/PDB_SourceFileStream.h"
"ext/raw_pdb/PDB_TPIStream.cpp"
"ext/raw_pdb/PDB_TPIStream.h"
"ext/raw_pdb/PDB_TPITypes.h"
"ext/raw_pdb/PDB_Types.cpp"
"ext/raw_pdb/PDB_Types.h"
"ext/raw_pdb/PDB_Util.h"
"src/assembler/assembler.hpp"
"src/config/config.cpp"
"src/config/config.hpp"
"src/control_flow/control_flow_flattening.cpp"
"src/control_flow/control_flow_flattening.hpp"
"src/linear_substitution/linear_substitution.cpp"
"src/linear_substitution/linear_substitution.hpp"
"src/main.cpp"
"src/mba/flag_behaviour.cpp"
"src/mba/flag_behaviour.hpp"
"src/mba/mba.cpp"
"src/mba/mba.hpp"
"src/opaque_predicate/opaque_predicate.cpp"
"src/opaque_predicate/opaque_predicate.hpp"
"src/virtual_machine/hardware_register.cpp"
"src/virtual_machine/hardware_register.hpp"
"src/virtual_machine/operand.hpp"
"src/virtual_machine/virtual_machine.cpp"
"src/virtual_machine/virtual_machine.hpp"
"src/virtual_machine/vm_context.cpp"
"src/virtual_machine/vm_context.hpp"
)
add_executable(binprotect)
target_sources(binprotect PRIVATE ${binprotect_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${binprotect_SOURCES})
if(MSVC) # msvc
target_compile_options(binprotect PRIVATE
"/utf-8"
)
endif()
target_include_directories(binprotect PRIVATE
ext
)
target_link_libraries(binprotect PRIVATE
spdlog::spdlog
Zydis
argparse::argparse
)
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
if(NOT CMKR_VS_STARTUP_PROJECT)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT binprotect)
endif()