-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
191 lines (130 loc) · 3.96 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
cmake_minimum_required(VERSION 2.6)
if (${USE_COLOR})
add_definitions(-DUSE_COLOR)
endif()
if (${USE_DRSYMS})
add_definitions(-DUSE_DRSYMS)
endif()
if (${INTELPT})
add_definitions(-DINTELPT)
endif()
if (${INTELPT})
add_subdirectory(third_party/processor-trace)
endif()
add_subdirectory(TinyInst)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
project(test)
add_executable(test
test.cpp
)
project(test_netmode)
add_executable(test_netmode test_netmode.cpp)
add_executable(test_servermode test_simple_winsock_client.cpp)
if(NOT ("${CMAKE_GENERATOR}" MATCHES "(Win64)" OR "${CMAKE_GENERATOR_PLATFORM}" MATCHES "(64)"))
project(test_static)
add_executable(test_static
test_static.cpp
afl-staticinstr.c
)
target_link_libraries(test_static "psapi.lib")
set_target_properties(test_static PROPERTIES COMPILE_FLAGS "/EHsc")
set_target_properties(test_static PROPERTIES LINK_FLAGS "/PROFILE")
endif()
project(test_gdiplus)
add_executable(test_gdiplus
gdiplus.cpp
)
target_link_libraries(test_gdiplus gdiplus)
project(afl-analyze)
add_executable(afl-analyze
afl-analyze.c
)
project(afl-showmap)
add_executable(afl-showmap
afl-showmap.c
)
target_link_libraries(afl-showmap tinyinst)
project(afl-tmin)
add_executable(afl-tmin
afl-tmin.c
)
target_link_libraries(afl-tmin tinyinst)
add_library(custom_winafl_server SHARED custom_winafl_server.c custom_winafl_server.def)
add_library(custom_net_fuzzer SHARED custom_net_fuzzer.c custom_net_fuzzer.def)
if (${INTELPT})
project(winipt)
include_directories(third_party/winipt/inc)
ADD_LIBRARY(winipt STATIC
ipttool.c
third_party/winipt/libipt/win32.c
)
target_compile_definitions(winipt PRIVATE UNICODE _UNICODE)
project(winaflpt-debug)
include_directories(third_party/winipt/inc)
include_directories(third_party/processor-trace/libipt/internal/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/processor-trace/libipt/include)
SET(PT_ADDITIONAL_SOURCES
winaflpt.c
ptdecode.c
third_party/processor-trace/libipt/src/pt_cpu.c
third_party/processor-trace/libipt/src/windows/pt_cpuid.c
)
ADD_EXECUTABLE(winaflpt-debug
winaflpt-debug.c
${PT_ADDITIONAL_SOURCES}
)
target_link_libraries(winaflpt-debug winipt)
target_link_libraries(winaflpt-debug libipt)
target_link_libraries(winaflpt-debug "psapi.lib")
target_link_libraries(winaflpt-debug "Dbghelp.lib")
endif()
project(afl-fuzz)
SET(AFL_FUZZ_SOURCES afl-fuzz.c)
if (${INTELPT})
include_directories(third_party/winipt/inc)
include_directories(third_party/processor-trace/libipt/internal/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/processor-trace/libipt/include)
SET(AFL_FUZZ_SOURCES ${AFL_FUZZ_SOURCES} ${PT_ADDITIONAL_SOURCES})
endif()
add_executable(afl-fuzz
${AFL_FUZZ_SOURCES}
winafltiny.cpp
)
target_link_libraries(afl-fuzz tinyinst)
if (${INTELPT})
target_link_libraries(afl-fuzz winipt)
target_link_libraries(afl-fuzz libipt)
target_link_libraries(afl-fuzz "psapi.lib")
target_link_libraries(afl-fuzz "Dbghelp.lib")
endif()
if (NOT "${DynamoRIO_DIR}" STREQUAL "")
project(WinAFL)
set(DynamoRIO_LOG_COMPATIBILITY on)
find_package(DynamoRIO)
if (NOT DynamoRIO_FOUND)
message(FATAL_ERROR "DynamoRIO package required to build")
endif(NOT DynamoRIO_FOUND)
if (STATIC_LIBRARY)
set(libtype STATIC)
else()
set(libtype SHARED)
endif ()
add_library(winafl ${libtype}
winafl.c
modules.c
)
configure_DynamoRIO_client(winafl)
use_DynamoRIO_extension(winafl drmgr)
use_DynamoRIO_extension(winafl drx)
use_DynamoRIO_extension(winafl drcontainers)
use_DynamoRIO_extension(winafl drreg)
use_DynamoRIO_extension(winafl drwrap)
if (${USE_DRSYMS})
use_DynamoRIO_extension(winafl drsyms)
endif()
# VS2015 Fix
if (NOT (MSVC_VERSION LESS 1900))
target_link_libraries(winafl "libucrt.lib")
target_link_libraries(winafl "libvcruntime.lib")
endif()
endif()