[gjs/meson.msvc: 4/11] meson.build: Don't use GCC-specific linker flags on MSVC



commit 3246d1c587ab7b89b0cd5d41778f3e0a3661613b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Oct 25 12:43:32 2019 +0800

    meson.build: Don't use GCC-specific linker flags on MSVC
    
    The notion of a symbols map and list file do not apply here on MSVC, as
    we use __declspec(dllexport) to export the symbols.  Also, don't check
    for GCC-specific -Wl,... flags on MSVC builds.

 meson.build | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5cce79f4..cb078205 100644
--- a/meson.build
+++ b/meson.build
@@ -486,21 +486,28 @@ if build_profiler
     libgjs_dependencies += profiler_deps
 endif
 
-symbol_map = files('libgjs.map')
-symbol_list = files('libgjs.symbols')
-link_args = cxx.get_supported_link_arguments([
-    '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
-        symbol_map[0]),
-    '-Wl,-exported_symbols_list,@0@/@1@'.format(meson.current_source_dir(),
-        symbol_list[0]),  # macOS linker
-])
-
-if cxx.has_link_argument('-Wl,-no-undefined')
-    link_args += '-Wl,-no-undefined'
+if cxx.get_id() == 'msvc'
+    # We use __declspec(dllexport) on MSVC builds.
+    symbol_map = []
+    symbol_list = []
+    link_args = []
 else
-    # -undefined error is the equivalent of -no-undefined for the macOS linker,
-    # but -undefined would also be understood as a valid argument for GNU ld!
-    link_args += cxx.get_supported_link_arguments('-Wl,-undefined,error')
+    symbol_map = files('libgjs.map')
+    symbol_list = files('libgjs.symbols')
+    link_args = cxx.get_supported_link_arguments([
+        '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
+            symbol_map[0]),
+        '-Wl,-exported_symbols_list,@0@/@1@'.format(meson.current_source_dir(),
+            symbol_list[0]),  # macOS linker
+    ])
+
+    if cxx.has_link_argument('-Wl,-no-undefined')
+        link_args += '-Wl,-no-undefined'
+    else
+        # -undefined error is the equivalent of -no-undefined for the macOS linker,
+        # but -undefined would also be understood as a valid argument for GNU ld!
+        link_args += cxx.get_supported_link_arguments('-Wl,-undefined,error')
+    endif
 endif
 
 libgjs_cpp_args = ['-DGJS_COMPILATION']


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]