1
FIND_PACKAGE(SDL REQUIRED)
2
FIND_PACKAGE(SDL_image REQUIRED)
3
FIND_PACKAGE(SDL_mixer REQUIRED)
4
FIND_PACKAGE(SDL_net REQUIRED)
5
FIND_PACKAGE(SDL_ttf REQUIRED)
6
FIND_PACKAGE(ENet REQUIRED)
7
FIND_PACKAGE(CURL REQUIRED)
8
FIND_PACKAGE(LibXml2 REQUIRED)
9
FIND_PACKAGE(PhysFS REQUIRED)
10
FIND_PACKAGE(PNG REQUIRED)
11
12
13
SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
14
SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
15
SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
16
17
IF (WIN32)
18
    SET(EXTRA_LIBRARIES ws2_32 winmm)
19
ENDIF()
20
21
SET(GUICHAN_COMPONENTS "SDL")
22
FIND_PACKAGE(Guichan REQUIRED ${GUICHAN_COMPONENTS})
23
24
IF (WITH_OPENGL)
25
    FIND_PACKAGE(OpenGL REQUIRED)
26
    INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
27
    SET(FLAGS "${FLAGS} -DUSE_OPENGL")
28
ENDIF (WITH_OPENGL)
29
30
INCLUDE_DIRECTORIES(
31
    ${CMAKE_CURRENT_SOURCE_DIR}
32
    ${SDL_INCLUDE_DIR}
33
    ${SDLIMAGE_INCLUDE_DIR}
34
    ${SDLMIXER_INCLUDE_DIR}
35
    ${SDLNET_INCLUDE_DIR}
36
    ${SDLTTF_INCLUDE_DIR}
37
    ${ENET_INCLUDE_DIR}
38
    ${PNG_INCLUDE_DIR}
39
    ${PHYSFS_INCLUDE_DIR}
40
    ${CURL_INCLUDE_DIR}
41
    ${LIBXML2_INCLUDE_DIR}
42
    ${GUICHAN_INCLUDE_DIR}
43
    )
