build: rework dependency handling

Rather than relying on git-submodules, use the built-in dependency
handling of meson. Meson wrap-files allow to integrate versioned
dependencies.

Adjust the entire build system to use the new features.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
main
David Rheinsberg 2022-04-13 12:26:37 +02:00
parent f9dd3852b8
commit e98d4ed5a8
4 changed files with 13 additions and 8 deletions

View File

@ -22,7 +22,7 @@ The requirements for this project are:
At build-time, the following software is required:
* `meson >= 0.41`
* `meson >= 0.60`
* `pkg-config >= 0.29`
### Build

View File

@ -1,19 +1,21 @@
project(
'c-rbtree',
'c',
version: '3',
license: 'Apache',
default_options: [
'c_std=c11'
],
license: 'Apache',
version: '3.0.0',
)
major = meson.project_version().split('.')[0]
project_description = 'Intrusive Red-Black Tree Collection'
add_project_arguments('-D_GNU_SOURCE', language: 'c')
mod_pkgconfig = import('pkgconfig')
sub_cstdaux = subproject('c-stdaux')
dep_cstdaux = sub_cstdaux.get_variable('libcstdaux_dep')
dep_cstdaux = dependency('libcstdaux-1')
add_project_arguments(dep_cstdaux.get_variable('cflags').split(' '), language: 'c')
subdir('src')
meson.override_dependency('libcrbtree-'+major, libcrbtree_dep, static: true)

View File

@ -9,7 +9,7 @@ libcrbtree_deps = [
]
libcrbtree_both = both_libraries(
'crbtree',
'crbtree-'+major,
[
'c-rbtree.c',
],
@ -39,7 +39,7 @@ if not meson.is_subproject()
mod_pkgconfig.generate(
description: project_description,
filebase: 'libcrbtree',
filebase: 'libcrbtree-'+major,
libraries: libcrbtree_both.get_shared_lib(),
name: 'libcrbtree',
version: meson.project_version(),

View File

@ -0,0 +1,3 @@
[wrap-git]
url = https://github.com/c-util/c-stdaux.git
revision = v1