[gtksourceview/meson.msvc.cleanups: 3/4] build: Clean up libgtksourceview linking
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/meson.msvc.cleanups: 3/4] build: Clean up libgtksourceview linking
- Date: Thu, 21 Nov 2019 04:46:05 +0000 (UTC)
commit e492c99a63e15527b0e962c40bd4fc7f8ad85e9a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Nov 21 12:31:41 2019 +0800
build: Clean up libgtksourceview linking
On all systems, build the static .lib's for the core GtkSourceView
sources as well as the completion provider sources, and link
libgtksourceview by:
-Using 'link_whole:' for non-MSVC as we did before
-Using 'objects:' in conjunction with <static_lib>.extact_all_objects()
for MSVC builds so that we are assured that the final DLL do not
optimize out the symbols that we have in our static .lib's.
.../completion-providers/words/meson.build | 37 +++++++--------
gtksourceview/meson.build | 54 +++++++++-------------
2 files changed, 39 insertions(+), 52 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/meson.build
b/gtksourceview/completion-providers/words/meson.build
index 75d942b8..f6750649 100644
--- a/gtksourceview/completion-providers/words/meson.build
+++ b/gtksourceview/completion-providers/words/meson.build
@@ -26,29 +26,26 @@ install_headers(
)
)
-if cc.get_id() != 'msvc'
- completionwords_lib = static_library(
- package_string + 'completionwords',
- completionwords_public_c,
- include_directories: rootdir,
- dependencies: core_dep,
- c_args: completionwords_c_args,
- install: false,
- )
-
- gtksource_libs += [
- completionwords_lib,
- ]
+completionwords_lib = static_library(
+ package_string + 'completionwords',
+ completionwords_public_c,
+ include_directories: rootdir,
+ dependencies: core_dep,
+ c_args: completionwords_c_args,
+ install: false,
+)
- completionwords_dep = declare_dependency(
- link_with: completionwords_lib,
- include_directories: rootdir,
- dependencies: core_dep,
- )
+gtksource_libs += [
+ completionwords_lib
+]
- gtksource_deps += completionwords_dep
+completionwords_dep = declare_dependency(
+ link_with: completionwords_lib,
+ include_directories: rootdir,
+ dependencies: core_dep,
+)
-endif
+gtksource_deps += completionwords_dep
extra_public_sources += files([
'gtksourcecompletionwords.c',
diff --git a/gtksourceview/meson.build b/gtksourceview/meson.build
index 1c219517..52302cc9 100644
--- a/gtksourceview/meson.build
+++ b/gtksourceview/meson.build
@@ -210,11 +210,7 @@ gtksource_deps = [
core_dep,
]
-# We can't use the static libs on Visual Studio builds
-# to form our DLL here, so we must build all the core
-# and word completion provider sources into the main DLL
-# instead
-gtksource_libs = cc.get_id() == 'msvc' ? [] : [core_lib]
+gtksource_libs = [core_lib]
extra_public_sources = []
@@ -225,35 +221,29 @@ gtksource_res = gnome.compile_resources(
'gtksourceview.gresource.xml'
)
+
# We can't use the static libs on Visual Studio builds
-# to form our DLL here, so we must build all the core
-# and word completion provider sources into the main DLL
+# to form our DLL here directly, so we must use
+# extract_all_objects() to extract all the core and word
+# completion provider objects that we previously built
+# into static .lib's and link them into the main DLL
# instead
-if cc.get_id() == 'msvc'
- gtksource_word_provider_sources = []
- foreach s: completionwords_public_c
- gtksource_word_provider_sources += files(['completion-providers/words/@0@'.format(s)])
- endforeach
- gtksource_lib = shared_library(package_string,
- [core_sources, gtksource_word_provider_sources, gtksource_res],
- version: lib_version,
- include_directories: gtksourceview_include_dirs,
- dependencies: core_deps,
- c_args: core_c_args,
- install: true,
- )
-else
- gtksource_lib = shared_library(package_string, gtksource_res,
- version: lib_version,
- darwin_versions: lib_osx_version,
- include_directories: gtksourceview_include_dirs,
- dependencies: gtksource_deps,
- link_whole: gtksource_libs,
- c_args: core_c_args,
- install: true,
- gnu_symbol_visibility: 'hidden',
- )
-endif
+gtksource_objs = []
+foreach int_lib : gtksource_libs
+ gtksource_objs += int_lib.extract_all_objects()
+endforeach
+
+gtksource_lib = shared_library(package_string, gtksource_res,
+ version: lib_version,
+ darwin_versions: lib_osx_version,
+ include_directories: gtksourceview_include_dirs,
+ dependencies: cc.get_id() == 'msvc' ? core_deps : gtksource_deps,
+ objects: cc.get_id() == 'msvc' ? gtksource_objs : [],
+ link_whole: cc.get_id() == 'msvc' ? [] : gtksource_libs,
+ c_args: core_c_args,
+ install: true,
+ gnu_symbol_visibility: 'hidden',
+)
gtksource_dep_sources = [
core_enums_h,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]