From 81e88c1d9ee328fce4afa50919684ae8c813c8bb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 21 Aug 2020 18:28:29 -0400 Subject: [PATCH] Alterative sysprof build support Don't link libgtk against libsysprof. We only need that for the test-performance binary. --- gdk/meson.build | 4 +-- meson.build | 57 +++++++++++++++---------------- tests/meson.build | 4 +-- testsuite/performance/meson.build | 10 +++--- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/gdk/meson.build b/gdk/meson.build index 76d60dd2e6..9bb679160a 100644 --- a/gdk/meson.build +++ b/gdk/meson.build @@ -194,8 +194,8 @@ gdk_deps = [ ] if profiler_enabled - if profiler_dep.found() - gdk_deps += [profiler_dep] + if libsysprof_capture_dep.found() + gdk_deps += [libsysprof_capture_dep] endif endif diff --git a/meson.build b/meson.build index 5884b259e9..bf8d515bbb 100644 --- a/meson.build +++ b/meson.build @@ -439,7 +439,7 @@ endif cairo_libs = [] if cc.get_id() == 'msvc' - # Fallback depedency discovery for those on Visual Studio that do not generate + # Fallback dependency discovery for those on Visual Studio that do not generate # pkg-config files in their build systems for MSVC # Fallback for Cairo if not cairo_dep.found() @@ -703,39 +703,38 @@ endif profiler_enabled = get_option('profiler') if profiler_enabled - # Depend on libsysprof-capture if we only need the capture format. - # For -Dbuild-tests=true, we need SysprofProfiler to profile processes - # which requires sysprof-4 instead of sysprof-capture-4. - - profiler_options = [ - 'enable_examples=false', - 'enable_gtk=false', - 'enable_tests=false', - 'enable_tools=false', - 'with_sysprofd=none', - 'help=false', - ] - - if get_option('build-tests') - profiler_dep_name = 'sysprof-4' - profiler_fallback = 'libsysprof_dep' - else - profiler_dep_name = 'sysprof-capture-4' - profiler_fallback = 'libsysprof_capture_dep' - profiler_options += ['libsysprof=false'] - endif - - profiler_dep = dependency(profiler_dep_name, + # libsysprof-capture support + libsysprof_capture_dep = dependency('sysprof-capture-4', required: true, - default_options: profiler_options, - fallback: ['sysprof', profiler_fallback], + default_options: [ + 'enable_examples=false', + 'enable_gtk=false', + 'enable_tests=false', + 'enable_tools=false', + 'libsysprof=true', + 'with_sysprofd=none', + 'help=false', + ], + fallback: ['sysprof', 'libsysprof_capture_dep'], ) - - if profiler_dep.found() - cdata.set('HAVE_SYSPROF', profiler_dep.found()) + if libsysprof_capture_dep.found() + cdata.set('HAVE_SYSPROF', 1) else error('Profiler support not found, but was explicitly requested.') endif + libsysprof_dep = dependency('sysprof-4', + required: false, + default_options: [ + 'enable_examples=false', + 'enable_gtk=false', + 'enable_tests=false', + 'enable_tools=false', + 'libsysprof=true', + 'with_sysprofd=none', + 'help=false', + ], + fallback: ['sysprof', 'libsysprof_dep'], + ) endif graphene_dep_type = graphene_dep.type_name() diff --git a/tests/meson.build b/tests/meson.build index fd5fd6905d..e80044569a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -136,9 +136,9 @@ foreach t: gtk_tests dependencies: [libgtk_dep, libm]) endforeach -if get_option('profiler') +if profiler_enabled executable('testperf', 'testperf.c', - dependencies: [profiler_dep, platform_gio_dep, libm]) + dependencies: [libsysprof_dep, platform_gio_dep, libm]) endif librsvg = dependency('librsvg-2.0', version: '>= 2.46.0', required: false) diff --git a/testsuite/performance/meson.build b/testsuite/performance/meson.build index e28207686c..33313923e8 100644 --- a/testsuite/performance/meson.build +++ b/testsuite/performance/meson.build @@ -1,5 +1,7 @@ -if get_option ('profiler') - test_performance = executable('test-performance', 'test-performance.c', - c_args: common_cflags, - dependencies: [profiler_dep, platform_gio_dep, libm]) +if profiler_enabled + if libsysprof_dep.found() + test_performance = executable('test-performance', 'test-performance.c', + c_args: common_cflags, + dependencies: [libsysprof_dep, platform_gio_dep, libm]) + endif endif