Skip to content

Commit

Permalink
[package] produce binary wheels for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine committed Apr 15, 2020
1 parent e134766 commit e3efe3b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,33 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install nasm
if: matrix.os == 'windows-latest'
run: choco install -y nasm
- name: Install nmake
if: matrix.os == 'windows-latest'
run: |
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify `
--installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --passive --norestart
shell: powershell
- name: Build wheels
env:
CIBW_BEFORE_BUILD: scripts/build-openssl /tmp/vendor
CIBW_BEFORE_BUILD_WINDOWS: scripts\build-openssl.bat C:\cibw\vendor
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS=ipv6,loss CFLAGS=-I/tmp/vendor/include LDFLAGS=-L/tmp/vendor/lib
CIBW_ENVIRONMENT_WINDOWS: AIOQUIC_SKIP_TESTS=ipv6,loss CL="/IC:\cibw\vendor\include" LINK="/LIBPATH:C:\cibw\vendor\lib"
CIBW_SKIP: cp27-* cp33-* cp34-* cp35-* pp27-*
CIBW_TEST_COMMAND: python -m unittest discover -t {project} -s {project}/tests
run: |
pip install cibuildwheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-openssl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ done
mkdir openssl
curl -L https://www.openssl.org/source/openssl-1.1.1f.tar.gz | tar xz -C openssl --strip-components 1
cd openssl
./config --prefix=$destdir no-dtls no-shared no-ssl no-tests no-tls

./config --prefix=$destdir no-comp no-shared no-tests
make
make install_sw
39 changes: 39 additions & 0 deletions scripts/build-openssl.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
set destdir=%1
set cachedir=%1.%PYTHON_ARCH%

for %%d in (openssl %destdir%) do (
if exist %%d (
rmdir /s /q %%d
)
)

if %PYTHON_ARCH% == 64 (
set OPENSSL_CONFIG=VC-WIN64A
set VC_ARCH=x64
) else (
set OPENSSL_CONFIG=VC-WIN32
set VC_ARCH=x86
)

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VC_ARCH%
SET PATH=%PATH%;C:\Program Files\NASM

if not exist %cachedir% (
mkdir openssl
curl -L https://www.openssl.org/source/openssl-1.1.1f.tar.gz -o openssl.tar.gz
tar xzf openssl.tar.gz -C openssl --strip-components 1
cd openssl

perl Configure no-comp no-shared no-tests %OPENSSL_CONFIG%
nmake

mkdir %cachedir%
mkdir %cachedir%\include
mkdir %cachedir%\lib
xcopy include %cachedir%\include\ /E
copy libcrypto.lib %cachedir%\lib\
copy libssl.lib %cachedir%\lib\
)

mkdir %destdir%
xcopy %cachedir% %destdir% /E
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

if sys.platform == "win32":
extra_compile_args = []
libraries = ["libcrypto"]
libraries = ["libcrypto", "advapi32", "crypt32", "gdi32", "user32", "ws2_32"]
else:
extra_compile_args = ["-std=c99"]
libraries = ["crypto"]
Expand Down

0 comments on commit e3efe3b

Please sign in to comment.