[tepl/master.msvc: 34/36] 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: 34/36] meson: Fix linking tepl library on Visual Studio
- Date: Mon, 4 May 2020 07:16:55 +0000 (UTC)
commit 5ea5cd4d0a2a35af32eb33c75088cc41d28f730a
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.
Also rename 'c_compiler' to 'CC', as per the variable naming
conventions, as this is used outside of $(srcroot)/meson.build as well.
meson.build | 6 +++---
tepl/meson.build | 16 ++++++++++++----
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index 1f8f7ae..f03de99 100644
--- a/meson.build
+++ b/meson.build
@@ -78,11 +78,11 @@ add_project_arguments(
# even at the maximum level.
# The following warning_cflags suppose that warning_level=2.
-c_compiler = meson.get_compiler('c')
+CC = meson.get_compiler('c')
warning_cflags = []
-if c_compiler.get_id() == 'msvc'
+if CC.get_id() == 'msvc'
# Use GLib's msvc_recommended_pragmas.h to filter out
# the warnings we don't really need to worry about,
# but do make the ones we want to be wary stand out
@@ -134,7 +134,7 @@ else
]
endif
-supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags)
+supported_warning_cflags = CC.get_supported_arguments(warning_cflags)
add_project_arguments(supported_warning_cflags, language: 'c')
##### end CFLAGS
diff --git a/tepl/meson.build b/tepl/meson.build
index fe257c0..b89df36 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -127,13 +127,21 @@ TEPL_STATIC_DEP = declare_dependency(
dependencies: TEPL_DEPS
)
-symbol_map = meson.current_source_dir() / 'symbol.map'
+tepl_link_args = []
+tepl_link_depends = []
+
+if CC.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]