[sysprof] build: add libsysprof-capture-2 static library



commit 469d54df5b4b067bbf84efeb7a67c578585b225f
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 20 01:30:39 2018 -0800

    build: add libsysprof-capture-2 static library
    
    This allows external tooling to write capture files that Sysprof can open.
    Ideally, this will get used by GJS in the near future to implement profiler
    output for Sysprof.

 lib/capture/meson.build |    2 ++
 lib/meson.build         |   26 ++++++++++++++++++++++++--
 lib/sysprof-capture.h   |   42 ++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build       |    2 +-
 tools/meson.build       |    2 +-
 tools/sysprof-dump.c    |    2 +-
 6 files changed, 71 insertions(+), 5 deletions(-)
---
diff --git a/lib/capture/meson.build b/lib/capture/meson.build
index fa75fed..7af1973 100644
--- a/lib/capture/meson.build
+++ b/lib/capture/meson.build
@@ -16,5 +16,7 @@ capture_sources = [
 libsysprof_headers += files(capture_headers)
 libsysprof_sources += files(capture_sources)
 
+libsysprof_capture_sources += files(capture_sources)
+
 install_headers(capture_headers,
   subdir: join_paths(libsysprof_header_subdir, 'capture'))
diff --git a/lib/meson.build b/lib/meson.build
index 2cff01b..d02d9f3 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -24,22 +24,27 @@ configure_file(
 
 libsysprof_base_headers = [
   'sysprof.h',
+  'sysprof-capture.h',
   'sp-address.h',
   'sp-clock.h',
   'sp-error.h',
 ]
 
-libsysprof_headers = libsysprof_base_headers
-libsysprof_sources = [
+libsysprof_base_sources = [
   'sp-address.c',
   'sp-clock.c',
   'sp-error.c',
 ]
 
+libsysprof_headers = libsysprof_base_headers
+libsysprof_sources = libsysprof_base_sources
+
 libsysprof_ui_base_headers = ['sysprof-ui.h']
 libsysprof_ui_headers = libsysprof_ui_base_headers
 libsysprof_ui_sources = []
 
+libsysprof_capture_sources = libsysprof_base_sources
+
 subdir('callgraph')
 subdir('capture')
 subdir('profiler')
@@ -51,6 +56,10 @@ subdir('widgets')
 
 cxx = meson.get_compiler('cpp')
 
+libsysprof_capture_deps = [
+  dependency('gobject-2.0'),
+]
+
 libsysprof_deps = [
   cxx.find_library('stdc++'),
   dependency('gio-unix-2.0'),
@@ -64,6 +73,13 @@ if get_option('with_sysprofd') != 'none'
   libsysprof_c_args += '-DENABLE_POLKIT'
 endif
 
+libsysprof_capture = static_library('sysprof-capture-' + libsysprof_api_version,
+  libsysprof_capture_sources,
+  dependencies: libsysprof_capture_deps,
+        c_args: libsysprof_c_args,
+       install: true,
+)
+
 libsysprof = shared_library('sysprof-' + libsysprof_api_version,
   libsysprof_sources,
   dependencies: libsysprof_deps,
@@ -79,6 +95,12 @@ libsysprof_dep = declare_dependency(
   dependencies: libsysprof_deps,
 )
 
+libsysprof_capture_dep = declare_dependency(
+  include_directories: include_directories('.'),
+     link_with: libsysprof_capture,
+  dependencies: libsysprof_capture_deps,
+)
+
 install_headers(libsysprof_base_headers, subdir: libsysprof_header_subdir)
 
 if get_option('enable_gtk')
diff --git a/lib/sysprof-capture.h b/lib/sysprof-capture.h
new file mode 100644
index 0000000..859f96b
--- /dev/null
+++ b/lib/sysprof-capture.h
@@ -0,0 +1,42 @@
+/* sysprof-capture.h
+ *
+ * Copyright © 2018 Christian Hergert <chergert redhat com>
+ *
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This file 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 Lesser 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/>.
+ */
+
+#ifndef SYSPROF_CAPTURE_H
+#define SYSPROF_CAPTURE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define SYSPROF_INSIDE
+
+# include "sp-address.h"
+# include "sp-clock.h"
+# include "sp-error.h"
+# include "sysprof-version.h"
+
+# include "capture/sp-capture-condition.h"
+# include "capture/sp-capture-cursor.h"
+# include "capture/sp-capture-reader.h"
+# include "capture/sp-capture-writer.h"
+
+#undef SYSPROF_INSIDE
+
+G_END_DECLS
+
+#endif /* SYSPROF_CAPTURE_H */
diff --git a/tests/meson.build b/tests/meson.build
index 398d8c7..3b87418 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,7 +8,7 @@ test_env = [
 
 test_capture = executable('test-capture',
   'test-capture.c',
-  dependencies: libsysprof_dep,
+  dependencies: libsysprof_capture_dep,
 )
 test('test-capture', test_capture, env: test_env)
 
diff --git a/tools/meson.build b/tools/meson.build
index f790046..b0b17b5 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -8,7 +8,7 @@ sysprof_cli = executable('sysprof-cli',
 
 sysprof_dump = executable('sysprof-dump',
   'sysprof-dump.c',
-  dependencies: libsysprof_dep,
+  dependencies: libsysprof_capture_dep,
   c_args: exe_c_args,
   link_args: exe_link_args,
 )
diff --git a/tools/sysprof-dump.c b/tools/sysprof-dump.c
index cf110a2..2fdb435 100644
--- a/tools/sysprof-dump.c
+++ b/tools/sysprof-dump.c
@@ -18,7 +18,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sysprof.h>
+#include <sysprof-capture.h>
 
 #define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]