blob: fd7b802e4702a20ce71d2ca1d8718add01bd699d (
plain)
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
# Aliens vs Predator Linux - http://icculus.org/avp/
# CMake 2.8 project
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
# default to Release
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
MESSAGE(STATUS "No build type specified, defaulting to Release")
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Build type; one of: Debug Release RelWithDebInfo MinSizeRel" FORCE)
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
option(AVP_WEB "Build a WASM binary (untested)")
PROJECT(avp)
IF(AVP_WEB)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -g4 -s USE_SDL=2 -s TOTAL_MEMORY=234881024 -s ASSERTIONS=2 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=2 -s DEMANGLE_SUPPORT=1")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -g4 -s USE_SDL=2 -s TOTAL_MEMORY=234881024 -s ASSERTIONS=2 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=2 -s DEMANGLE_SUPPORT=1")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_SDL=2 -s TOTAL_MEMORY=234881024")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2 -s TOTAL_MEMORY=234881024")
ENDIF()
IF(AVP_WEB_WASM)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s WASM=1")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
ENDIF()
ENDIF(AVP_WEB)
# required dependencies
IF(NOT AVP_WEB)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBAVCODEC REQUIRED libavcodec)
pkg_check_modules(LIBAVFORMAT REQUIRED libavformat)
pkg_check_modules(LIBAVUTIL REQUIRED libavutil)
pkg_check_modules(LIBSWSCALE REQUIRED libswscale)
pkg_check_modules(OPENAL REQUIRED openal)
option(USE_SDL1 "Use SDL 1.2 instead of SDL 2")
option(USE_GLES2 "Use OpenGLES 2 instead of OpenGL")
IF(USE_SDL1)
pkg_check_modules(SDL REQUIRED sdl>=1.2)
ELSE()
pkg_check_modules(SDL2 REQUIRED sdl2)
ENDIF()
IF(USE_GLES2)
IF(USE_SDL1)
MESSAGE(FATAL_ERROR "OpenGL ES 2.0 support requires SDL2.")
ENDIF()
pkg_check_modules(EGL REQUIRED egl)
pkg_check_modules(OPENGLES2 REQUIRED glesv2)
ELSE()
pkg_check_modules(OPENGL REQUIRED gl)
ENDIF()
ENDIF()
# required source files
LIST(APPEND source src/bink.c)
LIST(APPEND source src/stubs.c)
LIST(APPEND source src/version.c)
LIST(APPEND source src/mathline.c)
LIST(APPEND source src/net.c)
LIST(APPEND source src/frustum.c)
LIST(APPEND source src/kshape.c)
LIST(APPEND source src/map.c)
LIST(APPEND source src/maths.c)
LIST(APPEND source src/md5.c)
LIST(APPEND source src/mem3dc.c)
LIST(APPEND source src/mem3dcpp.cpp)
LIST(APPEND source src/module.c)
LIST(APPEND source src/morph.c)
LIST(APPEND source src/object.c)
LIST(APPEND source src/shpanim.c)
LIST(APPEND source src/sphere.c)
LIST(APPEND source src/tables.c)
LIST(APPEND source src/vdb.c)
LIST(APPEND source src/avp/ai_sight.c)
LIST(APPEND source src/avp/avpview.c)
LIST(APPEND source src/avp/bh_agun.c)
LIST(APPEND source src/avp/bh_ais.c)
LIST(APPEND source src/avp/bh_alien.c)
LIST(APPEND source src/avp/bh_binsw.c)
LIST(APPEND source src/avp/bh_cable.c)
LIST(APPEND source src/avp/bh_corpse.c)
LIST(APPEND source src/avp/bh_deathvol.c)
LIST(APPEND source src/avp/bh_debri.c)
LIST(APPEND source src/avp/bh_dummy.c)
LIST(APPEND source src/avp/bh_fan.c)
LIST(APPEND source src/avp/bh_far.c)
LIST(APPEND source src/avp/bh_fhug.c)
LIST(APPEND source src/avp/bh_gener.c)
LIST(APPEND source src/avp/bh_ldoor.c)
LIST(APPEND source src/avp/bh_lift.c)
LIST(APPEND source src/avp/bh_light.c)
LIST(APPEND source src/avp/bh_lnksw.c)
LIST(APPEND source src/avp/bh_ltfx.c)
LIST(APPEND source src/avp/bh_marin.c)
LIST(APPEND source src/avp/bh_mission.c)
LIST(APPEND source src/avp/bh_near.c)
LIST(APPEND source src/avp/bh_pargen.c)
LIST(APPEND source src/avp/bh_plachier.c)
LIST(APPEND source src/avp/bh_plift.c)
LIST(APPEND source src/avp/bh_pred.c)
LIST(APPEND source src/avp/bh_queen.c)
LIST(APPEND source src/avp/bh_rubberduck.c)
LIST(APPEND source src/avp/bh_selfdest.c)
LIST(APPEND source src/avp/bh_snds.c)
LIST(APPEND source src/avp/bh_spcl.c)
LIST(APPEND source src/avp/bh_swdor.c)
LIST(APPEND source src/avp/bh_track.c)
LIST(APPEND source src/avp/bh_types.c)
LIST(APPEND source src/avp/bh_videoscreen.c)
LIST(APPEND source src/avp/bh_waypt.c)
LIST(APPEND source src/avp/bh_weap.c)
LIST(APPEND source src/avp/bh_xeno.c)
LIST(APPEND source src/avp/bonusabilities.c)
LIST(APPEND source src/avp/cconvars.cpp)
LIST(APPEND source src/avp/cdtrackselection.cpp)
LIST(APPEND source src/avp/cheatmodes.c)
LIST(APPEND source src/avp/comp_map.c)
LIST(APPEND source src/avp/comp_shp.c)
LIST(APPEND source src/avp/consolelog.cpp)
LIST(APPEND source src/avp/davehook.cpp)
LIST(APPEND source src/avp/deaths.c)
LIST(APPEND source src/avp/decal.c)
LIST(APPEND source src/avp/detaillevels.c)
LIST(APPEND source src/avp/dynamics.c)
LIST(APPEND source src/avp/dynblock.c)
LIST(APPEND source src/avp/equipmnt.c)
LIST(APPEND source src/avp/extents.c)
LIST(APPEND source src/avp/game.c)
LIST(APPEND source src/avp/game_statistics.c)
LIST(APPEND source src/avp/gamecmds.cpp)
LIST(APPEND source src/avp/gamevars.cpp)
LIST(APPEND source src/avp/hmodel.c)
LIST(APPEND source src/avp/hud.c)
LIST(APPEND source src/avp/inventry.c)
LIST(APPEND source src/avp/language.c)
LIST(APPEND source src/avp/lighting.c)
LIST(APPEND source src/avp/load_shp.c)
LIST(APPEND source src/avp/los.c)
LIST(APPEND source src/avp/mempool.c)
LIST(APPEND source src/avp/messagehistory.c)
LIST(APPEND source src/avp/missions.cpp)
LIST(APPEND source src/avp/movement.c)
LIST(APPEND source src/avp/paintball.c)
LIST(APPEND source src/avp/particle.c)
LIST(APPEND source src/avp/pfarlocs.c)
LIST(APPEND source src/avp/pheromon.c)
LIST(APPEND source src/avp/player.c)
LIST(APPEND source src/avp/pmove.c)
LIST(APPEND source src/avp/psnd.c)
LIST(APPEND source src/avp/psndproj.c)
LIST(APPEND source src/avp/pvisible.c)
LIST(APPEND source src/avp/savegame.c)
LIST(APPEND source src/avp/scream.cpp)
LIST(APPEND source src/avp/secstats.c)
LIST(APPEND source src/avp/sfx.c)
LIST(APPEND source src/avp/stratdef.c)
LIST(APPEND source src/avp/targeting.c)
LIST(APPEND source src/avp/track.c)
LIST(APPEND source src/avp/triggers.c)
LIST(APPEND source src/avp/weapons.c)
LIST(APPEND source src/avp/shapes/cube.c)
LIST(APPEND source src/avp/support/consbind.cpp)
LIST(APPEND source src/avp/support/consbtch.cpp)
LIST(APPEND source src/avp/support/coordstr.cpp)
LIST(APPEND source src/avp/support/daemon.cpp)
LIST(APPEND source src/avp/support/indexfnt.cpp)
LIST(APPEND source src/avp/support/r2base.cpp)
LIST(APPEND source src/avp/support/r2pos666.cpp)
LIST(APPEND source src/avp/support/reflist.cpp)
LIST(APPEND source src/avp/support/refobj.cpp)
LIST(APPEND source src/avp/support/rentrntq.cpp)
LIST(APPEND source src/avp/support/scstring.cpp)
LIST(APPEND source src/avp/support/strtab.cpp)
LIST(APPEND source src/avp/support/strutil.c)
LIST(APPEND source src/avp/support/trig666.cpp)
LIST(APPEND source src/avp/support/wrapstr.cpp)
LIST(APPEND source src/avp/win95/avpchunk.cpp)
LIST(APPEND source src/avp/win95/cheat.c)
LIST(APPEND source src/avp/win95/chtcodes.cpp)
LIST(APPEND source src/avp/win95/d3d_hud.cpp)
LIST(APPEND source src/avp/win95/ddplat.cpp)
LIST(APPEND source src/avp/win95/endianio.c)
LIST(APPEND source src/avp/win95/ffread.cpp)
LIST(APPEND source src/avp/win95/ffstdio.cpp)
LIST(APPEND source src/avp/win95/gammacontrol.cpp)
LIST(APPEND source src/avp/win95/hierplace.cpp)
LIST(APPEND source src/avp/win95/iofocus.cpp)
LIST(APPEND source src/avp/win95/jsndsup.cpp)
LIST(APPEND source src/avp/win95/kzsort.c)
LIST(APPEND source src/avp/win95/langplat.c)
LIST(APPEND source src/avp/win95/modcmds.cpp)
LIST(APPEND source src/avp/win95/npcsetup.cpp)
LIST(APPEND source src/avp/win95/objsetup.cpp)
LIST(APPEND source src/avp/win95/pathchnk.cpp)
LIST(APPEND source src/avp/win95/platsup.c)
LIST(APPEND source src/avp/win95/pldghost.c)
LIST(APPEND source src/avp/win95/pldnet.c)
LIST(APPEND source src/avp/win95/progress_bar.cpp)
LIST(APPEND source src/avp/win95/projload.cpp)
LIST(APPEND source src/avp/win95/scrshot.cpp)
LIST(APPEND source src/avp/win95/strachnk.cpp)
LIST(APPEND source src/avp/win95/system.c)
LIST(APPEND source src/avp/win95/usr_io.c)
LIST(APPEND source src/avp/win95/vision.c)
LIST(APPEND source src/avp/win95/frontend/avp_envinfo.c)
LIST(APPEND source src/avp/win95/frontend/avp_intro.cpp)
LIST(APPEND source src/avp/win95/frontend/avp_menudata.c)
LIST(APPEND source src/avp/win95/frontend/avp_menus.c)
LIST(APPEND source src/avp/win95/frontend/avp_mp_config.cpp)
LIST(APPEND source src/avp/win95/frontend/avp_userprofile.cpp)
LIST(APPEND source src/avp/win95/gadgets/ahudgadg.cpp)
LIST(APPEND source src/avp/win95/gadgets/conscmnd.cpp)
LIST(APPEND source src/avp/win95/gadgets/conssym.cpp)
LIST(APPEND source src/avp/win95/gadgets/consvar.cpp)
LIST(APPEND source src/avp/win95/gadgets/gadget.cpp)
LIST(APPEND source src/avp/win95/gadgets/hudgadg.cpp)
LIST(APPEND source src/avp/win95/gadgets/rootgadg.cpp)
LIST(APPEND source src/avp/win95/gadgets/t_ingadg.cpp)
LIST(APPEND source src/avp/win95/gadgets/teletype.cpp)
LIST(APPEND source src/avp/win95/gadgets/textexp.cpp)
LIST(APPEND source src/avp/win95/gadgets/textin.cpp)
LIST(APPEND source src/avp/win95/gadgets/trepgadg.cpp)
LIST(APPEND source src/win95/animchnk.cpp)
LIST(APPEND source src/win95/animobs.cpp)
LIST(APPEND source src/win95/awtexld.cpp)
LIST(APPEND source src/win95/awbmpld.cpp)
LIST(APPEND source src/win95/awiffld.cpp)
LIST(APPEND source src/win95/awpnmld.cpp)
LIST(APPEND source src/win95/bmpnames.cpp)
LIST(APPEND source src/win95/chnkload.cpp)
LIST(APPEND source src/win95/chnktexi.cpp)
LIST(APPEND source src/win95/chnktype.cpp)
LIST(APPEND source src/win95/chunk.cpp)
LIST(APPEND source src/win95/chunkpal.cpp)
LIST(APPEND source src/win95/db.c)
LIST(APPEND source src/win95/debuglog.cpp)
LIST(APPEND source src/win95/dummyobjectchunk.cpp)
LIST(APPEND source src/win95/enumchnk.cpp)
LIST(APPEND source src/win95/enumsch.cpp)
LIST(APPEND source src/win95/envchunk.cpp)
LIST(APPEND source src/win95/fail.c)
LIST(APPEND source src/win95/fragchnk.cpp)
LIST(APPEND source src/win95/gsprchnk.cpp)
LIST(APPEND source src/win95/hierchnk.cpp)
LIST(APPEND source src/win95/huffman.cpp)
LIST(APPEND source src/win95/iff.cpp)
LIST(APPEND source src/win95/iff_ilbm.cpp)
LIST(APPEND source src/win95/ilbm_ext.cpp)
LIST(APPEND source src/win95/io.c)
LIST(APPEND source src/win95/list_tem.cpp)
LIST(APPEND source src/win95/ltchunk.cpp)
LIST(APPEND source src/win95/media.cpp)
LIST(APPEND source src/win95/mishchnk.cpp)
LIST(APPEND source src/win95/obchunk.cpp)
LIST(APPEND source src/win95/oechunk.cpp)
LIST(APPEND source src/win95/our_mem.c)
LIST(APPEND source src/win95/plat_shp.c)
LIST(APPEND source src/win95/plspecfn.c)
LIST(APPEND source src/win95/shpchunk.cpp)
LIST(APPEND source src/win95/sndchunk.cpp)
LIST(APPEND source src/win95/sprchunk.cpp)
LIST(APPEND source src/win95/string.cpp)
LIST(APPEND source src/win95/texio.c)
LIST(APPEND source src/win95/toolchnk.cpp)
LIST(APPEND source src/win95/txioctrl.cpp)
LIST(APPEND source src/win95/wpchunk.cpp)
LIST(APPEND source src/win95/zsp.cpp)
LIST(APPEND source src/opengl.c)
LIST(APPEND source src/oglfunc.c)
LIST(APPEND source src/fmv.c)
LIST(APPEND source src/openal.c)
LIST(APPEND source src/cdplayer.c)
LIST(APPEND source src/menus.c)
IF(WIN32)
LIST(APPEND source src/winfiles.c)
ELSE(WIN32)
LIST(APPEND source src/files.c)
LIST(APPEND source src/winapi.c)
ENDIF(WIN32)
IF(AVP_WEB)
LIST(APPEND source src/main2.c)
ENDIF(AVP_WEB)
IF(NOT AVP_WEB)
IF(USE_SDL1)
LIST(APPEND source src/main.c)
# SDL 1.2 on OS X requires this support file
IF(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
LIST(APPEND source src/sdl12/sdlmain.m)
ENDIF(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ELSE()
LIST(APPEND source src/main2.c)
ENDIF()
ENDIF(NOT AVP_WEB)
### build all source as C++
### (not normally used)
##SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES LANGUAGE CXX)
# auto-include directories with source files
FOREACH(sourcefile IN LISTS source)
GET_FILENAME_COMPONENT(includedir ${sourcefile} PATH) # newer CMake uses DIRECTORY
LIST(APPEND include ${includedir})
ENDFOREACH(sourcefile)
INCLUDE_DIRECTORIES(${include})
# manually include src/include
INCLUDE_DIRECTORIES(src/include)
IF(AVP_WEB)
ADD_DEFINITIONS(-DUSE_OPENGL_ES=1)
ADD_EXECUTABLE(avp ${source})
ENDIF(AVP_WEB)
IF(NOT AVP_WEB)
ADD_EXECUTABLE(avp ${source})
INSTALL(TARGETS avp DESTINATION bin)
# required dependencies
IF(WIN32)
TARGET_LINK_LIBRARIES(avp winmm)
ENDIF(WIN32)
IF(USE_SDL1)
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(avp ${SDL_LIBRARIES})
ELSE()
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(avp ${SDL2_LIBRARIES})
ENDIF()
IF(USE_GLES2)
ADD_DEFINITIONS(-DUSE_OPENGL_ES=1)
INCLUDE_DIRECTORIES(${OPENGLES2_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${EGL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(avp ${OPENGLES2_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${EGL_LIBRARIES})
ELSE()
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(avp ${OPENGL_LIBRARIES})
ENDIF()
INCLUDE_DIRECTORIES(${LIBAVCODEC_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIBAVFORMAT_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIBAVUTIL_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIBSWSCALE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(avp ${LIBAVCODEC_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${LIBAVFORMAT_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${LIBAVUTIL_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${LIBSWSCALE_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${OPENAL_LIBRARIES})
ENDIF(NOT AVP_WEB)
|