-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
181 lines (136 loc) · 5.64 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
cmake_minimum_required(VERSION 3.5.0)
project(HitmanC47 C CXX RC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src_main)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src_testing)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/include)
# Linker, compiler and resource flags
# Copied straight from the Isle Decompilation project
set(CMAKE_CXX_FLAGS "/W3 /GX /D \"WIN32\" /D \"_WINDOWS\"")
set(CMAKE_CXX_FLAGS_DEBUG "/Gm /Zi /Od /D \"_DEBUG\"")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /D \"NDEBUG\"")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Zi /O2 /D \"NDEBUG\"")
set(CMAKE_CXX_FLAGS_MINSIZEREL "/Os /D \"NDEBUG\"")
set(CMAKE_EXE_LINKER_FLAGS "/machine:I386 /ignore:4098,4099,4237") # Supress warning about missing .pdb files
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/incremental:yes /debug")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/incremental:no")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/incremental:no /debug")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/incremental:no")
set(CMAKE_SHARED_LINKER_FLAGS "/machine:I386 /ignore:4098,4099,4237")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/incremental:yes /debug")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/incremental:no")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/incremental:no /debug")
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "/incremental:no")
set(CMAKE_RC_FLAGS "/I\"${CMAKE_CURRENT_SOURCE_DIR}/resources\"")
set(RESOURCE_FILE "resources/hitman.rc")
# Build ZLIB
add_library(zlib STATIC
external/include/zlib/adler32.c
external/include/zlib/compress.c
external/include/zlib/crc32.c
external/include/zlib/deflate.c
external/include/zlib/gzio.c
external/include/zlib/infblock.c
external/include/zlib/infcodes.c
external/include/zlib/inffast.c
external/include/zlib/inflate.c
external/include/zlib/inftrees.c
external/include/zlib/infutil.c
external/include/zlib/trees.c
external/include/zlib/uncompr.c
external/include/zlib/zutil.c
)
set_target_properties(zlib PROPERTIES LINKER_LANGUAGE C)
# Add common library (zstdlib)
add_library(common STATIC
src_main/common.h
src_main/memory.cpp
# RefTabs
src_main/zstdlib/reftab/reftab.cpp
src_main/zstdlib/reftab/reftab.h
src_main/zstdlib/reftab/allocreftab.cpp
src_main/zstdlib/reftab/allocreftab.h
src_main/zstdlib/reftab/reftab32.cpp
src_main/zstdlib/reftab/reftab32.h
src_main/zstdlib/reftab/strreftab.cpp
src_main/zstdlib/reftab/strreftab.h
src_main/zstdlib/reftab/equreftab.cpp
src_main/zstdlib/reftab/equreftab.h
src_main/zstdlib/reftab/linkreftab.cpp
src_main/zstdlib/reftab/linkreftab.h
src_main/zstdlib/reftab/staticreftab.cpp
src_main/zstdlib/reftab/staticreftab.h
# Main
src_main/zstdlib/zdynamicloader.cpp
src_main/zstdlib/zdynamicloader.h
src_main/zstdlib/zmalloc.cpp
src_main/zstdlib/zmalloc.h
# Console
src_main/zstdlib/zconsole/zconsolecommand.cpp
src_main/zstdlib/zconsole/zconsolecommand.h
src_main/zstdlib/zconsole/zconsole.cpp
src_main/zstdlib/zconsole/zconsole.h
# Trees
src_main/zstdlib/trees/zrbtree.cpp
src_main/zstdlib/trees/zrbtree.h
src_main/zstdlib/trees/zvaltree.cpp
src_main/zstdlib/trees/zvaltree.h
)
# Add System DLL
add_library(system SHARED
src_main/system/dllmain.cpp
src_main/system/zsyscom.cpp
src_main/system/zsyscom.h
src_main/system/zsysinterface.cpp
src_main/system/zsysinterface.h
src_main/system/zsysmem.cpp
src_main/system/zsysmem.h
src_main/system/zsysfile.cpp
src_main/system/zsysfile.h
)
target_sources(system PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dll_defs/system.def)
target_link_libraries(system globals common)
# Add directplay dll
add_library(directplay SHARED
src_main/directplay/dllmain.cpp
src_main/directplay/directplayproxy.cpp
src_main/directplay/directplayproxy.h
src_main/directplay/directplay.cpp
src_main/directplay/directplay.h
)
target_link_directories(directplay PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/libs)
target_link_libraries(directplay globals common dplayx dxguid)
target_sources(directplay PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dll_defs/directplay.def)
# Add globals dll
add_library(globals SHARED src_main/globals/dllmain.cpp)
target_sources(globals PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dll_defs/globals.def)
# Add the hitman executable
add_executable(hitman WIN32 src_main/hitman/main.cpp ${RESOURCE_FILE})
target_link_libraries(hitman globals common zlib)
# Add the probe dll
add_library(systemprobe SHARED
src_main/systemprobe/dllmain.cpp
src_main/systemprobe/csystemprobe.cpp
src_main/systemprobe/csystemprobe.h
)
target_link_directories(systemprobe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/libs)
target_link_libraries(systemprobe common globals ddraw dxguid opengl32 glide3x)
target_sources(systemprobe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dll_defs/systemprobe.def)
set_target_properties(systemprobe PROPERTIES OUTPUT_NAME "systemprobedll")
# Build the testing dll(s)
add_library(impl_swap SHARED
src_testing/impl_swap/dllmain.cpp
src_testing/impl_swap/constructors.cpp
src_testing/impl_swap/constructors.h
src_testing/impl_swap/menu/menu.cpp
src_testing/impl_swap/menu/menu.h
src_testing/impl_swap/methods.cpp
src_testing/impl_swap/methods.h
src_testing/impl_swap/wnd_patches.cpp
src_testing/impl_swap/wnd_patches.h
src_testing/impl_swap/loader.cpp
src_testing/impl_swap/loader.h
src_testing/impl_swap/utilities.h
)
target_link_directories(impl_swap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/libs)
target_link_libraries(impl_swap PRIVATE system minhook_x86 globals kernel32 common opengl32)