|
1 | | -:: EXPECTED ENV VARS: TARGET_ARCH (either x86 or x64) |
2 | | -:: CONDA_PY (either 27, 33, 35 etc. - only major version is extracted) |
| 1 | +:: To build extensions for 64 bit Python 3.5 or later no special environment needs |
| 2 | +:: to be configured. |
3 | 3 | :: |
4 | | -:: |
5 | | -:: To build extensions for 64 bit Python 3, we need to configure environment |
| 4 | +:: To build extensions for 64 bit Python 3.4 or earlier, we need to configure environment |
6 | 5 | :: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: |
7 | 6 | :: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) |
8 | 7 | :: |
9 | 8 | :: To build extensions for 64 bit Python 2, we need to configure environment |
10 | 9 | :: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: |
11 | 10 | :: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) |
12 | 11 | :: |
13 | | -:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific |
14 | | -:: environment configurations. |
| 12 | +:: 32 bit builds do not require specific environment configurations. |
15 | 13 | :: |
16 | 14 | :: Note: this script needs to be run with the /E:ON and /V:ON flags for the |
17 | 15 | :: cmd interpreter, at least for (SDK v7.0) |
18 | 16 | :: |
19 | 17 | :: More details at: |
20 | 18 | :: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows |
21 | | -:: http://stackoverflow.com/a/13751649/163740 |
22 | | -:: |
23 | | -:: Author: Phil Elson |
24 | | -:: Original Author: Olivier Grisel (https://github.com/ogrisel/python-appveyor-demo) |
25 | | -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ |
26 | | -:: |
27 | | -:: Notes about batch files for Python people: |
28 | | -:: |
29 | | -:: Quotes in values are literally part of the values: |
30 | | -:: SET FOO="bar" |
31 | | -:: FOO is now five characters long: " b a r " |
32 | | -:: If you don't want quotes, don't include them on the right-hand side. |
| 19 | +:: https://stackoverflow.com/a/13751649/163740 |
33 | 20 | :: |
34 | | -:: The CALL lines at the end of this file look redundant, but if you move them |
35 | | -:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y |
36 | | -:: case, I don't know why. |
| 21 | +:: Original Author: Olivier Grisel |
| 22 | +:: License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/ |
| 23 | +:: This version based on updates for python 3.5 by Phil Elson at: |
| 24 | +:: https://github.com/pelson/Obvious-CI/tree/master/scripts |
| 25 | + |
37 | 26 | @ECHO OFF |
38 | 27 |
|
39 | 28 | SET COMMAND_TO_RUN=%* |
40 | 29 | SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows |
41 | 30 |
|
42 | | -:: Extract the major and minor versions, and allow for the minor version to be |
43 | | -:: more than 9. This requires the version number to have two dots in it. |
44 | | -SET MAJOR_PYTHON_VERSION=%CONDA_PY:~0,1% |
45 | | - |
46 | | -IF "%CONDA_PY:~2,1%" == "" ( |
47 | | - :: CONDA_PY style, such as 27, 34 etc. |
48 | | - SET MINOR_PYTHON_VERSION=%CONDA_PY:~1,1% |
49 | | -) ELSE ( |
50 | | - IF "%CONDA_PY:~3,1%" == "." ( |
51 | | - SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,1% |
52 | | - ) ELSE ( |
53 | | - SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,2% |
54 | | - ) |
55 | | -) |
56 | | - |
57 | | -:: Based on the Python version, determine what SDK version to use, and whether |
58 | | -:: to set the SDK for 64-bit. |
59 | | -IF %MAJOR_PYTHON_VERSION% == 2 ( |
| 31 | +SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" |
| 32 | +SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% |
| 33 | +IF %MAJOR_PYTHON_VERSION% == "2" ( |
60 | 34 | SET WINDOWS_SDK_VERSION="v7.0" |
61 | 35 | SET SET_SDK_64=Y |
62 | | -) ELSE ( |
63 | | - IF %MAJOR_PYTHON_VERSION% == 3 ( |
64 | | - SET WINDOWS_SDK_VERSION="v7.1" |
65 | | - IF %MINOR_PYTHON_VERSION% LEQ 4 ( |
66 | | - SET SET_SDK_64=Y |
67 | | - ) ELSE ( |
68 | | - SET SET_SDK_64=N |
69 | | - ) |
| 36 | +) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( |
| 37 | + SET WINDOWS_SDK_VERSION="v7.1" |
| 38 | + IF %MINOR_PYTHON_VERSION% LEQ 4 ( |
| 39 | + SET SET_SDK_64=Y |
70 | 40 | ) ELSE ( |
71 | | - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" |
72 | | - EXIT /B 1 |
| 41 | + SET SET_SDK_64=N |
73 | 42 | ) |
| 43 | +) ELSE ( |
| 44 | + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" |
| 45 | + EXIT 1 |
74 | 46 | ) |
75 | 47 |
|
76 | | -IF "%TARGET_ARCH%"=="x64" ( |
| 48 | +IF "%PYTHON_ARCH%"=="64" ( |
77 | 49 | IF %SET_SDK_64% == Y ( |
78 | 50 | ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture |
79 | 51 | SET DISTUTILS_USE_SDK=1 |
80 | 52 | SET MSSdk=1 |
81 | 53 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% |
82 | 54 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release |
83 | 55 | ECHO Executing: %COMMAND_TO_RUN% |
84 | | - call %COMMAND_TO_RUN% || EXIT /B 1 |
85 | | - ) ELSE ( |
| 56 | + call %COMMAND_TO_RUN% || EXIT 1 |
| 57 | + ) ELSE ( |
86 | 58 | ECHO Using default MSVC build environment for 64 bit architecture |
87 | 59 | ECHO Executing: %COMMAND_TO_RUN% |
88 | | - call %COMMAND_TO_RUN% || EXIT /B 1 |
| 60 | + call %COMMAND_TO_RUN% || EXIT 1 |
89 | 61 | ) |
90 | 62 | ) ELSE ( |
91 | 63 | ECHO Using default MSVC build environment for 32 bit architecture |
92 | 64 | ECHO Executing: %COMMAND_TO_RUN% |
93 | | - call %COMMAND_TO_RUN% || EXIT /B 1 |
| 65 | + call %COMMAND_TO_RUN% || EXIT 1 |
94 | 66 | ) |
0 commit comments