summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt15
-rw-r--r--facetracknoir/main.cpp19
2 files changed, 33 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f8daadb..cffe88cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++11)
endif()
+if(WIN32)
+ set(SDK_GOOGLE_BREAKPAD "" CACHE PATH "google-breakpad for crash reporting")
+endif()
+
+if(SDK_GOOGLE_BREAKPAD)
+ add_definitions(-DOPENTRACK_BREAKPAD)
+ include_directories("${SDK_GOOGLE_BREAKPAD}/src/client/windows/handler")
+ include_directories("${SDK_GOOGLE_BREAKPAD}/src/")
+endif()
+
if(UNIX)
set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)")
endif()
@@ -579,6 +589,11 @@ endif()
if(NOT WIN32)
target_link_libraries(opentrack dl)
endif()
+ if(SDK_GOOGLE_BREAKPAD AND MSVC)
+ target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib"
+ "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib"
+ "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib")
+ endif()
set_target_properties(opentrack PROPERTIES COMPILE_FLAGS -DOPENTRACK_MAIN)
endif()
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index cf7ff6fb..0c8e5c11 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -31,12 +31,29 @@
#if defined(_WIN32)
# include <windows.h>
-//#pragma comment(linker, "/SUBSYSTEM:console /ENTRY:mainCRTStartup")
+# ifdef OPENTRACK_BREAKPAD
+# include <exception_handler.h>
+using namespace google_breakpad;
+bool dumpCallback(const wchar_t* dump_path,
+ const wchar_t* minidump_id,
+ void* context,
+ EXCEPTION_POINTERS* exinfo,
+ MDRawAssertionInfo* assertion,
+ bool succeeded)
+{
+ return succeeded;
+}
+
+# endif
#endif
int main(int argc, char** argv)
{
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
+
+#ifdef OPENTRACK_BREAKPAD
+ auto handler = new ExceptionHandler(L".", nullptr, dumpCallback, nullptr, -1);
+#endif
QApplication app(argc, argv);