summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-01-02 13:37:06 +0100
committerThomas Haller <thaller@redhat.com>2018-01-08 12:38:53 +0100
commit22ef6a507a308f2fe495b60bef78ac2ca00fb6d2 (patch)
tree3bd2f287df3db9c5254f9b27607b4f0735b938d7 /libnm-glib
parent31b6abd4b533c56c91c616498ee2080d56d0fd48 (diff)
build: refine the NETWORKMANAGER_COMPILATION define
Note that: - we compile some source files multiple times. Most notably those under "shared/". - we include a default header "shared/nm-default.h" in every source file. This header is supposed to setup a common environment by defining and including parts that are commonly used. As we always include the same header, the header must behave differently depending one whether the compilation is for libnm-core, NetworkManager or libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h> depending on whether we compile a library or an application. For that, the source files need the NETWORKMANAGER_COMPILATION #define to behave accordingly. Extend the define to be composed of flags. These flags are all named NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the build are available. E.g. when building libnm-core.la itself, then WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE is not available but the internal parts are still accessible. When building nmcli, only WITH_LIBNM_CORE (the public part) is available. This granularily controls the build.
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/meson.build29
-rw-r--r--libnm-glib/tests/meson.build10
2 files changed, 20 insertions, 19 deletions
diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build
index 43497e60e..727c8b39c 100644
--- a/libnm-glib/meson.build
+++ b/libnm-glib/meson.build
@@ -12,8 +12,11 @@ common_deps = [
]
common_cflags = [
+ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB',
+]
+
+cflags = common_cflags + [
'-DG_LOG_DOMAIN="libnm-glib"',
- '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY'
]
libnm_glib_inc = include_directories('.')
@@ -64,17 +67,15 @@ install_headers(
incs = common_incs + [libnm_util_inc]
-cflags = common_cflags + [
- '-Wno-deprecated-declarations',
- '-Wno-deprecated'
-]
-
libdeprecated_nm_glib = static_library(
'deprecated-nm-glib',
sources: 'libnm_glib.c',
include_directories: incs,
dependencies: common_deps,
- c_args: cflags
+ c_args: cflags + [
+ '-Wno-deprecated-declarations',
+ '-Wno-deprecated',
+ ],
)
sources = files(
@@ -119,7 +120,7 @@ libnm_glib_vpn = shared_library(
version: libnm_glib_vpn_version,
include_directories: common_incs,
dependencies: deps,
- c_args: common_cflags,
+ c_args: cflags,
link_args: ldflags,
link_depends: symbol_map,
install: true
@@ -200,8 +201,6 @@ deps = common_deps + [
libnm_util_dep
]
-cflags = common_cflags + ['-DNMRUNDIR="@0@"'.format(nm_pkgrundir)]
-
symbol_map = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
ldflags = []
@@ -215,7 +214,9 @@ libnm_glib = shared_library(
version: libnm_glib_version,
include_directories: common_incs,
dependencies: deps,
- c_args: cflags,
+ c_args: cflags + [
+ '-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
+ ],
link_with: libdeprecated_nm_glib,
link_args: ldflags,
link_depends: symbol_map,
@@ -262,7 +263,9 @@ if enable_introspection
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: ['libnm-glib', 'libnm-glib-vpn'],
includes: gir_includes,
- extra_args: common_cflags + ['--include-uninstalled=' + libnm_util_gir[0].full_path()],
+ extra_args: cflags + [
+ '--include-uninstalled=' + libnm_util_gir[0].full_path(),
+ ],
install: true
)
endif
@@ -276,7 +279,7 @@ executable(
[name + '.c', libnm_utils_enum[1]],
include_directories: common_incs,
dependencies: deps,
- c_args: common_cflags,
+ c_args: cflags,
link_with: libnm_glib
)
diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build
index c655f5fd9..eb12dfe36 100644
--- a/libnm-glib/tests/meson.build
+++ b/libnm-glib/tests/meson.build
@@ -11,11 +11,6 @@ deps = [
libnm_util_dep
]
-cflags = [
- '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY',
- '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py'))
-]
-
test_units = [
'test-nm-client',
'test-remote-settings-client'
@@ -27,7 +22,10 @@ foreach test_unit: test_units
[test_unit + '.c', libnm_utils_enum[1]] + shared_test_utils,
include_directories: incs,
dependencies: deps,
- c_args: cflags
+ c_args: common_cflags + [
+ '-DNETWORKMANAGER_COMPILATION_TEST',
+ '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')),
+ ],
)
test(test_unit, exe)