From 94f69fb1bcef103392ca27074ebb31ef2ebd27fb Mon Sep 17 00:00:00 2001 From: StormBytePP Date: Sun, 16 Aug 2015 16:56:11 +0200 Subject: Core/Build: Removed obsolete SystemConfig.h and made genrev be part of shared library, which allows cache hits to happen more likely --- src/server/shared/CMakeLists.txt | 2 + .../shared/Debugging/WheatyExceptionReport.cpp | 9 ++- src/server/shared/PrecompiledHeaders/sharedPCH.h | 1 + src/server/shared/Revision.cpp | 71 ++++++++++++++++++++++ src/server/shared/Revision.h | 39 ++++++++++++ src/server/shared/SystemConfig.h | 44 -------------- src/server/shared/Updater/DBUpdater.cpp | 8 +-- 7 files changed, 121 insertions(+), 53 deletions(-) create mode 100644 src/server/shared/Revision.cpp create mode 100644 src/server/shared/Revision.h delete mode 100644 src/server/shared/SystemConfig.h (limited to 'src/server/shared') diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index abc019863b1..d68ddf85ff3 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -91,6 +91,8 @@ add_library(shared STATIC ${shared_STAT_PCH_SRC} ) +add_dependencies(shared revision_data.h) + # Generate precompiled header if (USE_COREPCH) add_cxx_pch(shared ${shared_STAT_PCH_HDR} ${shared_STAT_PCH_SRC}) diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index 02916ca12d2..80240bb9110 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -20,8 +20,7 @@ #include "WheatyExceptionReport.h" #include "Common.h" -#include "SystemConfig.h" -#include "revision.h" +#include "Revision.h" #define CrashFolder _T("Crashes") #pragma comment(linker, "/DEFAULTLIB:dbghelp.lib") @@ -131,10 +130,10 @@ PEXCEPTION_POINTERS pExceptionInfo) SYSTEMTIME systime; GetLocalTime(&systime); sprintf(m_szDumpFileName, "%s\\%s_%s_[%u-%u_%u-%u-%u].dmp", - crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond); + crash_folder_path, Revision::GetHash().c_str(), pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond); sprintf(m_szLogFileName, "%s\\%s_%s_[%u-%u_%u-%u-%u].txt", - crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond); + crash_folder_path, Revision::GetHash().c_str(), pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond); m_hDumpFile = CreateFile(m_szDumpFileName, GENERIC_WRITE, @@ -440,7 +439,7 @@ PEXCEPTION_POINTERS pExceptionInfo) GetLocalTime(&systime); // Start out with a banner - _tprintf(_T("Revision: %s\r\n"), _FULLVERSION); + _tprintf(_T("Revision: %s\r\n"), Revision::GetFullVersion().c_str()); _tprintf(_T("Date %u:%u:%u. Time %u:%u \r\n"), systime.wDay, systime.wMonth, systime.wYear, systime.wHour, systime.wMinute); PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; diff --git a/src/server/shared/PrecompiledHeaders/sharedPCH.h b/src/server/shared/PrecompiledHeaders/sharedPCH.h index d99476bc7a8..f4c18f89ec1 100644 --- a/src/server/shared/PrecompiledHeaders/sharedPCH.h +++ b/src/server/shared/PrecompiledHeaders/sharedPCH.h @@ -8,3 +8,4 @@ #include "TypeList.h" #include "TaskScheduler.h" #include "EventMap.h" +#include "Revision.h" diff --git a/src/server/shared/Revision.cpp b/src/server/shared/Revision.cpp new file mode 100644 index 00000000000..84142316db5 --- /dev/null +++ b/src/server/shared/Revision.cpp @@ -0,0 +1,71 @@ +#include "Revision.h" +#include "CompilerDefs.h" +#include "revision_data.h" + +std::string Revision::GetPackageName() +{ + return "TrinityCore"; +} + +std::string Revision::GetHash() +{ + return _HASH; +} + +std::string Revision::GetDate() +{ + return _DATE; +} + +std::string Revision::GetBranch() +{ + return _BRANCH; +} + +std::string Revision::GetSourceDirectory() +{ + return _SOURCE_DIRECTORY; +} + +std::string Revision::GetMySQLExecutable() +{ + return _MYSQL_EXECUTABLE; +} + +std::string Revision::GetFullDatabase() +{ + return _FULL_DATABASE; +} + +std::string Revision::GetFullVersion() +{ +#if PLATFORM == PLATFORM_WINDOWS +# ifdef _WIN64 + return GetPackageName() + " rev. " + VER_PRODUCTVERSION_STR + " (Win64, " + _BUILD_DIRECTIVE + ")"; +# else + return GetPackageName() + " rev. " + VER_PRODUCTVERSION_STR + " (Win32, " + _BUILD_DIRECTIVE + ")"; +# endif +#else + return GetPackageName() + " rev. " + VER_PRODUCTVERSION_STR + " (Unix, " + _BUILD_DIRECTIVE + ")"; +#endif +} + +std::string GetCompanyNameStr() +{ + return VER_COMPANYNAME_STR; +} + +std::string GetLegalCopyrightStr() +{ + return VER_LEGALCOPYRIGHT_STR; +} + +std::string GetFileVersionStr() +{ + return VER_FILEVERSION_STR; +} + +std::string GetProductVersionStr() +{ + return VER_PRODUCTVERSION_STR; +} diff --git a/src/server/shared/Revision.h b/src/server/shared/Revision.h new file mode 100644 index 00000000000..6b80eb2ca46 --- /dev/null +++ b/src/server/shared/Revision.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008-2015 TrinityCore + * + * 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, see . + */ + +#ifndef __REVISION_H__ +#define __REVISION_H__ + +#include + +namespace Revision +{ + std::string GetPackageName(); + std::string GetHash(); + std::string GetDate(); + std::string GetBranch(); + std::string GetSourceDirectory(); + std::string GetMySQLExecutable(); + std::string GetFullDatabase(); + std::string GetFullVersion(); + std::string GetCompanyNameStr(); + std::string GetLegalCopyrightStr(); + std::string GetFileVersionStr(); + std::string GetProductVersionStr(); +} + +#endif diff --git a/src/server/shared/SystemConfig.h b/src/server/shared/SystemConfig.h deleted file mode 100644 index 7c519c7de57..00000000000 --- a/src/server/shared/SystemConfig.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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, see . - */ - -// THIS FILE IS DEPRECATED - -#ifndef TRINITY_SYSTEMCONFIG_H -#define TRINITY_SYSTEMCONFIG_H - -#include "Define.h" -#include "revision.h" - -#define _PACKAGENAME "TrinityCore" - -#if TRINITY_ENDIAN == TRINITY_BIGENDIAN -# define _ENDIAN_STRING "big-endian" -#else -# define _ENDIAN_STRING "little-endian" -#endif - -#if PLATFORM == PLATFORM_WINDOWS -# ifdef _WIN64 -# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Win64, " _BUILD_DIRECTIVE ")" -# else -# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Win32, " _BUILD_DIRECTIVE ")" -# endif -#else -# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Unix, " _BUILD_DIRECTIVE ")" -#endif -#endif diff --git a/src/server/shared/Updater/DBUpdater.cpp b/src/server/shared/Updater/DBUpdater.cpp index 7b39062222e..c69d19b11d6 100644 --- a/src/server/shared/Updater/DBUpdater.cpp +++ b/src/server/shared/Updater/DBUpdater.cpp @@ -17,7 +17,7 @@ #include "DBUpdater.h" #include "Log.h" -#include "revision.h" +#include "Revision.h" #include "UpdateFetcher.h" #include "DatabaseLoader.h" #include "Config.h" @@ -40,7 +40,7 @@ std::string DBUpdater::GetSourceDirectory() if (!entry.empty()) return entry; else - return _SOURCE_DIRECTORY; + return Revision::GetSourceDirectory(); } template @@ -50,7 +50,7 @@ std::string DBUpdater::GetMySqlCli() if (!entry.empty()) return entry; else - return _MYSQL_EXECUTABLE; + return Revision::GetMySQLExecutable(); } // Auth Database @@ -95,7 +95,7 @@ std::string DBUpdater::GetTableName() template<> std::string DBUpdater::GetBaseFile() { - return _FULL_DATABASE; + return Revision::GetFullDatabase(); } template<> -- cgit v1.2.3