Fix setup.py for MSVC
This commit is contained in:
committed by
Jacob Alexander
parent
8361fa8597
commit
a7efe4e3f8
@@ -57,11 +57,14 @@ def test_compilation(cfile, compiler=None, **compiler_attrs):
|
|||||||
lpreargs = ['-m32']
|
lpreargs = ['-m32']
|
||||||
else:
|
else:
|
||||||
lpreargs = ['-m64']
|
lpreargs = ['-m64']
|
||||||
extra = compiler_attrs.get('extra_compile_args', [])
|
extra_compile_args = compiler_attrs.get('extra_compile_args', [])
|
||||||
extra += ['--std=c++14']
|
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)
|
objs = cc.compile([cfile], extra_preargs=cpreargs, extra_postargs=extra_compile_args)
|
||||||
cc.link_executable(objs, efile, extra_preargs=lpreargs)
|
cc.link_executable(objs, efile, extra_preargs=lpreargs, extra_postargs=extra_link_args)
|
||||||
return efile
|
return efile
|
||||||
|
|
||||||
def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
|
def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ def customize_mingw(cc):
|
|||||||
if 'msvcr90' in cc.dll_libraries:
|
if 'msvcr90' in cc.dll_libraries:
|
||||||
cc.dll_libraries.remove('msvcr90')
|
cc.dll_libraries.remove('msvcr90')
|
||||||
|
|
||||||
|
def customize_msvc(cc):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_compiler(compiler, **compiler_attrs):
|
def get_compiler(compiler, **compiler_attrs):
|
||||||
"""get and customize a compiler"""
|
"""get and customize a compiler"""
|
||||||
@@ -32,6 +34,8 @@ def get_compiler(compiler, **compiler_attrs):
|
|||||||
customize_compiler(cc)
|
customize_compiler(cc)
|
||||||
if cc.compiler_type == 'mingw32':
|
if cc.compiler_type == 'mingw32':
|
||||||
customize_mingw(cc)
|
customize_mingw(cc)
|
||||||
|
elif cc.compiler_type == 'msvc':
|
||||||
|
customize_msvc(cc)
|
||||||
else:
|
else:
|
||||||
cc = compiler
|
cc = compiler
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user