fix(Core/Cmake): Rename VER_* macros to AC_* and centralize build dir… (#24717)

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Andrew
2026-02-15 08:55:08 -03:00
committed by GitHub
parent e049122f5f
commit b348455d53
13 changed files with 45 additions and 82 deletions

View File

@@ -56,7 +56,7 @@ AC_MODULES_API void AddModulesScripts()
/// Exposed in script modules to get the build directive of the module.
AC_MODULES_API char const* GetModulesBuildDirective()
{
return _BUILD_DIRECTIVE;
return AC_BUILD_TYPE;
}
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER

View File

@@ -16,11 +16,6 @@ if ((USE_COREPCH OR USE_SCRIPTPCH) AND (CMAKE_C_COMPILER_LAUNCHER STREQUAL "ccac
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fno-pch-timestamp")
endif()
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
set(CLANG_EXPECTED_VERSION 10.0.0)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)

View File

@@ -10,11 +10,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
set(GCC_EXPECTED_VERSION 8.0.0)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION)

View File

@@ -10,11 +10,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
if(PLATFORM EQUAL 32)
target_compile_options(acore-compile-option-interface
INTERFACE

View File

@@ -13,11 +13,6 @@
# 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 build-directive (used in core to tell which buildtype we used)
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
if(PLATFORM EQUAL 32)
# Required on 32-bit systems to enable SSE2 (standard on x64)
target_compile_options(acore-compile-option-interface

View File

@@ -59,19 +59,6 @@ else()
message(STATUS "MSVC: Enabled SSE2 support")
endif()
# Set build-directive (used in core to tell which buildtype we used)
# msbuild/devenv don't set CMAKE_MAKE_PROGRAM, you can choose build type from a dropdown after generating projects
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$(ConfigurationName)")
else()
# while all make-like generators do (nmake, ninja)
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
endif()
# multithreaded compiling on VS
target_compile_options(acore-compile-option-interface
INTERFACE

View File

@@ -20,6 +20,12 @@ set(CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 20)
message(STATUS "Enabled С++20 standard")
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(acore-compile-option-interface
INTERFACE
AC_BUILD_TYPE="$<CONFIG>"
AC_BUILD_HAS_DEBUG_INFO=$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
# An interface library to make the warnings level available to other targets
# This interface taget is set-up through the platform specific script
add_library(acore-warning-interface INTERFACE)

View File

@@ -51,8 +51,4 @@ elseif(CMAKE_C_COMPILER MATCHES "icc")
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/icc/settings.cmake)
elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/clang/settings.cmake)
else()
target_compile_definitions(acore-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
endif()

View File

@@ -10,10 +10,10 @@
#define _SOURCE_DIRECTORY R"(@CMAKE_SOURCE_DIR@)"
#define _BUILD_DIRECTORY R"(@BUILDDIR@)"
#define _MYSQL_EXECUTABLE R"(@MYSQL_EXECUTABLE@)"
#define VER_COMPANYNAME_STR "AzerothCore"
#define VER_LEGALCOPYRIGHT_STR "(c)2016-@rev_year@ AzerothCore"
#define VER_FILEVERSION 0,0,0
#define VER_FILEVERSION_STR "@rev_hash@ @rev_date@ (@rev_branch@ branch)"
#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#define AC_COMPANYNAME_STR "AzerothCore"
#define AC_LEGALCOPYRIGHT_STR "(c)2016-@rev_year@ AzerothCore"
#define AC_FILEVERSION 0,0,0
#define AC_FILEVERSION_STR "@rev_hash@ @rev_date@ (@rev_branch@ branch)"
#define AC_PRODUCTVERSION AC_FILEVERSION
#define AC_PRODUCTVERSION_STR AC_FILEVERSION_STR
#endif // __REVISION_H__

View File

@@ -81,25 +81,25 @@ char const* GitRevision::GetMySQLExecutable()
char const* GitRevision::GetFullVersion()
{
return VER_COMPANYNAME_STR " rev. " VER_PRODUCTVERSION_STR " (" AZEROTH_PLATFORM_STR ", " _BUILD_DIRECTIVE ", " ACORE_LINKAGE_TYPE_STR ")"; // cppcheck-suppress unknownMacro
return AC_COMPANYNAME_STR " rev. " AC_PRODUCTVERSION_STR " (" AZEROTH_PLATFORM_STR ", " AC_BUILD_TYPE ", " ACORE_LINKAGE_TYPE_STR ")"; // cppcheck-suppress unknownMacro
}
char const* GitRevision::GetCompanyNameStr()
{
return VER_COMPANYNAME_STR;
return AC_COMPANYNAME_STR;
}
char const* GitRevision::GetLegalCopyrightStr()
{
return VER_LEGALCOPYRIGHT_STR;
return AC_LEGALCOPYRIGHT_STR;
}
char const* GitRevision::GetFileVersionStr()
{
return VER_FILEVERSION_STR;
return AC_FILEVERSION_STR;
}
char const* GitRevision::GetProductVersionStr()
{
return VER_PRODUCTVERSION_STR;
return AC_PRODUCTVERSION_STR;
}

View File

@@ -51,21 +51,18 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifndef _DEBUG
FILEFLAGS 0
#if AC_BUILD_HAS_DEBUG_INFO == 1
#define AC_DEBUG VS_FF_DEBUG
#else
#define VER_PRERELEASE VS_FF_PRERELEASE
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
#define VER_DEBUG 0
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#define AC_DEBUG 0
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION AC_FILEVERSION
PRODUCTVERSION AC_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VS_FF_PRERELEASE | AC_DEBUG)
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
@@ -74,14 +71,14 @@ BEGIN
BEGIN
BLOCK "080004b0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "CompanyName", AC_COMPANYNAME_STR
VALUE "FileDescription", "Authentication Server Daemon"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "FileVersion", AC_FILEVERSION_STR
VALUE "InternalName", "authserver"
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalCopyright", AC_LEGALCOPYRIGHT_STR
VALUE "OriginalFilename", "authserver.exe"
VALUE "ProductName", "Authentication Server"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "ProductVersion", AC_PRODUCTVERSION_STR
END
END

View File

@@ -51,21 +51,18 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifndef _DEBUG
FILEFLAGS 0
#if AC_BUILD_HAS_DEBUG_INFO == 1
#define AC_DEBUG VS_FF_DEBUG
#else
#define VER_PRERELEASE VS_FF_PRERELEASE
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
#define VER_DEBUG 0
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#define AC_DEBUG 0
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION AC_FILEVERSION
PRODUCTVERSION AC_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VS_FF_PRERELEASE | AC_DEBUG)
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
@@ -74,14 +71,14 @@ BEGIN
BEGIN
BLOCK "080004b0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "CompanyName", AC_COMPANYNAME_STR
VALUE "FileDescription", "World Server Daemon"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "FileVersion", AC_FILEVERSION_STR
VALUE "InternalName", "worldserver"
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalCopyright", AC_LEGALCOPYRIGHT_STR
VALUE "OriginalFilename", "worldserver.exe"
VALUE "ProductName", "World Server"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "ProductVersion", AC_PRODUCTVERSION_STR
END
END

View File

@@ -58,7 +58,7 @@ AC_SCRIPT_API void AddScripts()
/// Exposed in script modules to get the build directive of the module.
AC_SCRIPT_API char const* GetBuildDirective()
{
return _BUILD_DIRECTIVE;
return AC_BUILD_TYPE;
}
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER