diff options
-rw-r--r-- | CMake/Modules/FindENet.cmake | 52 | ||||
-rw-r--r-- | CMakeLists.txt | 34 | ||||
-rw-r--r-- | src/CMakeLists.txt | 252 | ||||
-rw-r--r-- | src/Makefile.am | 2 |
4 files changed, 339 insertions, 1 deletions
diff --git a/CMake/Modules/FindENet.cmake b/CMake/Modules/FindENet.cmake new file mode 100644 index 00000000..98da51a3 --- /dev/null +++ b/CMake/Modules/FindENet.cmake @@ -0,0 +1,52 @@ +# - Try to find enet +# Once done this will define +# +# ENET_FOUND - system has enet +# ENET_INCLUDE_DIR - the enet include directory +# ENET_LIBRARIES - the libraries needed to use enet +# ENET_DEFINITIONS - Compiler switches required for using enet + +IF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + SET(ENet_FIND_QUIETLY TRUE) +ENDIF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + +# for Windows we rely on the environement variables +# %INCLUDE% and %LIB%; FIND_LIBRARY checks %LIB% +# automatically on Windows +IF(WIN32) + FIND_PATH(ENet_INCLUDE_DIR enet/enet.h + $ENV{INCLUDE} + ) + FIND_LIBRARY(ENet_LIBRARY + NAMES enet + ) +ELSE() + FIND_PATH(ENet_INCLUDE_DIR enet/enet.h + /usr/include + /usr/local/include + ) + FIND_LIBRARY(ENet_LIBRARY + NAMES enet + PATHS /usr/lib /usr/local/lib + ) +ENDIF() + +IF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + SET(ENET_FOUND TRUE) + SET(ENET_INCLUDE_DIR ${ENet_INCLUDE_DIR}) + SET(ENET_LIBRARIES ${ENet_LIBRARY}) +ELSE () + SET(ENET_FOUND FALSE) +ENDIF () + +IF (ENET_FOUND) + IF (NOT ENet_FIND_QUIETLY) + MESSAGE(STATUS "Found enet: ${ENet_LIBRARY}") + ENDIF (NOT ENet_FIND_QUIETLY) +ELSE (ENET_FOUND) + IF (ENet_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find enet") + ENDIF (ENet_FIND_REQUIRED) +ENDIF (ENET_FOUND) + +MARK_AS_ADVANCED(ENet_INCLUDE_DIR ENet_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d365b8ae --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +PROJECT(MANASERV) + +IF (NOT VERSION) + SET(VERSION 0.1.0.0) +ENDIF() + +# where to look for cmake modules +SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) + +IF (WIN32) + SET(PKG_DATADIR ".") + SET(PKG_BINDIR ".") + SET(LOCALEDIR ".") + STRING(REPLACE "." " " _VERSION ${VERSION}) + SEPARATE_ARGUMENTS(_VERSION) + LIST(LENGTH _VERSION _LEN) + IF(NOT _LEN EQUAL 4) + MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE.BUILD") + ENDIF() + LIST(GET _VERSION 0 VER_MAJOR) + LIST(GET _VERSION 1 VER_MINOR) + LIST(GET _VERSION 2 VER_RELEASE) + LIST(GET _VERSION 3 VER_BUILD) + CONFIGURE_FILE(src/winver.h.in src/winver.h) +ELSE (WIN32) + SET(PKG_DATADIR ${CMAKE_INSTALL_PREFIX}/share/manaserv) + SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) + SET(PKG_BINDIR ${CMAKE_INSTALL_PREFIX}/bin) +ENDIF (WIN32) + +ADD_SUBDIRECTORY(src) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..34a82f7e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,252 @@ +FIND_PACKAGE(ENet REQUIRED) +FIND_PACKAGE(LibXml2 REQUIRED) +FIND_PACKAGE(PhysFS REQUIRED) + +IF (CMAKE_COMPILER_IS_GNUCXX) + # Help getting compilation warnings + SET(CMAKE_CXX_FLAGS "-Wall") + IF (WIN32) + # 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(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"") +SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") +SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") + +IF (CMAKE_BUILD_TYPE) + STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) + IF((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR + (CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo)) + SET(FLAGS "${FLAGS} -DDEBUG") + ENDIF() +ENDIF() + +IF (WIN32) + SET(EXTRA_LIBRARIES ws2_32 winmm) + FIND_PACKAGE(LibIntl REQUIRED) +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL SunOS) + # explicit linking to libintl is required on Solaris + SET(EXTRA_LIBRARIES intl) +ENDIF() + +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR} + ${ENET_INCLUDE_DIR} + ${PHYSFS_INCLUDE_DIR} + ${LIBXML2_INCLUDE_DIR} + ) + +# Fix some stuff that gets not hidden by mainline modules +MARK_AS_ADVANCED(PHYSFS_INCLUDE_DIR) +MARK_AS_ADVANCED(PHYSFS_LIBRARY) + +SET(SRCS_MANASERVACCOUNT + account-server/main-account.cpp + defines.h + protocol.h + point.h + account-server/account.hpp + account-server/account.cpp + account-server/accountclient.hpp + account-server/accountclient.cpp + account-server/accounthandler.hpp + account-server/accounthandler.cpp + account-server/character.hpp + account-server/character.cpp + account-server/serverhandler.hpp + account-server/serverhandler.cpp + account-server/storage.hpp + account-server/storage.cpp + chat-server/chathandler.hpp + chat-server/chathandler.cpp + chat-server/chatclient.hpp + chat-server/chatchannel.hpp + chat-server/chatchannel.cpp + chat-server/chatchannelmanager.hpp + chat-server/chatchannelmanager.cpp + chat-server/guild.hpp + chat-server/guild.cpp + chat-server/guildhandler.cpp + chat-server/guildmanager.hpp + chat-server/guildmanager.cpp + chat-server/party.cpp + chat-server/party.hpp + chat-server/partyhandler.cpp + chat-server/post.cpp + chat-server/post.hpp + common/configuration.hpp + common/configuration.cpp + common/inventorydata.hpp + dal/dalexcept.h + dal/dataprovider.h + dal/dataprovider.cpp + dal/dataproviderfactory.h + dal/dataproviderfactory.cpp + dal/recordset.h + dal/recordset.cpp + net/bandwidth.hpp + net/bandwidth.cpp + net/connectionhandler.hpp + net/connectionhandler.cpp + net/messagein.hpp + net/messagein.cpp + net/messageout.hpp + net/messageout.cpp + net/netcomputer.hpp + net/netcomputer.cpp + serialize/characterdata.hpp + utils/functors.h + utils/encryption.h + utils/encryption.cpp + utils/logger.h + utils/logger.cpp + utils/processorutils.hpp + utils/processorutils.cpp + utils/sha256.h + utils/sha256.cpp + utils/stringfilter.h + utils/stringfilter.cpp + utils/timer.cpp + utils/tokencollector.hpp + utils/tokencollector.cpp + utils/tokendispenser.hpp + utils/tokendispenser.cpp + utils/xml.hpp + utils/xml.cpp + utils/string.cpp + ) + +SET(SRCS_MANASERVGAME + game-server/main-game.cpp + defines.h + protocol.h + point.h + common/configuration.hpp + common/configuration.cpp + common/inventorydata.hpp + common/permissionmanager.hpp + common/permissionmanager.cpp + game-server/accountconnection.hpp + game-server/accountconnection.cpp + game-server/actor.hpp + game-server/actor.cpp + game-server/being.hpp + game-server/being.cpp + game-server/buysell.hpp + game-server/buysell.cpp + game-server/character.hpp + game-server/character.cpp + game-server/collisiondetection.hpp + game-server/collisiondetection.cpp + game-server/command.cpp + game-server/commandhandler.cpp + game-server/commandhandler.hpp + game-server/effect.hpp + game-server/effect.cpp + game-server/eventlistener.hpp + game-server/gamehandler.hpp + game-server/gamehandler.cpp + game-server/inventory.hpp + game-server/inventory.cpp + game-server/item.hpp + game-server/item.cpp + game-server/itemmanager.hpp + game-server/itemmanager.cpp + game-server/map.hpp + game-server/map.cpp + game-server/mapcomposite.hpp + game-server/mapcomposite.cpp + game-server/mapmanager.hpp + game-server/mapmanager.cpp + game-server/mapreader.hpp + game-server/mapreader.cpp + game-server/monster.hpp + game-server/monster.cpp + game-server/monstermanager.hpp + game-server/monstermanager.cpp + game-server/npc.hpp + game-server/npc.cpp + game-server/postman.hpp + game-server/quest.hpp + game-server/quest.cpp + game-server/resourcemanager.hpp + game-server/resourcemanager.cpp + game-server/skillmanager.hpp + game-server/skillmanager.cpp + game-server/spawnarea.hpp + game-server/spawnarea.cpp + game-server/state.hpp + game-server/state.cpp + game-server/statuseffect.hpp + game-server/statuseffect.cpp + game-server/statusmanager.hpp + game-server/statusmanager.cpp + game-server/thing.hpp + game-server/thing.cpp + game-server/trade.hpp + game-server/trade.cpp + game-server/trigger.hpp + game-server/trigger.cpp + net/bandwidth.hpp + net/bandwidth.cpp + net/connection.hpp + net/connection.cpp + net/connectionhandler.hpp + net/connectionhandler.cpp + net/messagein.hpp + net/messagein.cpp + net/messageout.hpp + net/messageout.cpp + net/netcomputer.hpp + net/netcomputer.cpp + scripting/script.hpp + scripting/script.cpp + serialize/characterdata.hpp + utils/base64.h + utils/base64.cpp + utils/mathutils.h + utils/mathutils.cpp + utils/logger.h + utils/logger.cpp + utils/processorutils.hpp + utils/processorutils.cpp + utils/stringfilter.h + utils/stringfilter.cpp + utils/timer.h + utils/timer.cpp + utils/trim.hpp + utils/tokencollector.hpp + utils/tokencollector.cpp + utils/tokendispenser.hpp + utils/tokendispenser.cpp + utils/xml.hpp + utils/xml.cpp + utils/zlib.hpp + utils/zlib.cpp + utils/string.cpp + ) + + +SET (PROGRAMS manaserv-account manaserv-game) + +ADD_EXECUTABLE(manaserv-account WIN32 ${SRCS} ${SRCS_MANASERVGAME}) +ADD_EXECUTABLE(manaserv-game WIN32 ${SRCS} ${SRCS_MANASERVACCOUNT}) + +FOREACH(program ${PROGRAMS}) + TARGET_LINK_LIBRARIES(${program} ${ENET_LIBRARIES} + ${PHYSFS_LIBRARY} + ${LIBXML2_LIBRARIES} + ${EXTRA_LIBRARIES}) + INSTALL(TARGETS ${program} RUNTIME DESTINATION ${PKG_BINDIR}) +ENDFOREACH(program) + +IF (CMAKE_SYSTEM_NAME STREQUAL SunOS) + # we expect the SMCgtxt package to be present on Solaris; + # the Solaris gettext is not API-compatible to GNU gettext + SET_TARGET_PROPERTIES(manaserv-account PROPERTIES LINK_FLAGS "-L/usr/local/lib") + SET_TARGET_PROPERTIES(manaserv-game PROPERTIES LINK_FLAGS "-L/usr/local/lib") +ENDIF() diff --git a/src/Makefile.am b/src/Makefile.am index de43ce3c..3e31cf2a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -136,7 +136,7 @@ manaserv_game_SOURCES = \ game-server/quest.cpp \ game-server/resourcemanager.hpp \ game-server/resourcemanager.cpp \ - game-server/skillanager.hpp \ + game-server/skillmanager.hpp \ game-server/skillmanager.cpp \ game-server/spawnarea.hpp \ game-server/spawnarea.cpp \ |