Browse Source

Attempt to fix 64 bit builds on Windows.

Jelmer Vernooij 7 years ago
parent
commit
91ef7633b0
2 changed files with 30 additions and 7 deletions
  1. 9 7
      appveyor.yml
  2. 21 0
      build.cmd

+ 9 - 7
appveyor.yml

@@ -17,6 +17,7 @@ environment:
     - PYTHON: "C:\\Python33-x64"
       PYTHON_VERSION: "3.3.x"
       PYTHON_ARCH: "64"
+      DISTUTILS_USE_SDK: "1"
 
     - PYTHON: "C:\\Python34"
       PYTHON_VERSION: "3.4.x"
@@ -25,6 +26,7 @@ environment:
     - PYTHON: "C:\\Python34-x64"
       PYTHON_VERSION: "3.4.x"
       PYTHON_ARCH: "64"
+      DISTUTILS_USE_SDK: "1"
 
     - PYTHON: "C:\\Python35"
       PYTHON_VERSION: "3.5.x"
@@ -68,26 +70,26 @@ install:
   - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
 
   # Check that we have the expected version and architecture for Python
-  - "python --version"
-  - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
+  - "build.cmd %PYTHON%\\python.exe --version"
+  - "build.cmd %PYTHON%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\""
 
   # Install setuptools/wheel so that we can e.g. use bdist_wheel
   - "pip install setuptools wheel"
 
-  - "python setup.py develop"
+  - "build.cmd %PYTHON%\\python.exe setup.py develop"
 
 build_script:
   # Build the compiled extension
-  - "python setup.py build"
+  - "build.cmd %PYTHON%\\python.exe setup.py build"
 
 test_script:
-  - "python setup.py test"
+  - "build.cmd %PYTHON%\\python.exe setup.py test"
 
 after_test:
-  - "python setup.py bdist_wheel"
+  - "build.cmd %PYTHON%\\python.exe setup.py bdist_wheel"
   # http://stackoverflow.com/questions/43255455/unicode-character-causing-error-with-bdist-wininst-on-python-3-but-not-python-2
   # - "python setup.py bdist_wininst"
-  - "python setup.py bdist_msi"
+  - "build.cmd %PYTHON%\\python.exe setup.py bdist_msi"
   - ps: "ls dist"
 
 artifacts:

+ 21 - 0
build.cmd

@@ -0,0 +1,21 @@
+@echo off
+:: To build extensions for 64 bit Python 3, we need to configure environment
+:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
+:: MS Windows SDK for Windows 7 and .NET Framework 4
+::
+:: More details at:
+:: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows
+
+IF "%DISTUTILS_USE_SDK%"=="1" (
+    ECHO Configuring environment to build with MSVC on a 64bit architecture
+    ECHO Using Windows SDK 7.1
+    "C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
+    CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
+    SET MSSdk=1
+    REM Need the following to allow tox to see the SDK compiler
+    SET TOX_TESTENV_PASSENV=DISTUTILS_USE_SDK MSSdk INCLUDE LIB
+) ELSE (
+    ECHO Using default MSVC build environment
+)
+
+CALL %*