diff options
author | Thomas Haller <thaller@redhat.com> | 2018-01-02 13:37:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-01-08 12:38:53 +0100 |
commit | 22ef6a507a308f2fe495b60bef78ac2ca00fb6d2 (patch) | |
tree | 3bd2f287df3db9c5254f9b27607b4f0735b938d7 /clients | |
parent | 31b6abd4b533c56c91c616498ee2080d56d0fd48 (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 'clients')
-rw-r--r-- | clients/cli/meson.build | 4 | ||||
-rw-r--r-- | clients/common/meson.build | 7 | ||||
-rw-r--r-- | clients/common/tests/meson.build | 4 | ||||
-rw-r--r-- | clients/meson.build | 8 | ||||
-rw-r--r-- | clients/tui/meson.build | 10 |
5 files changed, 20 insertions, 13 deletions
diff --git a/clients/cli/meson.build b/clients/cli/meson.build index bfe7de56c7..3eaf04b8b0 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -30,9 +30,9 @@ deps = [ readline_dep ] -cflags = [ +cflags = clients_cflags + [ '-DG_LOG_DOMAIN="nmcli"', - '-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir) + '-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir), ] ldflags = [] diff --git a/clients/common/meson.build b/clients/common/meson.build index 861a4442f8..44ddfaf9c9 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -13,9 +13,8 @@ deps = [ libnm_dep ] -cflags = [ +cflags = clients_cflags + [ '-DG_LOG_DOMAIN="libnmc"', - '-DNMLOCALEDIR="@0@"'.format(nm_localedir) ] sources = shared_utils + files( @@ -29,7 +28,7 @@ libnmc_base = static_library( sources: sources + [libnm_core_enum[1]], include_directories: incs, dependencies: deps, - c_args: common_cflags + c_args: cflags, ) libnmc_base_dep = declare_dependency( @@ -75,7 +74,7 @@ libnmc = static_library( sources: sources + [libnm_core_enum[1]], include_directories: incs, dependencies: deps, - c_args: common_cflags, + c_args: cflags, link_with: libnmc_base, link_depends: settings_docs_source ) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 84777011b1..27bf8d6def 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -10,7 +10,9 @@ exe = executable( test_unit + '.c', include_directories: incs, dependencies: deps, - c_args: cflags + c_args: clients_cflags + [ + '-DNETWORKMANAGER_COMPILATION_TEST', + ], ) test(test_unit, exe) diff --git a/clients/meson.build b/clients/meson.build index 1e197d3762..c5c8fd99f7 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -11,9 +11,13 @@ deps = [ libnm_dep ] -cflags = [ +clients_cflags = [ + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + '-DNMLOCALEDIR="@0@"'.format(nm_localedir), +] + +cflags = clients_cflags + [ '-DG_LOG_DOMAIN="@0@"'.format(name), - '-DNMLOCALEDIR="@0@"'.format(nm_localedir) ] ldflags = [] diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 2bff05359a..1b0702ad81 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,7 +1,8 @@ incs = [ top_inc, shared_inc, - libnm_core_inc + libnm_core_inc, + libnm_inc, ] deps = [ @@ -9,7 +10,10 @@ deps = [ newt_dep ] -cflags = ['-DG_LOG_DOMAIN="nmtui"'] +cflags = clients_cflags + [ + '-DG_LOG_DOMAIN="nmtui"', + '-DLOCALEDIR="@0@"'.format(nm_localedir), +] subdir('newt') @@ -62,8 +66,6 @@ deps += [ libnmt_newt_dep ] -cflags += '-DLOCALEDIR="@0@"'.format(nm_localedir) - ldflags = [] if have_version_script ldflags += '-Wl,--version-script,@0@'.format(linker_script_binary) |