1:: To build extensions for 64 bit Python 3, we need to configure environment 2:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: 3:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) 4:: 5:: To build extensions for 64 bit Python 2, we need to configure environment 6:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: 7:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) 8:: 9:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific 10:: environment configurations. 11:: 12:: Note: this script needs to be run with the /E:ON and /V:ON flags for the 13:: cmd interpreter, at least for (SDK v7.0) 14:: 15:: More details at: 16:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows 17:: http://stackoverflow.com/a/13751649/163740 18:: 19:: Original source: 20:: https://github.com/ogrisel/python-appveyor-demo/blob/master/appveyor/run_with_env.cmd 21:: 22:: Author: Olivier Grisel 23:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ 24@ECHO OFF 25 26SET COMMAND_TO_RUN=%* 27SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows 28SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf 29 30:: Extract the major and minor versions, and allow for the minor version to be 31:: more than 9. This requires the version number to have two dots in it. 32SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% 33IF "%PYTHON_VERSION:~3,1%" == "." ( 34 SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% 35) ELSE ( 36 SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2% 37) 38 39:: Based on the Python version, determine what SDK version to use, and whether 40:: to set the SDK for 64-bit. 41IF %MAJOR_PYTHON_VERSION% == 2 ( 42 SET WINDOWS_SDK_VERSION="v7.0" 43 SET SET_SDK_64=Y 44) ELSE ( 45 IF %MAJOR_PYTHON_VERSION% == 3 ( 46 SET WINDOWS_SDK_VERSION="v7.1" 47 IF %MINOR_PYTHON_VERSION% LEQ 4 ( 48 SET SET_SDK_64=Y 49 ) ELSE ( 50 SET SET_SDK_64=N 51 IF EXIST "%WIN_WDK%" ( 52 :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ 53 REN "%WIN_WDK%" 0wdf 54 ) 55 ) 56 ) ELSE ( 57 ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" 58 EXIT 1 59 ) 60) 61 62IF %PYTHON_ARCH% == 64 ( 63 IF %SET_SDK_64% == Y ( 64 ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture 65 SET DISTUTILS_USE_SDK=1 66 SET MSSdk=1 67 "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% 68 "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release 69 ECHO Executing: %COMMAND_TO_RUN% 70 call %COMMAND_TO_RUN% || EXIT 1 71 ) ELSE ( 72 ECHO Using default MSVC build environment for 64 bit architecture 73 ECHO Executing: %COMMAND_TO_RUN% 74 call %COMMAND_TO_RUN% || EXIT 1 75 ) 76) ELSE ( 77 ECHO Using default MSVC build environment for 32 bit architecture 78 ECHO Executing: %COMMAND_TO_RUN% 79 call %COMMAND_TO_RUN% || EXIT 1 80) 81