44
45
# Fix some stuff that gets not hidden by mainline modules
46
MARK_AS_ADVANCED(PHYSFS_INCLUDE_DIR)
47
MARK_AS_ADVANCED(PHYSFS_LIBRARY)
48
MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR)
49
MARK_AS_ADVANCED(SDLIMAGE_LIBRARY)
50
MARK_AS_ADVANCED(SDLMAIN_LIBRARY)
51
MARK_AS_ADVANCED(SDLMIXER_INCLUDE_DIR)
52
MARK_AS_ADVANCED(SDLMIXER_LIBRARY)
53
MARK_AS_ADVANCED(SDLNET_INCLUDE_DIR)
54
MARK_AS_ADVANCED(SDLNET_LIBRARY)
55
MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
56
MARK_AS_ADVANCED(SDL_LIBRARY)
57
58
SET(SRCS
59
    gui/widgets/avatar.cpp
60
    gui/widgets/avatar.h
61
    gui/widgets/browserbox.cpp
62
    gui/widgets/browserbox.h
63
    gui/widgets/button.cpp
64
    gui/widgets/button.h
65
    gui/widgets/channeltab.cpp
66
    gui/widgets/channeltab.h
67
    gui/widgets/chattab.cpp
68
    gui/widgets/chattab.h
69
    gui/widgets/checkbox.cpp
70
    gui/widgets/checkbox.h
71
    gui/widgets/container.cpp
72
    gui/widgets/container.h
73
    gui/widgets/desktop.cpp
74
    gui/widgets/desktop.h
75
    gui/widgets/dropdown.cpp
76
    gui/widgets/dropdown.h
77
    gui/widgets/flowcontainer.cpp
78
    gui/widgets/flowcontainer.h
79
    gui/widgets/icon.cpp
80
    gui/widgets/icon.h
81
    gui/widgets/inttextfield.cpp
82
    gui/widgets/inttextfield.h
83
    gui/widgets/label.cpp
84
    gui/widgets/label.h
85
    gui/widgets/layout.cpp
86
    gui/widgets/layout.h
87
    gui/widgets/layouthelper.cpp
88
    gui/widgets/layouthelper.h
89
    gui/widgets/listbox.cpp
90
    gui/widgets/listbox.h
91
    gui/widgets/passwordfield.cpp
92
    gui/widgets/passwordfield.h
93
    gui/widgets/popup.cpp
94
    gui/widgets/popup.h
95
    gui/widgets/progressbar.cpp
96
    gui/widgets/progressbar.h
97
    gui/widgets/radiobutton.cpp
98
    gui/widgets/radiobutton.h
99
    gui/widgets/resizegrip.cpp
100
    gui/widgets/resizegrip.h
101
    gui/widgets/scrollarea.cpp
102
    gui/widgets/scrollarea.h
103
    gui/widgets/slider.cpp
104
    gui/widgets/slider.h
105
    gui/widgets/tab.cpp
106
    gui/widgets/tab.h
107
    gui/widgets/tabbedarea.cpp
108
    gui/widgets/tabbedarea.h
109
    gui/widgets/textbox.cpp
110
    gui/widgets/textbox.h
111
    gui/widgets/textfield.cpp
112
    gui/widgets/textfield.h
113
    gui/widgets/textpreview.cpp
114
    gui/widgets/textpreview.h
115
    gui/widgets/vertcontainer.cpp
116
    gui/widgets/vertcontainer.h
117
    gui/widgets/whispertab.cpp
118
    gui/widgets/whispertab.h
119
    gui/widgets/window.cpp
120
    gui/widgets/window.h
121
    gui/widgets/windowcontainer.cpp
122
    gui/widgets/windowcontainer.h
123
    gui/buy.cpp
124
    gui/buy.h
125
    gui/buysell.cpp
126
    gui/buysell.h
127
    gui/changeemaildialog.cpp
128
    gui/changeemaildialog.h
129
    gui/changepassworddialog.cpp
130
    gui/changepassworddialog.h
131
    gui/charselectdialog.cpp
132
    gui/charselectdialog.h
133
    gui/charcreatedialog.cpp
134
    gui/charcreatedialog.h
135
    gui/chat.cpp
136
    gui/chat.h
137
    gui/confirmdialog.cpp
138
    gui/confirmdialog.h
139
    gui/connectiondialog.cpp
140
    gui/connectiondialog.h
141
    gui/debugwindow.cpp
142
    gui/debugwindow.h
143
    gui/emotepopup.cpp
144
    gui/emotepopup.h
145
    gui/emoteshortcutcontainer.cpp
146
    gui/emoteshortcutcontainer.h
147
    gui/equipmentwindow.cpp
148
    gui/equipmentwindow.h
149
    gui/focushandler.cpp
150
    gui/focushandler.h
151
    gui/gui.cpp
152
    gui/gui.h
153
    gui/help.cpp
154
    gui/help.h
155
    gui/inventorywindow.cpp
156
    gui/inventorywindow.h
157
    gui/itemcontainer.cpp
158
    gui/itemcontainer.h
159
    gui/itemlinkhandler.cpp
160
    gui/itemlinkhandler.h
161
    gui/itempopup.cpp
162
    gui/itempopup.h
163
    gui/itemshortcutcontainer.cpp
164
    gui/itemshortcutcontainer.h
165
    gui/itemamount.cpp
166
    gui/itemamount.h
167
    gui/linkhandler.h
168
    gui/login.cpp
169
    gui/login.h
170
    gui/minimap.cpp
171
    gui/minimap.h
172
    gui/ministatus.cpp
173
    gui/ministatus.h
174
    gui/npcdialog.cpp
175
    gui/npcdialog.h
176
    gui/npcpostdialog.cpp
177
    gui/npcpostdialog.h
178
    gui/okdialog.cpp
179
    gui/okdialog.h
180
    gui/outfitwindow.cpp
181
    gui/outfitwindow.h
182
    gui/palette.cpp
183
    gui/palette.h
184
    gui/partywindow.cpp
185
    gui/partywindow.h
186
    gui/playerbox.cpp
187
    gui/playerbox.h
188
    gui/popupmenu.cpp
189
    gui/popupmenu.h
190
    gui/quitdialog.cpp
191
    gui/quitdialog.h
192
    gui/recorder.cpp
193
    gui/recorder.h
194
    gui/register.cpp
195
    gui/register.h
196
    gui/sdlinput.cpp
197
    gui/sdlinput.h
198
    gui/sell.cpp
199
    gui/sell.h
200
    gui/serverdialog.cpp
201
    gui/serverdialog.h
202
    gui/setup.cpp
203
    gui/setup.h
204
    gui/setup_audio.cpp
205
    gui/setup_audio.h
206
    gui/setup_colors.cpp
207
    gui/setup_colors.h
208
    gui/setup_joystick.cpp
209
    gui/setup_joystick.h
210
    gui/setup_keyboard.cpp
211
    gui/setup_keyboard.h
212
    gui/setup_players.cpp
213
    gui/setup_players.h
214
    gui/setup_video.cpp
215
    gui/setup_video.h
216
    gui/setuptab.cpp
217
    gui/setuptab.h
218
    gui/shop.cpp
219
    gui/shop.h
220
    gui/shoplistbox.cpp
221
    gui/shoplistbox.h
222
    gui/shortcutcontainer.cpp
223
    gui/shortcutcontainer.h
224
    gui/shortcutwindow.cpp
225
    gui/shortcutwindow.h
226
    gui/skilldialog.cpp
227
    gui/skilldialog.h
228
    gui/skin.cpp
229
    gui/skin.h
230
    gui/speechbubble.cpp
231
    gui/speechbubble.h
232
    gui/specialswindow.cpp
233
    gui/specialswindow.h
234
    gui/statuswindow.cpp
235
    gui/statuswindow.h
236
    gui/storagewindow.cpp
237
    gui/storagewindow.h
238
    gui/table.cpp
239
    gui/table.h
240
    gui/tablemodel.cpp
241
    gui/tablemodel.h
242
    gui/textdialog.cpp
243
    gui/textdialog.h
244
    gui/textrenderer.h
245
    gui/trade.cpp
246
    gui/trade.h
247
    gui/truetypefont.cpp
248
    gui/truetypefont.h
249
    gui/unregisterdialog.cpp
250
    gui/unregisterdialog.h
251
    gui/updatewindow.cpp
252
    gui/updatewindow.h
253
    gui/viewport.cpp
254
    gui/viewport.h
255
    gui/windowmenu.cpp
256
    gui/windowmenu.h
257
    gui/worldselectdialog.cpp
258
    gui/worldselectdialog.h
259
    net/adminhandler.h
260
    net/charhandler.h
261
    net/chathandler.h
262
    net/download.cpp
263
    net/download.h
264
    net/gamehandler.h
265
    net/generalhandler.h
266
    net/guildhandler.h
267
    net/inventoryhandler.h
268
    net/logindata.h
269
    net/loginhandler.h
270
    net/messagehandler.cpp
271
    net/messagehandler.h
272
    net/messagein.cpp
273
    net/messagein.h
274
    net/messageout.cpp
275
    net/messageout.h
276
    net/npchandler.h
277
    net/net.cpp
278
    net/net.h
279
    net/partyhandler.h
280
    net/playerhandler.h
281
    net/serverinfo.h
282
    net/specialhandler.h
283
    net/tradehandler.h
284
    net/worldinfo.h
285
    resources/action.cpp
286
    resources/action.h
287
    resources/ambientoverlay.cpp
288
    resources/ambientoverlay.h
289
    resources/animation.cpp
290
    resources/animation.h
291
    resources/colordb.cpp
292
    resources/colordb.h
293
    resources/dye.cpp
294
    resources/dye.h
295
    resources/emotedb.cpp
296
    resources/emotedb.h
297
    resources/image.cpp
298
    resources/image.h
299
    resources/imageloader.cpp
300
    resources/imageloader.h
301
    resources/imageset.h
302
    resources/imageset.cpp
303
    resources/imagewriter.cpp
304
    resources/imagewriter.h
305
    resources/itemdb.cpp
306
    resources/itemdb.h
307
    resources/iteminfo.h
308
    resources/iteminfo.cpp
309
    resources/mapreader.cpp
310
    resources/mapreader.h
311
    resources/monsterdb.cpp
312
    resources/monsterdb.h
313
    resources/monsterinfo.cpp
314
    resources/monsterinfo.h
315
    resources/music.cpp
316
    resources/music.h
317
    resources/npcdb.cpp
318
    resources/npcdb.h
319
    resources/resource.cpp
320
    resources/resource.h
321
    resources/resourcemanager.cpp
322
    resources/resourcemanager.h
323
    resources/sdlrescalefacility.h
324
    resources/sdlrescalefacility.cpp
325
    resources/soundeffect.h
326
    resources/soundeffect.cpp
327
    resources/spritedef.h
328
    resources/spritedef.cpp
329
    resources/wallpaper.cpp
330
    resources/wallpaper.h
331
    utils/base64.cpp
332
    utils/base64.h
333
    utils/dtor.h
334
    utils/gettext.h
335
    utils/mathutils.h
336
    utils/sha256.cpp
337
    utils/sha256.h
338
    utils/stringutils.cpp
339
    utils/stringutils.h
340
    utils/mutex.h
341
    utils/xml.cpp
342
    utils/xml.h
343
    animatedsprite.cpp
344
    animatedsprite.h
345
    animationparticle.cpp
346
    animationparticle.h
347
    being.cpp
348
    being.h
349
    beingmanager.cpp
350
    beingmanager.h
351
    channel.cpp
352
    channel.h
353
    channelmanager.cpp
354
    channelmanager.h
355
    commandhandler.cpp
356
    commandhandler.h
357
    configlistener.h
358
    configuration.cpp
359
    configuration.h
360
    effectmanager.cpp
361
    effectmanager.h
362
    emoteshortcut.cpp
363
    emoteshortcut.h
364
    engine.cpp
365
    engine.h
366
    equipment.cpp
367
    equipment.h
368
    flooritem.cpp
369
    flooritem.h
370
    flooritemmanager.cpp
371
    flooritemmanager.h
372
    game.cpp
373
    game.h
374
    graphics.cpp
375
    graphics.h
376
    guichanfwd.h
377
    imageparticle.cpp
378
    imageparticle.h
379
    inventory.cpp
380
    inventory.h
381
    item.cpp
382
    item.h
383
    itemshortcut.cpp
384
    itemshortcut.h
385
    joystick.cpp
386
    joystick.h
387
    keyboardconfig.cpp
388
    keyboardconfig.h
389
    localplayer.cpp
390
    localplayer.h
391
    lockedarray.h
392
    log.cpp
393
    log.h
394
    main.cpp
395
    main.h
396
    map.cpp
397
    map.h
398
    monster.cpp
399
    monster.h
400
    npc.cpp
401
    npc.h
402
    openglgraphics.cpp
403
    openglgraphics.h
404
    particle.cpp
405
    particle.h
406
    particlecontainer.cpp
407
    particlecontainer.h
408
    particleemitter.cpp
409
    particleemitter.h
410
    particleemitterprop.h
411
    player.cpp
412
    player.h
413
    playerrelations.cpp
414
    playerrelations.h
415
    position.cpp
416
    position.h
417
    properties.h
418
    rotationalparticle.cpp
419
    rotationalparticle.h
420
    shopitem.cpp
421
    shopitem.h
422
    simpleanimation.cpp
423
    simpleanimation.h
424
    sound.cpp
425
    sound.h
426
    sprite.h
427
    statuseffect.cpp
428
    statuseffect.h
429
    text.cpp
430
    text.h
431
    textmanager.cpp
432
    textmanager.h
433
    textparticle.cpp
434
    textparticle.h
435
    tileset.h
436
    units.cpp
437
    units.h
438
    vector.cpp
439
    vector.h
440
    )
