Fix setup.py for MSVC

This commit is contained in:
Yann Diorcet
2017-05-18 11:47:38 +02:00
committed by Jacob Alexander
parent 8361fa8597
commit a7efe4e3f8
2 changed files with 11 additions and 4 deletions

View File

@@ -57,11 +57,14 @@ def test_compilation(cfile, compiler=None, **compiler_attrs):
lpreargs = ['-m32']
else:
lpreargs = ['-m64']
extra = compiler_attrs.get('extra_compile_args', [])
extra += ['--std=c++14']
extra_compile_args = compiler_attrs.get('extra_compile_args', [])
extra_compile_args += ['--std=c++14']
extra_link_args = compiler_attrs.get('extra_link_args', [])
if cc.compiler_type == 'msvc':
extra_link_args += ['/MANIFEST']
objs = cc.compile([cfile], extra_preargs=cpreargs, extra_postargs=extra)
cc.link_executable(objs, efile, extra_preargs=lpreargs)
objs = cc.compile([cfile], extra_preargs=cpreargs, extra_postargs=extra_compile_args)
cc.link_executable(objs, efile, extra_preargs=lpreargs, extra_postargs=extra_link_args)
return efile
def compile_and_run(basedir, src, compiler=None, **compiler_attrs):

View File

@@ -24,6 +24,8 @@ def customize_mingw(cc):
if 'msvcr90' in cc.dll_libraries:
cc.dll_libraries.remove('msvcr90')
def customize_msvc(cc):
pass
def get_compiler(compiler, **compiler_attrs):
"""get and customize a compiler"""
@@ -32,6 +34,8 @@ def get_compiler(compiler, **compiler_attrs):
customize_compiler(cc)
if cc.compiler_type == 'mingw32':
customize_mingw(cc)
elif cc.compiler_type == 'msvc':
customize_msvc(cc)
else:
cc = compiler