[gnome-photos/wip/rishi/buffer-decoder: 3/13] build: Split some code into a private shared library
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/buffer-decoder: 3/13] build: Split some code into a private shared library
- Date: Tue, 2 Oct 2018 15:20:29 +0000 (UTC)
commit 522f91dbe288aed5427fe8932d902ca57330e1d0
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Sep 25 09:21:23 2018 +0200
build: Split some code into a private shared library
The overall idea is to start adding unit tests, wherever possible.
Putting the tested code in a private library makes it accessible from
test cases because they can link to it.
Subsequent commits will add a new codec API for GeglBuffer. It will be
very important to have unit tests for those code paths because:
* That code will be inherently testable and tests are great.
* That code is likely to be security sensitive, will handle all
sorts of dodgy input from untrusted sources, and written using
very old APIs with brittle error handling.
This is a step towards that.
A private shared library seems better than a private static archive
because the most easily testable code paths are shared across the main
application and the thumbnailer. Therefore, the assumption is that the
benefits of sharing that code across both processes outweigh the
drawbacks of having to resolve yet another shared library on startup.
However, this is just an assumption. There's no data behind it.
https://gitlab.gnome.org/GNOME/gnome-photos/issues/63
meson.build | 1 +
src/meson.build | 27 +++++++++++++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 3ff4f6aa..d838a8ec 100644
--- a/meson.build
+++ b/meson.build
@@ -13,6 +13,7 @@ photos_libexecdir = join_paths(photos_prefix, get_option('libexecdir'))
photos_localedir = join_paths(photos_prefix, get_option('localedir'))
photos_docdir = join_paths(photos_datadir, 'doc', meson.project_name())
+photos_libdir = join_paths(photos_prefix, get_option('libdir'), meson.project_name())
photos_installed_test_metadir = join_paths(photos_datadir, 'installed-tests', meson.project_name())
photos_installed_test_execdir = join_paths(photos_libexecdir, 'installed-tests', meson.project_name())
diff --git a/src/meson.build b/src/meson.build
index 7b8c7290..0b4c3d92 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,26 @@
-common_sources = files(
+sources = files(
'photos-debug.c',
+ 'photos-quarks.c',
+)
+
+deps = [
+ glib_dep,
+]
+
+libgnome_photos = shared_library(
+ meson.project_name(),
+ sources,
+ dependencies: deps,
+ include_directories: top_inc,
+ install: true,
+ install_dir: photos_libdir,
+)
+
+libgnome_photos_dep = declare_dependency(
+ link_with: libgnome_photos,
+)
+
+common_sources = files(
'photos-error.c',
'photos-gegl.c',
'photos-glib.c',
@@ -15,7 +36,6 @@ common_sources = files(
'photos-operation-svg-multiply.c',
'photos-pipeline.c',
'photos-png-count.c',
- 'photos-quarks.c',
)
enum_headers = files(
@@ -65,6 +85,7 @@ common_deps = [
glib_dep,
goa_dep,
libdazzle_dep,
+ libgnome_photos_dep,
libjpeg_dep,
libpng_dep,
m_dep,
@@ -375,6 +396,7 @@ executable(
c_args: cflags,
install: true,
install_dir: photos_bindir,
+ install_rpath: photos_libdir,
)
sources = common_sources + files(
@@ -391,4 +413,5 @@ executable(
c_args: cflags,
install: true,
install_dir: photos_libexecdir,
+ install_rpath: photos_libdir,
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]