summaryrefslogtreecommitdiff
path: root/numpy/distutils
diff options
context:
space:
mode:
authorMatthew Brett <matthew.brett@gmail.com>2022-06-29 20:06:44 +0100
committerMatthew Brett <matthew.brett@gmail.com>2022-06-29 21:28:29 +0100
commit0fa10479209618f09febb6dc49cc79266d8aea88 (patch)
tree0b3a3d472394b03655fa78aa6b5437053b8d0b0a /numpy/distutils
parent2c79206d6048886635d5548721de0017c3fd9e74 (diff)
downloadnumpy-0fa10479209618f09febb6dc49cc79266d8aea88.tar.gz
Fix lib flags for librandom
Add the voltbl fix to librandom. Remove SSE flag for GCC on 32-bit Windows, it's the default.
Diffstat (limited to 'numpy/distutils')
-rw-r--r--numpy/distutils/msvccompiler.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/distutils/msvccompiler.py b/numpy/distutils/msvccompiler.py
index 681a254b8..2b93221ba 100644
--- a/numpy/distutils/msvccompiler.py
+++ b/numpy/distutils/msvccompiler.py
@@ -56,3 +56,21 @@ class MSVCCompiler(_MSVCCompiler):
if platform_bits == 32:
self.compile_options += ['/arch:SSE2']
self.compile_options_debug += ['/arch:SSE2']
+
+
+def lib_opts_if_msvc(build_cmd):
+ """ Add flags if we are using MSVC compiler
+
+ We can't see `build_cmd` in our scope, because we have not initialized
+ the distutils build command, so use this deferred calculation to run
+ when we are building the library.
+ """
+ if build_cmd.compiler.compiler_type != 'msvc':
+ return []
+ # Explicitly disable whole-program optimization.
+ flags = ['/GL-']
+ # Disable voltbl section for vc142 to allow link using mingw-w64; see:
+ # https://github.com/matthew-brett/dll_investigation/issues/1#issuecomment-1100468171
+ if build_cmd.compiler_opt.cc_test_flags(['-d2VolatileMetadata-']):
+ flags.append('-d2VolatileMetadata-')
+ return flags