Enabled backward-cpp for debug build on Linux
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Update package database
|
- name: Update package database
|
||||||
run: sudo apt -y update
|
run: sudo apt -y update
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: sudo apt -y install git make gcc-10 g++-10 ccache cmake libyaml-cpp-dev llvm-12 clang-12 libclang-12-dev libclang-cpp12-dev clang-format-12 lcov zlib1g-dev
|
run: sudo apt -y install git make pkg-config gcc-10 g++-10 ccache cmake libyaml-cpp-dev llvm-12 clang-12 libclang-12-dev libclang-cpp12-dev clang-format-12 lcov zlib1g-dev libunwind-dev libdw-dev
|
||||||
- name: Select g++ version
|
- name: Select g++ version
|
||||||
run: |
|
run: |
|
||||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
set(CMAKE_VERBOSE_MAKEFILE OFF)
|
set(CMAKE_VERBOSE_MAKEFILE OFF)
|
||||||
set(CMAKE_FIND_DEBUG_MODE OFF)
|
set(CMAKE_FIND_DEBUG_MODE OFF)
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
set(LINUX TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# C++ setup
|
# C++ setup
|
||||||
#
|
#
|
||||||
@@ -155,6 +159,17 @@ endif()
|
|||||||
|
|
||||||
link_directories(${LLVM_LIBRARY_DIR} ${YAML_CPP_LIBRARY_DIR})
|
link_directories(${LLVM_LIBRARY_DIR} ${YAML_CPP_LIBRARY_DIR})
|
||||||
|
|
||||||
|
#
|
||||||
|
# Setup libdw and libunwind
|
||||||
|
#
|
||||||
|
if(LINUX AND (CMAKE_BUILD_TYPE MATCHES Debug))
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(DW REQUIRED IMPORTED_TARGET libdw)
|
||||||
|
pkg_check_modules(UNWIND REQUIRED IMPORTED_TARGET libunwind)
|
||||||
|
set(BACKWARD_CPP_LIBRARIES PkgConfig::DW PkgConfig::UNWIND)
|
||||||
|
set(ENABLE_BACKWARD_CPP -DENABLE_BACKWARD_CPP)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Setup thirdparty sources
|
# Setup thirdparty sources
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -422,6 +422,7 @@ This project relies on the following great tools:
|
|||||||
* [glob](https://github.com/p-ranav/glob) - Unix style path expansion for C++
|
* [glob](https://github.com/p-ranav/glob) - Unix style path expansion for C++
|
||||||
* [CLI11](https://github.com/CLIUtils/CLI11) - command line parser for C++
|
* [CLI11](https://github.com/CLIUtils/CLI11) - command line parser for C++
|
||||||
* [inja](https://github.com/pantor/inja) - a template engine for modern C++
|
* [inja](https://github.com/pantor/inja) - a template engine for modern C++
|
||||||
|
* [backward-cpp](https://github.com/bombela/backward-cpp) - stack trace pretty printer for C++
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,13 @@ target_compile_options(clang-uml PRIVATE
|
|||||||
-Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field
|
-Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field
|
||||||
-Wno-deprecated-declarations>
|
-Wno-deprecated-declarations>
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>)
|
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>)
|
||||||
|
target_compile_definitions(clang-uml PRIVATE
|
||||||
|
${ENABLE_BACKWARD_CPP})
|
||||||
target_link_libraries(clang-uml
|
target_link_libraries(clang-uml
|
||||||
${YAML_CPP_LIBRARIES}
|
${YAML_CPP_LIBRARIES}
|
||||||
${LIBTOOLING_LIBS}
|
${LIBTOOLING_LIBS}
|
||||||
${MSVC_LIBRARIES}
|
${MSVC_LIBRARIES}
|
||||||
|
${BACKWARD_CPP_LIBRARIES}
|
||||||
clang-umllib
|
clang-umllib
|
||||||
Threads::Threads)
|
Threads::Threads)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifdef ENABLE_BACKWARD_CPP
|
||||||
|
#define BACKWARD_HAS_DW 1
|
||||||
|
#define BACKWARD_HAS_LIBUNWIND 1
|
||||||
#include <backward-cpp/backward.hpp>
|
#include <backward-cpp/backward.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -40,7 +42,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <util/thread_pool_executor.h>
|
#include <util/thread_pool_executor.h>
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifdef ENABLE_BACKWARD_CPP
|
||||||
namespace backward {
|
namespace backward {
|
||||||
backward::SignalHandling sh; // NOLINT
|
backward::SignalHandling sh; // NOLINT
|
||||||
} // namespace backward
|
} // namespace backward
|
||||||
|
|||||||
Reference in New Issue
Block a user