441
442
SET(SRCS_EA
443
    net/ea/gui/partytab.cpp
444
    net/ea/gui/partytab.h
445
    net/ea/adminhandler.cpp
446
    net/ea/adminhandler.h
447
    net/ea/beinghandler.cpp
448
    net/ea/beinghandler.h
449
    net/ea/buysellhandler.cpp
450
    net/ea/buysellhandler.h
451
    net/ea/charserverhandler.cpp
452
    net/ea/charserverhandler.h
453
    net/ea/chathandler.cpp
454
    net/ea/chathandler.h
455
    net/ea/equipmenthandler.cpp
456
    net/ea/equipmenthandler.h
457
    net/ea/gamehandler.cpp
458
    net/ea/gamehandler.h
459
    net/ea/generalhandler.cpp
460
    net/ea/generalhandler.h
461
    net/ea/inventoryhandler.cpp
462
    net/ea/inventoryhandler.h
463
    net/ea/itemhandler.cpp
464
    net/ea/itemhandler.h
465
    net/ea/loginhandler.cpp
466
    net/ea/loginhandler.h
467
    net/ea/network.cpp
468
    net/ea/network.h
469
    net/ea/npchandler.cpp
470
    net/ea/npchandler.h
471
    net/ea/partyhandler.cpp
472
    net/ea/partyhandler.h
473
    net/ea/playerhandler.cpp
474
    net/ea/playerhandler.h
475
    net/ea/protocol.h
476
    net/ea/specialhandler.cpp
477
    net/ea/specialhandler.h
478
    net/ea/tradehandler.cpp
479
    net/ea/tradehandler.h
480
    )
