Build wxPython using VisualStudio 2019

Hello everyone,

is it possible to build wxPython 4.1.1 on Windows using only Visual Studio 2019?
After quickly browsing the build scripts I had the impression that VS2019 is not supported yet.
The build script did find my installation of VS2015 (it seems to be a fallback if the specific version used to build the python interpreter is not found). When I “hided” the VS2015 installation, the VS2019 was found not by the build script.
As far as I understand, the Python 3.9 is built using VS2019 so it should be possible to build wxPython for Python 3.9 using VS2019 (?)

Are there plans to support Visual Studio 2019 or am I missing something?

cheers
Detlef

well, it’s not really a matter of the Visual Studio version, but of the compiler version. Python 3.5+ is compiled with the visual c++ 14 compiler. So, you have to compile wxPython with that compiler too, to make it work.

Hi there,

I agree to what you say about the compiler version. In fact the wxPython build script determines the correct compiler from the target Python distribution (which is passed as a command line argument).

However, Python 3.9.7 is built using Visual Studio 2019, as the interpreter tells me on startup:

python.exe

Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:05:41) [MSC v.1929 32 bit (Intel)] on win32

According to

v.1929 corresponds to Visual Studio 2019-Version 16.10, 16.11

So it should be possible/mandatory to build wxPython using VS2019, when used with Python 3.9.7?

On a system that contains only VS 2019 and Python 3.9.7, that is built with VS2019, it should be possible to build wxPython using VS 2019. Right?

I know that at some point, Microsoft introduced binary compatibility in the C++ runtime, so that it is possible to use the same binary (of wxPython) with different Python distributions. I guess this explains that it is possible to build wxPython using VS 2015 for a Python interpreter built with VS 2019.

Cheers
Detlef

try this:

git clone https://github.com/wxWidgets/Phoenix.git
cd Phoenix
git checkout tags/wxPython-4.1.1 -b 4.1.1

git submodule update --init --recursive
set DISTUTILS_USE_SDK=1
set SET MSSdk=1
set VS140COMNTOOLS=%VS160COMNTOOLS%

# (important!) disable all calls to checkCompiler function in build.py

python build.py dox etg --nodoc sip build