From c0e4652edfae0bbcdeb481d807c6b1075d9600c7 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 12 Dec 2023 08:04:41 +0400 Subject: [PATCH 1/4] meson: Add tracy_public_deps list Currently functionally identical to before. Will be used in a subsequent commit for libunwind, which appears in a public header. --- meson.build | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 782e2f66..88397aa0 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,9 @@ tracy_compile_args = [] # compiler flags shared between the capture library itself and the code using it tracy_common_args = [] +# dependencies that will be propagated to the users of the capture library +tracy_public_deps = [] + if get_option('tracy_enable') tracy_common_args += ['-DTRACY_ENABLE'] endif @@ -103,8 +106,6 @@ if tracy_shared_libs tracy_compile_args += ['-DTRACY_EXPORTS'] endif -threads_dep = dependency('threads') - if host_machine.system() == 'windows' tracy_compile_args += ['-DWINVER=0x0601', '-D_WIN32_WINNT=0x0601'] endif @@ -175,8 +176,10 @@ endif tracy_compile_args += tracy_common_args +tracy_deps = [dependency('threads')] + tracy_public_deps + tracy = library('tracy', tracy_src, tracy_header_files, - dependencies : [ threads_dep ], + dependencies : tracy_deps, include_directories : tracy_public_include_dirs, cpp_args : tracy_compile_args, override_options : override_options, @@ -193,7 +196,9 @@ if tracy_shared_libs endif pkg = import('pkgconfig') -pkg.generate(tracy, extra_cflags: tracy_dep_compile_args) +pkg.generate(tracy, + extra_cflags : tracy_dep_compile_args, + requires : tracy_public_deps) tracy_dep = declare_dependency( compile_args : tracy_dep_compile_args, From 2b0be68b4a448cffca9a150aa79b94b8f9ae11a2 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 12 Dec 2023 08:05:38 +0400 Subject: [PATCH 2/4] meson: Add libunwind option The CMake name was a bit weird, so I changed it to the standard format for meson. --- meson.build | 5 +++++ meson_options.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/meson.build b/meson.build index 88397aa0..0cfa677f 100644 --- a/meson.build +++ b/meson.build @@ -97,6 +97,11 @@ if get_option('tracy_no_crash_handler') tracy_common_args += ['-DTRACY_NO_CRASH_HANDLER'] endif +if get_option('tracy_libunwind_backtrace') + tracy_common_args += ['-DTRACE_CLIENT_LIBUNWIND_BACKTRACE'] + tracy_public_deps += dependency('libunwind') +endif + tracy_shared_libs = get_option('default_library') == 'shared' if not tracy_shared_libs and get_option('tracy_shared_libs') warning('tracy_shared_libs is set to true, but default_library is set to static. Building static library.') diff --git a/meson_options.txt b/meson_options.txt index d46686ee..a76ad9c0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,7 @@ option('tracy_no_frame_image', type : 'boolean', value : false, description : 'D option('tracy_no_system_tracing', type : 'boolean', value : false, description : 'Disable systrace sampling') option('tracy_patchable_nopsleds', type : 'boolean', value : false, description : 'Enable nopsleds for efficient patching by system-level tools (e.g. rr)') option('tracy_timer_fallback', type : 'boolean', value : false, description : 'Use lower resolution timers') +option('tracy_libunwind_backtrace', type : 'boolean', value : false, description : 'Use libunwind backtracing where supported') option('tracy_delayed_init', type : 'boolean', value : false, description : 'Enable delayed initialization of the library (init on first call)') option('tracy_manual_lifetime', type : 'boolean', value : false, description : 'Enable the manual lifetime management of the profile') option('tracy_fibers', type : 'boolean', value : false, description : 'Enable fibers support') From b110b10b35d5eb61ef7ed9b45be4c7af4d05a773 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 12 Dec 2023 08:06:08 +0400 Subject: [PATCH 3/4] meson: Add tracy_symbol_offline_resolve option --- meson.build | 4 ++++ meson_options.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/meson.build b/meson.build index 0cfa677f..6227c81d 100644 --- a/meson.build +++ b/meson.build @@ -102,6 +102,10 @@ if get_option('tracy_libunwind_backtrace') tracy_public_deps += dependency('libunwind') endif +if get_option('tracy_symbol_offline_resolve') + tracy_compile_args += ['-DTRACY_SYMBOL_OFFLINE_RESOLVE'] +endif + tracy_shared_libs = get_option('default_library') == 'shared' if not tracy_shared_libs and get_option('tracy_shared_libs') warning('tracy_shared_libs is set to true, but default_library is set to static. Building static library.') diff --git a/meson_options.txt b/meson_options.txt index a76ad9c0..1da92d08 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -17,6 +17,7 @@ option('tracy_no_system_tracing', type : 'boolean', value : false, description : option('tracy_patchable_nopsleds', type : 'boolean', value : false, description : 'Enable nopsleds for efficient patching by system-level tools (e.g. rr)') option('tracy_timer_fallback', type : 'boolean', value : false, description : 'Use lower resolution timers') option('tracy_libunwind_backtrace', type : 'boolean', value : false, description : 'Use libunwind backtracing where supported') +option('tracy_symbol_offline_resolve', type : 'boolean', value : false, description : 'Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution') option('tracy_delayed_init', type : 'boolean', value : false, description : 'Enable delayed initialization of the library (init on first call)') option('tracy_manual_lifetime', type : 'boolean', value : false, description : 'Enable the manual lifetime management of the profile') option('tracy_fibers', type : 'boolean', value : false, description : 'Enable fibers support') From 4e23b1125a7c1497cb0ca38a81a47fc741383e2b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 12 Dec 2023 08:06:31 +0400 Subject: [PATCH 4/4] meson: Add tracy_libbacktrace_elf_dynload_support option --- meson.build | 4 ++++ meson_options.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/meson.build b/meson.build index 6227c81d..bb0e8458 100644 --- a/meson.build +++ b/meson.build @@ -106,6 +106,10 @@ if get_option('tracy_symbol_offline_resolve') tracy_compile_args += ['-DTRACY_SYMBOL_OFFLINE_RESOLVE'] endif +if get_option('tracy_libbacktrace_elf_dynload_support') + tracy_compile_args += ['-DTRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT'] +endif + tracy_shared_libs = get_option('default_library') == 'shared' if not tracy_shared_libs and get_option('tracy_shared_libs') warning('tracy_shared_libs is set to true, but default_library is set to static. Building static library.') diff --git a/meson_options.txt b/meson_options.txt index 1da92d08..a2194417 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,6 +18,7 @@ option('tracy_patchable_nopsleds', type : 'boolean', value : false, description option('tracy_timer_fallback', type : 'boolean', value : false, description : 'Use lower resolution timers') option('tracy_libunwind_backtrace', type : 'boolean', value : false, description : 'Use libunwind backtracing where supported') option('tracy_symbol_offline_resolve', type : 'boolean', value : false, description : 'Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution') +option('tracy_libbacktrace_elf_dynload_support', type : 'boolean', value : false, description : 'Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation') option('tracy_delayed_init', type : 'boolean', value : false, description : 'Enable delayed initialization of the library (init on first call)') option('tracy_manual_lifetime', type : 'boolean', value : false, description : 'Enable the manual lifetime management of the profile') option('tracy_fibers', type : 'boolean', value : false, description : 'Enable fibers support')