Add static linkage argument in meson.build.

Those options were added by the kiwix-build.py script.
But it's better to add them in the meson.build script to allow people
not using kiwix-build to compile static binaries either.
This commit is contained in:
Matthieu Gautier 2017-01-31 14:43:25 +01:00
parent db7e1e5c8f
commit 0f6ca21188
3 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,9 @@ $ ninja install
```
By default, it will compile dynamic linked binaries.
If you want statically linked binaries, you can add `--default-library=static`
If you want statically linked binaries, you can add `-Dstatic-linkage=true`
option to the meson command.
Be aware that you must have static library dependencies installed on your
system.
Licensed as GPLv3 or later, see COPYING for more details.

View File

@ -2,6 +2,11 @@ project('kiwix-tools', 'cpp')
compiler = meson.get_compiler('cpp')
static_linkage = get_option('static-linkage')
if static_linkage
add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
endif
thread_dep = dependency('threads')
kiwixlib_dep = dependency('kiwix')
microhttpd_dep = dependency('libmicrohttpd')

View File

@ -1,2 +1,4 @@
option('static-linkage', type : 'boolean', value : false,
description : 'Create statically linked binaries.')
option('ctpp2-install-prefix', type : 'string', value : '',
description : 'Prefix where ctpp libs has been installed')