-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathCMakeLists.txt
228 lines (195 loc) · 7.56 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
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
foreach(SUBDIR doom heretic hexen strife setup)
add_subdirectory("${SUBDIR}")
endforeach()
# Common source files used by absolutely everything:
set(COMMON_SOURCE_FILES
i_main.c
i_system.c i_system.h
m_argv.c m_argv.h
m_misc.c m_misc.h)
# Dedicated server (chocolate-server):
set(DEDSERV_FILES
d_dedicated.c
d_iwad.c d_iwad.h
d_mode.c d_mode.h
deh_str.c deh_str.h
i_timer.c i_timer.h
m_config.c m_config.h
net_common.c net_common.h
net_dedicated.c net_dedicated.h
net_io.c net_io.h
net_packet.c net_packet.h
net_sdl.c net_sdl.h
net_query.c net_query.h
net_server.c net_server.h
net_structrw.c net_structrw.h
z_native.c z_zone.h)
add_executable("${PROGRAM_PREFIX}server" WIN32 ${COMMON_SOURCE_FILES} ${DEDSERV_FILES})
target_include_directories("${PROGRAM_PREFIX}server"
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries("${PROGRAM_PREFIX}server" SDL2::SDL2main SDL2::net)
# Source files used by the game binaries (chocolate-doom, etc.)
set(GAME_SOURCE_FILES
aes_prng.c aes_prng.h
d_event.c d_event.h
doomkeys.h
doomtype.h
d_iwad.c d_iwad.h
d_loop.c d_loop.h
d_mode.c d_mode.h
d_ticcmd.h
deh_str.c deh_str.h
gusconf.c gusconf.h
i_cdmus.c i_cdmus.h
i_endoom.c i_endoom.h
i_glob.c i_glob.h
i_input.c i_input.h
i_joystick.c i_joystick.h
i_swap.h
i_midipipe.c i_midipipe.h
i_musicpack.c
i_oplmusic.c
i_pcsound.c
i_sdlmusic.c
i_sdlsound.c
i_sound.c i_sound.h
i_timer.c i_timer.h
i_video.c i_video.h
i_videohr.c i_videohr.h
midifile.c midifile.h
mus2mid.c mus2mid.h
m_bbox.c m_bbox.h
m_cheat.c m_cheat.h
m_config.c m_config.h
m_controls.c m_controls.h
m_fixed.c m_fixed.h
net_client.c net_client.h
net_common.c net_common.h
net_dedicated.c net_dedicated.h
net_defs.h
net_gui.c net_gui.h
net_io.c net_io.h
net_loop.c net_loop.h
net_packet.c net_packet.h
net_petname.c net_petname.h
net_query.c net_query.h
net_sdl.c net_sdl.h
net_server.c net_server.h
net_structrw.c net_structrw.h
sha1.c sha1.h
memio.c memio.h
tables.c tables.h
v_diskicon.c v_diskicon.h
v_video.c v_video.h
v_patch.h
w_checksum.c w_checksum.h
w_main.c w_main.h
w_wad.c w_wad.h
w_file.c w_file.h
w_file_stdc.c
w_file_posix.c
w_file_win32.c
w_merge.c w_merge.h
z_zone.c z_zone.h)
set(GAME_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/../")
if(MSVC)
list(APPEND GAME_SOURCE_FILES
"../win32/win_opendir.c" "../win32/win_opendir.h")
list(APPEND GAME_INCLUDE_DIRS
"${PROJECT_SOURCE_DIR}/win32/")
endif()
set(DEHACKED_SOURCE_FILES
deh_defs.h
deh_io.c deh_io.h
deh_main.c deh_main.h
deh_mapping.c deh_mapping.h
deh_text.c)
# Some games support dehacked patches, some don't:
set(SOURCE_FILES ${COMMON_SOURCE_FILES} ${GAME_SOURCE_FILES})
set(SOURCE_FILES_WITH_DEH ${SOURCE_FILES} ${DEHACKED_SOURCE_FILES})
set(EXTRA_LIBS SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net textscreen pcsound opl)
if(SAMPLERATE_FOUND)
list(APPEND EXTRA_LIBS samplerate::samplerate)
endif()
if(PNG_FOUND)
list(APPEND EXTRA_LIBS PNG::PNG)
endif()
if(WIN32)
add_executable("${PROGRAM_PREFIX}doom" WIN32 ${SOURCE_FILES_WITH_DEH} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
else()
add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH})
endif()
target_include_directories("${PROGRAM_PREFIX}doom" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}doom" doom ${EXTRA_LIBS})
if(MSVC)
set_target_properties("${PROGRAM_PREFIX}doom" PROPERTIES
LINK_FLAGS "/MANIFEST:NO")
endif()
if(WIN32)
add_executable("${PROGRAM_PREFIX}heretic" WIN32 ${SOURCE_FILES_WITH_DEH} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
else()
add_executable("${PROGRAM_PREFIX}heretic" ${SOURCE_FILES_WITH_DEH})
endif()
target_include_directories("${PROGRAM_PREFIX}heretic" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}heretic" heretic ${EXTRA_LIBS})
if(MSVC)
set_target_properties("${PROGRAM_PREFIX}heretic" PROPERTIES
LINK_FLAGS "/MANIFEST:NO")
endif()
if(WIN32)
add_executable("${PROGRAM_PREFIX}hexen" WIN32 ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
else()
add_executable("${PROGRAM_PREFIX}hexen" ${SOURCE_FILES})
endif()
target_include_directories("${PROGRAM_PREFIX}hexen" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}hexen" hexen ${EXTRA_LIBS})
if(MSVC)
set_target_properties("${PROGRAM_PREFIX}hexen" PROPERTIES
LINK_FLAGS "/MANIFEST:NO")
endif()
if(WIN32)
add_executable("${PROGRAM_PREFIX}strife" WIN32 ${SOURCE_FILES_WITH_DEH} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
else()
add_executable("${PROGRAM_PREFIX}strife" ${SOURCE_FILES_WITH_DEH})
endif()
target_include_directories("${PROGRAM_PREFIX}strife" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}strife" strife ${EXTRA_LIBS})
if(MSVC)
set_target_properties("${PROGRAM_PREFIX}strife" PROPERTIES
LINK_FLAGS "/MANIFEST:NO")
endif()
# Source files needed for chocolate-setup:
set(SETUP_FILES
deh_str.c deh_str.h
d_mode.c d_mode.h
d_iwad.c d_iwad.h
i_timer.c i_timer.h
m_config.c m_config.h
m_controls.c m_controls.h
net_io.c net_io.h
net_packet.c net_packet.h
net_petname.c net_petname.h
net_sdl.c net_sdl.h
net_query.c net_query.h
net_structrw.c net_structrw.h
z_native.c z_zone.h)
if(WIN32)
add_executable("${PROGRAM_PREFIX}setup" WIN32 ${SETUP_FILES} ${COMMON_SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/setup-res.rc")
else()
add_executable("${PROGRAM_PREFIX}setup" ${SETUP_FILES} ${COMMON_SOURCE_FILES})
endif()
target_include_directories("${PROGRAM_PREFIX}setup"
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries("${PROGRAM_PREFIX}setup" SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net setup textscreen)
if(MSVC)
set_target_properties("${PROGRAM_PREFIX}setup" PROPERTIES
LINK_FLAGS "/MANIFEST:NO")
endif()
add_executable(midiread midifile.c z_native.c i_system.c m_argv.c m_misc.c d_iwad.c deh_str.c m_config.c)
target_compile_definitions(midiread PRIVATE "-DTEST")
target_include_directories(midiread PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(midiread SDL2::SDL2main SDL2::SDL2)
add_executable(mus2mid mus2mid.c memio.c z_native.c i_system.c m_argv.c m_misc.c d_iwad.c deh_str.c m_config.c)
target_compile_definitions(mus2mid PRIVATE "-DSTANDALONE")
target_include_directories(mus2mid PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(mus2mid SDL2::SDL2main SDL2::SDL2)