[11167] Added CMake support

(based on cipherCOM's commit 0039476)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
cipherCOM 2011-02-13 03:42:09 +03:00 committed by VladimirMangos
parent c9942fb0cc
commit a81cf28610
43 changed files with 3465 additions and 4 deletions

34
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,34 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Needs to link against mangos_worldd.lib
if(WIN32)
link_directories(
${CMAKE_BINARY_DIR}/src/mangosd/${CMAKE_CFG_INTDIR}
)
include_directories(
${CMAKE_SOURCE_DIR}/dep/include # For Win32
)
endif()
add_subdirectory(bindings)
add_subdirectory(framework)
add_subdirectory(shared)
add_subdirectory(realmd)
add_subdirectory(game)
add_subdirectory(mangosd)

View file

@ -0,0 +1,19 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# add_subdirectory(universal)

View file

@ -0,0 +1,85 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
file(GLOB_RECURSE mangosscript_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
include_directories(
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_BINARY_DIR}
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
)
add_library(mangosscript SHARED
${mangosscript_SRCS}
)
add_dependencies(mangosscript revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(mangosscript ACE_Project)
# add_dependencies(mangosscript ace)
endif()
target_link_libraries(mangosscript
${ZLIB_LIBRARIES}
${ACE_LIBRARIES}
)
if(WIN32)
target_link_libraries(mangosscript
mangosd # FIXME: could this be done for unix? because unix won't generate exe.libs
)
if(WIN32 AND PLATFORM MATCHES X86)
target_link_libraries(mangosscript
debug ${WIN_DEBUGLIBS}
)
endif()
endif()
if(UNIX)
set(mangosscript_LINK_FLAGS "-pthread")
if(APPLE)
set(mangosscript_LINK_FLAGS "-framework Carbon ${mangosscript_LINK_FLAGS}")
# Needed for the linking because of the missing symbols
set(mangosscript_LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup ${mangosscript_LINK_FLAGS}")
endif()
if(APPLE)
set(mangosscript_PROPERTIES INSTALL_NAME_DIR "${LIBS_DIR}")
else()
set(mangosscript_PROPERTIES INSTALL_RPATH ${LIBS_DIR})
endif()
# Run out of build tree
set(mangosscript_PROPERTIES
${mangosscript_PROPERTIES}
BUILD_WITH_INSTALL_RPATH OFF
)
set_target_properties(mangosscript PROPERTIES
LINK_FLAGS ${mangosscript_LINK_FLAGS}
${mangosscript_PROPERTIES}
)
endif()
# LIBRARY = dyld / so, RUNTIME = dll
install(TARGETS mangosscript
LIBRARY DESTINATION ${LIBS_DIR}
RUNTIME DESTINATION ${LIBS_DIR}
)

View file

@ -0,0 +1,72 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# include(${CMAKE_SOURCE_DIR}/dep/tbb/tbbinclude.cmake)
file(GLOB_RECURSE framework_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
source_group("Other"
REGULAR_EXPRESSION .*
)
source_group("GameSystem"
REGULAR_EXPRESSION GameSystem
)
source_group("Platform"
REGULAR_EXPRESSION Platform
)
source_group("Policies"
REGULAR_EXPRESSION Policies
)
source_group("Utilities"
REGULAR_EXPRESSION Utilities
)
source_group("LinkedReference"
REGULAR_EXPRESSION LinkedReference
)
source_group("Dynamic"
REGULAR_EXPRESSION Dynamic
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${ACE_INCLUDE_DIR}
)
add_library(framework STATIC
${framework_SRCS}
)
if(NOT TBB_USE_EXTERNAL)
add_dependencies(framework TBB_Project)
# add_dependencies(framework tbb)
# add_dependencies(framework tbbmalloc)
endif()
if(NOT ACE_USE_EXTERNAL)
add_dependencies(framework ACE_Project)
# add_dependencies(framework ace)
endif()
target_link_libraries(framework
${TBB_LIBRARIES}
)

108
src/game/CMakeLists.txt Normal file
View file

@ -0,0 +1,108 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
file(GLOB_RECURSE game_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/vmap
${CMAKE_SOURCE_DIR}/dep/include/g3dlite
${CMAKE_SOURCE_DIR}/dep/include
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/shared
${MYSQL_INCLUDE_DIR}
${ACE_INCLUDE_DIR}
)
source_group("Object"
REGULAR_EXPRESSION .*
)
source_group("World/Handlers"
# REGULAR_EXPRESSION Mgr|Handler|Manager|BattleGround|Cell|Channel|Chat|Gossip|Grid|Group|Instance|Mail|Map|Path|Pool|Quest|Script|Skill|Spell|Transports|Update|Weather|World
REGULAR_EXPRESSION Mgr|Handler|Manager|Cell|Channel|Chat|Gossip|Grid|Instance|Map|Path|Pool|Script|Skill|Transports|Update|Weather|World
)
source_group("Motion generators"
REGULAR_EXPRESSION Movement|Holder|Motion|Traveller
)
source_group("Server"
REGULAR_EXPRESSION Socket|Session|Opcodes|DBC
FILES
SharedDefines.h
)
source_group("Chat Commands"
REGULAR_EXPRESSION Level[0-9]
FILES
debugcmds.cpp
)
source_group("Tool"
REGULAR_EXPRESSION DatabaseCleaner|Language|PlayerDump
)
source_group("References"
REGULAR_EXPRESSION Reference|RefManager|ThreatManager
)
if(PCH)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
add_library(game STATIC
${game_SRCS}
)
target_link_libraries(game
shared
)
if(UNIX)
# Both systems don't have libdl and don't need them
if (NOT (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD"))
target_link_libraries(game
dl
)
endif()
endif()
add_dependencies(game revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(game ACE_Project)
# add_dependencies(game ace)
endif()
# Generate precompiled header
if(PCH)
if(MSVC OR XCODE)
if(MSVC)
set(game_pch "${CMAKE_CURRENT_SOURCE_DIR}/pchdef.cpp")
endif()
add_native_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/pchdef.h)
elseif(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/pchdef.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(game_pch_dephelp ACE_Project)
# add_dependencies(game_pch_dephelp ace)
endif()
endif()
endif()

View file

@ -0,0 +1,98 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
set(EXECUTABLE_NAME mangosd)
file(GLOB_RECURSE EXECUTABLE_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
include_directories(
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/dep/include/gsoap
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_SOURCE_DIR}/src/game
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/shared
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
add_executable(${EXECUTABLE_NAME}
${EXECUTABLE_SRCS}
)
add_dependencies(${EXECUTABLE_NAME} revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(${EXECUTABLE_NAME} ACE_Project)
# add_dependencies(${EXECUTABLE_NAME} ace)
endif()
target_link_libraries(${EXECUTABLE_NAME}
game
shared
framework
g3dlite
gsoap
${ACE_LIBRARIES}
)
if(WIN32)
target_link_libraries(${EXECUTABLE_NAME}
zlib
optimized ${MYSQL_LIBRARY}
optimized ${OPENSSL_LIBRARIES}
debug ${MYSQL_DEBUG_LIBRARY}
debug ${OPENSSL_DEBUG_LIBRARIES}
)
if(PLATFORM MATCHES X86)
target_link_libraries(${EXECUTABLE_NAME}
debug ${WIN_DEBUGLIBS}
)
endif()
endif()
if(UNIX)
target_link_libraries(${EXECUTABLE_NAME}
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENSSL_EXTRA_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
set(EXECUTABLE_LINK_FLAGS "")
if(UNIX)
set(EXECUTABLE_LINK_FLAGS "-pthread ${EXECUTABLE_LINK_FLAGS}")
endif()
if(APPLE)
set(EXECUTABLE_LINK_FLAGS "-framework Carbon ${EXECUTABLE_LINK_FLAGS}")
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS
"${EXECUTABLE_LINK_FLAGS}"
)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${BIN_DIR})
install(FILES run-mangosd DESTINATION ${BIN_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mangosd.conf.dist.in ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist DESTINATION ${CONF_DIR})
if(WIN32 AND MSVC)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/\${BUILD_TYPE}/${EXECUTABLE_NAME}.pdb DESTINATION ${BIN_DIR} CONFIGURATIONS Debug)
endif()

View file

@ -14,7 +14,7 @@ ConfVersion=2010100901
# DataDir
# Data directory setting.
# Important: DataDir needs to be quoted, as it is a string which may contain space characters.
# Example: "@prefix@/share/mangos"
# Example: "@CMAKE_INSTALL_PREFIX@/share/mangos"
#
# LogsDir
# Logs directory setting.

88
src/realmd/CMakeLists.txt Normal file
View file

@ -0,0 +1,88 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
set(EXECUTABLE_NAME realmd)
file(GLOB_RECURSE EXECUTABLE_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
include_directories(
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/shared
${MYSQL_INCLUDE_DIR}
${ACE_INCLUDE_DIR}
)
add_executable(${EXECUTABLE_NAME}
${EXECUTABLE_SRCS}
)
add_dependencies(${EXECUTABLE_NAME} revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(${EXECUTABLE_NAME} ACE_Project)
# add_dependencies(${EXECUTABLE_NAME} ace)
endif()
target_link_libraries(${EXECUTABLE_NAME}
shared
framework
${ACE_LIBRARIES}
)
if(WIN32)
target_link_libraries(${EXECUTABLE_NAME}
optimized ${MYSQL_LIBRARY}
optimized ${OPENSSL_LIBRARIES}
debug ${MYSQL_DEBUG_LIBRARY}
debug ${OPENSSL_DEBUG_LIBRARIES}
)
if(PLATFORM MATCHES X86)
target_link_libraries(${EXECUTABLE_NAME}
debug ${WIN_DEBUGLIBS}
)
endif()
endif()
if(UNIX)
target_link_libraries(${EXECUTABLE_NAME}
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENSSL_EXTRA_LIBRARIES}
)
endif()
set(EXECUTABLE_LINK_FLAGS "")
if(UNIX)
set(EXECUTABLE_LINK_FLAGS "-pthread ${EXECUTABLE_LINK_FLAGS}")
endif()
if(APPLE)
set(EXECUTABLE_LINK_FLAGS "-framework Carbon ${EXECUTABLE_LINK_FLAGS}")
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS
"${EXECUTABLE_LINK_FLAGS}"
)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${BIN_DIR})
install(FILES realmd.conf.dist.in DESTINATION ${CONF_DIR} RENAME realmd.conf.dist)
if(WIN32 AND MSVC)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/\${BUILD_TYPE}/${EXECUTABLE_NAME}.pdb DESTINATION ${BIN_DIR} CONFIGURATIONS Debug)
endif()

73
src/shared/CMakeLists.txt Normal file
View file

@ -0,0 +1,73 @@
#
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Glob only and not recurse, there are other libs for that
file(GLOB_RECURSE shared_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
# Exclude Win32 files
if(NOT WIN32)
list(REMOVE_ITEM shared_SRCS
WheatyExceptionReport.cpp
WheatyExceptionReport.h
ServiceWin32.cpp
ServiceWin32.h
)
endif()
source_group("Util"
REGULAR_EXPRESSION .*
)
foreach(SRC ${shared_SRCS})
get_filename_component(PTH ${SRC} PATH)
if(PTH)
if(NOT XCODE) # FIXME: Xcode Generator has bug with nested dirs
string(REPLACE "/" "\\\\" PTH ${PTH})
endif()
source_group(${PTH} FILES ${SRC})
endif()
endforeach(SRC)
source_group("DataStores"
REGULAR_EXPRESSION DBC
)
source_group("Log"
REGULAR_EXPRESSION Log
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/dep/include
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_BINARY_DIR}
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SystemConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SystemConfig.h)
add_library(shared STATIC
${shared_SRCS}
)
add_dependencies(shared revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(shared ACE_Project)
# add_dependencies(shared ace)
endif()

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11166"
#define REVISION_NR "11167"
#endif // __REVISION_NR_H__