forked from OpenDungeons/OpenDungeons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
907 lines (790 loc) · 36.7 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
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
cmake_minimum_required(VERSION 2.8)
##################################
#### Project settings ############
##################################
project(opendungeons)
# Set a capitalized exe name on Windows
if(WIN32)
set(PROJECT_BINARY_NAME "OpenDungeons")
else()
set(PROJECT_BINARY_NAME "opendungeons")
endif()
# Project version
set(OD_MAJOR_VERSION 0)
set(OD_MINOR_VERSION 7)
set(OD_PATCH_LEVEL 0)
# Set the project version ready to be used in the code.
if(NOT MSVC)
add_definitions(-DOD_VERSION="${OD_MAJOR_VERSION}.${OD_MINOR_VERSION}.${OD_PATCH_LEVEL}")
endif()
# Set the data path depending on the platform
if(WIN32)
set(OD_DATA_PATH ".")
set(OD_PLUGINS_CFG_PATH ".")
set(OD_BIN_PATH ${CMAKE_INSTALL_PREFIX})
else()
# Set binary and data install locations if we want to use the installer
set(OD_BIN_PATH ${CMAKE_INSTALL_PREFIX}/games CACHE PATH "Absolute path to the game binary directory")
set(OD_DATA_PATH ${CMAKE_INSTALL_PREFIX}/share/games/${PROJECT_NAME} CACHE PATH "Absolute path to the game data directory")
set(OD_SHARE_PATH ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Absolute path to the shared data directory (desktop file, icons, etc.)")
# Set the plugins.cfg file path to a common but architecture-dependent location.
# Because the plugins.cfg Ogre plugins path path may vary depending on the architecture used.
set(OD_PLUGINS_CFG_PATH /etc/${PROJECT_NAME} CACHE PATH "Absolute path to the Ogre plugins.cfg file")
endif()
if(NOT MSVC)
# Set the data paths
add_definitions(-DOD_DATA_PATH="${OD_DATA_PATH}")
add_definitions(-DOD_PLUGINS_CFG_PATH="${OD_PLUGINS_CFG_PATH}")
endif()
# Where we want the binary
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
# Compilation options
option(OD_ENABLE_WARNINGS "Compile the game with all standard warnings enabled" ON)
option(OD_TREAT_WARNINGS_AS_ERRORS "Treat any warning seen while compiling as errors." ON)
# enable/disable unit tests
option(OD_BUILD_TESTING "Compile unit tests (to enable unit tests both this and BUILD_TESTING has to be on." OFF)
if(OD_BUILD_TESTING)
include(CTest)
endif()
##################################
#### Useful variables ############
##################################
#project paths
set(SRC "${CMAKE_SOURCE_DIR}/source")
#cmake paths
set(CMAKE_CONFIG_DIR "${CMAKE_SOURCE_DIR}/cmake/config")
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake/modules
${CMAKE_SOURCE_DIR}/cmake/modules/BoostTestTargets
)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMake build type is not set, defaulting to 'RelWithDebInfo'")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# For MSVC builds, the debug flags is added below.
add_definitions("-DOD_DEBUG")
endif()
# From Boost cmake file
# We want to differentiate MinGW64 and MinGW32
if(WIN32 AND MINGW)
exec_program(${CMAKE_CXX_COMPILER} ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE OD_MINGW_COMPILER_VERSION)
string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" OD_MINGW_COMPILER_VERSION ${OD_MINGW_COMPILER_VERSION})
message(STATUS "OD_MINGW_COMPILER_VERSION: ${OD_MINGW_COMPILER_VERSION}")
endif()
## We check for dependencies
set(OD_DEPENDENCIES_DIR "$ENV{OD_DEPS}" CACHE PATH "Path to prebuilt OD dependencies")
if(OD_DEPENDENCIES_DIR)
if(WIN32 AND MINGW)
set(OD_ARCH_SUFIX "/mingw${OD_MINGW_COMPILER_VERSION}")
elseif(WIN32 AND MSVC)
set(OD_ARCH_SUFIX "/msvc")
else()
set(OD_ARCH_SUFIX "")
endif()
set(OD_DEP_SEARCH_PATH
# Boost binaries contains compiler name. They can be put in the same directory
${OD_DEPENDENCIES_DIR}/boost
${OD_DEPENDENCIES_DIR}/stage/lib
${OD_DEPENDENCIES_DIR}/cegui/include/cegui-0
${OD_DEPENDENCIES_DIR}/cegui/lib${OD_ARCH_SUFIX}
${OD_DEPENDENCIES_DIR}/ogresdk/include
${OD_DEPENDENCIES_DIR}/ogresdk/lib${OD_ARCH_SUFIX}
${OD_DEPENDENCIES_DIR}/sfml/include
${OD_DEPENDENCIES_DIR}/sfml/lib${OD_ARCH_SUFIX}
)
# hints to the find_package calls
set(CMAKE_PREFIX_PATH ${OD_DEP_SEARCH_PATH} ${CMAKE_PREFIX_PATH})
message(STATUS "Search path dependencies: ${OD_DEP_SEARCH_PATH}")
endif()
##################################
#### ExplicitCompilerFlags #######
##################################
# TODO: Use add_compiler_options instead of setting CMAKE_CXX_FLAGS
# CMAKE_CXX_FLAGS are meant to be defined using these two public strings
# This makes it possible to have them explicitly displayed in CMake GUI
# CMAKE_CXX_FLAGS can still be used to override our default defintions
set(OD_OPT_FLAGS CACHE STRING "Optimization and optional compilation flags")
set(OD_CXX11_FLAGS CACHE STRING "Compilation flags to enable C++11 support")
if(MSVC)
# C++11 compilation flag is activated by default
# Optimisation flags can be added if deemed useful
else()
include(CheckCXXCompilerFlag)
if(NOT OD_CXX11_FLAGS)
CHECK_CXX_COMPILER_FLAG("-std=c++11" OD_CXX11_FLAG_SUPPORTED)
CHECK_CXX_COMPILER_FLAG("-std=gnu++11" OD_CXXGNU11_FLAG_SUPPORTED)
# MinGW supports CXX11 flag but do not compile with it. However, it works with gnu++11
if(OD_CXX11_FLAG_SUPPORTED AND NOT MINGW)
set(OD_CXX11_FLAGS "-std=c++11" CACHE STRING "Compilation flags to enable C++11 support" FORCE)
elseif(OD_CXX11_FLAG_SUPPORTED)
set(OD_CXX11_FLAGS "-std=gnu++11" CACHE STRING "Compilation flags to enable C++11 support" FORCE)
endif()
endif()
if(OD_ENABLE_WARNINGS)
# Help getting compilation warnings
set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wold-style-cast")
set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Woverloaded-virtual -Wredundant-decls -Wswitch-default -Wstrict-null-sentinel -Winvalid-pch")
set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wswitch-default -Wstack-protector")
#for later https://stackoverflow.com/questions/5088460/flags-to-enable-thorough-and-verbose-g-warnings/9862800#9862800:
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -pedantic -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization ")
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept")
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo")
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused")
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Winline -Winvalid-pch -Wswitch-enum -Wzero-as-null-pointer-constant -Wuseless-cast")
#set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Weffc++")
endif()
if(MINGW)
# Disable some warnings on MinGW
if(OD_ENABLE_WARNINGS)
set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wno-unused-local-typedefs -Wno-format")
endif()
# This includes enough debug information to get something useful
# from Dr. Mingw while keeping binary size down. Almost useless
# with gdb, though.
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
endif()
endif()
# Set compiler options in MSVC
if(WIN32 AND MSVC)
#Set some extra compiler flags
#TODO - investigate if these are what they should be
set(PLATFORM_C_FLAGS "/W3 /MD /Od /DWIN32 /D_WINDOWS /Gm /Gy /fp:fast /ZI /EHsc")
set(PLATFORM_C_FLAGS_DEBUG "/W3 /MDd /Od /Gm /Gy /fp:fast /ZI /DOD_DEBUG" )
# Set the application version
add_definitions(/DOD_VERSION="${OD_MAJOR_VERSION}.${OD_MINOR_VERSION}.${OD_PATCH_LEVEL}")
# Set the data paths
add_definitions(/DOD_DATA_PATH="${OD_DATA_PATH}")
add_definitions(/DOD_PLUGINS_CFG_PATH="${OD_PLUGINS_CFG_PATH}")
set(CMAKE_CXX_FLAGS "${PLATFORM_C_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${PLATFORM_C_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${PLATFORM_C_FLAGS_DEBUG}")
endif()
if(WIN32)
#Tell OIS we are linking dynamically for dllexport/dllimport attributes.
#TODO: Find out if this is needed.
add_definitions(-DOIS_DYNAMIC_LIB)
endif()
set(CMAKE_CXX_FLAGS "${OD_CXX11_FLAGS} ${OD_OPT_FLAGS} ${CMAKE_CXX_FLAGS}")
message(STATUS "CMake CXX Flags: " ${CMAKE_CXX_FLAGS})
##################################
#### Source files (.cpp) #########
##################################
#Add new .cpp files here so that they get compiled
set(OD_SOURCEFILES
#OpenDungeons sources
${SRC}/ai/AIFactory.cpp
${SRC}/ai/AIManager.cpp
${SRC}/ai/BaseAI.cpp
${SRC}/ai/KeeperAI.cpp
${SRC}/ai/KeeperAIType.cpp
${SRC}/camera/CameraManager.cpp
${SRC}/camera/HermiteCatmullSpline.cpp
${SRC}/camera/CullingManager.cpp
${SRC}/camera/CullingVectorManager.cpp
${SRC}/camera/SlopeWalk.cpp
${SRC}/creatureaction/CreatureAction.cpp
${SRC}/creatureaction/CreatureActionCarryEntity.cpp
${SRC}/creatureaction/CreatureActionClaimGroundTile.cpp
${SRC}/creatureaction/CreatureActionClaimWallTile.cpp
${SRC}/creatureaction/CreatureActionDigTile.cpp
${SRC}/creatureaction/CreatureActionEatChicken.cpp
${SRC}/creatureaction/CreatureActionFight.cpp
${SRC}/creatureaction/CreatureActionFightFriendly.cpp
${SRC}/creatureaction/CreatureActionFindHome.cpp
${SRC}/creatureaction/CreatureActionFlee.cpp
${SRC}/creatureaction/CreatureActionGetFee.cpp
${SRC}/creatureaction/CreatureActionGrabEntity.cpp
${SRC}/creatureaction/CreatureActionLeaveDungeon.cpp
${SRC}/creatureaction/CreatureActionSearchEntityToCarry.cpp
${SRC}/creatureaction/CreatureActionSearchFood.cpp
${SRC}/creatureaction/CreatureActionSearchGroundTileToClaim.cpp
${SRC}/creatureaction/CreatureActionSearchJob.cpp
${SRC}/creatureaction/CreatureActionSearchTileToDig.cpp
${SRC}/creatureaction/CreatureActionSearchWallTileToClaim.cpp
${SRC}/creatureaction/CreatureActionSleep.cpp
${SRC}/creatureaction/CreatureActionStealFreeGold.cpp
${SRC}/creatureaction/CreatureActionUseRoom.cpp
${SRC}/creatureaction/CreatureActionWalkToTile.cpp
${SRC}/creaturebehaviour/CreatureBehaviour.cpp
${SRC}/creaturebehaviour/CreatureBehaviourAttackEnemy.cpp
${SRC}/creaturebehaviour/CreatureBehaviourEngageNaturalEnemy.cpp
${SRC}/creaturebehaviour/CreatureBehaviourFleeWhenWeak.cpp
${SRC}/creaturebehaviour/CreatureBehaviourLeaveDungeonWhenFurious.cpp
${SRC}/creaturebehaviour/CreatureBehaviourManager.cpp
${SRC}/creatureeffect/CreatureEffect.cpp
${SRC}/creatureeffect/CreatureEffectDefense.cpp
${SRC}/creatureeffect/CreatureEffectExplosion.cpp
${SRC}/creatureeffect/CreatureEffectHeal.cpp
${SRC}/creatureeffect/CreatureEffectManager.cpp
${SRC}/creatureeffect/CreatureEffectSlap.cpp
${SRC}/creatureeffect/CreatureEffectSpeedChange.cpp
${SRC}/creatureeffect/CreatureEffectStrengthChange.cpp
${SRC}/creaturemood/CreatureMood.cpp
${SRC}/creaturemood/CreatureMoodWakefulness.cpp
${SRC}/creaturemood/CreatureMoodCreature.cpp
${SRC}/creaturemood/CreatureMoodFee.cpp
${SRC}/creaturemood/CreatureMoodHunger.cpp
${SRC}/creaturemood/CreatureMoodHpLoss.cpp
${SRC}/creaturemood/CreatureMoodManager.cpp
${SRC}/creaturemood/CreatureMoodTurnsWithoutFight.cpp
${SRC}/creatureskill/CreatureSkill.cpp
${SRC}/creatureskill/CreatureSkillDefenseSelf.cpp
${SRC}/creatureskill/CreatureSkillExplosion.cpp
${SRC}/creatureskill/CreatureSkillHasteSelf.cpp
${SRC}/creatureskill/CreatureSkillHealSelf.cpp
${SRC}/creatureskill/CreatureSkillManager.cpp
${SRC}/creatureskill/CreatureSkillMeleeFight.cpp
${SRC}/creatureskill/CreatureSkillMissileLaunch.cpp
${SRC}/creatureskill/CreatureSkillSlow.cpp
${SRC}/creatureskill/CreatureSkillStrengthSelf.cpp
${SRC}/creatureskill/CreatureSkillWeak.cpp
${SRC}/entities/Building.cpp
${SRC}/entities/BuildingObject.cpp
${SRC}/entities/ChickenEntity.cpp
${SRC}/entities/CraftedTrap.cpp
${SRC}/entities/Creature.cpp
${SRC}/entities/CreatureDefinition.cpp
${SRC}/entities/DoorEntity.cpp
${SRC}/entities/EntityLoading.cpp
${SRC}/entities/GameEntity.cpp
${SRC}/entities/GameEntityType.cpp
${SRC}/entities/GiftBoxEntity.cpp
${SRC}/entities/MapLight.cpp
${SRC}/entities/MissileBoulder.cpp
${SRC}/entities/MissileObject.cpp
${SRC}/entities/MissileOneHit.cpp
${SRC}/entities/MovableGameEntity.cpp
${SRC}/entities/PersistentObject.cpp
${SRC}/entities/RenderedMovableEntity.cpp
${SRC}/entities/SkillEntity.cpp
${SRC}/entities/SmallSpiderEntity.cpp
${SRC}/entities/Tile.cpp
${SRC}/entities/TrapEntity.cpp
${SRC}/entities/TreasuryObject.cpp
${SRC}/entities/Weapon.cpp
${SRC}/game/Player.cpp
${SRC}/game/PlayerSelection.cpp
${SRC}/game/Skill.cpp
${SRC}/game/SkillManager.cpp
${SRC}/game/SkillType.cpp
${SRC}/game/Seat.cpp
${SRC}/game/SeatData.cpp
${SRC}/gamemap/GameMap.cpp
${SRC}/gamemap/MapHandler.cpp
${SRC}/gamemap/MiniMap.cpp
${SRC}/gamemap/MiniMapDrawn.cpp
${SRC}/gamemap/MiniMapDrawnFull.cpp
${SRC}/gamemap/MiniMapCamera.cpp
${SRC}/gamemap/TileContainer.cpp
${SRC}/gamemap/TileSet.cpp
${SRC}/giftboxes/GiftBoxSkill.cpp
${SRC}/goals/Goal.cpp
${SRC}/goals/GoalClaimNTiles.cpp
${SRC}/goals/GoalLoading.cpp
${SRC}/goals/GoalKillAllEnemies.cpp
${SRC}/goals/GoalMineNGold.cpp
${SRC}/goals/GoalProtectCreature.cpp
${SRC}/goals/GoalProtectDungeonTemple.cpp
${SRC}/modes/AbstractApplicationMode.cpp
${SRC}/modes/Command.cpp
${SRC}/modes/ConsoleCommands.cpp
${SRC}/modes/ConsoleInterface.cpp
${SRC}/modes/EditorMode.cpp
${SRC}/modes/GameMode.cpp
${SRC}/modes/GameEditorModeBase.cpp
${SRC}/modes/GameEditorModeConsole.cpp
${SRC}/modes/InputManager.cpp
${SRC}/modes/MenuModeMain.cpp
${SRC}/modes/MenuModeConfigureSeats.cpp
${SRC}/modes/MenuModeEditorLoad.cpp
${SRC}/modes/MenuModeEditorNew.cpp
${SRC}/modes/MenuModeLoad.cpp
${SRC}/modes/MenuModeMasterServerJoin.cpp
${SRC}/modes/MenuModeMultiplayerClient.cpp
${SRC}/modes/MenuModeMultiplayerServer.cpp
${SRC}/modes/MenuModeReplay.cpp
${SRC}/modes/MenuModeSkirmish.cpp
${SRC}/modes/ModeManager.cpp
${SRC}/modes/SettingsWindow.cpp
${SRC}/network/ChatEventMessage.cpp
${SRC}/network/ClientNotification.cpp
${SRC}/network/ODClient.cpp
${SRC}/network/ODPacket.cpp
${SRC}/network/ODServer.cpp
${SRC}/network/ODSocketClient.cpp
${SRC}/network/ODSocketServer.cpp
${SRC}/network/ServerMode.cpp
${SRC}/network/ServerNotification.cpp
${SRC}/render/CreatureOverlayStatus.cpp
${SRC}/render/Gui.cpp
${SRC}/render/MovableTextOverlay.cpp
${SRC}/render/ODFrameListener.cpp
${SRC}/render/RenderManager.cpp
${SRC}/render/TextRenderer.cpp
${SRC}/renderscene/RenderScene.cpp
${SRC}/renderscene/RenderSceneAddEntity.cpp
${SRC}/renderscene/RenderSceneAddParticleEffect.cpp
${SRC}/renderscene/RenderSceneAddParticleEffectBone.cpp
${SRC}/renderscene/RenderSceneAddPointLight.cpp
${SRC}/renderscene/RenderSceneCameraMove.cpp
${SRC}/renderscene/RenderSceneGroup.cpp
${SRC}/renderscene/RenderSceneManager.cpp
${SRC}/renderscene/RenderSceneMenu.cpp
${SRC}/renderscene/RenderSceneAnimationOnce.cpp
${SRC}/renderscene/RenderSceneAnimationTime.cpp
${SRC}/renderscene/RenderSceneMoveEntity.cpp
${SRC}/renderscene/RenderScenePosEntity.cpp
${SRC}/renderscene/RenderSceneResizeEntity.cpp
${SRC}/renderscene/RenderSceneSyncWait.cpp
${SRC}/renderscene/RenderSceneSyncWaitAnimation.cpp
${SRC}/renderscene/RenderSceneSyncPost.cpp
${SRC}/renderscene/RenderSceneTurnEntity.cpp
${SRC}/renderscene/RenderSceneWait.cpp
${SRC}/rooms/Room.cpp
${SRC}/rooms/RoomArena.cpp
${SRC}/rooms/RoomBridge.cpp
${SRC}/rooms/RoomBridgeStone.cpp
${SRC}/rooms/RoomBridgeWooden.cpp
${SRC}/rooms/RoomCasino.cpp
${SRC}/rooms/RoomCrypt.cpp
${SRC}/rooms/RoomDormitory.cpp
${SRC}/rooms/RoomDungeonTemple.cpp
${SRC}/rooms/RoomHatchery.cpp
${SRC}/rooms/RoomLibrary.cpp
${SRC}/rooms/RoomManager.cpp
${SRC}/rooms/RoomPortal.cpp
${SRC}/rooms/RoomPortalWave.cpp
${SRC}/rooms/RoomPrison.cpp
${SRC}/rooms/RoomTorture.cpp
${SRC}/rooms/RoomTrainingHall.cpp
${SRC}/rooms/RoomTreasury.cpp
${SRC}/rooms/RoomType.cpp
${SRC}/rooms/RoomWorkshop.cpp
${SRC}/sound/MusicPlayer.cpp
${SRC}/sound/SoundEffectsManager.cpp
${SRC}/spawnconditions/SpawnCondition.cpp
${SRC}/spawnconditions/SpawnConditionCreature.cpp
${SRC}/spawnconditions/SpawnConditionGold.cpp
${SRC}/spawnconditions/SpawnConditionRoom.cpp
${SRC}/spells/Spell.cpp
${SRC}/spells/SpellCallToWar.cpp
${SRC}/spells/SpellCreatureDefense.cpp
${SRC}/spells/SpellCreatureExplosion.cpp
${SRC}/spells/SpellCreatureHaste.cpp
${SRC}/spells/SpellCreatureHeal.cpp
${SRC}/spells/SpellCreatureSlow.cpp
${SRC}/spells/SpellCreatureStrength.cpp
${SRC}/spells/SpellCreatureWeak.cpp
${SRC}/spells/SpellEyeEvil.cpp
${SRC}/spells/SpellManager.cpp
${SRC}/spells/SpellSummonWorker.cpp
${SRC}/spells/SpellType.cpp
${SRC}/traps/Trap.cpp
${SRC}/traps/TrapBoulder.cpp
${SRC}/traps/TrapCannon.cpp
${SRC}/traps/TrapDoor.cpp
${SRC}/traps/TrapManager.cpp
${SRC}/traps/TrapSpike.cpp
${SRC}/traps/TrapType.cpp
${SRC}/utils/ConfigManager.cpp
${SRC}/utils/FrameRateLimiter.cpp
${SRC}/utils/Helper.cpp
${SRC}/utils/LogManager.cpp
${SRC}/utils/LogSinkConsole.cpp
${SRC}/utils/LogSinkFile.cpp
${SRC}/utils/LogSinkOgre.cpp
${SRC}/utils/MasterServer.cpp
${SRC}/utils/Random.cpp
${SRC}/utils/ResourceManager.cpp
${SRC}/utils/VectorInt64.cpp
${SRC}/ODApplication.cpp
${SRC}/main.cpp
)
IF (MINGW)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${SRC}/utils/StackTraceWinMinGW.cpp)
ELSEIF(MSVC)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${SRC}/utils/StackTraceWinMSVC.cpp)
ELSEIF(UNIX)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${SRC}/utils/StackTraceUnix.cpp)
ELSE()
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${SRC}/utils/StackTraceStub.cpp)
ENDIF ()
# Adds the Windows icon resource file when building on windows.
IF (WIN32)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${CMAKE_SOURCE_DIR}/dist/icon.rc)
ENDIF ()
##################################
#### Find packages ###############
##################################
find_package(Threads REQUIRED)
find_package(OIS REQUIRED)
find_package(OGRE REQUIRED)
find_package(CEGUI REQUIRED)
find_package(SFML 2 REQUIRED COMPONENTS Audio System Network)
if((OGRE_VERSION_MAJOR LESS 1) AND (OGRE_VERSION_MINOR LESS 9))
message(FATAL_ERROR "OGRE version >= 1.9.0 required")
endif()
if("${CEGUI_VERSION}" VERSION_LESS "0.8.0")
message(FATAL_ERROR "CEGUI version >= 0.8.0 required")
endif()
if (SFML_VERSION_MAJOR LESS 2)
message(FATAL_ERROR "SFML version >= 2.0 required")
else()
message(STATUS "SFML include directory: ${SFML_INCLUDE_DIR}; SFML audio library: ${SFML_AUDIO_LIBRARY_DEBUG} ${SFML_AUDIO_LIBRARY_RELEASE}")
endif()
#This has to cover the versions not already known by CMake
set(Boost_ADDITIONAL_VERSIONS 1.47 1.47.0 1.47.1 1.55.0)
set(OD_BOOST_COMPONENTS system filesystem locale program_options thread)
if(BUILD_TESTING AND OD_BUILD_TESTING)
set(OD_BOOST_COMPONENTS ${OD_BOOST_COMPONENTS} unit_test_framework)
endif()
if(WIN32 AND ${OGRE_FOUND})
# On windows we can try to use boost from the Ogre SDK instead
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${ENV_OGRE_HOME}/boost_1_44/lib)
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${ENV_OGRE_HOME}/boost_1_44)
# We set these instead of searching if using MSVC
# This is because the libs in the ogre dir has a lib prefix making findboost not find them
set(OD_BOOST_LIB_DIRS ${ENV_OGRE_HOME}/boost_1_44/lib)
set(OD_BOOST_INCLUDE_DIRS ${ENV_OGRE_HOME}/boost_1_44)
find_package(Boost REQUIRED COMPONENTS ${OD_BOOST_COMPONENTS})
if(Boost_FOUND)
set(OD_BOOST_LIB_DIRS ${Boost_INCLUDE_DIRS}/stage/lib)
set(OD_BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
endif()
else()
find_package(Boost REQUIRED COMPONENTS ${OD_BOOST_COMPONENTS})
endif()
##################################
#### Headers and linking #########
##################################
#add all project specific include directorieS
include_directories(
#OpenDungeons includes
${CMAKE_SOURCE_DIR}/source
#external packages includes
SYSTEM ${CEGUI_INCLUDE_DIR}
SYSTEM ${SFML_INCLUDE_DIR}
SYSTEM ${OGRE_INCLUDE_DIRS}
SYSTEM ${OIS_INCLUDE_DIRS}
)
if(WIN32)
if(MINGW)
#TODO: Why are we linking boost here? It's linked again later.
# Boost
link_libraries(${Boost_LIBRARIES})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
endif()
if(MSVC)
include_directories(SYSTEM ${OD_BOOST_INCLUDE_DIRS})
link_directories(${OD_BOOST_LIB_DIRS})
endif()
endif()
##################################
#### Binary ######################
##################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32 OR APPLE)
set(OD_BUILD_SUFFIX "_d" CACHE STRING "String holding a suffix appended to the name of output binaries (under CMake build, only used for debug).")
else()
set(OD_BUILD_SUFFIX "" CACHE STRING "String holding a suffix appended to the name of output binaries (under CMake build, only used for debug).")
endif()
if(OD_BUILD_SUFFIX)
set(OD_HAS_BUILD_SUFFIX TRUE)
set(CMAKE_DEBUG_POSTFIX ${OD_BUILD_SUFFIX})
endif()
# Treat warnings as errors
if(NOT MSVC AND OD_TREAT_WARNINGS_AS_ERRORS)
add_compile_options("-Werror")
endif()
# Create the binary file (WIN32 makes sure there is no console window on windows.)
add_executable(${PROJECT_BINARY_NAME} WIN32 ${OD_SOURCEFILES})
##################################
#### Link libraries ##############
##################################
# Link libraries
target_link_libraries(
#target
${PROJECT_BINARY_NAME}
#libraries
${OGRE_LIBRARIES}
${OGRE_RTShaderSystem_LIBRARIES}
${OIS_LIBRARIES}
${CEGUI_LIBRARIES}
${CEGUI_OgreRenderer_LIBRARIES}
)
# Set linker options in MSVC
if(WIN32 AND MSVC)
# We need to force output because of the boost lib used, defining two times the
# same set of functions, once for Ogre, once for OD. It is harmless in our case
# to select this option.
SET_TARGET_PROPERTIES(${PROJECT_BINARY_NAME} PROPERTIES LINK_FLAGS " /FORCE:MULTIPLE")
endif()
if(OD_HAS_BUILD_SUFFIX)
SET_TARGET_PROPERTIES(${PROJECT_BINARY_NAME} PROPERTIES OUTPUT_NAME_DEBUG "${PROJECT_BINARY_NAME}${OD_BUILD_SUFFIX}")
endif()
# The name of the OGRE Overlay library is available as CMAKE variable, also discovering debug versions correctly; please leave it like that!
target_link_libraries(${PROJECT_BINARY_NAME} ${OGRE_Overlay_LIBRARY})
# We link needed libraries to display stacktrace on uncatched exception
if(MINGW)
# MinGW32 needs intl while not MinGW64. To differentiate them, we test the compiler version as it does not change very often for MinGW32
if(${OD_MINGW_COMPILER_VERSION} EQUAL 48)
message(STATUS "MINGW32 COMPILER VERSION: " ${CMAKE_CXX_COMPILER_VERSION})
target_link_libraries(${PROJECT_BINARY_NAME} imagehlp bfd intl iberty z)
else()
message(STATUS "MINGW64 COMPILER VERSION: " ${CMAKE_CXX_COMPILER_VERSION})
target_link_libraries(${PROJECT_BINARY_NAME} imagehlp bfd iberty z)
endif()
elseif(MSVC)
target_link_libraries(${PROJECT_BINARY_NAME} imagehlp)
endif()
# MSVC automatically links boost
if(NOT MSVC)
target_link_libraries(${PROJECT_BINARY_NAME} ${Boost_LIBRARIES})
endif()
# Link sfml
# No need to make a difference when release/debug is found because even
# if only one is found, the other is set to the same value
target_link_libraries(${PROJECT_BINARY_NAME} ${SFML_LIBRARIES})
##################################
#### Unit testing ################
##################################
if(BUILD_TESTING AND OD_BUILD_TESTING)
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
message(STATUS "boost testing framework found, enabling tests")
add_subdirectory("${SRC}/tests")
else()
message(STATUS "boost testing framework not found, not enabling tests")
endif()
endif()
##################################
#### Configure settings files ####
##################################
if(WIN32)
#On windows, use current directory for plugins and data for now
set(OD_OGRE_PLUGIN_DIR_REL "")
set(OD_OGRE_PLUGIN_DIR_DBG "")
else()
set(OD_OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_REL})
set(OD_OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_DBG})
message(STATUS "Plugin path rel: " ${OD_OGRE_PLUGIN_DIR_REL})
message(STATUS "Plugin path dbg: " ${OD_OGRE_PLUGIN_DIR_DBG})
endif()
#Do the configuration
configure_file(${CMAKE_CONFIG_DIR}/plugins.cfg.in ${CMAKE_BINARY_DIR}/plugins.cfg)
if(WIN32)
configure_file(${CMAKE_CONFIG_DIR}/plugins_d.cfg.in ${CMAKE_BINARY_DIR}/plugins_d.cfg)
endif()
configure_file(${CMAKE_CONFIG_DIR}/resources.cfg.in ${CMAKE_BINARY_DIR}/resources.cfg)
# Link icon with its full path when not installed in the /usr prefix since it might not be caught by the hicolor theme
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(OD_ICON_FULLPATH ${PROJECT_BINARY_NAME})
else()
set(OD_ICON_FULLPATH ${OD_SHARE_PATH}/icons/hicolor/scalable/apps/opendungeons.svg)
endif()
configure_file(${CMAKE_CONFIG_DIR}/opendungeons.desktop.in ${CMAKE_BINARY_DIR}/opendungeons.desktop)
configure_file(${CMAKE_CONFIG_DIR}/opendungeons.6.in ${CMAKE_BINARY_DIR}/opendungeons.6)
##################################
### Run-in-place customisation ###
##################################
# If the project is not built in the source directory, create symbolic links
# pointing to the game resources so that the game can be run in place
# NOTE: This won't work on FAT filesystems
if(NOT CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
foreach(RES config gui levels materials models music particles scripts sounds)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/${RES})
message(STATUS "Creating symlink to ${CMAKE_SOURCE_DIR}/${RES} in ${CMAKE_BINARY_DIR}")
if(UNIX)
execute_process(COMMAND ln -s -r -T ${CMAKE_SOURCE_DIR}/${RES} ${CMAKE_BINARY_DIR}/${RES})
elseif(WIN32 AND ${CMAKE_SYSTEM_VERSION} GREATER 6.0) # Windows Vista or newer
# For some reason "COMMAND cmd.exe /c mklink /j" does not work as expected
# so we use a batch file to workaround it (cf. https://github.com/OpenDungeons/OpenDungeons/pull/206 for details)
execute_process(COMMAND cmd.exe /c ${CMAKE_SOURCE_DIR}/cmake/winsymlink.bat ${CMAKE_BINARY_DIR}/${RES} ${CMAKE_SOURCE_DIR}/${RES})
endif()
endif()
endforeach(RES)
endif()
##################################
#### Installation ################
##################################
if(UNIX)
set(OD_PLUGINSCFGFILE ${CMAKE_BINARY_DIR}/plugins.cfg)
set(OD_RESOURCESFILE ${CMAKE_BINARY_DIR}/resources.cfg)
set(OD_RESOURCES ${CMAKE_SOURCE_DIR}/config
${CMAKE_SOURCE_DIR}/gui
${CMAKE_SOURCE_DIR}/levels
${CMAKE_SOURCE_DIR}/materials
${CMAKE_SOURCE_DIR}/models
${CMAKE_SOURCE_DIR}/music
${CMAKE_SOURCE_DIR}/particles
${CMAKE_SOURCE_DIR}/scripts
${CMAKE_SOURCE_DIR}/sounds)
set(OD_DOC ${CMAKE_SOURCE_DIR}/AUTHORS
${CMAKE_SOURCE_DIR}/CREDITS
${CMAKE_SOURCE_DIR}/LICENSE.md
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/RELEASE-NOTES.md)
# Install required game files: binary, configuration files and resources
install(TARGETS ${PROJECT_BINARY_NAME}
DESTINATION ${OD_BIN_PATH}
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES ${OD_PLUGINSCFGFILE}
DESTINATION ${OD_PLUGINS_CFG_PATH})
install(FILES ${OD_RESOURCESFILE}
DESTINATION ${OD_DATA_PATH})
install(DIRECTORY ${OD_RESOURCES}
DESTINATION ${OD_DATA_PATH})
# Additional distribution content (desktop file, icons, man page, doc)
install(FILES ${CMAKE_SOURCE_DIR}/dist/opendungeons.appdata.xml
DESTINATION ${OD_SHARE_PATH}/appdata)
install(FILES ${CMAKE_BINARY_DIR}/opendungeons.desktop
DESTINATION ${OD_SHARE_PATH}/applications)
install(FILES ${CMAKE_BINARY_DIR}/opendungeons.6
DESTINATION ${OD_SHARE_PATH}/man/man6)
install(FILES ${OD_DOC}
DESTINATION ${OD_SHARE_PATH}/doc/${PROJECT_NAME})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/dist/hicolor
DESTINATION ${OD_SHARE_PATH}/icons)
elseif(WIN32)
# To include redistributable needed files
include(InstallRequiredSystemLibraries)
message(STATUS "RUNTIME_LIBS: ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}")
# try to locate needed dlls
if(Boost_CHRONO_LIBRARY_RELEASE)
get_filename_component(BOOST_CHRONO_NAME ${Boost_CHRONO_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_CHRONO_BIN_REL NAMES "${BOOST_CHRONO_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_CHRONO_BIN_REL})
endif()
if(Boost_FILESYSTEM_LIBRARY_RELEASE)
get_filename_component(BOOST_FILESYSTEM_NAME ${Boost_FILESYSTEM_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_FILESYSTEM_BIN_REL NAMES "${BOOST_FILESYSTEM_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_FILESYSTEM_BIN_REL})
endif()
if(Boost_LOCALE_LIBRARY_RELEASE)
get_filename_component(BOOST_LOCALE_NAME ${Boost_LOCALE_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_LOCALE_BIN_REL NAMES "${BOOST_LOCALE_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_LOCALE_BIN_REL})
endif()
if(Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE)
get_filename_component(BOOST_PROGRAM_OPTIONS_NAME ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_PROGRAM_OPTIONS_BIN_REL NAMES "${BOOST_PROGRAM_OPTIONS_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_PROGRAM_OPTIONS_BIN_REL})
endif()
if(Boost_SYSTEM_LIBRARY_RELEASE)
get_filename_component(BOOST_SYSTEM_NAME ${Boost_SYSTEM_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_SYSTEM_BIN_REL NAMES "${BOOST_SYSTEM_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_SYSTEM_BIN_REL})
endif()
if(Boost_THREAD_LIBRARY_RELEASE)
get_filename_component(BOOST_THREAD_NAME ${Boost_THREAD_LIBRARY_RELEASE} NAME_WE)
find_file(DEPS_BOOST_THREAD_BIN_REL NAMES "${BOOST_THREAD_NAME}.dll" PATH_SUFFIXES "${Boost_LIBRARY_DIR}" "")
set(BOOST_BIN_REL ${BOOST_BIN_REL} ${DEPS_BOOST_THREAD_BIN_REL})
endif()
message(STATUS "BOOST_BIN_REL: ${BOOST_BIN_REL}")
#CEGUI
find_file(DEPS_CEGUI_MAIN_BIN_REL NAMES "CEGUIBase-0.dll" "libCEGUIBase-0.dll" PATH_SUFFIXES "")
find_file(DEPS_CEGUI_COREWINDOWRENDERERSET_BIN_REL NAMES "CEGUICoreWindowRendererSet.dll" "libCEGUICoreWindowRendererSet.dll" PATH_SUFFIXES "")
find_file(DEPS_CEGUI_EXPATPARSER_BIN_REL NAMES "CEGUIExpatParser.dll" "libCEGUIExpatParser.dll" PATH_SUFFIXES "")
find_file(DEPS_CEGUI_OGRERENDERER_BIN_REL NAMES "CEGUIOgreRenderer-0.dll" "libCEGUIOgreRenderer-0.dll" PATH_SUFFIXES "")
# Ogre
find_file(DEPS_OGRE_MAIN_BIN_REL NAMES "OgreMain.dll" "libOgreMain.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_OVERLAY_BIN_REL NAMES "OgreOverlay.dll" "libOgreOverlay.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_RTSHADERSSYSTEM_BIN_REL NAMES "OgreRTShaderSystem.dll" "libOgreRTShaderSystem.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_PLUGIN_OCTREE_BIN_REL NAMES "Plugin_OctreeSceneManager.dll" "libPlugin_OctreeSceneManager.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_PLUGIN_PARTICLEFX_BIN_REL NAMES "Plugin_ParticleFX.dll" "libPlugin_ParticleFX.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_RENDER_GL_BIN_REL NAMES "RenderSystem_GL.dll" "libRenderSystem_GL.dll" PATH_SUFFIXES "")
find_file(DEPS_OGRE_RENDER_D3D9_BIN_REL NAMES "RenderSystem_Direct3D9.dll" "libRenderSystem_Direct3D9.dll" PATH_SUFFIXES "")
# SFML
find_file(DEPS_SFML_AUDIO_BIN_REL NAMES "sfml-audio-2.dll" PATH_SUFFIXES "")
find_file(DEPS_SFML_NETWORK_BIN_REL NAMES "sfml-network-2.dll" PATH_SUFFIXES "")
find_file(DEPS_SFML_SYSTEM_BIN_REL NAMES "sfml-system-2.dll" PATH_SUFFIXES "")
# Other
find_file(DEPS_OIS_BIN_REL NAMES "OIS.dll" "libOIS.dll" PATH_SUFFIXES "")
find_file(DEPS_FREETYPE_BIN_REL NAMES "freetype.dll" "libfreetype.dll" PATH_SUFFIXES "")
find_file(DEPS_EXPAT_BIN_REL NAMES "expat.dll" "libexpat.dll" PATH_SUFFIXES "")
find_file(DEPS_OPENAL32_BIN_REL NAMES "openal32.dll" "libopenal32.dll" PATH_SUFFIXES "")
set(OD_PLUGINSCFGFILE ${CMAKE_BINARY_DIR}/plugins.cfg)
set(OD_RESOURCESFILE ${CMAKE_BINARY_DIR}/resources.cfg)
set(OD_RESOURCES ${CMAKE_SOURCE_DIR}/config
${CMAKE_SOURCE_DIR}/gui
${CMAKE_SOURCE_DIR}/levels
${CMAKE_SOURCE_DIR}/licenses
${CMAKE_SOURCE_DIR}/materials
${CMAKE_SOURCE_DIR}/models
${CMAKE_SOURCE_DIR}/music
${CMAKE_SOURCE_DIR}/particles
${CMAKE_SOURCE_DIR}/scripts
${CMAKE_SOURCE_DIR}/sounds)
set(OD_DOC ${CMAKE_SOURCE_DIR}/AUTHORS
${CMAKE_SOURCE_DIR}/CREDITS
${CMAKE_SOURCE_DIR}/LICENSE.md
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/RELEASE-NOTES.md)
set(EXT_LIBS # boost
${BOOST_BIN_REL}
#CEGUI
${DEPS_CEGUI_MAIN_BIN_REL}
${DEPS_CEGUI_COREWINDOWRENDERERSET_BIN_REL}
${DEPS_CEGUI_EXPATPARSER_BIN_REL}
${DEPS_CEGUI_OGRERENDERER_BIN_REL}
# Ogre
${DEPS_OGRE_MAIN_BIN_REL}
${DEPS_OGRE_OVERLAY_BIN_REL}
${DEPS_OGRE_RTSHADERSSYSTEM_BIN_REL}
${DEPS_OGRE_PLUGIN_OCTREE_BIN_REL}
${DEPS_OGRE_PLUGIN_PARTICLEFX_BIN_REL}
# SFML
${DEPS_SFML_AUDIO_BIN_REL}
${DEPS_SFML_NETWORK_BIN_REL}
${DEPS_SFML_SYSTEM_BIN_REL}
# Dependencies
${DEPS_OIS_BIN_REL}
${DEPS_FREETYPE_BIN_REL}
${DEPS_EXPAT_BIN_REL}
${DEPS_OPENAL32_BIN_REL}
)
# Optional renderers
if(DEPS_OGRE_RENDER_GL_BIN_REL)
set(EXT_LIBS ${EXT_LIBS} ${DEPS_OGRE_RENDER_GL_BIN_REL})
endif()
if(DEPS_OGRE_RENDER_D3D9_BIN_REL)
set(EXT_LIBS ${EXT_LIBS} ${DEPS_OGRE_RENDER_D3D9_BIN_REL})
endif()
if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
set(EXT_LIBS ${EXT_LIBS} ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
endif()
# Install required game files: binary, configuration files and resources
install(TARGETS ${PROJECT_BINARY_NAME}
RUNTIME DESTINATION ${OD_BIN_PATH}
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES ${OD_PLUGINSCFGFILE}
DESTINATION ${OD_PLUGINS_CFG_PATH})
install(FILES ${OD_RESOURCESFILE}
DESTINATION ${OD_DATA_PATH})
install(DIRECTORY ${OD_RESOURCES}
DESTINATION ${OD_DATA_PATH})
# Additional distribution content (desktop file, icons, man page, doc)
install(FILES ${OD_DOC}
DESTINATION ${OD_BIN_PATH})
# External libraries
install(FILES ${EXT_LIBS}
DESTINATION ${OD_BIN_PATH})
endif()
##################################
#### Packaging ###################
##################################
#Not used at the moment, more flexible to do the deb packages manually
#TODO - set up for making tarballs
# set(CPACK_SOURCE_IGNORE_FILES "~$" "${CMAKE_SOURCE_DIR}.*/.svn/" "${CMAKE_SOURCE_DIR}/debian/")
# set(CPACK_PACKAGE_NAME opendungeons)
# set(CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL})
# set(CPACK_PACKAGE_CONTACT OpenDungeons Team)
# set(CPACK_GENERATOR "DEB")
# set(CPACK_SOURCE_GENERATOR "DEB")
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcegui (>= 0.8.3), libois-1.2.0, libsfml-audio2.0, libopenal1, libogremain-1.9.0")
# include(CPack)