From bd616e898d61fb9aa70eef1d2e239d08655df5a4 Mon Sep 17 00:00:00 2001 From: KmolYuan Date: Tue, 8 Oct 2019 21:25:03 +0800 Subject: [PATCH] Add MSVC CI builder. --- appveyor.yml | 27 +++++++++++---------------- cython/platform/set_pycompiler.bat | 6 ++++-- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 56b49d6b..338de330 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,8 +6,13 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 PYTHON_DIR: C:\Python36-x64 + COMPILER: mingw32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 PYTHON_DIR: C:\Python37-x64 + COMPILER: mingw32 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + PYTHON_DIR: C:\Python37-x64 + COMPILER: msvc for: - matrix: only: @@ -33,12 +38,10 @@ for: on: APPVEYOR_REPO_NAME: solvespace/solvespace APPVEYOR_REPO_TAG: true - - matrix: only: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON_DIR: C:\Python36-x64 - install: &python-install + install: # Environment variables - set Path=%MSYS_DIR%\mingw64\bin;%MSYS_DIR%\usr\bin;%Path% - set Path=%PYTHON_DIR%;%PYTHON_DIR%\Scripts;%Path% @@ -48,32 +51,24 @@ for: # Upgrade setuptools - pip install setuptools -U # Set Python compiler to MinGW - - cython\platform\set_pycompiler %PYTHON_DIR% + - cython\platform\set_pycompiler %PYTHON_DIR% %COMPILER% # Install modules - pip install -r cython\requirements.txt # Show tool kits - gcc --version - mingw32-make --version - build_script: &python-script + build_script: - cd cython && python setup.py test && cd .. - after_build: &python-deploy + after_build: # PyPI deployment - IF "%APPVEYOR_REPO_TAG%"=="true" - IF "%APPVEYOR_REPO_NAME%"=="KmolYuan/solvespace" ( + IF "%APPVEYOR_REPO_NAME%"=="KmolYuan/solvespace" + IF "%COMPILER%"=="mingw32" ( pip install twine && cd cython && python setup.py bdist_wheel && twine upload dist\*.whl --skip-existing ) - - - matrix: - only: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON_DIR: C:\Python37-x64 - install: *python-install - build_script: *python-script - after_build: *python-deploy - artifacts: - path: build\bin\%BUILD_TYPE%\solvespace.exe name: solvespace.exe diff --git a/cython/platform/set_pycompiler.bat b/cython/platform/set_pycompiler.bat index 03ec1ff1..5d32358e 100644 --- a/cython/platform/set_pycompiler.bat +++ b/cython/platform/set_pycompiler.bat @@ -1,14 +1,16 @@ echo off -REM Usage: set_pycompiler C:\Python37 +REM Usage: set_pycompiler C:\Python37 mingw32 REM Where %PYTHON_DIR% is the directory of your Python installation. +REM Compiler option can be "mingw32" or "msvc". REM In Pyslvs project. set HERE=%~dp0 set PYTHON_DIR=%1 +set COMPILER=%2 REM Create "distutils.cfg" echo [build]>> "%PYTHON_DIR%\Lib\distutils\distutils.cfg" -echo compiler=mingw32>> "%PYTHON_DIR%\Lib\distutils\distutils.cfg" +echo compiler=%COMPILER%>> "%PYTHON_DIR%\Lib\distutils\distutils.cfg" REM Apply the patch of "cygwinccompiler.py". REM Unix "patch" command of Msys.