Skip to content

Commit 127a85b

Browse files
author
Github Actions
committed
Merge 3.3.5 to 3.3.5-nemesis_anticheat
2 parents 964a586 + 9c04a32 commit 127a85b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+770
-609
lines changed

cmake/compiler/clang/settings.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
33
# apple doesnt like to do the sane thing which would be to use the same version numbering as regular clang
44
# version number pulled from https://en.wikipedia.org/wiki/Xcode#Toolchain_versions for row matching LLVM 11
55
set(CLANG_EXPECTED_VERSION 12.0.5)
6+
# enable -fpch-instantiate-templates for AppleClang (by default it is active only for regular clang)
7+
set(CMAKE_C_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
8+
set(CMAKE_CXX_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
69
endif()
710

811
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
@@ -46,7 +49,8 @@ if(WITH_WARNINGS)
4649
-Winit-self
4750
-Wfatal-errors
4851
-Wno-mismatched-tags
49-
-Woverloaded-virtual)
52+
-Woverloaded-virtual
53+
-Wno-missing-field-initializers) # this warning is useless when combined with structure members that have default initializers
5054

5155
message(STATUS "Clang: All warnings enabled")
5256
endif()

cmake/compiler/msvc/settings.cmake

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,7 @@ target_compile_options(trinity-compile-option-interface
2828
INTERFACE
2929
/permissive-)
3030

31-
if(PLATFORM EQUAL 64)
32-
# This definition is necessary to work around a bug with Intellisense described
33-
# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper
34-
# debugger functionality.
35-
target_compile_definitions(trinity-compile-option-interface
36-
INTERFACE
37-
_WIN64)
38-
39-
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")
40-
41-
else()
31+
if(PLATFORM EQUAL 32)
4232
# mark 32 bit executables large address aware so they can use > 2GB address space
4333
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
4434
message(STATUS "MSVC: Enabled large address awareness")
@@ -75,14 +65,12 @@ if((PLATFORM EQUAL 64) OR (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.2302
7565
endif()
7666

7767
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
78-
# /Zc:throwingNew.
79-
# When you specify Zc:throwingNew on the command line, it instructs the compiler to assume
80-
# that the program will eventually be linked with a conforming operator new implementation,
81-
# and can omit all of these extra null checks from your program.
82-
# http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx
8368
target_compile_options(trinity-compile-option-interface
8469
INTERFACE
85-
/Zc:throwingNew)
70+
/Zc:__cplusplus # Enable updated __cplusplus macro value
71+
/Zc:preprocessor # Enable preprocessor conformance mode
72+
/Zc:templateScope # Check template parameter shadowing
73+
/Zc:throwingNew) # Assume operator new throws
8674
endif()
8775

8876
# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
@@ -137,14 +125,15 @@ if(BUILD_SHARED_LIBS)
137125
message(STATUS "MSVC: Enabled shared linking")
138126
endif()
139127

140-
# Move some warnings that are enabled for other compilers from level 4 to level 3
128+
# Move some warnings that are enabled for other compilers from level 4 to level 3 and enable some warnings which are off by default
141129
target_compile_options(trinity-compile-option-interface
142130
INTERFACE
143-
/w34100 # C4100 'identifier' : unreferenced formal parameter
131+
/w15038 # C5038: data member 'member1' will be initialized after data member 'member2'
132+
/w34100 # C4100: 'identifier' : unreferenced formal parameter
144133
/w34101 # C4101: 'identifier' : unreferenced local variable
145134
/w34189 # C4189: 'identifier' : local variable is initialized but not referenced
146135
/w34389 # C4389: 'equality-operator' : signed/unsigned mismatch
147-
/w35054) # C5054: 'operator 'operator-name': deprecated between enumerations of different types'
136+
/w35054) # C5054: 'operator 'operator-name': deprecated between enumerations of different types'
148137

149138
# Enable and treat as errors the following warnings to easily detect virtual function signature failures:
150139
# 'function' : member function does not override any base class virtual member function

cmake/genrev.cmake

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# This is done EACH compile so they can be alerted about the consequences.
1313

1414
if(NOT BUILDDIR)
15-
# Workaround for funny MSVC behaviour - this segment is only used when using cmake gui
15+
# Workaround for cmake script mode
1616
set(BUILDDIR ${CMAKE_BINARY_DIR})
1717
endif()
1818

@@ -122,12 +122,29 @@ set(rev_month ${CMAKE_MATCH_2})
122122
set(rev_day ${CMAKE_MATCH_3})
123123

