libsysprof-profile: stub out libsysprof-profile library

This does the same thing as we did for libsysprof-analyze, but to contain
the profiler bits that will be used from applications/etc.
This commit is contained in:
Christian Hergert
2023-05-25 15:43:53 -07:00
parent a4b5ea6160
commit 24b876f437
5 changed files with 105 additions and 2 deletions

View File

@ -41,6 +41,11 @@ need_glib = (need_gtk or
get_option('sysprofd') != 'none' or
get_option('agent'))
# Determine what libraries to build
need_libsysprof_capture = true
need_libsysprof_profile = get_option('libsysprof') or get_option('agent')
need_libsysprof_analyze = get_option('libsysprof') or get_option('agent')
glib_req = '2.76.0'
gtk_req = '4.10'
polkit_req = '0.105'

View File

@ -0,0 +1,61 @@
libsysprof_profile_public_sources = [
]
libsysprof_profile_private_sources = [
]
libsysprof_profile_public_headers = [
'sysprof-profile.h',
]
libsysprof_profile_deps = [
dependency('gio-2.0', version: glib_req_version),
libsysprof_capture_dep,
]
libsysprof_profile_static = static_library(
'sysprof-profile-@0@'.format(soname_major_version),
libsysprof_profile_public_sources +
libsysprof_profile_private_sources,
include_directories: [include_directories('.'),
ipc_include_dirs,
libsysprof_capture_include_dirs],
dependencies: libsysprof_profile_deps,
gnu_symbol_visibility: 'hidden',
)
libsysprof_profile_static_dep = declare_dependency(
link_with: libsysprof_profile_static,
dependencies: libsysprof_profile_deps,
include_directories: [include_directories('.'),
libsysprof_capture_include_dirs],
)
libsysprof_profile = library('sysprof-profile-@0@'.format(soname_major_version),
dependencies: [libsysprof_profile_static_dep],
gnu_symbol_visibility: 'hidden',
version: '@0@.0.0'.format(soname_major_version),
darwin_versions: '@0@.0'.format(soname_major_version),
install: true,
)
libsysprof_profile_dep = declare_dependency(
link_with: libsysprof_profile,
dependencies: libsysprof_profile_deps,
include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
)
meson.override_dependency('sysprof-profile-@0@'.format(soname_major_version), libsysprof_profile_dep)
pkgconfig.generate(libsysprof_profile,
subdirs: [sysprof_header_subdir],
description: 'A library for recording profiles using various instruments',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
requires: ['gio-2.0'],
variables: ['datadir=' + datadir_for_pc_file],
)
install_headers(libsysprof_profile_public_headers, subdir: sysprof_header_subdir)
subdir('tests')

View File

@ -0,0 +1,28 @@
/* sysprof-profile.h
*
* Copyright 2023 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
G_BEGIN_DECLS
#define SYSPROF_PROFILE_INSIDE
#undef SYSPROF_PROFILE_INSIDE
G_END_DECLS

View File

View File

@ -54,8 +54,17 @@ stackstash_sources = files('stackstash.c')
helpers_sources = files('helpers.c')
subdir('libsysprof-capture')
subdir('libsysprof-analyze')
if need_libsysprof_capture
subdir('libsysprof-capture')
endif
if need_libsysprof_analyze
subdir('libsysprof-analyze')
endif
if need_libsysprof_profile
subdir('libsysprof-profile')
endif
if get_option('sysprofd') == 'bundled'
subdir('sysprofd')