[tepl] meson: Fix linking tepl library on Visual Studio
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] meson: Fix linking tepl library on Visual Studio
- Date: Mon, 4 May 2020 13:30:25 +0000 (UTC)
commit 11963709cda7584a05ec1d0d3aab7ec5f514bf0d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Apr 28 16:16:11 2020 +0800
meson: Fix linking tepl library on Visual Studio
Some of the linker flags cannot be used for Visual Studio, and we can't
just link a DLL entirely from a static library on Visual Studio, as the
linker will optimize things out as it does not see the symbols being
used.
As a result, instead of linking using just the static library, we call
extract_all_objects() on the static library in order to link the final
tepl .so/.dll on all builds.
tepl/meson.build | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/tepl/meson.build b/tepl/meson.build
index b06eaed..d0ecd5c 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -129,13 +129,21 @@ TEPL_STATIC_DEP = declare_dependency(
dependencies: TEPL_DEPS
)
-symbol_map = meson.current_source_dir() / 'symbol.map'
+tepl_link_args = []
+tepl_link_depends = []
+
+if meson.get_compiler('c').get_argument_syntax() != 'msvc'
+ symbol_map = meson.current_source_dir() / 'symbol.map'
+ tepl_link_args = '-Wl,--version-script,' + symbol_map
+ tepl_link_depends = symbol_map
+endif
tepl_lib = library(
'tepl-@0@'.format(TEPL_API_VERSION),
- link_whole: tepl_static_lib,
- link_args: '-Wl,--version-script,' + symbol_map,
- link_depends: symbol_map,
+ dependencies: TEPL_DEPS,
+ link_args: tepl_link_args,
+ link_depends: tepl_link_depends,
+ objects: tepl_static_lib.extract_all_objects(),
version: TEPL_LT_VERSION,
install: true
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]