124124
# Create the actual revision_data.h file from the above params
125-
if(NOT "${rev_hash_cached}" STREQUAL "${rev_hash}" OR NOT "${rev_branch_cached}" STREQUAL "${rev_branch}" OR NOT EXISTS "${BUILDDIR}/revision_data.h")
126-
configure_file(
127-
"${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake"
128-
"${BUILDDIR}/revision_data.h"
129-
@ONLY
125+
cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM QUERY OS_NAME)
126+
cmake_host_system_information(RESULT TRINITY_BUILD_HOST_DISTRO QUERY DISTRIB_INFO)
127+
cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM_RELEASE QUERY OS_RELEASE)
128+
# on windows OS_RELEASE contains sub-type string tag like "Professional" instead of a version number and OS_VERSION has only build number
129+
# so we grab that with Get-CimInstance powershell cmdlet
130+
if(WIN32)
131+
execute_process(
132+
COMMAND powershell -NoProfile -Command "$v=(Get-CimInstance -ClassName Win32_OperatingSystem); '{0} ({1})' -f $v.Caption, $v.Version"
133+
OUTPUT_VARIABLE TRINITY_BUILD_HOST_SYSTEM_RELEASE
134+
OUTPUT_STRIP_TRAILING_WHITESPACE
130135
)
131-
set(rev_hash_cached "${rev_hash}" CACHE INTERNAL "Cached commit-hash")
132-
set(rev_branch_cached "${rev_branch}" CACHE INTERNAL "Cached branch name")
136+
# Remove "Microsoft Windows" from the result
137+
string(REGEX REPLACE "^.* Windows " "" TRINITY_BUILD_HOST_SYSTEM_RELEASE ${TRINITY_BUILD_HOST_SYSTEM_RELEASE})
133138
endif()
139+
140+
if(CMAKE_SCRIPT_MODE_FILE)
141+
# hack for CMAKE_SYSTEM_PROCESSOR missing in script mode
142+
set(CMAKE_PLATFORM_INFO_DIR ${BUILDDIR}${CMAKE_FILES_DIRECTORY})
143+
include(${CMAKE_ROOT}/Modules/CMakeDetermineSystem.cmake)
144+
endif()
145+
146+
configure_file(
147+
"${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake"
148+
"${BUILDDIR}/revision_data.h"
149+
@ONLY
150+
)

cmake/macros/ConfigureBaseTargets.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ set(CMAKE_CXX_STANDARD 20)
1818
# Set build-directive (used in core to tell which buildtype we used)
1919
target_compile_definitions(trinity-compile-option-interface
2020
INTERFACE
21-
_BUILD_DIRECTIVE="$<CONFIG>")
21+
TRINITY_BUILD_TYPE="$<CONFIG>"
22+
TRINITY_BUILD_HAS_DEBUG_INFO=$<CONFIG:Debug,RelWithDebInfo>)
2223

2324
# An interface library to make the target features available to other targets
2425
add_library(trinity-feature-interface INTERFACE)

cmake/macros/FindMySQL.cmake

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,19 @@ This module will set the following variables in your project:
4040
MySQL library.
4141
``MYSQL_EXECUTABLE``
4242
Path to mysql client binary.
43+
``MYSQL_FLAVOR``
44+
Flavor of mysql installation (MySQL or MariaDB).
45+
``MYSQL_VERSION``
46+
MySQL version string.
4347
4448
Hints
4549
^^^^^
4650
4751
Set ``MYSQL_ROOT_DIR`` to the root directory of MySQL installation.
4852
#]=======================================================================]
4953

54+
include(FindPackageHandleStandardArgs)
55+
5056
set(MYSQL_FOUND 0)
5157

5258
set(_MYSQL_ROOT_HINTS
@@ -136,20 +142,42 @@ if(WIN32)
136142
list(APPEND _MYSQL_ROOT_HINTS_REGISTRY_LOCATIONS ${_MYSQL_ROOT_HINTS_REGISTRY_LOCATION})
137143
endforeach()
138144

145+
cmake_host_system_information(
146+
RESULT
147+
_MYSQL_ROOT_HINTS_SUBKEYS
148+
QUERY
149+
WINDOWS_REGISTRY
150+
"HKEY_LOCAL_MACHINE\\SOFTWARE" SUBKEYS
151+
VIEW BOTH
152+
)
153+
list(FILTER _MYSQL_ROOT_HINTS_SUBKEYS INCLUDE REGEX "^MariaDB ")
154+
list(SORT _MYSQL_ROOT_HINTS_SUBKEYS COMPARE NATURAL ORDER DESCENDING)
155+
156+
foreach(subkey IN LISTS _MYSQL_ROOT_HINTS_SUBKEYS)
157+
cmake_host_system_information(
158+
RESULT
159+
_MYSQL_ROOT_HINTS_REGISTRY_LOCATION
160+
QUERY
161+
WINDOWS_REGISTRY
162+
"HKEY_LOCAL_MACHINE\\SOFTWARE\\${subkey}" VALUE "INSTALLDIR"
163+
VIEW BOTH
164+
)
165+
list(APPEND _MYSQL_ROOT_HINTS_REGISTRY_LOCATIONS ${_MYSQL_ROOT_HINTS_REGISTRY_LOCATION})
166+
endforeach()
167+
139168
set(_MYSQL_ROOT_HINTS
140169
${_MYSQL_ROOT_HINTS}
141170
${_MYSQL_ROOT_HINTS_REGISTRY_LOCATIONS}
142-
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MariaDB 10.4;INSTALLDIR]"
143-
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MariaDB 10.4 (x64);INSTALLDIR]"
144-
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MariaDB 10.5;INSTALLDIR]"
145-
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MariaDB 10.5 (x64);INSTALLDIR]"
146171
)
147172

