However, I do have several Visual Studios available:
>set vs
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
The problem is that setup.py uses distutils to compile the distorm3 DLL. However, distutils is designed for building Python extensions and on Windows they need to be built with the same compiler the Python executable was built with:
>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Version MSC v.1500 is Visual Studio 2008 a.k.a MSVC++ 9.0.
I don't have that over 9 years old compiler installed any more, so setup.py fails. However, any of my newer compilers is capable of building the distorm3 DLL and there already is make\win32\distorm.sln to do exactly that.
This PR modifies setup.py to automatically pick the latest installed Visual Studio and use msbuild to build distorm.sln. This makes it much easier to build the Python package and removes the duplication of DLL build configuration in setup.py and the solution file.
Trying to build the Python package of distorm3, I get this:
However, I do have several Visual Studios available:
The problem is that setup.py uses distutils to compile the distorm3 DLL. However, distutils is designed for building Python extensions and on Windows they need to be built with the same compiler the Python executable was built with:
Version
MSC v.1500
isVisual Studio 2008
a.k.aMSVC++ 9.0
.I don't have that over 9 years old compiler installed any more, so setup.py fails. However, any of my newer compilers is capable of building the distorm3 DLL and there already is
make\win32\distorm.sln
to do exactly that.This PR modifies setup.py to automatically pick the latest installed Visual Studio and use
msbuild
to builddistorm.sln
. This makes it much easier to build the Python package and removes the duplication of DLL build configuration in setup.py and the solution file.