Skip to content

Commit

Permalink
Merge branch '3.3.5' of github.com:TrinityCore/TrinityCore
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
	src/server/game/CMakeLists.txt
	src/server/scripts/CMakeLists.txt
	src/server/worldserver/CMakeLists.txt
  • Loading branch information
Rochet2 committed Apr 1, 2016
2 parents 1b246e6 + c9e3f2a commit 58ac4c5
Show file tree
Hide file tree
Showing 397 changed files with 14,884 additions and 2,792 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/LuaEngine"]
path = src/LuaEngine
path = src/server/game/LuaEngine
url = https://github.com/ElunaLuaEngine/Eluna.git
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ git:
depth: 1

before_install:
- echo "yes" | sudo add-apt-repository ppa:kalakris/cmake
- echo "yes" | sudo add-apt-repository ppa:george-edison55/precise-backports
- echo "yes" | sudo add-apt-repository ppa:boost-latest/ppa
- echo "yes" | sudo add-apt-repository ppa:ubuntu-toolchain-r/test
- echo "yes" | sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main'
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get -qq update
- sudo apt-get -qq install build-essential libtool gcc-4.8 g++-4.8 make cmake openssl clang-3.5
- sudo apt-get -qq install build-essential libtool gcc-4.8 g++-4.8 make cmake cmake-data openssl clang-3.5
- sudo apt-get -qq install libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev
- sudo apt-get -qq install libboost1.55-dev libboost-thread1.55-dev libboost-filesystem1.55-dev libboost-system1.55-dev libboost-program-options1.55-dev libboost-iostreams1.55-dev
- export CC=clang-3.5 CXX=clang++-3.5
Expand All @@ -21,7 +21,7 @@ install:
- mysql -uroot -e 'create database test_mysql;'
- mkdir bin
- cd bin
- cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DNOJEM=1 -DCMAKE_BUILD_TYPE=Release
- cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DNOJEM=1 -DWITH_DYNAMIC_LINKING=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install
- cd ..
- sudo chmod +x contrib/check_updates.sh

