From 4cf6dec592fb9b577f9f38b32fe726827b5c2dd3 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 19 Jun 2019 09:13:03 +1000 Subject: [PATCH] [all] allow disable of backtrace support during build --- VERSION | 2 +- c-host/CMakeLists.txt | 3 +++ client/CMakeLists.txt | 3 +++ common/CMakeLists.txt | 8 +++++++- common/src/crash.linux.c | 13 ++++++++++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 5369ccdd..e0f5974c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-rc6-1-g2def6346e6+1 \ No newline at end of file +B1-rc6-2-gd7fa0aeff9+1 \ No newline at end of file diff --git a/c-host/CMakeLists.txt b/c-host/CMakeLists.txt index 46f64de6..776de9c1 100644 --- a/c-host/CMakeLists.txt +++ b/c-host/CMakeLists.txt @@ -14,6 +14,9 @@ if(OPTIMIZE_FOR_NATIVE) endif() endif() +option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON) +add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.") + add_compile_options( "-Wall" "-Werror" diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e2fbe10d..4c1ba29f 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -24,6 +24,9 @@ add_feature_info(ENABLE_EGL ENABLE_EGL "EGL renderer.") option(ENABLE_CB_X11 "Enable X11 clipboard integration" ON) add_feature_info(ENABLE_CB_X11 ENABLE_CB_X11 "X11 Clipboard Integration.") +option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON) +add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.") + add_compile_options( "-Wall" "-Werror" diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 97c207c4..86af720c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -5,6 +5,10 @@ include_directories( ${PROJECT_SOURCE_DIR}/include ) +if(ENABLE_BACKTRACE) + add_definitions(-DENABLE_BACKTRACE) +endif() + set(COMMON_SOURCES src/stringutils.c src/stringlist.c @@ -27,7 +31,9 @@ if(WIN32) else() set(SOURCES ${COMMON_SOURCES} ${LINUX_SOURCES}) add_library(lg_common STATIC ${SOURCES}) - target_link_libraries(lg_common bfd) + if(ENABLE_BACKTRACE) + target_link_libraries(lg_common bfd) + endif() endif() target_include_directories(lg_common diff --git a/common/src/crash.linux.c b/common/src/crash.linux.c index 69bb7241..218d65f5 100644 --- a/common/src/crash.linux.c +++ b/common/src/crash.linux.c @@ -21,6 +21,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "common/crash.h" #include "common/debug.h" +#if defined(ENABLE_BACKTRACE) + #include #include #include @@ -219,4 +221,13 @@ bool installCrashHandler(const char * exe) } return true; -} \ No newline at end of file +} + +#else //ENABLE_BACKTRACE + +bool installCrashHandler(const char * exe) +{ + return true; +} + +#endif \ No newline at end of file