148173
file(GLOB _MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES
149174
LIST_DIRECTORIES TRUE
150175
"${PROGRAM_FILES_64}/MySQL/MySQL Server *"
151176
"${PROGRAM_FILES_32}/MySQL/MySQL Server *"
152177
"$ENV{SystemDrive}/MySQL/MySQL Server *"
178+
"${PROGRAM_FILES_64}/MariaDB *"
179+
"${PROGRAM_FILES_32}/MariaDB *"
180+
"$ENV{SystemDrive}/MariaDB *"
153181
)
154182

155183
list(SORT _MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES COMPARE NATURAL ORDER DESCENDING)
@@ -219,30 +247,16 @@ endif(WIN32)
219247
# On Windows you typically don't need to include any extra libraries
220248
# to build MYSQL stuff.
221249

222-
if(NOT WIN32)
223-
find_library(MYSQL_EXTRA_LIBRARIES
224-
NAMES
225-
z zlib
226-
PATHS
227-
/usr/lib
228-
/usr/local/lib
229-
DOC
230-
"if more libraries are necessary to link in a MySQL client (typically zlib), specify them here."
231-
)
232-
else(NOT WIN32)
233-
set(MYSQL_EXTRA_LIBRARIES "")
234-
endif(NOT WIN32)
235-
236250
if(UNIX)
237-
find_program(MYSQL_EXECUTABLE mysql
238-
PATHS
239-
${MYSQL_CONFIG_PREFER_PATH}
240-
/usr/local/mysql/bin/
241-
/usr/local/bin/
242-
/usr/bin/
243-
DOC
244-
"path to your mysql binary."
245-
)
251+
find_program(MYSQL_EXECUTABLE mysql
252+
PATHS
253+
${MYSQL_CONFIG_PREFER_PATH}
254+
/usr/local/mysql/bin/
255+
/usr/local/bin/
256+
/usr/bin/
257+
DOC
258+
"path to your mysql binary."
259+
)
246260
endif(UNIX)
247261

248262
if(WIN32)
@@ -291,7 +305,6 @@ foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
291305
endforeach()
292306
unset(_comp)
293307