Expand All @@ -36,4 +36,7 @@ script:
- cat sql/updates/world/*.sql | mysql -utrinity -ptrinity world
- mysql -uroot < sql/create/drop_mysql.sql
- cd bin
- make -j 10 -k
- make -j 8 -k && make install
- cd check_install/bin
- ./authserver --version
- ./worldserver --version
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# We require CMake >= 3.0
cmake_minimum_required(VERSION 3.0)

# Set projectname (must be done AFTER setting configurationtypes)
project(TrinityCore)

# CMake policies (can not be handled elsewhere)
cmake_minimum_required(VERSION 2.8.9)
cmake_policy(SET CMP0005 OLD)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD) # Disable 'Ignore COMPILE_DEFINITIONS_<Config> properties'
Expand Down Expand Up @@ -51,23 +53,11 @@ endif()
include(CheckPlatform)

include(GroupSources)

# basic packagesearching and setup (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
include(AutoCollect)

find_package(PCHSupport)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(MySQL)

include(ConfigureBoost)

if( UNIX )
find_package(Readline)
find_package(ZLIB)
find_package(BZip2)
endif()

if(NOT WITHOUT_GIT)
find_package(Git)
endif()
Expand Down
13 changes: 13 additions & 0 deletions cmake/compiler/clang/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ endif()
# -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing -Wno-deprecated-register")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1")

if (WITH_DYNAMIC_LINKING)
# -fPIC is needed to allow static linking in shared libs.
# -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden")

# --no-undefined to throw errors when there are undefined symbols
# (caused through missing TRINITY_*_API macros).
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined")

message(STATUS "Clang: Disallow undefined symbols")
endif()
12 changes: 12 additions & 0 deletions cmake/compiler/gcc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ if( WITH_COREDEBUG )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
message(STATUS "GCC: Debug-flags set (-g3)")
endif()

if (WITH_DYNAMIC_LINKING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes")

# Should break the build when there are TRINITY_*_API macros missing
# but it complains about missing references in precompiled headers.
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--no-undefined")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined")

message(STATUS "GCC: Enabled shared linking")
endif()
33 changes: 26 additions & 7 deletions cmake/compiler/msvc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ if(PLATFORM EQUAL 64)
add_definitions("-D_WIN64")
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0)
#Enable extended object support for debug compiles on X64 (not required on X86)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
message(STATUS "MSVC: Enabled increased number of sections in object files")
endif()
else()
# mark 32 bit executables large address aware so they can use > 2GB address space
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
Expand All @@ -41,15 +36,20 @@ add_definitions(-D_BUILD_DIRECTIVE=\\"$(ConfigurationName)\\")
# multithreaded compiling on VS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")

if((PLATFORM EQUAL 64) OR (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0) OR WITH_DYNAMIC_LINKING)
# Enable extended object support
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
message(STATUS "MSVC: Enabled increased number of sections in object files")
endif()

# /Zc:throwingNew.
# When you specify Zc:throwingNew on the command line, it instructs the compiler to assume
# that the program will eventually be linked with a conforming operator new implementation,
# and can omit all of these extra null checks from your program.
# http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0))
# also enable /bigobj for ALL builds under visual studio 2015, increased number of templates in standard library
# makes this flag a requirement to build TC at all
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew")
endif()

# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
Expand All @@ -74,6 +74,13 @@ if(NOT WITH_WARNINGS)
message(STATUS "MSVC: Disabled generic compiletime warnings")
endif()

if (WITH_DYNAMIC_LINKING)
# C4251: needs to have dll-interface to be used by clients of class '...'
# C4275: non dll-interface class ...' used as base for dll-interface class '...'
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275")
message(STATUS "MSVC: Enabled shared linking")
endif()

# Specify the maximum PreCompiled Header memory allocation limit
# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies)
# (And yes, this is a verified , unresolved bug with MSVC... *sigh*)
Expand All @@ -84,3 +91,15 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500")
# 'function' : member function does not override any base class virtual member function
# 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4263 /we4264")

# Disable incremental linking in debug builds.
# To prevent linking getting stuck (which might be fixed in a later VS version).
macro(DisableIncrementalLinking variable)
string(REGEX REPLACE "/INCREMENTAL *" "" ${variable} "${${variable}}")
set(${variable} "${${variable}} /INCREMENTAL:NO")
endmacro()

DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_DEBUG)
DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
71 changes: 71 additions & 0 deletions cmake/macros/AutoCollect.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright (C) 2008-2016 TrinityCore <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.

# Collects all source files into the given variable,
# which is useful to include all sources in subdirectories.
# Ignores full qualified directories listed in the variadic arguments.
#
# Use it like:
# CollectSourceFiles(
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PRIVATE_SOURCES
# # Exclude
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectSourceFiles current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
file(GLOB COLLECTED_SOURCES
${current_dir}/*.c
${current_dir}/*.cc
${current_dir}/*.cpp
${current_dir}/*.inl
${current_dir}/*.def
${current_dir}/*.h
${current_dir}/*.hh
${current_dir}/*.hpp)
list(APPEND ${variable} ${COLLECTED_SOURCES})

file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if (IS_DIRECTORY ${SUB_DIRECTORY})
CollectSourceFiles("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
endif()
endfunction()

# Collects all subdirectoroies into the given variable,
# which is useful to include all subdirectories.
# Ignores full qualified directories listed in the variadic arguments.
#
# Use it like:
# CollectIncludeDirectories(
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PUBLIC_INCLUDES
# # Exclude
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectIncludeDirectories current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
list(APPEND ${variable} ${current_dir})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if (IS_DIRECTORY ${SUB_DIRECTORY})
CollectIncludeDirectories("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
endif()
endfunction()
40 changes: 36 additions & 4 deletions cmake/macros/FindPCHSupport.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
FUNCTION(GET_COMMON_PCH_PARAMS PCH_HEADER PCH_FE INCLUDE_PREFIX)
FUNCTION(GET_COMMON_PCH_PARAMS TARGET_NAME_LIST PCH_HEADER PCH_FE INCLUDE_PREFIX)
GET_FILENAME_COMPONENT(PCH_HEADER_N ${PCH_HEADER} NAME)
GET_DIRECTORY_PROPERTY(TARGET_INCLUDES INCLUDE_DIRECTORIES)

# Stores the inherited dependency definitions and include directories
# from the given target into the given variables
MACRO(CollectIncludes target inherited_includes inherited_definitions)
# Append the includes and definitions of the current target to the list
get_property(included TARGET ${target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
LIST(APPEND "${inherited_includes}" ${included})
get_property(definitions TARGET ${target} PROPERTY INTERFACE_COMPILE_DEFINITIONS)
FOREACH(def ${definitions})
LIST(APPEND "${inherited_definitions}" "-D${def}")
ENDFOREACH()
# Add all inherited link targets which weren't included already
get_property(links TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
# TODO Maybe catch circular dependencies?
FOREACH(target_link ${links})
IF(TARGET ${target_link})
CollectIncludes(${target_link} "${inherited_includes}" "${inherited_definitions}")
ENDIF()
ENDFOREACH()
ENDMACRO()

FOREACH(TARGET_NAME ${TARGET_NAME_LIST})
CollectIncludes(${TARGET_NAME} TARGET_INCLUDES TARGET_DEFINITIONS)
ENDFOREACH()

LIST(REMOVE_DUPLICATES TARGET_INCLUDES)
LIST(REMOVE_DUPLICATES TARGET_DEFINITIONS)

FOREACH(ITEM ${TARGET_INCLUDES})
LIST(APPEND INCLUDE_FLAGS_LIST "${INCLUDE_PREFIX}\"${ITEM}\" ")
ENDFOREACH(ITEM)

SET(PCH_INCLUDES ${TARGET_INCLUDES} PARENT_SCOPE)
SET(PCH_DEFINITIONS ${TARGET_DEFINITIONS} PARENT_SCOPE)
SET(PCH_HEADER_NAME ${PCH_HEADER_N} PARENT_SCOPE)
SET(PCH_HEADER_OUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_HEADER_N}.${PCH_FE} PARENT_SCOPE)
SET(INCLUDE_FLAGS ${INCLUDE_FLAGS_LIST} PARENT_SCOPE)
ENDFUNCTION(GET_COMMON_PCH_PARAMS)

FUNCTION(GENERATE_CXX_PCH_COMMAND TARGET_NAME_LIST INCLUDE_FLAGS IN PCH_SRC OUT)
include_directories(${PCH_INCLUDES})
add_definitions(${PCH_DEFINITIONS})

IF (CMAKE_BUILD_TYPE)
STRING(TOUPPER _${CMAKE_BUILD_TYPE} CURRENT_BUILD_TYPE)
ENDIF ()
Expand Down Expand Up @@ -62,7 +94,7 @@ FUNCTION(GENERATE_CXX_PCH_COMMAND TARGET_NAME_LIST INCLUDE_FLAGS IN PCH_SRC OUT)
ENDFUNCTION(GENERATE_CXX_PCH_COMMAND)

FUNCTION(ADD_CXX_PCH_GCC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "gch" "-I")
GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "gch" "-I")
GENERATE_CXX_PCH_COMMAND("${TARGET_NAME_LIST}" "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT})

FOREACH(TARGET_NAME ${TARGET_NAME_LIST})
Expand All @@ -74,7 +106,7 @@ FUNCTION(ADD_CXX_PCH_GCC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE)
ENDFUNCTION(ADD_CXX_PCH_GCC)

FUNCTION(ADD_CXX_PCH_CLANG TARGET_NAME_LIST PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "-I")
GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "pch" "-I")
GENERATE_CXX_PCH_COMMAND("${TARGET_NAME_LIST}" "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT})

FOREACH(TARGET_NAME ${TARGET_NAME_LIST})
Expand All @@ -86,7 +118,7 @@ FUNCTION(ADD_CXX_PCH_CLANG TARGET_NAME_LIST PCH_HEADER PCH_SOURCE)
ENDFUNCTION(ADD_CXX_PCH_CLANG)

FUNCTION(ADD_CXX_PCH_MSVC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "/I")
GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "pch" "/I")

FOREACH(TARGET_NAME ${TARGET_NAME_LIST})
SET_TARGET_PROPERTIES(
Expand Down
18 changes: 0 additions & 18 deletions cmake/macros/FindReadline.cmake

This file was deleted.

9 changes: 7 additions & 2 deletions cmake/macros/GroupSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

macro(GroupSources dir)
# Skip this if WITH_SOURCE_TREE is not set (empty string).
if (NOT ${_WITH_SOURCE_TREE} STREQUAL "")
if (NOT ${WITH_SOURCE_TREE} STREQUAL "")
# Include all header and c files
file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.c *.cpp *.cc)

Expand All @@ -21,7 +21,7 @@ macro(GroupSources dir)

if (NOT ${element_dir} STREQUAL "")
# If the file is in a subdirectory use it as source group.
if (${_WITH_SOURCE_TREE} STREQUAL "flat")
if (${WITH_SOURCE_TREE} STREQUAL "flat")
# Build flat structure by using only the first subdirectory.
string(FIND ${element_dir} "/" delemiter_pos)
if (NOT ${delemiter_pos} EQUAL -1)
Expand All @@ -44,3 +44,8 @@ macro(GroupSources dir)
endforeach()
endif()
endmacro()

if (WITH_SOURCE_TREE STREQUAL "hierarchical-folders")
# Use folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
5 changes: 3 additions & 2 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ option(TOOLS "Build map/vmap/mmap extraction/assembler tools"
option(ELUNA "Build Eluna Lua Engine" 1)
option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1)
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
option(WITH_DYNAMIC_LINKING "Enable dynamic library linking." 0)
option(WITH_WARNINGS "Show all warnings during compile" 0)
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
set(WITH_SOURCE_TREE "no" CACHE STRING "Build the source tree for IDE's.")
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical)
set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.")
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders)
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
Loading

0 comments on commit 58ac4c5

Please sign in to comment.