# Copyright (C) 2005-2010 Trinity <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

######## game ########

# Enable precompiled headers when using the GCC compiler.
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
        INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)

SET(game_STAT_SRCS
   Accounts/AccountMgr.cpp
   Accounts/AccountMgr.h
   Achievements/AchievementMgr.h
   Achievements/AchievementMgr.cpp
   Addons/AddonMgr.cpp
   Addons/AddonMgr.h
   AI/CoreAI/CombatAI.cpp
   AI/CoreAI/CombatAI.h
   AI/CoreAI/GuardAI.cpp
   AI/CoreAI/GuardAI.h
   AI/CoreAI/PassiveAI.cpp
   AI/CoreAI/PassiveAI.h
   AI/CoreAI/PetAI.cpp
   AI/CoreAI/PetAI.h
   AI/CoreAI/ReactorAI.cpp
   AI/CoreAI/ReactorAI.h
   AI/CoreAI/TotemAI.cpp
   AI/CoreAI/TotemAI.h
   AI/CoreAI/UnitAI.cpp
   AI/CoreAI/UnitAI.h
   AI/EventAI/CreatureEventAI.cpp
   AI/EventAI/CreatureEventAIMgr.cpp
   AI/ScriptedAI/ScriptedSmartAI.cpp
   AI/ScriptedAI/ScriptedSmartAI.h
   AI/CreatureAIFactory.h
   AI/CreatureAIImpl.h
   AI/CreatureAIRegistry.cpp
   AI/CreatureAIRegistry.h
   AI/CreatureAISelector.cpp
   AI/CreatureAISelector.h
   AI/CreatureAI.cpp
   AI/CreatureAI.h
   AuctionHouse/AuctionHouseMgr.cpp
   AuctionHouse/AuctionHouseMgr.h
   AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp
   AuctionHouse/AuctionHouseBot/AuctionHouseBot.h
   BattleGrounds/ArenaTeam.cpp
   BattleGrounds/ArenaTeam.h
   BattleGrounds/Zones/BattleGroundAA.cpp
   BattleGrounds/Zones/BattleGroundAA.h
   BattleGrounds/Zones/BattleGroundAB.cpp
   BattleGrounds/Zones/BattleGroundAB.h
   BattleGrounds/Zones/BattleGroundRB.cpp
   BattleGrounds/Zones/BattleGroundRB.h
   BattleGrounds/Zones/BattleGroundAV.cpp
   BattleGrounds/Zones/BattleGroundAV.h
   BattleGrounds/Zones/BattleGroundBE.cpp
   BattleGrounds/Zones/BattleGroundBE.h
   BattleGrounds/Zones/BattleGroundDS.cpp
   BattleGrounds/Zones/BattleGroundDS.h
   BattleGrounds/Zones/BattleGroundEY.cpp
   BattleGrounds/Zones/BattleGroundEY.h
   BattleGrounds/Zones/BattleGroundIC.cpp
   BattleGrounds/Zones/BattleGroundIC.h
   BattleGrounds/Zones/BattleGroundNA.cpp
   BattleGrounds/Zones/BattleGroundNA.h
   BattleGrounds/Zones/BattleGroundRL.cpp
   BattleGrounds/Zones/BattleGroundRL.h
   BattleGrounds/Zones/BattleGroundRV.cpp
   BattleGrounds/Zones/BattleGroundRV.h
   BattleGrounds/Zones/BattleGroundSA.cpp
   BattleGrounds/Zones/BattleGroundSA.h
   BattleGrounds/Zones/BattleGroundWS.cpp
   BattleGrounds/Zones/BattleGroundWS.h
   BattleGrounds/BattleGround.cpp
   BattleGrounds/BattleGround.h
   BattleGrounds/BattleGroundMgr.cpp
   BattleGrounds/BattleGroundMgr.h
   Calendar/Calendar.cpp
   Calendar/Calendar.h
   Chat/Channels/Channel.cpp
   Chat/Channels/Channel.h
   Chat/Channels/ChannelMgr.h
   Chat/Channels/ChannelMgr.cpp
   Chat/Commands/Debugcmds.cpp
   Chat/Commands/Level0.cpp
   Chat/Commands/Level1.cpp
   Chat/Commands/Level2.cpp
   Chat/Commands/Level3.cpp
   Chat/Chat.cpp
   Chat/Chat.h
   Combat/HostileRefManager.cpp
   Combat/HostileRefManager.h
   Combat/ThreatManager.cpp
   Combat/ThreatManager.h
   Combat/UnitEvents.h
   Conditions/ConditionMgr.cpp
   Conditions/ConditionMgr.h
   DataStores/DBCEnums.h
   DataStores/DBCStores.cpp
   DataStores/DBCStores.h
   DataStores/DBCStructure.h
   DataStores/DBCfmt.h
   DungeonFinding/LFG.h
   DungeonFinding/LFGMgr.cpp
   DungeonFinding/LFGMgr.h
   Entities/Corpse/Corpse.cpp
   Entities/Corpse/Corpse.h
   Entities/Creature/Creature.cpp
   Entities/Creature/Creature.h
   Entities/Creature/CreatureGroups.cpp
   Entities/Creature/CreatureGroups.h
   Entities/Creature/GossipDef.cpp
   Entities/Creature/GossipDef.h
   Entities/Creature/TemporarySummon.cpp
   Entities/Creature/TemporarySummon.h
   Entities/DynamicObject/DynamicObject.cpp
   Entities/DynamicObject/DynamicObject.h
   Entities/GameObject/GameObject.cpp
   Entities/GameObject/GameObject.h
   Entities/Item/Container/Bag.cpp
   Entities/Item/Container/Bag.h
   Entities/Item/Item.cpp
   Entities/Item/Item.h
   Entities/Item/ItemEnchantmentMgr.cpp
   Entities/Item/ItemEnchantmentMgr.h
   Entities/Item/ItemPrototype.h
   Entities/Object/Updates/UpdateData.cpp
   Entities/Object/Updates/UpdateData.h
   Entities/Object/Updates/UpdateFields.h
   Entities/Object/Updates/UpdateMask.h
   Entities/Object/ObjectDefines.h
   Entities/Object/Object.cpp
   Entities/Object/Object.h
   Entities/Object/ObjectPosSelector.cpp
   Entities/Object/ObjectPosSelector.h
   Entities/Pet/Pet.cpp
   Entities/Pet/Pet.h
   Entities/Player/Player.cpp
   Entities/Player/Player.h
   Entities/Player/SocialMgr.cpp
   Entities/Player/SocialMgr.h
   Entities/Unit/StatSystem.cpp
   Entities/Unit/Unit.cpp
   Entities/Unit/Unit.h
   Entities/Totem/Totem.cpp
   Entities/Totem/Totem.h
   Entities/Transport/Transport.cpp
   Entities/Transport/Transport.h
   Entities/Vehicle/Vehicle.cpp
   Entities/Vehicle/Vehicle.h
   Events/GameEventMgr.cpp
   Events/GameEventMgr.h
   Globals/GlobalEvents.cpp
   Globals/GlobalEvents.h
   Globals/ObjectAccessor.cpp
   Globals/ObjectAccessor.h
   Globals/ObjectMgr.cpp
   Globals/ObjectMgr.h
   Grids/Cells/Cell.h
   Grids/Cells/CellImpl.h
   Grids/Notifiers/GridNotifiers.cpp
   Grids/Notifiers/GridNotifiers.h
   Grids/Notifiers/GridNotifiersImpl.h
   Grids/GridDefines.h
   Grids/GridStates.cpp
   Grids/GridStates.h
   Grids/ObjectGridLoader.cpp
   Grids/ObjectGridLoader.h
   Groups/Group.cpp
   Groups/Group.h
   Groups/GroupReference.cpp
   Groups/GroupReference.h
   Groups/GroupRefManager.h
   Guilds/Guild.cpp
   Guilds/Guild.h
   Instances/InstanceData.cpp
   Instances/InstanceData.h
   Instances/InstanceSaveMgr.cpp
   Instances/InstanceSaveMgr.h
   Loot/LootMgr.cpp
   Loot/LootMgr.h
   Mails/Mail.cpp
   Mails/Mail.h
   Maps/Map.cpp
   Maps/Map.h
   Maps/MapInstanced.cpp
   Maps/MapInstanced.h
   Maps/MapManager.cpp
   Maps/MapManager.h
   Maps/MapUpdater.cpp
   Maps/MapUpdater.h
   Maps/MapReference.h
   Maps/MapRefManager.h
   Maps/ZoneScript.h
   Miscellaneous/Formulas.h
   Miscellaneous/Language.h
   Miscellaneous/SharedDefines.h
   Movement/MovementGenerators/ConfusedMovementGenerator.cpp
   Movement/MovementGenerators/ConfusedMovementGenerator.h
   Movement/MovementGenerators/FleeingMovementGenerator.cpp
   Movement/MovementGenerators/FleeingMovementGenerator.h
   Movement/MovementGenerators/HomeMovementGenerator.cpp
   Movement/MovementGenerators/HomeMovementGenerator.h
   Movement/MovementGenerators/IdleMovementGenerator.cpp
   Movement/MovementGenerators/IdleMovementGenerator.h
   Movement/MovementGenerators/PointMovementGenerator.cpp
   Movement/MovementGenerators/PointMovementGenerator.h
   Movement/MovementGenerators/RandomMovementGenerator.cpp
   Movement/MovementGenerators/RandomMovementGenerator.h
   Movement/MovementGenerators/TargetedMovementGenerator.cpp
   Movement/MovementGenerators/TargetedMovementGenerator.h
   Movement/MovementGenerators/WaypointMovementGenerator.cpp
   Movement/MovementGenerators/WaypointMovementGenerator.h
   Movement/Waypoints/Path.h
   Movement/Waypoints/WaypointManager.cpp
   Movement/Waypoints/WaypointManager.h
   Movement/DestinationHolder.cpp
   Movement/DestinationHolder.h
   Movement/DestinationHolderImp.h
   Movement/FollowerReference.cpp
   Movement/FollowerReference.h
   Movement/FollowerRefManager.h
   Movement/MotionMaster.cpp
   Movement/MotionMaster.h
   Movement/MovementGenerator.cpp
   Movement/MovementGenerator.h
   Movement/MovementGeneratorImpl.h
   Movement/Traveller.h
   OutdoorPvP/Zones/OutdoorPvPEP.cpp
   OutdoorPvP/Zones/OutdoorPvPEP.h
   OutdoorPvP/Zones/OutdoorPvPHP.cpp
   OutdoorPvP/Zones/OutdoorPvPHP.h
   OutdoorPvP/Zones/OutdoorPvPNA.cpp
   OutdoorPvP/Zones/OutdoorPvPNA.h
   OutdoorPvP/Zones/OutdoorPvPSI.cpp
   OutdoorPvP/Zones/OutdoorPvPSI.h
   OutdoorPvP/Zones/OutdoorPvPTF.cpp
   OutdoorPvP/Zones/OutdoorPvPTF.h
   OutdoorPvP/Zones/OutdoorPvPZM.cpp
   OutdoorPvP/Zones/OutdoorPvPZM.h
   OutdoorPvP/OutdoorPvP.cpp
   OutdoorPvP/OutdoorPvP.h
   OutdoorPvP/OutdoorPvPImpl.h
   OutdoorPvP/OutdoorPvPMgr.cpp
   OutdoorPvP/OutdoorPvPMgr.h
   Pools/PoolHandler.cpp
   Pools/PoolHandler.h
   Quests/QuestDef.cpp
   Quests/QuestDef.h
   Reputation/ReputationMgr.cpp
   Reputation/ReputationMgr.h
   Scripting/ScriptLoader.cpp
   Scripting/ScriptLoader.h
   Scripting/ScriptMgr.cpp
   Scripting/ScriptMgr.h
   Scripting/ScriptSystem.cpp
   Scripting/ScriptSystem.h
   Server/Protocol/Handlers/AddonHandler.cpp
   Server/Protocol/Handlers/AddonHandler.h
   Server/Protocol/Handlers/ArenaTeamHandler.cpp
   Server/Protocol/Handlers/AuctionHouseHandler.cpp
   Server/Protocol/Handlers/BattleGroundHandler.cpp
   Server/Protocol/Handlers/CalendarHandler.cpp
   Server/Protocol/Handlers/ChannelHandler.cpp
   Server/Protocol/Handlers/CharacterHandler.cpp
   Server/Protocol/Handlers/ChatHandler.cpp
   Server/Protocol/Handlers/CombatHandler.cpp
   Server/Protocol/Handlers/DuelHandler.cpp
   Server/Protocol/Handlers/GroupHandler.cpp
   Server/Protocol/Handlers/GuildHandler.cpp
   Server/Protocol/Handlers/ItemHandler.cpp
   Server/Protocol/Handlers/LFGHandler.cpp
   Server/Protocol/Handlers/LootHandler.cpp
   Server/Protocol/Handlers/MiscHandler.cpp
   Server/Protocol/Handlers/MovementHandler.cpp
   Server/Protocol/Handlers/NPCHandler.cpp
   Server/Protocol/Handlers/NPCHandler.h
   Server/Protocol/Handlers/PetHandler.cpp
   Server/Protocol/Handlers/PetitionsHandler.cpp
   Server/Protocol/Handlers/QueryHandler.cpp
   Server/Protocol/Handlers/QuestHandler.cpp
   Server/Protocol/Handlers/SkillHandler.cpp
   Server/Protocol/Handlers/SpellHandler.cpp
   Server/Protocol/Handlers/TaxiHandler.cpp
   Server/Protocol/Handlers/TicketHandler.cpp
   Server/Protocol/Handlers/TradeHandler.cpp
   Server/Protocol/Handlers/VoiceChatHandler.cpp
   Server/Protocol/Opcodes.cpp
   Server/Protocol/Opcodes.h
   Server/Protocol/WorldLog.cpp
   Server/Protocol/WorldLog.h
   Server/WorldSession.cpp
   Server/WorldSession.h
   Server/WorldSocket.cpp
   Server/WorldSocket.h
   Server/WorldSocketMgr.cpp
   Server/WorldSocketMgr.h
   Skills/SkillDiscovery.cpp
   Skills/SkillDiscovery.h
   Skills/SkillExtraItems.cpp
   Skills/SkillExtraItems.h
   Spells/Auras/SpellAuraDefines.h
   Spells/Auras/SpellAuras.cpp
   Spells/Auras/SpellAuras.h
   Spells/Auras/SpellAuraEffects.cpp
   Spells/Auras/SpellAuraEffects.h
   Spells/Auras/SpellEffects.cpp
   Spells/Spell.cpp
   Spells/Spell.h
   Spells/SpellMgr.cpp
   Spells/SpellMgr.h
   Tools/PlayerDump.cpp
   Tools/PlayerDump.h
   Tools/Tools.cpp
   Tools/Tools.h
   Weather/Weather.cpp
   Weather/Weather.h
   World/World.cpp
   World/World.h
)

