Skip to content

Commit

Permalink
Merge TrinityCore 3.3.5 to ElunaTrinityWotlk [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochet2 committed Feb 27, 2024
2 parents 2643584 + 75cbafd commit 90069a2
Show file tree
Hide file tree
Showing 75 changed files with 2,141 additions and 7,609 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
mkdir bin
cd bin
if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1
else
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1
fi
cd ..
- run:
Expand All @@ -79,13 +79,13 @@ jobs:
- run:
name: Create docker images
command: |
cd bin/check_install/bin
cp -r ../../../contrib/Docker/* .
cp -r ../../../sql ./sql
cd bin/check_install
cp -r ../../contrib/Docker/* .
cp -r ../../sql ./sql
image_prefix=$(echo $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME | tr '[:upper:]' '[:lower:]')
echo $image_prefix
docker build --file Dockerfile --force-rm --tag $image_prefix:$CIRCLE_SHA1 --tag $image_prefix:$(echo $CIRCLE_BRANCH | tr '/' '-' | tr '[:upper:]' '[:lower:]') .
docker save $image_prefix | gzip > ../../../docker.tar.gz
docker save $image_prefix | gzip > ../../docker.tar.gz
if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then
if [ "$CIRCLE_BRANCH" == "3.3.5" ] || [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "wotlk_classic" ]; then
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
Expand Down
24 changes: 9 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.18)

# add this options before PROJECT keyword
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
Expand All @@ -19,32 +19,24 @@ project(TrinityCore)

# CMake policies (can not be handled elsewhere)
cmake_policy(SET CMP0005 NEW)
if(CMAKE_VERSION VERSION_LESS "3.16.0")
cmake_policy(SET CMP0043 OLD) # Disable 'Ignore COMPILE_DEFINITIONS_<Config> properties'
else()
cmake_policy(SET CMP0043 NEW) # Cotire isn't used so set to NEW
endif()
cmake_policy(SET CMP0043 NEW) # Ignore COMPILE_DEFINITIONS_<Config> properties
cmake_policy(SET CMP0054 NEW) # Only interpret if() arguments as variables or keywords when unquoted - prevents intepreting if(SOME_STRING_VARIABLE MATCHES "MSVC") as if(SOME_STRING_VARIABLE MATCHES "1")
cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables

if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW) # find_package() uses upper-case <PACKAGENAME>_ROOT variables
endif()

# Set RPATH-handing (CMake parameters)
set(CMAKE_SKIP_BUILD_RPATH 0)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 0)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)

# set macro-directory
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake/macros")

if(CMAKE_VERSION VERSION_LESS "3.16.0")
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/dep/cotire/CMake")
endif()

# build in Release-mode by default if not explicitly set
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
set(CMAKE_DEFAULT_BUILD_TYPE "RelWithDebInfo" CACHE INTERNAL "")
Expand Down Expand Up @@ -73,12 +65,14 @@ include(GroupSources)
include(AutoCollect)

find_package(PCHSupport)
find_package(MySQL)

if(NOT WITHOUT_GIT)
find_package(Git 1.7)
endif()

# find mysql client binary (needed by genrev)
find_package(MySQL OPTIONAL_COMPONENTS binary)

# Find revision ID and hash of the sourcetree
include(cmake/genrev.cmake)

Expand Down
5 changes: 5 additions & 0 deletions cmake/compiler/clang/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ target_compile_definitions(trinity-compile-option-interface
-D_BUILD_DIRECTIVE="$<CONFIG>")

set(CLANG_EXPECTED_VERSION 11.0.0)
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
# apple doesnt like to do the sane thing which would be to use the same version numbering as regular clang
# version number pulled from https://en.wikipedia.org/wiki/Xcode#Toolchain_versions for row matching LLVM 11
set(CLANG_EXPECTED_VERSION 12.0.5)
endif()

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
message(FATAL_ERROR "Clang: TrinityCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down
5 changes: 3 additions & 2 deletions cmake/compiler/gcc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(PLATFORM EQUAL 32)
-msse2
-mfpmath=sse)
endif()
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
target_compile_definitions(trinity-compile-option-interface
INTERFACE
-DHAVE_SSE2
Expand All @@ -35,7 +35,8 @@ if(WITH_WARNINGS)
-Winit-self
-Winvalid-pch
-Wfatal-errors
-Woverloaded-virtual)
-Woverloaded-virtual
-Wno-missing-field-initializers) # this warning is useless when combined with structure members that have default initializers

message(STATUS "GCC: All warnings enabled")
endif()
Expand Down
51 changes: 29 additions & 22 deletions cmake/compiler/msvc/settings.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(MSVC_EXPECTED_VERSION 19.30)
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17")

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
else()
message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
set(MSVC_EXPECTED_VERSION 19.32)
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17.2")

# This file is also used by compilers that pretend to be MSVC but report their own version number - don't version check them
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
else()
message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
endif()
endif()

# CMake sets warning flags by default, however we manage it manually
Expand Down Expand Up @@ -111,38 +114,42 @@ target_compile_definitions(trinity-compile-option-interface
message(STATUS "MSVC: Disabled POSIX warnings")

# Ignore specific warnings
# C4351: new behavior: elements of array 'x' will be default initialized
# C4091: 'typedef ': ignored on left of '' when no variable is declared
target_compile_options(trinity-compile-option-interface
INTERFACE
/wd4351
/wd4091)
/wd4351 # C4351: new behavior: elements of array 'x' will be default initialized
/wd4091) # C4091: 'typedef ': ignored on left of '' when no variable is declared

if(NOT WITH_WARNINGS)
target_compile_options(trinity-compile-option-interface
INTERFACE
/wd4996
/wd4355
/wd4244
/wd4985
/wd4267
/wd4619
/wd4512)
/wd4996 # C4996 deprecation
/wd4985 # C4985 'symbol-name': attributes not present on previous declaration.
/wd4244 # C4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
/wd4267 # C4267 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4619 # C4619 #pragma warning : there is no warning number 'number'
/wd4512) # C4512 'class' : assignment operator could not be generated

message(STATUS "MSVC: Disabled generic compiletime warnings")
endif()

if(BUILD_SHARED_LIBS)
# 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 '...'
target_compile_options(trinity-compile-option-interface
INTERFACE
/wd4251
/wd4275)
/wd4251 # C4251: needs to have dll-interface to be used by clients of class '...'
/wd4275) # C4275: non dll-interface class ...' used as base for dll-interface class '...'

message(STATUS "MSVC: Enabled shared linking")
endif()

# Move some warnings that are enabled for other compilers from level 4 to level 3
target_compile_options(trinity-compile-option-interface
INTERFACE
/w34100 # C4100 'identifier' : unreferenced formal parameter
/w34101 # C4101: 'identifier' : unreferenced local variable
/w34189 # C4189: 'identifier' : local variable is initialized but not referenced
/w34389 # C4389: 'equality-operator' : signed/unsigned mismatch
/w35054) # C5054: 'operator 'operator-name': deprecated between enumerations of different types'

# Enable and treat as errors the following warnings to easily detect virtual function signature failures:
# '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
Expand Down
89 changes: 46 additions & 43 deletions cmake/genrev.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ if(WITHOUT_GIT)
string(TIMESTAMP rev_date_fallback "%Y-%m-%d %H:%M:%S" UTC)
else()
if(GIT_EXECUTABLE)
# Retrieve repository dirty status
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE is_dirty
)

# Create a revision-string that we can use
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
Expand All @@ -40,58 +33,68 @@ else()
ERROR_QUIET
)

# Append dirty marker to commit hash
if(is_dirty)
set(rev_hash "${rev_hash}+")
endif()

# And grab the commits timestamp
execute_process(
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_date
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(rev_hash)
# Retrieve repository dirty status
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE is_dirty
ERROR_QUIET
)

# Also retrieve branch name
execute_process(
COMMAND "${GIT_EXECUTABLE}" symbolic-ref -q --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
# Append dirty marker to commit hash
if(is_dirty)
set(rev_hash "${rev_hash}+")
endif()

# when ran on CI, repository is put in detached HEAD state, attempt to scan for known local branches
if(NOT rev_branch)
# And grab the commits timestamp
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/heads "--format=%(refname:short)"
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_VARIABLE rev_date
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# if local branch scan didn't find anything, try remote branches
if(NOT rev_branch)
# Also retrieve branch name
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/remotes "--format=%(refname:short)"
COMMAND "${GIT_EXECUTABLE}" symbolic-ref -q --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# give up finding a name for branch, use commit hash
if(NOT rev_branch)
set(rev_branch ${rev_hash})
endif()
# when ran on CI, repository is put in detached HEAD state, attempt to scan for known local branches
if(NOT rev_branch)
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/heads "--format=%(refname:short)"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# if local branch scan didn't find anything, try remote branches
if(NOT rev_branch)
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/remotes "--format=%(refname:short)"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# normalize branch to single line (for-each-ref can output multiple lines if there are multiple branches on the same commit)
string(REGEX MATCH "^[^ \t\r\n]+" rev_branch ${rev_branch})
# give up finding a name for branch, use commit hash
if(NOT rev_branch)
set(rev_branch ${rev_hash})
endif()

# normalize branch to single line (for-each-ref can output multiple lines if there are multiple branches on the same commit)
string(REGEX MATCH "^[^ \t\r\n]+" rev_branch ${rev_branch})
endif()
endif()

# Last minute check - ensure that we have a proper revision
Expand Down
23 changes: 23 additions & 0 deletions cmake/macros/CheckPlatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ else()
MESSAGE(STATUS "Detected 32-bit platform")
endif()

if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
set(TRINITY_SYSTEM_PROCESSOR "amd64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM)64$")
set(TRINITY_SYSTEM_PROCESSOR "arm64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM)$")
set(TRINITY_SYSTEM_PROCESSOR "arm")
else()
set(TRINITY_SYSTEM_PROCESSOR "x86")
endif()

# detect MSVC special case of using cmake -A switch (which doesn't set any cross compiling variables)
if(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
set(TRINITY_SYSTEM_PROCESSOR "x86")
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
set(TRINITY_SYSTEM_PROCESSOR "amd64")
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set(TRINITY_SYSTEM_PROCESSOR "arm")
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
set(TRINITY_SYSTEM_PROCESSOR "arm64")
endif()

message(STATUS "Detected ${TRINITY_SYSTEM_PROCESSOR} processor architecture")

if(WIN32)
include("${CMAKE_SOURCE_DIR}/cmake/platform/win/settings.cmake")
elseif(UNIX)
Expand Down
Loading

0 comments on commit 90069a2

Please sign in to comment.