[tepl/master.msvc: 2/8] meson: Fix linking tepl library on Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl/master.msvc: 2/8] meson: Fix linking tepl library on Visual Studio
- Date: Thu, 30 Apr 2020 09:06:10 +0000 (UTC)
commit ae0c5b53860a847ebc178c6f6c42fba3883be52b
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 | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/tepl/meson.build b/tepl/meson.build
index 6ad5947..a7bc27a 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -120,13 +120,23 @@ TEPL_STATIC_DEP = declare_dependency(
dependencies: TEPL_DEPS
)
-symbol_map = meson.current_source_dir() / 'symbol.map'
+symbol_map = []
+tepl_link_args = []
+tepl_link_depends = []
+
+if c_compiler.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]