Skip to content

Commit 7ce2f65

Browse files
committed
fix appveyor environment setup
1 parent b017522 commit 7ce2f65

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

build.cmd

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
1-
@echo off
21
:: To build extensions for 64 bit Python 3, we need to configure environment
32
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
4-
:: MS Windows SDK for Windows 7 and .NET Framework 4
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 do not require specific environment configurations.
10+
::
11+
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
12+
:: cmd interpreter, at least for (SDK v7.0)
513
::
614
:: More details at:
715
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
16+
:: http://stackoverflow.com/a/13751649/163740
17+
::
18+
:: Author: Olivier Grisel
19+
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
20+
@ECHO OFF
821

9-
IF "%DISTUTILS_USE_SDK%"=="1" (
10-
ECHO Configuring environment to build with MSVC on a 64bit architecture
11-
ECHO Using Windows SDK 7.1
12-
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
13-
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
14-
SET MSSdk=1
15-
REM Need the following to allow tox to see the SDK compiler
16-
SET TOX_TESTENV_PASSENV=DISTUTILS_USE_SDK MSSdk INCLUDE LIB
22+
SET COMMAND_TO_RUN=%*
23+
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
24+
25+
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
26+
IF %MAJOR_PYTHON_VERSION% == "2" (
27+
SET WINDOWS_SDK_VERSION="v7.0"
28+
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
29+
SET WINDOWS_SDK_VERSION="v7.1"
1730
) ELSE (
18-
ECHO Using default MSVC build environment
31+
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
32+
EXIT 1
1933
)
2034

21-
CALL %*
35+
IF "%PYTHON_ARCH%"=="64" (
36+
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
37+
SET DISTUTILS_USE_SDK=1
38+
SET MSSdk=1
39+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
40+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
41+
ECHO Executing: %COMMAND_TO_RUN%
42+
call %COMMAND_TO_RUN% || EXIT 1
43+
) ELSE (
44+
ECHO Using default MSVC build environment for 32 bit architecture
45+
ECHO Executing: %COMMAND_TO_RUN%
46+
call %COMMAND_TO_RUN% || EXIT 1
47+
)

0 commit comments

Comments
 (0)