setup.py
changeset 32782 9a4adc76c88a
parent 32725 6c4b58422974
child 32886 19b0fd4b5570
--- a/setup.py	Sat Jun 10 16:00:18 2017 -0700
+++ b/setup.py	Fri Jun 09 22:15:53 2017 -0400
@@ -704,6 +704,23 @@
     class HackedMingw32CCompiler(object):
         pass
 
+if os.name == 'nt':
+    # Allow compiler/linker flags to be added to Visual Studio builds.  Passing
+    # extra_link_args to distutils.extensions.Extension() doesn't have any
+    # effect.
+    from distutils import msvccompiler
+
+    compiler = msvccompiler.MSVCCompiler
+
+    class HackedMSVCCompiler(msvccompiler.MSVCCompiler):
+        def initialize(self):
+            compiler.initialize(self)
+            # "warning LNK4197: export 'func' specified multiple times"
+            self.ldflags_shared.append('/ignore:4197')
+            self.ldflags_shared_debug.append('/ignore:4197')
+
+    msvccompiler.MSVCCompiler = HackedMSVCCompiler
+
 packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
                              'help/*.txt',
                              'help/internals/*.txt',