MCPcopy Create free account
hub / github.com/numpy/numpy / lib_opts_if_msvc

Function lib_opts_if_msvc

numpy/distutils/msvccompiler.py:61–76  ·  view source on GitHub ↗

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.

(build_cmd)

Source from the content-addressed store, hash-verified

59
60
61def lib_opts_if_msvc(build_cmd):
62 """ Add flags if we are using MSVC compiler
63
64 We can't see `build_cmd` in our scope, because we have not initialized
65 the distutils build command, so use this deferred calculation to run
66 when we are building the library.
67 """
68 if build_cmd.compiler.compiler_type != 'msvc':
69 return []
70 # Explicitly disable whole-program optimization.
71 flags = ['/GL-']
72 # Disable voltbl section for vc142 to allow link using mingw-w64; see:
73 # https://github.com/matthew-brett/dll_investigation/issues/1#issuecomment-1100468171
74 if build_cmd.compiler_opt.cc_test_flags(['-d2VolatileMetadata-']):
75 flags.append('-d2VolatileMetadata-')
76 return flags

Callers 1

lib_optsFunction · 0.90

Calls 1

cc_test_flagsMethod · 0.80

Tested by

no test coverage detected