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)
| 59 | |
| 60 | |
| 61 | def 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 |
no test coverage detected