diff options
author | Matti Picus <matti.picus@gmail.com> | 2022-04-21 07:39:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 07:39:12 +0300 |
commit | a5ae25039c9cbb525a420165cad559c7edfd6eab (patch) | |
tree | 0e3f9ab0c8f716b6de0c48039cd827f53e7eadd7 /numpy | |
parent | f44653454685d92cb4f19862c15027f7227a7858 (diff) | |
parent | 422701d0f8b03d5552a7ed6b6eea0ffdbfd3dadf (diff) | |
download | numpy-a5ae25039c9cbb525a420165cad559c7edfd6eab.tar.gz |
Merge pull request #21360 from matthew-brett/no-msvc-voltab
MAINT: Add compile flag to disable voltbl on MSVC 142
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/setup.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index c632d60e8..a92bda90c 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -774,24 +774,29 @@ def configuration(parent_package='',top_path=None): join('src', 'npymath', 'halffloat.c') ] - def gl_if_msvc(build_cmd): - """ Add flag if we are using MSVC compiler + def opts_if_msvc(build_cmd): + """ Add flags if we are using MSVC compiler - We can't see this 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. + 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': - # explicitly disable whole-program optimization - return ['/GL-'] - return [] + 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 config.add_installed_library('npymath', sources=npymath_sources + [get_mathlib_info], install_dir='lib', build_info={ 'include_dirs' : [], # empty list required for creating npy_math_internal.h - 'extra_compiler_args': [gl_if_msvc], + 'extra_compiler_args': [opts_if_msvc], }) config.add_npy_pkg_config("npymath.ini.in", "lib/npy-pkg-config", subst_dict) |