Skip to content

Commit

Permalink
linux/cmake: Allow libbacktrace to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
F0bes authored and SternXD committed Jul 18, 2024
1 parent 41d5a8d commit ab053a0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmake/BuildParameters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if(UNIX AND NOT APPLE)
option(ENABLE_SETCAP "Enable networking capability for DEV9" OFF)
option(X11_API "Enable X11 support" ON)
option(WAYLAND_API "Enable Wayland support" ON)
option(USE_BACKTRACE "Enable libbacktrace support" ON)
endif()

if(UNIX)
Expand Down
5 changes: 4 additions & 1 deletion cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ else()
find_package(Wayland REQUIRED Egl)
endif()

find_package(Libbacktrace REQUIRED)
if(USE_BACKTRACE)
find_package(Libbacktrace REQUIRED)
endif()

find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
endif()
Expand Down
5 changes: 4 additions & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,13 @@ else()
)
target_link_libraries(common PRIVATE
${DBUS_LINK_LIBRARIES}
libbacktrace::libbacktrace
X11::X11
X11::Xrandr
)
if(USE_BACKTRACE)
target_compile_definitions(common PRIVATE "HAS_LIBBACKTRACE=1")
target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_link_libraries(common PRIVATE cpuinfo)
endif()
Expand Down
4 changes: 2 additions & 2 deletions common/CrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void CrashHandler::WriteDumpForCaller()
WriteMinidumpAndCallstack(nullptr);
}

#elif !defined(__APPLE__)
#elif !defined(__APPLE__) && defined(HAS_LIBBACKTRACE)

#include "FileSystem.h"

Expand Down Expand Up @@ -377,4 +377,4 @@ void CrashHandler::CrashSignalHandler(int signal, siginfo_t* siginfo, void* ctx)
std::abort();
}

#endif
#endif

0 comments on commit ab053a0

Please sign in to comment.