Initial integration of CrashRpt for Windows.
This commit is contained in:
parent
e3e44e49ee
commit
590be3f8ff
6 changed files with 97 additions and 2 deletions
|
@ -203,6 +203,15 @@ find_package(OpenGL REQUIRED)
|
|||
find_package(OpenAL REQUIRED)
|
||||
find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
||||
|
||||
if (MSVC)
|
||||
find_package(CrashRpt)
|
||||
if (CRASHRPT_FOUND)
|
||||
set(HAVE_CRASHRPT 1)
|
||||
message(STATUS "Using CrashRpt")
|
||||
include_directories( ${CRASHRPT_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_FGADMIN)
|
||||
find_package(FLTK)
|
||||
|
||||
|
|
31
CMakeModules/FindCrashRpt.cmake
Normal file
31
CMakeModules/FindCrashRpt.cmake
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Find CrashRpt
|
||||
# ~~~~~~~~~~~~
|
||||
# Copyright (c) 2014, James Turner <zakalawe at mac dot com>
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# CMake module to search for CrashRpt library
|
||||
#
|
||||
# If it's found it sets CRASHRPT_FOUND to TRUE
|
||||
# and following variables are set:
|
||||
# CRASHRPT_FOUND_INCLUDE_DIR
|
||||
# CRASHRPT_FOUND_LIBRARY
|
||||
|
||||
FIND_PATH(CRASHRPT_INCLUDE_DIR CrashRpt.h
|
||||
PATH_SUFFIXES include
|
||||
HINTS $ENV{CRASHRPTDIR}
|
||||
PATHS
|
||||
${ADDITIONAL_LIBRARY_PATHS}
|
||||
)
|
||||
|
||||
set(CRASHRPPT_LIBRARIES "")
|
||||
|
||||
FIND_LIBRARY(CRASHRPT_LIBRARY NAMES CrashRpt1402
|
||||
HINTS $ENV{CRASHRPTDIR}
|
||||
PATH_SUFFIXES lib
|
||||
PATHS ${ADDITIONAL_LIBRARY_PATHS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CRASHRPT DEFAULT_MSG
|
||||
CRASHRPT_LIBRARY CRASHRPT_INCLUDE_DIR)
|
|
@ -42,3 +42,6 @@
|
|||
#cmakedefine ENABLE_IAX
|
||||
|
||||
#cmakedefine HAVE_DBUS
|
||||
|
||||
#cmakedefine HAVE_CRASHRPT
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ target_link_libraries(fgfs
|
|||
${JPEG_LIBRARY}
|
||||
${HLA_LIBRARIES}
|
||||
${EVENT_INPUT_LIBRARIES}
|
||||
${CRASHRPT_LIBRARY}
|
||||
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
|
||||
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
|
||||
${PLATFORM_LIBS}
|
||||
|
|
|
@ -60,6 +60,7 @@ using std::endl;
|
|||
|
||||
#include <Viewer/fgviewer.hxx>
|
||||
#include "main.hxx"
|
||||
#include <Include/version.h>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <GUI/MessageBox.hxx>
|
||||
|
@ -70,6 +71,10 @@ using std::endl;
|
|||
#include <GUI/CocoaHelpers.h> // for transformToForegroundApp
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CRASHRPT)
|
||||
#include <CrashRpt.h>
|
||||
#endif
|
||||
|
||||
std::string homedir;
|
||||
std::string hostname;
|
||||
|
||||
|
@ -176,6 +181,41 @@ int main ( int argc, char **argv )
|
|||
#endif
|
||||
_bootstrap_OSInit = 0;
|
||||
|
||||
#if defined(HAVE_CRASHRPT)
|
||||
// Define CrashRpt configuration parameters
|
||||
CR_INSTALL_INFO info;
|
||||
memset(&info, 0, sizeof(CR_INSTALL_INFO));
|
||||
info.cb = sizeof(CR_INSTALL_INFO);
|
||||
info.pszAppName = "FlightGear";
|
||||
info.pszAppVersion = FLIGHTGEAR_VERSION;
|
||||
info.pszEmailSubject = "FlightGear " FLIGHTGEAR_VERSION " crash report";
|
||||
info.pszEmailTo = "fgcrash@goneabitbursar.com";
|
||||
info.pszUrl = "http://fgfs.goneabitbursar.com/crashreporter/crashrpt.php";
|
||||
info.uPriorities[CR_HTTP] = 3;
|
||||
info.uPriorities[CR_SMTP] = 2;
|
||||
info.uPriorities[CR_SMAPI] = 1;
|
||||
|
||||
// Install all available exception handlers
|
||||
info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;
|
||||
|
||||
// Restart the app on crash
|
||||
info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS;
|
||||
|
||||
// autoamticallty install handlers for all threads
|
||||
info.dwFlags |= CR_INST_AUTO_THREAD_HANDLERS;
|
||||
|
||||
// Define the Privacy Policy URL
|
||||
info.pszPrivacyPolicyURL = "http://flightgear.org/crash-privacypolicy.html";
|
||||
|
||||
// Install crash reporting
|
||||
int nResult = crInstall(&info);
|
||||
if(nResult!=0) {
|
||||
std::cerr << "failed to install crash reporting engine" << std::endl;
|
||||
} else {
|
||||
crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
// Ignore floating-point exceptions on FreeBSD
|
||||
signal(SIGFPE, SIG_IGN);
|
||||
|
@ -225,7 +265,6 @@ int main ( int argc, char **argv )
|
|||
else
|
||||
fgMainInit(argc, argv);
|
||||
|
||||
|
||||
} catch (const sg_throwable &t) {
|
||||
std::string info;
|
||||
if (std::strlen(t.getOrigin()) != 0)
|
||||
|
@ -245,6 +284,10 @@ int main ( int argc, char **argv )
|
|||
perror("Possible cause");
|
||||
}
|
||||
|
||||
#if defined(HAVE_CRASHRPT)
|
||||
crUninstall();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#include <osg/GraphicsContext>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#if defined(HAVE_CRASHRPT)
|
||||
#include <CrashRpt.h>
|
||||
#endif
|
||||
|
||||
// Class references
|
||||
#include <simgear/canvas/VGInitOperation.hxx>
|
||||
#include <simgear/scene/model/modellib.hxx>
|
||||
|
@ -339,6 +343,10 @@ static void logToFile()
|
|||
logPath.append("fgfs.log");
|
||||
}
|
||||
sglog().logToFile(logPath, SG_ALL, SG_INFO);
|
||||
|
||||
#if defined(HAVE_CRASHRPT)
|
||||
crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Main top level initialization
|
||||
|
|
Loading…
Reference in a new issue