diff options
author | Iñigo MartÃnez <inigomartinez@gmail.com> | 2018-01-07 15:39:42 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-01-10 12:20:17 +0100 |
commit | 5e16bcf268b0a88764c06ecdb0d694cff560d201 (patch) | |
tree | 53adb3607e52fc64e0fbaa821c145f00ad6a8dbd | |
parent | 96658d2fd11410b01d11ace62a89899dd7958ee4 (diff) | |
download | NetworkManager-5e16bcf268b0a88764c06ecdb0d694cff560d201.tar.gz |
meson: Improve dependency system
Some targets are missing dependencies on some generated sources in
the meson port. These makes the build to fail due to missing source
files on a highly parallelized build.
These dependencies have been resolved by taking advantage of meson's
internal dependencies which can be used to pass source files,
include directories, libraries and compiler flags.
One of such internal dependencies called `core_dep` was already in
use. However, in order to avoid any confusion with another new
internal dependency called `nm_core_dep`, which is used to include
directories and source files from the `libnm-core` directory, the
`core_dep` dependency has been renamed to `nm_dep`.
These changes have allowed minimizing the build details which are
inherited by using those dependencies. The parallelized build has
also been improved.
45 files changed, 193 insertions, 320 deletions
diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 3eaf04b8b0..e03b127872 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -16,23 +16,17 @@ sources = files( 'utils.c' ) -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ - glib_dep, libnm_dep, - libnmc_dep, libnmc_base_dep, + libnmc_dep, + nm_core_dep, readline_dep ] cflags = clients_cflags + [ '-DG_LOG_DOMAIN="nmcli"', - '-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir), + '-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir) ] ldflags = [] @@ -48,8 +42,7 @@ endif executable( 'nmcli', - sources + [libnm_core_enum[1]], - include_directories: incs, + sources, dependencies: deps, c_args: cflags, link_args: ldflags, diff --git a/clients/common/meson.build b/clients/common/meson.build index 44ddfaf9c9..46489f4140 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -2,15 +2,9 @@ common_inc = include_directories('.') nm_polkit_listener = files('nm-polkit-listener.c') -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ - glib_dep, - libnm_dep + libnm_dep, + nm_core_dep ] cflags = clients_cflags + [ @@ -25,15 +19,14 @@ sources = shared_utils + files( libnmc_base = static_library( 'nmc-base', - sources: sources + [libnm_core_enum[1]], - include_directories: incs, + sources: sources, dependencies: deps, - c_args: cflags, + c_args: cflags ) libnmc_base_dep = declare_dependency( - link_with: libnmc_base, - include_directories: common_inc + include_directories: common_inc, + link_with: libnmc_base ) sources = shared_meta_setting + files( @@ -71,8 +64,7 @@ sources += settings_docs_source libnmc = static_library( 'nmc', - sources: sources + [libnm_core_enum[1]], - include_directories: incs, + sources: sources, dependencies: deps, c_args: cflags, link_with: libnmc_base, @@ -80,8 +72,8 @@ libnmc = static_library( ) libnmc_dep = declare_dependency( - link_with: libnmc, - include_directories: common_inc + include_directories: common_inc, + link_with: libnmc ) if (enable_introspection or enable_nmtui) and enable_tests diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 27bf8d6def..b7784e7154 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -1,14 +1,15 @@ test_unit = 'test-general' -deps += [ +deps = [ + libnm_dep, libnmc_dep, - libnmc_base_dep + libnmc_base_dep, + nm_core_dep ] exe = executable( 'clients-' + test_unit, test_unit + '.c', - include_directories: incs, dependencies: deps, c_args: clients_cflags + [ '-DNETWORKMANAGER_COMPILATION_TEST', diff --git a/clients/meson.build b/clients/meson.build index c5c8fd99f7..f5e9c0eab2 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -1,14 +1,8 @@ name = 'nm-online' -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ - glib_dep, - libnm_dep + libnm_dep, + nm_core_dep ] clients_cflags = [ @@ -27,8 +21,7 @@ endif executable( name, - [name + '.c', libnm_core_enum[1]], - include_directories: incs, + name + '.c', dependencies: deps, c_args: cflags, link_args: ldflags, diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 1b0702ad81..fc1ce3462e 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,18 +1,11 @@ -incs = [ - top_inc, - shared_inc, - libnm_core_inc, - libnm_inc, -] - deps = [ - glib_dep, - newt_dep + newt_dep, + nm_core_dep ] cflags = clients_cflags + [ '-DG_LOG_DOMAIN="nmtui"', - '-DLOCALEDIR="@0@"'.format(nm_localedir), + '-DLOCALEDIR="@0@"'.format(nm_localedir) ] subdir('newt') @@ -73,8 +66,7 @@ endif executable( 'nmtui', - sources + [libnm_core_enum[1]], - include_directories: incs, + sources, dependencies: deps, c_args: cflags, link_args: ldflags, diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index ec14f1264d..aeec39dad0 100644 --- a/clients/tui/newt/meson.build +++ b/clients/tui/newt/meson.build @@ -23,13 +23,13 @@ sources = files( libnmt_newt = static_library( 'nmt-newt', - sources: sources + [libnm_core_enum[1]], - include_directories: incs, + sources: sources + [libnm_enum[1]], + include_directories: libnm_inc, dependencies: deps, c_args: cflags ) libnmt_newt_dep = declare_dependency( - link_with: libnmt_newt, - include_directories: include_directories('.') + include_directories: include_directories('.'), + link_with: libnmt_newt ) diff --git a/dispatcher/meson.build b/dispatcher/meson.build index 03e8d4e92f..c72175bdb7 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -25,15 +25,9 @@ install_data( sources = files('nm-dispatcher-utils.c') -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ - glib_dep, - libnm_dep + libnm_dep, + nm_core_dep ] cflags = [ @@ -47,7 +41,6 @@ cflags = [ libnm_dispatcher_core = static_library( name + '-core', sources: sources, - include_directories: incs, dependencies: deps, c_args: cflags ) @@ -69,7 +62,6 @@ endif executable( name, sources, - include_directories: incs, dependencies: deps, c_args: cflags, link_with: libnm_dispatcher_core, diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index 2224ade58b..8675271c58 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -1,11 +1,8 @@ test_unit = 'test-dispatcher-envp' incs = [ - top_inc, - shared_inc, - libnm_core_inc, - libnm_inc, - dispatcher_inc + dispatcher_inc, + libnm_inc ] cflags = [ @@ -16,9 +13,9 @@ cflags = [ exe = executable( test_unit, - [test_unit + '.c', libnm_core_enum[1]], + test_unit + '.c', include_directories: incs, - dependencies: glib_dep, + dependencies: nm_core_dep, c_args: cflags, link_with: libnm_dispatcher_core ) diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build index c32ebdeed4..0a4694dd52 100644 --- a/examples/C/glib/meson.build +++ b/examples/C/glib/meson.build @@ -1,27 +1,20 @@ examples = [ - ['add-connection-gdbus', [uuid_dep], [libnm_core_enum[1], libnm_enum[1]]], - ['add-connection-libnm', [libnm_dep], []], - ['get-active-connections-gdbus', [], [libnm_core_enum[1], libnm_enum[1]]], - ['get-ap-info-libnm', [libnm_dep], []], - ['list-connections-gdbus', [], []], - ['list-connections-libnm', [libnm_dep], []], - ['monitor-nm-running-gdbus', [], []], - ['monitor-nm-state-gdbus', [], []] -] - -incs = [ - top_inc, - shared_inc, - libnm_core_inc, - libnm_inc + ['add-connection-gdbus', [libnm_enum[1]], [libnm_inc], [uuid_dep]], + ['add-connection-libnm', [], [], [libnm_dep]], + ['get-active-connections-gdbus', [libnm_enum[1]], [libnm_inc], []], + ['get-ap-info-libnm', [], [], [libnm_dep]], + ['list-connections-gdbus', [], [], []], + ['list-connections-libnm', [], [], [libnm_dep]], + ['monitor-nm-running-gdbus', [], [], []], + ['monitor-nm-state-gdbus', [], [], []] ] foreach example: examples executable( example[0], - [example[0] + '.c'] + example[2], - include_directories: incs, - dependencies: [glib_dep] + example[1], + [example[0] + '.c'] + example[1], + include_directories: example[2], + dependencies: [nm_core_dep] + example[3], c_args: '-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE' ) endforeach diff --git a/introspection/meson.build b/introspection/meson.build index cac63bc77a..b3fdbecd1d 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -93,6 +93,9 @@ libnmdbus = static_library( ) libnmdbus_dep = declare_dependency( - link_with: libnmdbus, - include_directories: include_directories('.') + # FIXME: only headers should be added here to resolve dependencies on + # libNetworkManagerBase and libNetworkManager + #sources: sources, + include_directories: include_directories('.'), + link_with: libnmdbus ) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 4772df5576..946ffb18f7 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -127,16 +127,11 @@ libnm_core_enum = gnome.mkenums( install_dir: libnm_pkgincludedir ) -incs = [ - top_inc, - shared_inc -] - deps = [ crypto_dep, dl_dep, - glib_dep, libudev_dep, + shared_dep, uuid_dep ] @@ -158,11 +153,16 @@ endif libnm_core = static_library( 'nm-core', sources: libnm_core_sources + libnm_core_enum + shared_sources + [version_header], - include_directories: incs, dependencies: deps, c_args: cflags ) +nm_core_dep = declare_dependency( + sources: libnm_core_enum[1], + include_directories: libnm_core_inc, + dependencies: shared_dep +) + enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl') docbooks = [ diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 602a789774..b3d62d4741 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -27,12 +27,6 @@ test_units = [ 'test-settings-defaults' ] -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - test_cert_dir = join_paths(meson.current_source_dir(), 'certs') cflags = [ @@ -45,8 +39,7 @@ foreach test_unit: test_units exe = executable( 'libnm-core-' + test_unit, [test_unit + '.c'] + enum, - include_directories: incs, - dependencies: glib_dep, + dependencies: nm_core_dep, c_args: cflags, link_with: libnm_core ) diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build index 727c8b39c1..4c3f23cc1e 100644 --- a/libnm-glib/meson.build +++ b/libnm-glib/meson.build @@ -1,14 +1,11 @@ -dbus_binding_tool = find_program('dbus-binding-tool') +libnm_glib_inc = include_directories('.') -common_incs = [ - top_inc, - shared_inc -] +dbus_binding_tool = find_program('dbus-binding-tool') common_deps = [ dbus_dep, dbus_glib_dep, - glib_dep + shared_dep ] common_cflags = [ @@ -16,11 +13,9 @@ common_cflags = [ ] cflags = common_cflags + [ - '-DG_LOG_DOMAIN="libnm-glib"', + '-DG_LOG_DOMAIN="libnm-glib"' ] -libnm_glib_inc = include_directories('.') - vpn_headers = files( 'nm-vpn-plugin.h', 'nm-vpn-plugin-ui-interface.h', @@ -65,12 +60,10 @@ install_headers( subdir: 'libnm-glib' ) -incs = common_incs + [libnm_util_inc] - libdeprecated_nm_glib = static_library( 'deprecated-nm-glib', sources: 'libnm_glib.c', - include_directories: incs, + include_directories: libnm_util_inc, dependencies: common_deps, c_args: cflags + [ '-Wno-deprecated-declarations', @@ -116,9 +109,8 @@ endif libnm_glib_vpn = shared_library( 'nm-glib-vpn', - sources: sources + libnm_glib_vpn_enum + [libnm_utils_enum[1]], + sources: sources + libnm_glib_vpn_enum, version: libnm_glib_vpn_version, - include_directories: common_incs, dependencies: deps, c_args: cflags, link_args: ldflags, @@ -127,8 +119,8 @@ libnm_glib_vpn = shared_library( ) libnm_glib_vpn_dep = declare_dependency( - link_with: libnm_glib_vpn, - include_directories: libnm_glib_inc + include_directories: libnm_glib_inc, + link_with: libnm_glib_vpn ) pkg.generate( @@ -197,8 +189,8 @@ libnm_glib_enum = gnome.mkenums( ) deps = common_deps + [ - libudev_dep, - libnm_util_dep + libnm_util_dep, + libudev_dep ] symbol_map = join_paths(meson.current_source_dir(), 'libnm-glib.ver') @@ -210,9 +202,8 @@ endif libnm_glib = shared_library( 'nm-glib', - sources: sources + libnm_glib_enum + [nm_secret_agent_glue, libnm_utils_enum[1]], + sources: sources + libnm_glib_enum + [nm_secret_agent_glue], version: libnm_glib_version, - include_directories: common_incs, dependencies: deps, c_args: cflags + [ '-DNMRUNDIR="@0@"'.format(nm_pkgrundir), @@ -224,8 +215,8 @@ libnm_glib = shared_library( ) libnm_glib_dep = declare_dependency( - link_with: libnm_glib, - include_directories: libnm_glib_inc + include_directories: libnm_glib_inc, + link_with: libnm_glib ) pkg.generate( @@ -276,8 +267,7 @@ deps = common_deps + [libnm_util_dep] executable( name, - [name + '.c', libnm_utils_enum[1]], - include_directories: common_incs, + name + '.c', dependencies: deps, c_args: cflags, link_with: libnm_glib diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build index eb12dfe36a..2ab17039e5 100644 --- a/libnm-glib/tests/meson.build +++ b/libnm-glib/tests/meson.build @@ -1,14 +1,9 @@ -incs = [ - top_inc, - shared_inc -] - deps = [ dbus_dep, dbus_glib_dep, - glib_dep, libnm_glib_dep, - libnm_util_dep + libnm_util_dep, + shared_dep ] test_units = [ @@ -19,8 +14,7 @@ test_units = [ foreach test_unit: test_units exe = executable( test_unit, - [test_unit + '.c', libnm_utils_enum[1]] + shared_test_utils, - include_directories: incs, + [test_unit + '.c'] + shared_test_utils, dependencies: deps, c_args: common_cflags + [ '-DNETWORKMANAGER_COMPILATION_TEST', diff --git a/libnm-util/meson.build b/libnm-util/meson.build index 944137ea4c..e04b98ec28 100644 --- a/libnm-util/meson.build +++ b/libnm-util/meson.build @@ -91,16 +91,11 @@ sources = shared_utils + files( 'nm-value-transforms.c' ) -incs = [ - top_inc, - shared_inc -] - deps = [ crypto_dep, dbus_dep, dbus_glib_dep, - glib_dep, + shared_dep, uuid_dep ] @@ -110,7 +105,7 @@ common_cflags = [ ] cflags = common_cflags + [ - '-DG_LOG_DOMAIN="libnm-util"', + '-DG_LOG_DOMAIN="libnm-util"' ] symbol_map = join_paths(meson.current_source_dir(), 'libnm-util.ver') @@ -124,7 +119,6 @@ libnm_util = shared_library( 'nm-util', sources: sources + libnm_utils_enum, version: libnm_util_version, - include_directories: incs, dependencies: deps, c_args: cflags, link_args: ldflags, @@ -133,8 +127,9 @@ libnm_util = shared_library( ) libnm_util_dep = declare_dependency( - link_with: libnm_util, - include_directories: libnm_util_inc + sources: libnm_utils_enum[1], + include_directories: libnm_util_inc, + link_with: libnm_util ) pkg.generate( @@ -169,8 +164,8 @@ if enable_introspection ) libnm_util_gir_dep = declare_dependency( - link_with: libnm_util, - sources: libnm_util_gir + sources: libnm_util_gir, + link_with: libnm_util ) endif @@ -187,13 +182,12 @@ sources = files( deps = [ crypto_dep, - glib_dep + shared_dep ] libtest_crypto = static_library( 'test-crypto', sources: sources, - include_directories: incs, dependencies: deps, c_args: cflags ) diff --git a/libnm-util/tests/meson.build b/libnm-util/tests/meson.build index 0c8cd8628b..c1f7800a41 100644 --- a/libnm-util/tests/meson.build +++ b/libnm-util/tests/meson.build @@ -1,13 +1,8 @@ -incs = [ - top_inc, - shared_inc -] - deps = [ dbus_dep, dbus_glib_dep, - glib_dep, - libnm_util_dep + libnm_util_dep, + shared_dep ] cflags = common_cflags + [ @@ -20,8 +15,7 @@ test = 'test-libnm-linking' test_libnm_linking = executable( test, - [test + '.c', libnm_utils_enum[1]], - include_directories: incs, + test + '.c', dependencies: deps + [libnm_dep], c_args: cflags ) @@ -38,8 +32,7 @@ test_units = [ foreach test_unit: test_units exe = executable( 'libnm-util-' + test_unit[0], - [test_unit[0] + '.c', libnm_utils_enum[1]], - include_directories: incs, + test_unit[0] + '.c', dependencies: deps, c_args: cflags, link_with: test_unit[1], diff --git a/libnm/meson.build b/libnm/meson.build index 062e8a8fb8..e3b0d65ec7 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -6,17 +6,11 @@ if have_fake_typelibs subdir('fake-typelib') endif -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ # FIXME: this makes GIR mandatory? gir_dep, - glib_dep, - libnmdbus_dep + libnmdbus_dep, + shared_dep ] cflags = [ @@ -28,7 +22,7 @@ cflags = [ libnm_utils = static_library( 'nm-utils', sources: sources, - include_directories: incs, + include_directories: libnm_core_inc, dependencies: deps, c_args: cflags ) @@ -145,8 +139,8 @@ libnm_sources = files( deps = [ dl_dep, - glib_dep, libudev_dep, + shared_dep, uuid_dep ] @@ -161,7 +155,7 @@ libnm = shared_library( 'nm', sources: libnm_sources + libnm_enum, version: libnm_version, - include_directories: incs + [libnm_core_inc], + include_directories: libnm_core_inc, dependencies: deps, c_args: cflags, link_with: libnm_utils, @@ -172,8 +166,9 @@ libnm = shared_library( ) libnm_dep = declare_dependency( - link_with: libnm, - include_directories: libnm_inc + sources: libnm_enum[1], + include_directories: libnm_inc, + link_with: libnm ) pkg.generate( diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 1955707ae1..8edb9fbed5 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -6,15 +6,9 @@ test_units = [ #['test-secret-agent', shared_test_utils, []] ] -incs = [ - top_inc, - shared_inc, - libnm_core_inc -] - deps = [ - glib_dep, - libnm_dep + libnm_dep, + nm_core_dep ] cflags = [ @@ -27,7 +21,6 @@ foreach test_unit: test_units exe = executable( 'libnm-' + test_unit[0], [test_unit[0] + '.c'] + test_unit[1], - include_directories: incs, dependencies: deps, c_args: cflags, link_with: test_unit[2] @@ -36,18 +29,11 @@ foreach test_unit: test_units test(test_unit[0], exe) endforeach -incs = [ - top_inc, - shared_inc, - libnm_core_inc, - libnm_inc -] - # just test, that we can build "nm-vpn-plugin-utils.c" libnm_vpn_plugin_utils_test = static_library( 'nm-vpn-plugin-utils-test', sources: shared_vpn_plugin_utils + [libnm_enum[1]], - include_directories: incs, - dependencies: glib_dep, - c_args: cflags, + include_directories: libnm_inc, + dependencies: nm_core_dep, + c_args: cflags ) diff --git a/shared/meson.build b/shared/meson.build index d3c1df0dff..2d0281b93f 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -1,7 +1,4 @@ -shared_inc = include_directories( - '.', - 'nm-utils' -) +shared_inc = include_directories('.') version_conf = configuration_data() version_conf.set('NM_MAJOR_VERSION', nm_major_version) @@ -37,3 +34,12 @@ shared_sources = shared_utils + shared_meta_setting + shared_udev_utils + files( 'nm-utils/c-list-util.c', 'nm-utils/nm-dedup-multi.c' ) + +shared_dep = declare_dependency( + include_directories: [ + top_inc, + shared_inc, + include_directories('nm-utils') + ], + dependencies: glib_dep +) diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index 9b4dc84285..bca488e50f 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -4,9 +4,9 @@ sources = files( ) deps = [ - core_dep, libnmdbus_dep, - libudev_dep + libudev_dep, + nm_dep ] ldflags = [] diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index 2e59810dfa..e1ce74b316 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -9,9 +9,9 @@ sources = files( ) deps = [ - core_dep, + libnmdbus_dep, libnm_wwan_dep, - libnmdbus_dep + nm_dep ] ldflags = [] diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index dbbb9e77a3..64d98dfe33 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -7,13 +7,11 @@ sources = files( ) deps = [ - core_dep, jansson_dep, - libnmdbus_dep + libnmdbus_dep, + nm_dep ] -cflags = '-DRUNSTATEDIR="@0@"'.format(nm_runstatedir) - ldflags = [] if have_version_script ldflags += '-Wl,--version-script,@0@'.format(linker_script_devices) @@ -23,7 +21,7 @@ libnm_device_plugin_ovs = shared_module( 'nm-device-plugin-ovs', sources: sources, dependencies: deps, - c_args: cflags, + c_args: '-DRUNSTATEDIR="@0@"'.format(nm_runstatedir), link_args: ldflags, link_depends: linker_script_devices, install: true, diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build index 64d6ab334a..0853c610d0 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -4,10 +4,10 @@ sources = files( ) deps = [ - core_dep, jansson_dep, libnmdbus_dep, - libteamdctl_dep + libteamdctl_dep, + nm_dep ] ldflags = [] diff --git a/src/devices/tests/meson.build b/src/devices/tests/meson.build index 015b2a6fe2..c1d6def4eb 100644 --- a/src/devices/tests/meson.build +++ b/src/devices/tests/meson.build @@ -7,7 +7,7 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep + dependencies: test_nm_dep ) test(test_unit, exe) diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index 0b681262be..a733b379c8 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -17,8 +17,8 @@ if enable_iwd endif deps = [ - core_dep, - libnmdbus_dep + libnmdbus_dep, + nm_dep ] ldflags = [] diff --git a/src/devices/wifi/tests/meson.build b/src/devices/wifi/tests/meson.build index 189c1a730e..05db2ffbb7 100644 --- a/src/devices/wifi/tests/meson.build +++ b/src/devices/wifi/tests/meson.build @@ -3,7 +3,7 @@ test_unit = 'test-general' exe = executable( 'wifi-' + test_unit, [test_unit + '.c'] + common_sources, - dependencies: test_core_dep + dependencies: test_nm_dep ) test(test_unit, exe) diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 3f3c70002d..e571cf94f8 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -5,9 +5,9 @@ sources = files( ) deps = [ - core_dep, libsystemd_dep, - mm_glib_dep + mm_glib_dep, + nm_dep ] if enable_ofono @@ -32,8 +32,8 @@ libnm_wwan = shared_module( ) libnm_wwan_dep = declare_dependency( - link_with: libnm_wwan, - include_directories: include_directories('.') + include_directories: include_directories('.'), + link_with: libnm_wwan ) core_plugins += libnm_wwan diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build index a26e6748e3..a41aac46a1 100644 --- a/src/dhcp/meson.build +++ b/src/dhcp/meson.build @@ -14,8 +14,7 @@ endif executable( name, name + '.c', - include_directories: core_incs, - dependencies: glib_dep, + dependencies: nm_core_dep, c_args: cflags, link_args: ldflags, link_depends: linker_script_binary, diff --git a/src/dhcp/tests/meson.build b/src/dhcp/tests/meson.build index 85c6811bce..2a6b55df2b 100644 --- a/src/dhcp/tests/meson.build +++ b/src/dhcp/tests/meson.build @@ -3,14 +3,12 @@ test_units = [ 'test-dhcp-utils' ] -cflags = '-DTESTDIR="@0@"'.format(meson.current_source_dir()) - foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, - c_args: cflags + dependencies: test_nm_dep, + c_args: '-DTESTDIR="@0@"'.format(meson.current_source_dir()) ) test(test_unit, exe) diff --git a/src/dnsmasq/tests/meson.build b/src/dnsmasq/tests/meson.build index 749e6f64fa..56d917486a 100644 --- a/src/dnsmasq/tests/meson.build +++ b/src/dnsmasq/tests/meson.build @@ -1,16 +1,10 @@ test_unit = 'test-dnsmasq-utils' -cflags = [ - '-DTESTDIR="@0@"'.format(meson.source_root()), - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', -] - exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, - c_args: cflags + dependencies: test_nm_dep, + c_args: '-DTESTDIR="@0@"'.format(meson.source_root()) ) test(test_unit, exe) diff --git a/src/meson.build b/src/meson.build index 26c53edcd1..1c5b6921b0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,25 +7,17 @@ install_data( subdir('systemd') -core_incs = [ - top_inc, - shared_inc, - libnm_core_inc, - src_inc -] +core_plugins = [] -core_dep = declare_dependency( - sources: libnm_core_enum[1], - include_directories: core_incs, - dependencies: glib_dep, - compile_args: [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', - ], -) +nm_cflags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON'] -core_plugins = [] +nm_dep = declare_dependency( + include_directories: src_inc, + dependencies: nm_core_dep, + compile_args: nm_cflags +) -common_cflags = [ +cflags = nm_cflags + [ '-DPREFIX="@0@"'.format(nm_prefix), '-DBINDIR="@0@"'.format(nm_bindir), '-DDATADIR="@0@"'.format(nm_datadir), @@ -40,20 +32,19 @@ common_cflags = [ '-DNMPLUGINDIR="@0@"'.format(nm_pkglibdir), '-DNMRUNDIR="@0@"'.format(nm_pkgrundir), '-DNMSTATEDIR="@0@"'.format(nm_pkgstatedir), - '-DNMLIBDIR="@0@"'.format(nm_pkglibdir), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', + '-DNMLIBDIR="@0@"'.format(nm_pkglibdir) ] if enable_dhcpcanon - common_cflags += '-DDHCPCANON_PATH="@0@"'.format(dhcpcanon.path()) + cflags += '-DDHCPCANON_PATH="@0@"'.format(dhcpcanon.path()) endif if enable_dhclient - common_cflags += '-DDHCLIENT_PATH="@0@"'.format(dhclient.path()) + cflags += '-DDHCLIENT_PATH="@0@"'.format(dhclient.path()) endif if enable_dhcpcd - common_cflags += '-DDHCPCD_PATH="@0@"'.format(dhcpcd.path()) + cflags += '-DDHCPCD_PATH="@0@"'.format(dhcpcd.path()) endif sources = files( @@ -80,11 +71,11 @@ sources = files( ) deps = [ - core_dep, libnl_dep, libnmdbus_dep, libsystemd_dep, - libudev_dep + libudev_dep, + nm_core_dep ] if enable_wext @@ -95,7 +86,7 @@ libnetwork_manager_base = static_library( 'NetworkManagerBase', sources: sources, dependencies: deps, - c_args: common_cflags, + c_args: cflags, link_with: libnm_core ) @@ -176,11 +167,14 @@ sources = files( ) deps = [ - core_dep, dl_dep, libndp_dep, libnl_dep, - libudev_dep + # FIXME: Some files use introspection/dbus* headers, so + # this dependency might be needed + #libnmdbus_dep, + libudev_dep, + nm_core_dep ] if enable_concheck @@ -209,7 +203,7 @@ libnetwork_manager = static_library( 'NetworkManager', sources: sources, dependencies: deps, - c_args: common_cflags, + c_args: cflags, link_with: [libnetwork_manager_base, libsystemd_nm] ) @@ -247,7 +241,7 @@ network_manager = executable( meson.project_name(), 'main.c', dependencies: deps, - c_args: common_cflags, + c_args: cflags, link_with: libnetwork_manager, link_args: ldflags, link_depends: symbol_map, @@ -256,11 +250,11 @@ network_manager = executable( ) deps = [ - core_dep, dl_dep, libndp_dep, libnl_dep, - libudev_dep + libudev_dep, + nm_core_dep ] ldflags = [] @@ -274,7 +268,7 @@ executable( name, name + '.c', dependencies: deps, - c_args: common_cflags, + c_args: cflags, link_with: [libnetwork_manager_base, libsystemd_nm], link_args: ldflags, link_depends: linker_script_binary, @@ -290,36 +284,29 @@ if enable_tests ) deps = [ - core_dep, libnl_dep, - libudev_dep + libudev_dep, + nm_core_dep ] - test_cflags = [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', - ] + test_cflags = ['-DNETWORKMANAGER_COMPILATION_TEST'] if require_root_tests test_cflags += ['-DREQUIRE_ROOT_TESTS=1'] endif platform = (host_machine.system().contains('linux') ? 'linux' : 'fake') - test_cflags_platform = [ - '-DSETUP=nm_' + platform + '_platform_setup', - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', - ] + test_cflags_platform = '-DSETUP=nm_' + platform + '_platform_setup' libnetwork_manager_test = static_library( 'NetworkManagerTest', sources: sources, dependencies: deps, - c_args: test_cflags, + c_args: cflags + test_cflags, link_with: libnetwork_manager ) - test_core_dep = declare_dependency( - dependencies: core_dep, + test_nm_dep = declare_dependency( + dependencies: nm_dep, compile_args: test_cflags, link_with: libnetwork_manager_test ) diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build index acd5a6ec80..708ecf4122 100644 --- a/src/ndisc/tests/meson.build +++ b/src/ndisc/tests/meson.build @@ -3,7 +3,7 @@ test_unit = 'test-ndisc-fake' exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: test_cflags_platform ) @@ -14,6 +14,6 @@ test = 'test-ndisc-linux' exe = executable( test, test + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: test_cflags_platform ) diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index c7c5c855f7..6c18241e7d 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -15,7 +15,7 @@ foreach test_unit: test_units exe = executable( 'platform-' + test_unit[0], test_unit[1], - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: test_cflags_platform ) @@ -27,6 +27,6 @@ test = 'monitor' executable( test, test + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: test_cflags_platform ) diff --git a/src/ppp/meson.build b/src/ppp/meson.build index 90988050ea..c0f1f1b107 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -2,14 +2,14 @@ name = 'nm-pppd-plugin' deps = [ dl_dep, - glib_dep + nm_core_dep ] nm_pppd_plugin = shared_module( name, name_prefix: '', - sources: [name + '.c', libnm_core_enum[1]], - include_directories: core_incs, + sources: name + '.c', + include_directories: src_inc, dependencies: deps, c_args: [ '-DG_LOG_DOMAIN="nm-pppd-plugin"', @@ -22,13 +22,8 @@ nm_pppd_plugin = shared_module( name = 'nm-ppp-plugin' deps = [ - core_dep, - libnmdbus_dep -] - -cflags = [ - '-DPPPD_PLUGIN_DIR="@0@"'.format(pppd_plugin_dir), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON', + libnmdbus_dep, + nm_dep ] symbol_map = join_paths(meson.current_source_dir(), name + '.ver') @@ -42,7 +37,7 @@ core_plugins += shared_module( name, sources: 'nm-ppp-manager.c', dependencies: deps, - c_args: cflags, + c_args: '-DPPPD_PLUGIN_DIR="@0@"'.format(pppd_plugin_dir), link_args: ldflags, link_depends: symbol_map, install: true, diff --git a/src/settings/plugins/ibft/meson.build b/src/settings/plugins/ibft/meson.build index 66ed0abe0c..12f0acba6d 100644 --- a/src/settings/plugins/ibft/meson.build +++ b/src/settings/plugins/ibft/meson.build @@ -8,7 +8,7 @@ cflags = [ libnms_ibft_core = static_library( 'nms-ibft-core', 'nms-ibft-reader.c', - dependencies: core_dep, + dependencies: nm_dep, c_args: cflags ) @@ -25,7 +25,7 @@ endif libnm_settings_plugin_ibft = shared_module( name, sources: sources, - dependencies: core_dep, + dependencies: nm_dep, c_args: cflags, link_with: libnms_ibft_core, link_args: ldflags, diff --git a/src/settings/plugins/ibft/tests/meson.build b/src/settings/plugins/ibft/tests/meson.build index ed5cb3ffca..d579895245 100644 --- a/src/settings/plugins/ibft/tests/meson.build +++ b/src/settings/plugins/ibft/tests/meson.build @@ -10,7 +10,7 @@ cflags = [ exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: cflags, link_with: libnms_ibft_core ) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index f480831a38..2d46fc45d0 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -33,8 +33,8 @@ sources = files( ) deps = [ - core_dep, - crypto_dep + crypto_dep, + nm_dep ] libnms_ifcfg_rh_core = static_library( diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index 359ed73600..3be38bd3c6 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -10,7 +10,7 @@ cflags = [ exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: cflags, link_with: libnms_ifcfg_rh_core ) diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 6e84951ce4..9800f58887 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -4,8 +4,8 @@ sources = files( ) deps = [ - core_dep, - libudev_dep + libudev_dep, + nm_dep ] cflags = '-DSYSCONFDIR="@0@"'.format(nm_sysconfdir) diff --git a/src/settings/plugins/ifupdown/tests/meson.build b/src/settings/plugins/ifupdown/tests/meson.build index 5d416b3836..287c89d2e4 100644 --- a/src/settings/plugins/ifupdown/tests/meson.build +++ b/src/settings/plugins/ifupdown/tests/meson.build @@ -5,7 +5,7 @@ cflags = '-DTEST_ENI_DIR="@0@"'.format(meson.current_source_dir()) exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: cflags, link_with: libnms_ifupdown_core ) diff --git a/src/settings/plugins/keyfile/tests/meson.build b/src/settings/plugins/keyfile/tests/meson.build index 47a2af1f35..1f32650b2c 100644 --- a/src/settings/plugins/keyfile/tests/meson.build +++ b/src/settings/plugins/keyfile/tests/meson.build @@ -10,7 +10,7 @@ cflags = [ exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: cflags ) diff --git a/src/supplicant/tests/meson.build b/src/supplicant/tests/meson.build index 357bcb5937..87acc7eb56 100644 --- a/src/supplicant/tests/meson.build +++ b/src/supplicant/tests/meson.build @@ -3,7 +3,7 @@ test_unit = 'test-supplicant-config' exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: '-DTEST_CERT_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'certs')) ) diff --git a/src/systemd/meson.build b/src/systemd/meson.build index 0d9213b290..fe3d88d3b3 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -51,9 +51,6 @@ sources = files( ) incs = [ - top_inc, - shared_inc, - libnm_core_inc, src_inc, include_directories( 'sd-adapt', @@ -64,12 +61,10 @@ incs = [ ) ] -cflags = '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD' - libsystemd_nm = static_library( 'systemd-nm', - sources: sources + [libnm_core_enum[1]], + sources: sources, include_directories: incs, - dependencies: glib_dep, - c_args: cflags + dependencies: nm_core_dep, + c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD' ) diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index f80453ebc1..80d289f717 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -15,7 +15,7 @@ cflags = [ exe = executable( test_unit, sources, - dependencies: test_core_dep, + dependencies: test_nm_dep, c_args: cflags ) diff --git a/src/tests/meson.build b/src/tests/meson.build index f8383d89b4..9e32a92965 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -15,7 +15,7 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_core_dep + dependencies: test_nm_dep ) test(test_unit, exe) @@ -30,9 +30,9 @@ cflags = [ exe = executable( test_unit, - [test_unit + '.c', libnm_core_enum[1]] + shared_siphash, - include_directories: core_incs, - dependencies: glib_dep, + [test_unit + '.c'] + shared_siphash, + include_directories: src_inc, + dependencies: nm_core_dep, c_args: cflags, link_with: libsystemd_nm ) |