Skip to content

Commit

Permalink
Merge f68371e into b8bbd4f
Browse files Browse the repository at this point in the history
  • Loading branch information
xDimon authored Oct 28, 2022
2 parents b8bbd4f + f68371e commit ea2f7a0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
option(COVERAGE "Enable generation of coverage info" OFF)
option(EMBEDDINGS "Embed developers assets" ON )
option(PROFILING "Enable internal profiling instruments" OFF)
option(BACKWARD "Enable stacktrace logging instruments" ON )

# sanitizers will be enabled only for Kagome, and will be disabled for dependencies
option(ASAN "Enable address sanitizer" OFF)
Expand Down
6 changes: 4 additions & 2 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ if (TESTING)
find_package(GTest CONFIG REQUIRED)
endif()

hunter_add_package(backward-cpp)
find_package(Backward)
if (BACKWARD)
hunter_add_package(backward-cpp)
find_package(Backward)
endif()

# https://docs.hunter.sh/en/latest/packages/pkg/Boost.html
hunter_add_package(Boost COMPONENTS random filesystem program_options date_time)
Expand Down
9 changes: 7 additions & 2 deletions core/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ add_executable(storage_explorer
target_link_libraries(storage_explorer
application_injector
)
add_backward(storage_explorer)
if (BACKWARD)
add_backward(storage_explorer)
endif()

add_executable(kagome-db-editor
kagome_db_editor.cpp
)
target_link_libraries(kagome-db-editor
Backward::Backward
Boost::Boost.DI
block_storage
changes_tracker
Expand All @@ -29,4 +30,8 @@ target_link_libraries(kagome-db-editor
trie_storage
trie_storage_backend
)
if (BACKWARD)
add_backward(kagome-db-editor)
endif()
kagome_install(kagome-db-editor)

6 changes: 6 additions & 0 deletions core/utils/kagome_db_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
#include <string_view>
#include <thread>

#if defined(BACKWARD_HAS_BACKTRACE)
#include <backward.hpp>
#endif

#undef TRUE
#undef FALSE

#include <boost/di.hpp>
#include <soralog/impl/configurator_from_yaml.hpp>

Expand Down Expand Up @@ -160,7 +164,9 @@ auto is_hash(const char *s) {
};

int main(int argc, char *argv[]) {
#if defined(BACKWARD_HAS_BACKTRACE)
backward::SignalHandling sh;
#endif

Command cmd;
if (argc == 2 or (argc == 3 && is_hash(argv[2]))
Expand Down
4 changes: 3 additions & 1 deletion node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ add_executable(kagome
main.cpp
)
target_link_libraries(kagome
Backward::Backward
Boost::boost
Boost::program_options
kagome_application
Expand All @@ -16,4 +15,7 @@ target_link_libraries(kagome
p2p::p2p_identify
p2p::p2p_ping
)
if (BACKWARD)
add_backward(kagome)
endif()
kagome_install(kagome)
7 changes: 6 additions & 1 deletion node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

#include <iostream>

#if defined(BACKWARD_HAS_BACKTRACE)
#include <backward.hpp>
#endif

#undef TRUE
#undef FALSE

#include <libp2p/log/configurator.hpp>

#include "application/impl/app_configuration_impl.hpp"
Expand All @@ -20,8 +24,9 @@ using kagome::application::AppConfiguration;
using kagome::application::AppConfigurationImpl;

int main(int argc, const char **argv) {
#if defined(BACKWARD_HAS_BACKTRACE)
backward::SignalHandling sh;

#endif
{
soralog::util::setThreadName("kagome");

Expand Down

0 comments on commit ea2f7a0

Please sign in to comment.