Sfoglia il codice sorgente

Merge pull request #4639 from a16bitsysop/backward

[Minor] Make compiling with backward-cpp optional
tags/3.7.2
Vsevolod Stakhov 7 mesi fa
parent
commit
81032871e5
Nessun account collegato all'indirizzo email del committer
2 ha cambiato i file con 25 aggiunte e 18 eliminazioni
  1. 12
    4
      CMakeLists.txt
  2. 13
    14
      contrib/backward-cpp/backward.hpp

+ 12
- 4
CMakeLists.txt Vedi File

@@ -60,6 +60,7 @@ OPTION(ENABLE_LIBUNWIND "Obsoleted [default: OFF]" OFF)
OPTION(ENABLE_LUA_TRACE "Trace all Lua C API invocations [default: OFF]" OFF)
OPTION(ENABLE_LUA_REPL "Enables Lua repl (requires C++11 compiler) [default: ON]" ON)
OPTION(ENABLE_FASTTEXT "Link with FastText library [default: OFF]" OFF)
OPTION(ENABLE_BACKWARD "Build rspamd with backward-cpp stacktrace [default: ON]" ON)
OPTION(SYSTEM_ZSTD "Use system zstd instead of bundled one [default: OFF]" OFF)
OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [default: OFF]" OFF)
OPTION(SYSTEM_DOCTEST "Use system doctest instead of bundled one [default: OFF]" OFF)
@@ -625,11 +626,18 @@ ADD_SUBDIRECTORY(contrib/libev)
ADD_SUBDIRECTORY(contrib/kann)
ADD_SUBDIRECTORY(contrib/fastutf8)
ADD_SUBDIRECTORY(contrib/google-ced)
ADD_SUBDIRECTORY(contrib/backward-cpp)
message(STATUS "Backward-cpp config: ${BACKWARD_DEFINITIONS}")
if (BACKWARD_LIBRARIES)
IF (ENABLE_BACKWARD MATCHES "ON")
ADD_SUBDIRECTORY(contrib/backward-cpp)
message(STATUS "Backward-cpp config: ${BACKWARD_DEFINITIONS}")
ELSE ()
set(BACKWARD_ENABLE)
macro(add_backward target)
# do nothing
endmacro()
ENDIF ()
IF (BACKWARD_LIBRARIES)
message(STATUS "Backward-cpp libraries: ${BACKWARD_LIBRARIES}")
endif()
ENDIF ()

IF (SYSTEM_FMT MATCHES "OFF")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/contrib/fmt/include")

+ 13
- 14
contrib/backward-cpp/backward.hpp Vedi File

@@ -211,10 +211,23 @@
#else
#include <link.h>
#endif
#if defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \
defined(__POWERPC__)
// Linux kernel header required for the struct pt_regs definition
// to access the NIP (Next Instruction Pointer) register value
#include <asm/ptrace.h>
#endif
#include <signal.h>
#include <sys/stat.h>
#include <syscall.h>
#include <unistd.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <dlfcn.h>
#undef _GNU_SOURCE
#else
#include <dlfcn.h>
#endif

#if BACKWARD_HAS_BFD == 1
// NOTE: defining PACKAGE{,_VERSION} is required before including
@@ -227,13 +240,6 @@
#define PACKAGE_VERSION
#endif
#include <bfd.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <dlfcn.h>
#undef _GNU_SOURCE
#else
#include <dlfcn.h>
#endif
#endif

#if BACKWARD_HAS_DW == 1
@@ -248,13 +254,6 @@
#include <libdwarf.h>
#include <libelf.h>
#include <map>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <dlfcn.h>
#undef _GNU_SOURCE
#else
#include <dlfcn.h>
#endif
#endif

#if (BACKWARD_HAS_BACKTRACE == 1) || (BACKWARD_HAS_BACKTRACE_SYMBOL == 1)

Loading…
Annulla
Salva