include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_SOURCE_DIR}/externals/mersennetwister
  ${CMAKE_SOURCE_DIR}/externals/zlib
  ${CMAKE_SOURCE_DIR}/src/server/collision
  ${CMAKE_SOURCE_DIR}/src/server/collision/Management
  ${CMAKE_SOURCE_DIR}/src/server/shared
  ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
  ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography
  ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication
  ${CMAKE_SOURCE_DIR}/src/server/shared/Database
  ${CMAKE_SOURCE_DIR}/src/server/shared/DataStores
  ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
  ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/CountedReference
  ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference
  ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
  ${CMAKE_SOURCE_DIR}/src/server/shared/Logging
  ${CMAKE_SOURCE_DIR}/src/server/shared/Packets
  ${CMAKE_SOURCE_DIR}/src/server/shared/Policies
  ${CMAKE_SOURCE_DIR}/src/server/shared/Threading
  ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
  ${CMAKE_SOURCE_DIR}/src/server/game
  ${CMAKE_SOURCE_DIR}/src/server/game/Accounts
  ${CMAKE_SOURCE_DIR}/src/server/game/Achievements
  ${CMAKE_SOURCE_DIR}/src/server/game/Addons
  ${CMAKE_SOURCE_DIR}/src/server/game/AI
  ${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
  ${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI
  ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
  ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
  ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
  ${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds
  ${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones
  ${CMAKE_SOURCE_DIR}/src/server/game/Calendar
  ${CMAKE_SOURCE_DIR}/src/server/game/Chat
  ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
  ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands
  ${CMAKE_SOURCE_DIR}/src/server/game/Combat
  ${CMAKE_SOURCE_DIR}/src/server/game/Conditions
  ${CMAKE_SOURCE_DIR}/src/server/game/DataStores
  ${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
  ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
  ${CMAKE_SOURCE_DIR}/src/server/game/Events
  ${CMAKE_SOURCE_DIR}/src/server/game/Globals
  ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
  ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
  ${CMAKE_SOURCE_DIR}/src/server/game/Grids
  ${CMAKE_SOURCE_DIR}/src/server/game/Groups
  ${CMAKE_SOURCE_DIR}/src/server/game/Guilds
  ${CMAKE_SOURCE_DIR}/src/server/game/Instances
  ${CMAKE_SOURCE_DIR}/src/server/game/Loot
  ${CMAKE_SOURCE_DIR}/src/server/game/Mails
  ${CMAKE_SOURCE_DIR}/src/server/game/Maps
  ${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
  ${CMAKE_SOURCE_DIR}/src/server/game/Movement
  ${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
  ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
  ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
  ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP/Zones
  ${CMAKE_SOURCE_DIR}/src/server/game/Pools
  ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
  ${CMAKE_SOURCE_DIR}/src/server/game/Quests
  ${CMAKE_SOURCE_DIR}/src/server/game/Reputation
  ${CMAKE_SOURCE_DIR}/src/server/game/Scripting
  ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
  ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol/Handlers
  ${CMAKE_SOURCE_DIR}/src/server/game/Server
  ${CMAKE_SOURCE_DIR}/src/server/game/Skills
  ${CMAKE_SOURCE_DIR}/src/server/game/Spells
  ${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
  ${CMAKE_SOURCE_DIR}/src/server/game/Tools
  ${CMAKE_SOURCE_DIR}/src/server/game/Weather
  ${CMAKE_SOURCE_DIR}/src/server/game/World
  ${MYSQL_INCLUDE_DIR}
  ${ACE_INCLUDE_DIR}
)

if(NOT DO_SCRIPTS)
   SET(game_STAT_SRCS ${game_STAT_SRCS}
      AI/ScriptedAI/ScriptedEscortAI.cpp
      AI/ScriptedAI/ScriptedEscortAI.h
      AI/ScriptedAI/ScriptedCreature.cpp
      AI/ScriptedAI/ScriptedCreature.h
      AI/ScriptedAI/ScriptedFollowerAI.cpp
      AI/ScriptedAI/ScriptedFollowerAI.h
      AI/ScriptedAI/ScriptedGossip.h
      AI/ScriptedAI/ScriptedGuardAI.cpp
      AI/ScriptedAI/ScriptedGuardAI.h
      AI/ScriptedAI/ScriptedInstance.h
      AI/ScriptedAI/ScriptedSimpleAI.cpp
      AI/ScriptedAI/ScriptedSimpleAI.h
   )
   message("-- Added Script Engine to GAME lib")
endif(NOT DO_SCRIPTS)

add_library(game STATIC ${game_STAT_SRCS})
ADD_DEPENDENCIES(game revision.h)

# Generate precompiled header
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
        ADD_PRECOMPILED_HEADER(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/NixCorePCH.h)
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)

