mirror of
https://github.com/xmrig/xmrig-proxy.git
synced 2026-02-09 02:59:17 +08:00
Add optional support for Google Breakpad for Linux.
This commit is contained in:
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.0)
|
||||
project(xmrig-proxy)
|
||||
|
||||
|
||||
option(WITH_GOOGLE_BREAKPAD "Use Google Breakpad" OFF)
|
||||
|
||||
|
||||
include (CheckIncludeFile)
|
||||
|
||||
|
||||
@@ -131,6 +134,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
|
||||
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
|
||||
|
||||
if (WITH_GOOGLE_BREAKPAD)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g")
|
||||
endif()
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
||||
@@ -152,6 +160,13 @@ if (HAVE_SYSLOG_H)
|
||||
set(SOURCES_SYSLOG src/log/SysLog.h src/log/SysLog.cpp)
|
||||
endif()
|
||||
|
||||
if (WITH_GOOGLE_BREAKPAD)
|
||||
include_directories(/usr/local/include/breakpad)
|
||||
set(GOOGLE_BREAKPAD_LIBS breakpad_client)
|
||||
else()
|
||||
add_definitions(/DXMRIG_NO_GOOGLE_BREAKPAD)
|
||||
endif()
|
||||
|
||||
include_directories(src)
|
||||
include_directories(src/3rdparty)
|
||||
include_directories(src/3rdparty/jansson)
|
||||
@@ -160,4 +175,4 @@ include_directories(${UV_INCLUDE_DIR})
|
||||
add_subdirectory(src/3rdparty/jansson)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_SYSLOG})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} jansson ${UV_LIBRARIES} ${EXTRA_LIBS})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} jansson ${UV_LIBRARIES} ${EXTRA_LIBS} ${GOOGLE_BREAKPAD_LIBS})
|
||||
|
||||
@@ -21,11 +21,24 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_NO_GOOGLE_BREAKPAD
|
||||
# include "client/linux/handler/exception_handler.h"
|
||||
|
||||
static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded) {
|
||||
printf("Dump path: %s\n", descriptor.path());
|
||||
return succeeded;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "App.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
auto app = new App(argc, argv);
|
||||
# ifndef XMRIG_NO_GOOGLE_BREAKPAD
|
||||
google_breakpad::MinidumpDescriptor descriptor("/tmp");
|
||||
google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL, true, -1);
|
||||
# endif
|
||||
|
||||
return app->exec();
|
||||
App app(argc, argv);
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user