Skip to content

Commit

Permalink
integrate external libraries as subproject
Browse files Browse the repository at this point in the history
Instead of inlining external libraries it is
benefictial to dynamically integrate them to
get the latest bugfixes etc.
Meson provides the features subproject() and
a wrap dependency system. Using these the
currently used libraries inih and hashmap.c
can be dynamically integrated to a specific
revision of the project - replacing the
inlined library code.

Signed-off-by: Michael Engel <[email protected]>
  • Loading branch information
engelmi committed Aug 4, 2023
1 parent 580792e commit babdc1e
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 1,647 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ builddir/
hirte.spec
rpmbuild/
artifacts/
subprojects/inih/
subprojects/hashmap.c/
## python build artifacts
build/
dist/
Expand Down
7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ config_h = configure_file(
add_project_arguments('-include', 'config.h', language : 'c')


# (External) subprojects used by hirte
inih = subproject('inih', default_options: ['default_library=static'])
inih_dep = inih.get_variable('inih_dep')

hashmapc = subproject('hashmap.c', default_options: ['default_library=static', 'werror=false'])
hashmapc_dep = hashmapc.get_variable('hashmapc_dep')

# Subdirectory for the shared library.
subdir('src/libhirte')

Expand Down
3 changes: 2 additions & 1 deletion src/agent/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <stdbool.h>
#include <sys/socket.h>

#include <hashmap.h>

#include "libhirte/common/cfg.h"
#include "libhirte/common/common.h"
#include "libhirte/hashmap/hashmap.h"

#include "types.h"

Expand Down
2 changes: 2 additions & 0 deletions src/agent/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ executable(
node_src,
dependencies: [
systemd_dep,
inih_dep,
hashmapc_dep,
],
link_with: [
hirte_lib,
Expand Down
5 changes: 3 additions & 2 deletions src/libhirte/common/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
#include <string.h>
#include <unistd.h>

#include <hashmap.h>

#include "ini.h"
#include "libhirte/common/list.h"
#include "libhirte/common/network.h"
#include "libhirte/hashmap/hashmap.h"
#include "libhirte/ini/ini.h"

#include "cfg.h"
#include "common.h"
Expand Down
20 changes: 0 additions & 20 deletions src/libhirte/hashmap/LICENSE

This file was deleted.

Loading

0 comments on commit babdc1e

Please sign in to comment.