--- /dev/null
+# 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)
#include <Viewer/fgviewer.hxx>
#include "main.hxx"
+#include <Include/version.h>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <GUI/MessageBox.hxx>
#include <GUI/CocoaHelpers.h> // for transformToForegroundApp
#endif
+#if defined(HAVE_CRASHRPT)
+ #include <CrashRpt.h>
+#endif
+
std::string homedir;
std::string hostname;
#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);
fgviewerMain(argc, argv);
else
fgMainInit(argc, argv);
-
-
+
} catch (const sg_throwable &t) {
std::string info;
if (std::strlen(t.getOrigin()) != 0)
perror("Possible cause");
}
+#if defined(HAVE_CRASHRPT)
+ crUninstall();
+#endif
+
return 0;
}
#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>
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