From a4e1503be9b70867bc62c2bae0b6e2ffae3253d3 Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Fri, 2 Aug 2019 00:11:11 +0200 Subject: [PATCH 1/2] Adds simple meson build file. This is a very minimalist build config, just enough to build the project. --- meson.build | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 meson.build diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..50ea0048 --- /dev/null +++ b/meson.build @@ -0,0 +1,29 @@ +project( + 'libdict', + 'c', + default_options: ['c_std=c11'], + version: '0.1.0', + license: 'BSD2') + +incdir = include_directories('include', 'src') +libdict = library( + 'dict', + 'src/dict.c', + 'src/hashtable.c', + 'src/hashtable2.c', + 'src/hashtable_common.c', + 'src/hb_tree.c', + 'src/pr_tree.c', + 'src/rb_tree.c', + 'src/sp_tree.c', + 'src/tr_tree.c', + 'src/wb_tree.c', + 'src/skiplist.c', + 'src/tree_common.c', + include_directories: incdir) + +cunit = dependency('cunit') + +executable('demo', 'demo.c', link_with: libdict, include_directories: incdir) +executable('benchmark_bin', 'benchmark.c', link_with: libdict, include_directories: incdir) +executable('unit_tests', 'unit_tests.c', link_with: libdict, include_directories: incdir, dependencies: cunit) From 70dc23c38266c11899126d334dc6b57309b6c88e Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Fri, 2 Aug 2019 10:47:02 +0200 Subject: [PATCH 2/2] Adds installing instructions for meson. This will install both the static and the shared library, as well as all the headers and a pkg-config file. --- meson.build | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 50ea0048..3d0642b6 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( license: 'BSD2') incdir = include_directories('include', 'src') -libdict = library( +libdict = both_libraries( 'dict', 'src/dict.c', 'src/hashtable.c', @@ -20,10 +20,29 @@ libdict = library( 'src/wb_tree.c', 'src/skiplist.c', 'src/tree_common.c', - include_directories: incdir) + include_directories: incdir, + install: true) cunit = dependency('cunit') executable('demo', 'demo.c', link_with: libdict, include_directories: incdir) executable('benchmark_bin', 'benchmark.c', link_with: libdict, include_directories: incdir) executable('unit_tests', 'unit_tests.c', link_with: libdict, include_directories: incdir, dependencies: cunit) + +install_headers( + 'include/dict.h', + 'include/hashtable.h', + 'include/hashtable2.h', + 'include/hb_tree.h', + 'include/pr_tree.h', + 'include/rb_tree.h', + 'include/sp_tree.h', + 'include/tr_tree.h', + 'include/wb_tree.h', + 'include/skiplist.h', + subdir: 'libdict') + +pkg = import('pkgconfig') +pkg.generate( + libdict, + description: 'Data structures with efficient insert, lookup and delete routines.')