diff --git a/src/libsysprof-analyze/meson.build b/src/libsysprof-analyze/meson.build new file mode 100644 index 00000000..c63aced6 --- /dev/null +++ b/src/libsysprof-analyze/meson.build @@ -0,0 +1,45 @@ +libsysprof_analyze_public_sources = [ + 'sysprof-capture-model.c', + 'sysprof-capture-frame-object.c', +] + +libsysprof_analyze_public_headers = [ + 'sysprof-analyze.h', + 'sysprof-capture-model.h', + 'sysprof-capture-frame-object.h', +] + +libsysprof_analyze_deps = [ + dependency('gio-2.0', version: glib_req_version), + libsysprof_capture_deps, +] + +libsysprof_analyze = library('sysprof-analyze', + libsysprof_analyze_public_sources, + include_directories: [include_directories('.'), + ipc_include_dirs, + libsysprof_capture_include_dirs], + dependencies: libsysprof_analyze_deps, + gnu_symbol_visibility: 'hidden', + version: '@0@.0.0'.format(soname_major_version), + darwin_versions: '@0@.0'.format(soname_major_version), +) + +libsysprof_analyze_dep = declare_dependency( + link_with: libsysprof_analyze, + dependencies: libsysprof_analyze_deps, + include_directories: [include_directories('.'), libsysprof_capture_include_dirs], +) +meson.override_dependency('sysprof-analyze-@0@'.format(soname_major_version), libsysprof_analyze_dep) + +pkgconfig.generate(libsysprof_analyze, + subdirs: [sysprof_header_subdir], + description: 'A library for processing and analyzing Sysprof captures', + install_dir: join_paths(get_option('libdir'), 'pkgconfig'), + requires: ['gio-2.0'], + variables: ['datadir=' + datadir_for_pc_file], +) + +install_headers(libsysprof_analyze_public_headers, subdir: sysprof_header_subdir) + +subdir('tests') diff --git a/src/libsysprof-analyze/sysprof-analyze.h b/src/libsysprof-analyze/sysprof-analyze.h new file mode 100644 index 00000000..caaaccf5 --- /dev/null +++ b/src/libsysprof-analyze/sysprof-analyze.h @@ -0,0 +1,32 @@ +/* sysprof-analyze.h + * + * Copyright 2023 Christian Hergert + * + * 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 . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define SYSPROF_ANALYZE_INSIDE +# include "sysprof-capture-frame-object.h" +# include "sysprof-capture-model.h" +#undef SYSPROF_ANALYZE_INSIDE + +G_END_DECLS diff --git a/src/libsysprof/sysprof-capture-frame-object-private.h b/src/libsysprof-analyze/sysprof-capture-frame-object-private.h similarity index 100% rename from src/libsysprof/sysprof-capture-frame-object-private.h rename to src/libsysprof-analyze/sysprof-capture-frame-object-private.h diff --git a/src/libsysprof/sysprof-capture-frame-object.c b/src/libsysprof-analyze/sysprof-capture-frame-object.c similarity index 100% rename from src/libsysprof/sysprof-capture-frame-object.c rename to src/libsysprof-analyze/sysprof-capture-frame-object.c diff --git a/src/libsysprof/sysprof-capture-frame-object.h b/src/libsysprof-analyze/sysprof-capture-frame-object.h similarity index 100% rename from src/libsysprof/sysprof-capture-frame-object.h rename to src/libsysprof-analyze/sysprof-capture-frame-object.h diff --git a/src/libsysprof/sysprof-capture-model.c b/src/libsysprof-analyze/sysprof-capture-model.c similarity index 100% rename from src/libsysprof/sysprof-capture-model.c rename to src/libsysprof-analyze/sysprof-capture-model.c diff --git a/src/libsysprof/sysprof-capture-model.h b/src/libsysprof-analyze/sysprof-capture-model.h similarity index 100% rename from src/libsysprof/sysprof-capture-model.h rename to src/libsysprof-analyze/sysprof-capture-model.h diff --git a/src/libsysprof-analyze/tests/meson.build b/src/libsysprof-analyze/tests/meson.build new file mode 100644 index 00000000..d54c296a --- /dev/null +++ b/src/libsysprof-analyze/tests/meson.build @@ -0,0 +1,31 @@ +libsysprof_analyze_test_env = [ + 'G_DEBUG=gc-friendly', + 'GSETTINGS_BACKEND=memory', + 'MALLOC_CHECK_=2', +] + +libsysprof_analyze_testsuite_c_args = [ + '-DG_LOG_DOMAIN="libdex"', + '-DG_ENABLE_DEBUG', + '-UG_DISABLE_ASSERT', + '-UG_DISABLE_CAST_CHECKS', +] + +libsysprof_analyze_testsuite = { + 'test-capture-model': {'skip': true}, +} + +libsysprof_analyze_testsuite_deps = [ + libsysprof_analyze_dep, + libsysprof_capture_dep, +] + +foreach test, params: libsysprof_analyze_testsuite + test_exe = executable(test, '@0@.c'.format(test), + c_args: libsysprof_analyze_testsuite_c_args, + dependencies: libsysprof_analyze_testsuite_deps, + ) + if not params.get('skip', false) + test(test, test_exe, env: libsysprof_analyze_test_env) + endif +endforeach diff --git a/src/tests/test-capture-model.c b/src/libsysprof-analyze/tests/test-capture-model.c similarity index 97% rename from src/tests/test-capture-model.c rename to src/libsysprof-analyze/tests/test-capture-model.c index aca52f0b..3e4b1976 100644 --- a/src/tests/test-capture-model.c +++ b/src/libsysprof-analyze/tests/test-capture-model.c @@ -1,7 +1,6 @@ #include #include - -#include +#include int main (int argc, diff --git a/src/libsysprof/meson.build b/src/libsysprof/meson.build index 42c5f0af..a730ef11 100644 --- a/src/libsysprof/meson.build +++ b/src/libsysprof/meson.build @@ -3,9 +3,7 @@ libsysprof_c_args = [ '-DSYSPROF_COMPILATION' ] libsysprof_public_sources = [ 'sysprof-battery-source.c', 'sysprof-callgraph-profile.c', - 'sysprof-capture-frame-object.c', 'sysprof-capture-gobject.c', - 'sysprof-capture-model.c', 'sysprof-capture-symbol-resolver.c', 'sysprof-control-source.c', 'sysprof-diskstat-source.c', @@ -38,9 +36,7 @@ libsysprof_public_headers = [ 'sysprof-battery-source.h', 'sysprof-callgraph-profile.h', 'sysprof-capture-autocleanups.h', - 'sysprof-capture-frame-object.h', 'sysprof-capture-gobject.h', - 'sysprof-capture-model.h', 'sysprof-capture-symbol-resolver.h', 'sysprof-control-source.h', 'sysprof-diskstat-source.h', diff --git a/src/libsysprof/sysprof.h b/src/libsysprof/sysprof.h index ac96871b..5abe64b6 100644 --- a/src/libsysprof/sysprof.h +++ b/src/libsysprof/sysprof.h @@ -28,9 +28,7 @@ G_BEGIN_DECLS # include "sysprof-battery-source.h" # include "sysprof-callgraph-profile.h" # include "sysprof-capture-autocleanups.h" -# include "sysprof-capture-frame-object.h" # include "sysprof-capture-gobject.h" -# include "sysprof-capture-model.h" # include "sysprof-capture-symbol-resolver.h" # include "sysprof-control-source.h" # include "sysprof-diskstat-source.h" diff --git a/src/meson.build b/src/meson.build index 9d8817eb..a74f2754 100644 --- a/src/meson.build +++ b/src/meson.build @@ -55,6 +55,8 @@ stackstash_sources = files('stackstash.c') helpers_sources = files('helpers.c') subdir('libsysprof-capture') +subdir('libsysprof-analyze') + if get_option('sysprofd') == 'bundled' subdir('sysprofd') endif diff --git a/src/tests/meson.build b/src/tests/meson.build index 2dbc717b..611ff260 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -56,11 +56,6 @@ if get_option('libsysprof') dependencies: test_deps, ) - test_capture_model = executable('test-capture-model', 'test-capture-model.c', - c_args: test_cflags, - dependencies: test_deps, - ) - test_mountinfo = executable('test-mountinfo', 'test-mountinfo.c', c_args: test_cflags, dependencies: test_deps,