mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
capture: avoid GObject in libsysprof-capture-2.a
The point of this file was to be easily usable by applications that want to generate capture files (or proxy them). The intention here is that we only have SpCaptureReader/SpCaptureWriter (and associated bits necessary to support that). This makes sure that we do not use GObject from the libsysprof-capture-2.a while still having GType's in the libsysprof-2.so dynamic library. We also invert the GObject macro check so that the default is to not register a GType which increases the chances that copy/paste code does not run into double-registering a GType if used with an application that links against libsysprof-2. (One such example could be if Gtk uses this code for timers, as it would break Sysprof itself).
This commit is contained in:
@ -13,10 +13,15 @@ capture_sources = [
|
|||||||
'sp-capture-writer.c',
|
'sp-capture-writer.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
static_capture_sources = [
|
||||||
|
'sp-capture-reader.c',
|
||||||
|
'sp-capture-writer.c',
|
||||||
|
]
|
||||||
|
|
||||||
libsysprof_headers += files(capture_headers)
|
libsysprof_headers += files(capture_headers)
|
||||||
libsysprof_sources += files(capture_sources)
|
libsysprof_sources += files(capture_sources)
|
||||||
|
|
||||||
libsysprof_capture_sources += files(capture_sources)
|
libsysprof_capture_sources += files(static_capture_sources)
|
||||||
|
|
||||||
install_headers(capture_headers,
|
install_headers(capture_headers,
|
||||||
subdir: join_paths(libsysprof_header_subdir, 'capture'))
|
subdir: join_paths(libsysprof_header_subdir, 'capture'))
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
#ifndef SP_CAPTURE_CONDITION_H
|
#ifndef SP_CAPTURE_CONDITION_H
|
||||||
#define SP_CAPTURE_CONDITION_H
|
#define SP_CAPTURE_CONDITION_H
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "capture/sp-capture-types.h"
|
#include "capture/sp-capture-types.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|||||||
@ -42,7 +42,7 @@ struct _SpCaptureReader
|
|||||||
gint64 end_time;
|
gint64 end_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef SP_DISABLE_GOBJECT
|
#ifdef SP_ENABLE_GOBJECT
|
||||||
G_DEFINE_BOXED_TYPE (SpCaptureReader, sp_capture_reader,
|
G_DEFINE_BOXED_TYPE (SpCaptureReader, sp_capture_reader,
|
||||||
sp_capture_reader_ref, sp_capture_reader_unref)
|
sp_capture_reader_ref, sp_capture_reader_unref)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -59,7 +59,7 @@ gboolean sp_capture_reader_save_as (SpCapt
|
|||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
#ifndef SP_DISABLE_GOBJECT
|
#ifdef SP_ENABLE_GOBJECT
|
||||||
# define SP_TYPE_CAPTURE_READER (sp_capture_reader_get_type())
|
# define SP_TYPE_CAPTURE_READER (sp_capture_reader_get_type())
|
||||||
GType sp_capture_reader_get_type (void);
|
GType sp_capture_reader_get_type (void);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifndef SP_DISABLE_GOBJECT
|
#ifdef SP_ENABLE_GOBJECT
|
||||||
# include <glib-object.h>
|
# include <glib-object.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ struct _SpCaptureWriter
|
|||||||
SpCaptureStat stat;
|
SpCaptureStat stat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef SP_DISABLE_GOBJECT
|
#ifdef SP_ENABLE_GOBJECT
|
||||||
G_DEFINE_BOXED_TYPE (SpCaptureWriter, sp_capture_writer,
|
G_DEFINE_BOXED_TYPE (SpCaptureWriter, sp_capture_writer,
|
||||||
sp_capture_writer_ref, sp_capture_writer_unref)
|
sp_capture_writer_ref, sp_capture_writer_unref)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -120,7 +120,7 @@ gboolean _sp_capture_writer_set_time_range (SpCaptureWriter *
|
|||||||
gint64 start_time,
|
gint64 start_time,
|
||||||
gint64 end_time) G_GNUC_INTERNAL;
|
gint64 end_time) G_GNUC_INTERNAL;
|
||||||
|
|
||||||
#ifndef SP_DISABLE_GOBJECT
|
#ifdef SP_ENABLE_GOBJECT
|
||||||
# define SP_TYPE_CAPTURE_WRITER (sp_capture_writer_get_type())
|
# define SP_TYPE_CAPTURE_WRITER (sp_capture_writer_get_type())
|
||||||
GType sp_capture_writer_get_type (void);
|
GType sp_capture_writer_get_type (void);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -59,7 +59,7 @@ subdir('widgets')
|
|||||||
cxx = meson.get_compiler('cpp')
|
cxx = meson.get_compiler('cpp')
|
||||||
|
|
||||||
libsysprof_capture_deps = [
|
libsysprof_capture_deps = [
|
||||||
dependency('gobject-2.0'),
|
dependency('glib-2.0'),
|
||||||
]
|
]
|
||||||
|
|
||||||
libsysprof_deps = [
|
libsysprof_deps = [
|
||||||
@ -68,7 +68,7 @@ libsysprof_deps = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
version_link_arg = '-Wl,--version-script,' + join_paths(meson.current_source_dir(), 'sysprof.map')
|
version_link_arg = '-Wl,--version-script,' + join_paths(meson.current_source_dir(), 'sysprof.map')
|
||||||
libsysprof_c_args = []
|
libsysprof_c_args = [ '-DSP_ENABLE_GOBJECT' ]
|
||||||
|
|
||||||
if get_option('with_sysprofd') != 'none'
|
if get_option('with_sysprofd') != 'none'
|
||||||
libsysprof_deps += dependency('polkit-gobject-1')
|
libsysprof_deps += dependency('polkit-gobject-1')
|
||||||
@ -78,7 +78,6 @@ endif
|
|||||||
libsysprof_capture = static_library('sysprof-capture-' + libsysprof_api_version,
|
libsysprof_capture = static_library('sysprof-capture-' + libsysprof_api_version,
|
||||||
libsysprof_capture_sources,
|
libsysprof_capture_sources,
|
||||||
dependencies: libsysprof_capture_deps,
|
dependencies: libsysprof_capture_deps,
|
||||||
c_args: libsysprof_c_args,
|
|
||||||
install: true,
|
install: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -93,14 +92,14 @@ libsysprof = shared_library('sysprof-' + libsysprof_api_version,
|
|||||||
|
|
||||||
libsysprof_dep = declare_dependency(
|
libsysprof_dep = declare_dependency(
|
||||||
include_directories: include_directories('.'),
|
include_directories: include_directories('.'),
|
||||||
link_with: libsysprof,
|
link_with: libsysprof,
|
||||||
dependencies: libsysprof_deps,
|
dependencies: libsysprof_deps,
|
||||||
)
|
)
|
||||||
|
|
||||||
libsysprof_capture_dep = declare_dependency(
|
libsysprof_capture_dep = declare_dependency(
|
||||||
include_directories: include_directories('.'),
|
include_directories: include_directories('.'),
|
||||||
link_with: libsysprof_capture,
|
link_with: libsysprof_capture,
|
||||||
dependencies: libsysprof_capture_deps,
|
dependencies: libsysprof_capture_deps,
|
||||||
)
|
)
|
||||||
|
|
||||||
install_headers(libsysprof_base_headers, subdir: libsysprof_header_subdir)
|
install_headers(libsysprof_base_headers, subdir: libsysprof_header_subdir)
|
||||||
@ -121,9 +120,12 @@ if get_option('enable_gtk')
|
|||||||
dependency('gtk+-3.0', version: '>=3.22.0'),
|
dependency('gtk+-3.0', version: '>=3.22.0'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
libsysprof_ui_c_args = [ '-DSP_ENABLE_GOBJECT' ]
|
||||||
|
|
||||||
libsysprof_ui = shared_library('sysprof-ui-' + libsysprof_api_version,
|
libsysprof_ui = shared_library('sysprof-ui-' + libsysprof_api_version,
|
||||||
libsysprof_ui_resources + libsysprof_ui_sources,
|
libsysprof_ui_resources + libsysprof_ui_sources,
|
||||||
dependencies: libsysprof_ui_deps,
|
dependencies: libsysprof_ui_deps,
|
||||||
|
c_args: libsysprof_ui_c_args,
|
||||||
link_args: version_link_arg,
|
link_args: version_link_arg,
|
||||||
link_depends: 'sysprof.map',
|
link_depends: 'sysprof.map',
|
||||||
install: true,
|
install: true,
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#ifndef SYSPROF_CAPTURE_H
|
#ifndef SYSPROF_CAPTURE_H
|
||||||
#define SYSPROF_CAPTURE_H
|
#define SYSPROF_CAPTURE_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -30,8 +30,6 @@ G_BEGIN_DECLS
|
|||||||
# include "sp-error.h"
|
# include "sp-error.h"
|
||||||
# include "sysprof-version.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-reader.h"
|
||||||
# include "capture/sp-capture-writer.h"
|
# include "capture/sp-capture-writer.h"
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define SYSPROF_INSIDE
|
#define SYSPROF_INSIDE
|
||||||
|
#define SP_ENABLE_GOBJECT
|
||||||
|
|
||||||
# include "sp-address.h"
|
# include "sp-address.h"
|
||||||
# include "sp-clock.h"
|
# include "sp-clock.h"
|
||||||
@ -57,6 +58,7 @@ G_BEGIN_DECLS
|
|||||||
# include "util/sp-map-lookaside.h"
|
# include "util/sp-map-lookaside.h"
|
||||||
# include "util/sp-selection.h"
|
# include "util/sp-selection.h"
|
||||||
|
|
||||||
|
#undef SP_ENABLE_GOBJECT
|
||||||
#undef SYSPROF_INSIDE
|
#undef SYSPROF_INSIDE
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
sysprof_cli = executable('sysprof-cli',
|
sysprof_cli = executable('sysprof-cli',
|
||||||
'sysprof-cli.c',
|
'sysprof-cli.c',
|
||||||
dependencies: libsysprof_dep,
|
dependencies: libsysprof_dep,
|
||||||
c_args: exe_c_args,
|
c_args: exe_c_args,
|
||||||
link_args: exe_link_args,
|
link_args: exe_link_args,
|
||||||
install: true,
|
install: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
|
sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
|
||||||
@ -15,6 +15,6 @@ sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
|
|||||||
sysprof_dump = executable('sysprof-dump',
|
sysprof_dump = executable('sysprof-dump',
|
||||||
'sysprof-dump.c',
|
'sysprof-dump.c',
|
||||||
dependencies: libsysprof_capture_dep,
|
dependencies: libsysprof_capture_dep,
|
||||||
c_args: exe_c_args,
|
c_args: exe_c_args,
|
||||||
link_args: exe_link_args,
|
link_args: exe_link_args,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user