[Distutils] distutils.command.build_clib: How to add additional compiler flags for cl.exe?

Kim Walisch kim.walisch at gmail.com
Sun Nov 29 10:44:58 EST 2015


Hi,

For distutils.command.build_clib the commonly used code below does not
work for adding additional compiler flags (it works using
distutils.command.build_ext):

extra_compile_args = '-fopenmp'

On Unix-like system I found a workaround which allows to specify
additional compiler flags for distutils.command.build_clib:

cflags = distutils.sysconfig.get_config_var('CFLAGS')
distutils.sysconfig._config_vars['CFLAGS'] = cflags + " -fopenmp"

Unfortunately this does not work with Microsoft's C/C++ compiler
cl.exe.

Does anybody know how I can add additional compiler flags for cl.exe
and distutils.command.build_clib?

Thanks and best regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20151129/5f56e971/attachment.html>


More information about the Distutils-SIG mailing list