Alterative sysprof build support

Don't link libgtk against libsysprof. We only
need that for the test-performance binary.
This commit is contained in:
Matthias Clasen 2020-08-21 18:28:29 -04:00
parent 5a5b30681e
commit 81e88c1d9e
4 changed files with 38 additions and 37 deletions

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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