481
482
SET(SRCS_TMW
483
    gui/buddywindow.cpp
484
    gui/buddywindow.h
485
    gui/guildlistbox.cpp
486
    gui/guildlistbox.h
487
    gui/guildwindow.cpp
488
    gui/guildwindow.h
489
    net/tmwserv/accountserver/account.cpp
490
    net/tmwserv/accountserver/account.h
491
    net/tmwserv/accountserver/accountserver.cpp
492
    net/tmwserv/accountserver/accountserver.h
493
    net/tmwserv/accountserver/internal.cpp
494
    net/tmwserv/accountserver/internal.h
495
    net/tmwserv/chatserver/chatserver.cpp
496
    net/tmwserv/chatserver/chatserver.h
497
    net/tmwserv/chatserver/guild.cpp
498
    net/tmwserv/chatserver/guild.h
499
    net/tmwserv/chatserver/internal.cpp
500
    net/tmwserv/chatserver/internal.h
501
    net/tmwserv/chatserver/party.cpp
502
    net/tmwserv/chatserver/party.h
503
    net/tmwserv/gameserver/gameserver.cpp
504
    net/tmwserv/gameserver/gameserver.h
505
    net/tmwserv/gameserver/internal.cpp
506
    net/tmwserv/gameserver/internal.h
507
    net/tmwserv/gameserver/player.cpp
508
    net/tmwserv/gameserver/player.h
509
    net/tmwserv/adminhandler.cpp
510
    net/tmwserv/adminhandler.h
511
    net/tmwserv/beinghandler.cpp
512
    net/tmwserv/beinghandler.h
513
    net/tmwserv/buysellhandler.cpp
514
    net/tmwserv/buysellhandler.h
515
    net/tmwserv/charhandler.cpp
516
    net/tmwserv/charhandler.h
517
    net/tmwserv/chathandler.cpp
518
    net/tmwserv/chathandler.h
519
    net/tmwserv/connection.cpp
520
    net/tmwserv/connection.h
521
    net/tmwserv/effecthandler.cpp
522
    net/tmwserv/effecthandler.h
523
    net/tmwserv/gamehandler.cpp
524
    net/tmwserv/gamehandler.h
525
    net/tmwserv/generalhandler.cpp
526
    net/tmwserv/generalhandler.h
527
    net/tmwserv/guildhandler.cpp
528
    net/tmwserv/guildhandler.h
529
    net/tmwserv/internal.cpp
530
    net/tmwserv/internal.h
531
    net/tmwserv/inventoryhandler.cpp
532
    net/tmwserv/inventoryhandler.h
533
    net/tmwserv/itemhandler.h
534
    net/tmwserv/itemhandler.cpp
535
    net/tmwserv/loginhandler.cpp
536
    net/tmwserv/loginhandler.h
537
    net/tmwserv/network.cpp
538
    net/tmwserv/network.h
539
    net/tmwserv/npchandler.cpp
540
    net/tmwserv/npchandler.h
541
    net/tmwserv/partyhandler.cpp
542
    net/tmwserv/partyhandler.h
543
    net/tmwserv/playerhandler.cpp
544
    net/tmwserv/playerhandler.h
545
    net/tmwserv/protocol.h
546
    net/tmwserv/specialhandler.cpp
547
    net/tmwserv/specialhandler.h
548
    net/tmwserv/tradehandler.cpp
549
    net/tmwserv/tradehandler.h
550
    guild.cpp
551
    guild.h
552
    )
