Core/Debugging: Partially revert e0fb4445cd, the cmake hack to build wheaty directly into executable is still needed as it is impossible to have it initialize before every other static variable when it resides in dll (dynamic linking only)

This commit is contained in:
Shauren
2016-11-28 20:21:21 +01:00
parent e0fb4445cd
commit 9633c8c2b7
16 changed files with 40 additions and 23 deletions

View File

@@ -8,6 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if(WIN32)
set(sources_windows
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h
)
endif(WIN32)
add_subdirectory(genrev)
add_subdirectory(common)

View File

@@ -12,9 +12,17 @@ CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
${CMAKE_CURRENT_SOURCE_DIR}/Platform
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in common project
# It needs to be included both in authserver and worldserver for the static global variable to be properly initialized
# and to handle crash logs on windows
list(APPEND PRIVATE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.h)
if (USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/commonPCH.h)
set(PRIVATE_PCH_SOURCE PrecompiledHeaders/commonPCH.cpp)

View File

@@ -1463,8 +1463,3 @@ char* WheatyExceptionReport::PrintSymbolDetail(char* pszCurrBuffer)
}
#endif // _WIN32
void InitializeCrashHandler()
{
// dummy call to make the linker not discard the compilation unit
}

View File

@@ -210,8 +210,5 @@ class WheatyExceptionReport
extern WheatyExceptionReport g_WheatyExceptionReport; // global instance of class
#endif // _WIN32
// dummy call to make the linker not discard the compilation unit
void InitializeCrashHandler();
#endif // _WHEATYEXCEPTIONREPORT_

View File

@@ -17,7 +17,7 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
endif()
if(WIN32)
set(sources_windows
list(APPEND sources_windows
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h
)

View File

@@ -32,7 +32,6 @@
#include "SslContext.h"
#include "DatabaseLoader.h"
#include "LoginRESTService.h"
#include "WheatyExceptionReport.h"
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/filesystem/path.hpp>
@@ -78,7 +77,6 @@ static uint32 _banExpiryCheckInterval;
int main(int argc, char** argv)
{
InitializeCrashHandler();
signal(SIGABRT, &Trinity::AbortHandler);
auto configFile = fs::absolute(_TRINITY_BNET_CONFIG);

View File

@@ -47,7 +47,6 @@
#include "DatabaseLoader.h"
#include "AppenderDB.h"
#include "Metric.h"
#include "WheatyExceptionReport.h"
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
#include <boost/asio/io_service.hpp>
@@ -100,7 +99,6 @@ variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, s
/// Launch the Trinity server
extern int main(int argc, char** argv)
{
InitializeCrashHandler();
signal(SIGABRT, &Trinity::AbortHandler);
auto configFile = fs::absolute(_TRINITY_CORE_CONFIG);

View File

@@ -26,6 +26,10 @@ set(SRC_FILES
Program.cpp
)
if (WIN32)
list(APPEND SRC_FILES ${sources_windows})
endif()
add_executable(connection_patcher ${HEADER_FILES} ${SRC_FILES})
if (MSVC)

View File

@@ -27,7 +27,6 @@
#include "Banner.h"
#include "CompilerDefs.h"
#include "WheatyExceptionReport.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/program_options.hpp>
@@ -129,7 +128,6 @@ namespace Connection_Patcher
int main(int argc, char** argv)
{
InitializeCrashHandler();
using namespace Connection_Patcher;
try

View File

@@ -13,6 +13,10 @@ CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
if (WIN32)
list(APPEND PRIVATE_SOURCES ${sources_windows})
endif()
add_executable(mapextractor
${PRIVATE_SOURCES}
)

View File

@@ -12,6 +12,10 @@ CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
if (WIN32)
list(APPEND PRIVATE_SOURCES ${sources_windows})
endif()
add_executable(mmaps_generator ${PRIVATE_SOURCES})
target_link_libraries(mmaps_generator

View File

@@ -22,7 +22,6 @@
#include "MapBuilder.h"
#include "Timer.h"
#include "Banner.h"
#include "WheatyExceptionReport.h"
using namespace MMAP;
@@ -243,7 +242,6 @@ int finish(const char* message, int returnValue)
int main(int argc, char** argv)
{
InitializeCrashHandler();
Trinity::Banner::Show("MMAP generator", [](char const* text) { printf("%s\n", text); }, nullptr);
int threads = 3, mapnum = -1;

View File

@@ -9,7 +9,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
add_executable(vmap4assembler VMapAssembler.cpp)
set(PRIVATE_SOURCES VMapAssembler.cpp)
if (WIN32)
list(APPEND PRIVATE_SOURCES ${sources_windows})
endif()
add_executable(vmap4assembler ${PRIVATE_SOURCES})
target_link_libraries(vmap4assembler
common

View File

@@ -21,15 +21,13 @@
#include "TileAssembler.h"
#include "Banner.h"
#include "WheatyExceptionReport.h"
int main(int argc, char* argv[])
{
InitializeCrashHandler();
Trinity::Banner::Show("VMAP assembler", [](char const* text) { std::cout << text << std::endl; }, nullptr);
std::string src = "Buildings";
std::string dest = "vmaps";
std::string dest = "vmaps";
if (argc > 3)
{

View File

@@ -13,6 +13,10 @@ CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
if (WIN32)
list(APPEND PRIVATE_SOURCES ${sources_windows})
endif()
add_executable(vmap4extractor ${PRIVATE_SOURCES})
target_link_libraries(vmap4extractor

View File

@@ -50,7 +50,6 @@
#include "vmapexport.h"
#include "Banner.h"
#include "WheatyExceptionReport.h"
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
@@ -492,7 +491,6 @@ bool processArgv(int argc, char ** argv, const char *versionString)
int main(int argc, char ** argv)
{
InitializeCrashHandler();
Trinity::Banner::Show("VMAP data extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
bool success = true;