[gtk/fix.vs2013.link] gtk/meson.build: Fix linking on Visual Studio 2013
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix.vs2013.link] gtk/meson.build: Fix linking on Visual Studio 2013
- Date: Sun, 23 May 2021 08:15:29 +0000 (UTC)
commit 6cd96e653e27f647795f015b2a74cc3f68b9260b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Sat May 22 22:11:05 2021 +0800
gtk/meson.build: Fix linking on Visual Studio 2013
Visual Studio 2013's linker does not suport `/WHOLEARCHIVE:`, so just
explicitly extract the objects from the static libraries that will
form the final GTK DLL.
gtk/meson.build | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/gtk/meson.build b/gtk/meson.build
index 2bb41b03e7..f8805318ac 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1113,11 +1113,32 @@ libgtk_static = static_library('gtk',
link_with: [libgtk_css, libgdk, libgsk ],
)
+# `link_whole:` is actually only supported on Visual Studio 2015 Update 2
+# or later via the linker flag `/WHOLEARCHIVE:<static_lib>`, so we need
+# to work around it for Visual Studio 2013. Note that all needed static
+# libs are required so that we grab the object files from each of them to
+# link the final GTK DLL.
+if cc.get_id() == 'msvc' and cc.version().split('.').get(0) < '19'
+ whole_archives = []
+
+ # Add libgdk_broadway when ported later, if opted
+ gtk4_objs = [ libgtk_static.extract_all_objects(),
+ libgtk_css.extract_all_objects(),
+ libgdk.extract_all_objects(),
+ libgdk_win32.extract_all_objects(),
+ libgsk.extract_all_objects(),
+ libgsk_f16c.extract_all_objects()]
+else
+ whole_archives = [libgtk_static, libgtk_css, libgdk, libgsk ]
+ gtk4_objs = []
+endif
+
libgtk = shared_library('gtk-4',
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
- link_whole: [libgtk_static, libgtk_css, libgdk, libgsk ],
+ link_whole: whole_archives,
+ objects: gtk4_objs,
link_args: common_ldflags,
soversion: gtk_soversion,
version: gtk_library_version,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]