553
554
555
SET (PROGRAMS tmw tmw-ea)
556
557
ADD_EXECUTABLE(tmw WIN32 ${SRCS} ${SRCS_TMW})
558
ADD_EXECUTABLE(tmw-ea WIN32 ${SRCS} ${SRCS_EA})
559
560
FOREACH(program ${PROGRAMS})
561
    TARGET_LINK_LIBRARIES(${program} ${SDL_LIBRARY}
562
        ${SDLIMAGE_LIBRARY}
563
        ${SDLMIXER_LIBRARY}
564
        ${SDLNET_LIBRARY}
565
        ${SDLTTF_LIBRARY}
566
        ${ENET_LIBRARIES}
567
        ${PNG_LIBRARIES}
568
        ${PHYSFS_LIBRARY}
569
        ${CURL_LIBRARIES}
570
        ${LIBXML2_LIBRARIES}
571
        ${GUICHAN_LIBRARIES}
572
        ${OPENGL_LIBRARIES}
573
        ${EXTRA_LIBRARIES})
574
    INSTALL(TARGETS ${program} RUNTIME DESTINATION ${PKG_BINDIR})
575
ENDFOREACH(program)
576
577
SET(FLAGS_EA "${FLAGS} -DEATHENA_SUPPORT")
578
SET(FLAGS_TMW "${FLAGS} -DTMWSERV_SUPPORT")
579
580
SET_TARGET_PROPERTIES(tmw PROPERTIES COMPILE_FLAGS "${FLAGS_TMW}")
581
SET_TARGET_PROPERTIES(tmw-ea PROPERTIES COMPILE_FLAGS "${FLAGS_EA}")