294-
include(FindPackageHandleStandardArgs)
295308
find_package_handle_standard_args(MySQL
296309
REQUIRED_VARS
297310
${MYSQL_REQUIRED_VARS}
@@ -301,25 +314,37 @@ find_package_handle_standard_args(MySQL
301314
)
302315
unset(MYSQL_REQUIRED_VARS)
303316

304-
if(MYSQL_FOUND)
305-
if(MySQL_lib_WANTED AND MySQL_lib_FOUND)
306-
message(STATUS "Found MySQL library: ${MYSQL_LIBRARY}")
307-
message(STATUS "Found MySQL headers: ${MYSQL_INCLUDE_DIR}")
308-
endif()
309-
if(MySQL_binary_WANTED AND MySQL_binary_FOUND)
310-
message(STATUS "Found MySQL executable: ${MYSQL_EXECUTABLE}")
311-
endif()
312-
mark_as_advanced(MYSQL_FOUND MYSQL_LIBRARY MYSQL_EXTRA_LIBRARIES MYSQL_INCLUDE_DIR MYSQL_EXECUTABLE)
313-
314-
if(NOT TARGET MySQL::MySQL AND MySQL_lib_WANTED AND MySQL_lib_FOUND)
315-
add_library(MySQL::MySQL UNKNOWN IMPORTED)
316-
set_target_properties(MySQL::MySQL
317-
PROPERTIES
318-
IMPORTED_LOCATION
319-
"${MYSQL_LIBRARY}"
320-
INTERFACE_INCLUDE_DIRECTORIES
321-
"${MYSQL_INCLUDE_DIR}")
317+
if(MySQL_lib_WANTED AND MySQL_lib_FOUND)
318+
try_run(MYSQL_VERSION_DETECTED MYSQL_VERSION_COMPILED ${CMAKE_BINARY_DIR}
319+
SOURCES "${CMAKE_CURRENT_LIST_DIR}/FindMySQLVersion.c"
320+
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${MYSQL_INCLUDE_DIR}
321+
LINK_LIBRARIES ${MYSQL_LIBRARY}
322+
RUN_OUTPUT_VARIABLE MYSQL_VERSION_DETECTION_RUN_OUTPUT
323+
)
324+
325+
string(JSON MYSQL_VERSION GET "${MYSQL_VERSION_DETECTION_RUN_OUTPUT}" "version")
326+
string(JSON MYSQL_FLAVOR GET "${MYSQL_VERSION_DETECTION_RUN_OUTPUT}" "flavor")
327+
328+
if(MYSQL_MIN_VERSION_${MYSQL_FLAVOR} VERSION_GREATER MYSQL_VERSION)
329+
message(FATAL_ERROR "Found ${MYSQL_FLAVOR} version: \"${MYSQL_VERSION}\", but required is at least \"${MYSQL_MIN_VERSION_${MYSQL_FLAVOR}}\"")
330+
else()
331+
message(STATUS "Found ${MYSQL_FLAVOR} version: \"${MYSQL_VERSION}\", minimum required is \"${MYSQL_MIN_VERSION_${MYSQL_FLAVOR}}\"")
322332
endif()
323-
else()
324-
message(FATAL_ERROR "Could not find the MySQL libraries! Please install the development libraries and headers")
333+
334+
message(STATUS "Found ${MYSQL_FLAVOR} library: ${MYSQL_LIBRARY}")
335+
message(STATUS "Found ${MYSQL_FLAVOR} headers: ${MYSQL_INCLUDE_DIR}")
336+
endif()
337+
if(MySQL_binary_WANTED AND MySQL_binary_FOUND)
338+
message(STATUS "Found MySQL executable: ${MYSQL_EXECUTABLE}")
339+
endif()
340+
mark_as_advanced(MYSQL_FOUND MYSQL_LIBRARY MYSQL_INCLUDE_DIR MYSQL_EXECUTABLE)
341+
342+
if(NOT TARGET MySQL::MySQL AND MySQL_lib_WANTED AND MySQL_lib_FOUND)
343+
add_library(MySQL::MySQL UNKNOWN IMPORTED)
344+
set_target_properties(MySQL::MySQL
345+
PROPERTIES
346+
IMPORTED_LOCATION
347+
"${MYSQL_LIBRARY}"
348+
INTERFACE_INCLUDE_DIRECTORIES
349+
"${MYSQL_INCLUDE_DIR}")
325350
endif()

cmake/macros/FindMySQLVersion.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <mysql.h>
2+
#include <stdio.h>
3+
4+
int main()
5+
{
6+
printf("{ "
7+
"\"version\": \"%d.%d.%d\", "
8+
"\"flavor\": \"%s\""
9+
" }",
10+
MYSQL_VERSION_ID / 10000, (MYSQL_VERSION_ID / 100) % 100, MYSQL_VERSION_ID % 100,
11+
#ifdef MARIADB_VERSION_ID
12+
"MariaDB"
13+
#else
14+
"MySQL"
15+
#endif
16+
);
17+
return 0;
18+
}

cmake/options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if(WITH_FILESYSTEM_WATCHER OR BUILD_SHARED_LIBS)
5151
set(BUILD_EFSW ON)
5252
endif()
5353
option(WITH_WARNINGS "Show all warnings during compile" 0)
54+
option(WITH_WARNINGS_AS_ERRORS "Treat warnings as errors" 0)
5455
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
5556
option(WITHOUT_METRICS "Disable metrics reporting (i.e. InfluxDB and Grafana)" 0)
5657
option(WITH_DETAILED_METRICS "Enable detailed metrics reporting (i.e. time each session takes to update)" 0)

cmake/platform/win/settings.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ target_compile_definitions(trinity-compile-option-interface
88

99
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
1010
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
11+
12+
# add WindowsSettings.manifest to all executables
13+
target_sources(trinity-core-interface
14+
INTERFACE
15+
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:${CMAKE_SOURCE_DIR}/cmake/platform/win/WindowsSettings.manifest>)

cmake/showoptions.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ endif()
6161
if(WITH_WARNINGS)
6262
message("* Show all warnings : Yes")
6363
else()
64-
message("* Show compile-warnings : No (default)")
64+
message("* Show all warnings : No (default)")
65+
endif()
66+
67+
if(WITH_WARNINGS_AS_ERRORS)
68+
message("* Stop build on warning : Yes")
69+
else()
70+
message("* Stop build on warning : No (default)")
6571
endif()
6672

6773
if(WITH_COREDEBUG)

0 commit comments

Comments
 (0)