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



commit 87ffa5069f1c4c7b13cf4d46ecbd0c6550ce6845
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 6346bd85..2da228c1 100644
--- a/meson.build
+++ b/meson.build
@@ -485,21 +485,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
 
 extra_libgjs_cpp_args = []


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