From 7899faa4b3fe32c9c4f4240168ed11397e32ab28 Mon Sep 17 00:00:00 2001 From: uchenily Date: Mon, 20 May 2024 10:39:21 +0800 Subject: [PATCH] test backward-cpp --- meson.build | 12 +++++++++++- tests/meson.build | 1 + tests/test_backward.cpp | 13 +++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/test_backward.cpp diff --git a/meson.build b/meson.build index a373621..96ac68b 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,11 @@ project('uvio', 'cpp', version: '0.0.1', default_options: [ + 'buildtype=debug', + 'default_library=shared', 'cpp_std=c++20', 'warning_level=3'], - meson_version: '>=0.60.0') + meson_version: '>=0.63.0') # Use libc++ by default if available instead of libstdc++ when compiling with clang. cxx = meson.get_compiler('cpp') @@ -18,8 +20,16 @@ compile_args = [] includes = include_directories('.') libuv_dep = dependency('libuv') +backward_dep = dependency('backward-cpp') dependencies = [] dependencies += libuv_dep +dependencies += backward_dep + +add_project_arguments(['-DBACKWARD_HAS_BFD=1'], language: 'cpp') +# add_project_arguments(['-DBACKWARD_HAS_UNWIND=1'], language: 'cpp') +# add_project_arguments(['-DBACKWARD_HAS_LIBUNWIND=1'], language: 'cpp') +# add_project_arguments(['-DBACKWARD_HAS_DW=1'], language: 'cpp') # hang up? +# add_project_link_arguments(['-rdynamic'], language: 'cpp') subdir('tests') subdir('examples') diff --git a/tests/meson.build b/tests/meson.build index 7b6f2b1..87cdf35 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,5 +1,6 @@ all_tests_sources = [ 'test_log.cpp', + 'test_backward.cpp', 'test_libuv.cpp', 'test_task.cpp', 'test_timer.cpp', diff --git a/tests/test_backward.cpp b/tests/test_backward.cpp new file mode 100644 index 0000000..22cbee6 --- /dev/null +++ b/tests/test_backward.cpp @@ -0,0 +1,13 @@ +#include "backward.hpp" + +#include +#include + +namespace backward { +backward::SignalHandling sh; +} // namespace backward + +auto main() -> int { + std::vector vec; + std::cout << "vec[100] = " << vec[100] << '\n'; +}