Skip to content

Commit

Permalink
Allow building windows wheel from CI (#95)
Browse files Browse the repository at this point in the history
* Temporarily disable all jobs

* Add initial windows wheel instructions

* Temporarily disable branches

* Add openblas-download and tweaks

* Allow deploy

* Reenable normal travis, tweaks
  • Loading branch information
diego-plan9 authored Dec 7, 2020
1 parent a552d22 commit f77bc27
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
35 changes: 32 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ branches:
stages:
- Test and lint
- Test multiple python versions
- Build Linux and OSX wheels
- Build wheels

# Parent stage definition, to avoid copy-pasting.
job_compile_common: &job_compile_common
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
dist: bionic
language: python
services: docker
stage: Build Linux and OSX wheels
stage: Build wheels
if: branch =~ /^release\/.*$/
env:
# Use a specific torch version.
Expand All @@ -118,7 +118,7 @@ jobs:
- name: "Build wheel for Python 3.6, 3.7, 3.8 on OS X"
os: osx
osx_image: xcode12.2
stage: Build Linux and OSX wheels
stage: Build wheels
if: branch =~ /^release\/.*$/
addons:
homebrew:
Expand All @@ -138,3 +138,32 @@ jobs:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse --platform macos
<<: *build_deploy_common

- name: "Build wheel for Python 3.6, 3.7, 3.8 on win64"
os: windows
language: shell
stage: Build wheels
if: branch =~ /^release\/win.*$/
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==1.6.0'"
- CIBW_BEFORE_BUILD="pip install torch==1.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html && pip install -r requirements.txt"
- CIBW_BUILD="cp36-win_amd64 cp37-win_amd64 cp38-win_amd64"
# Use unzipped OpenBLAS.
- OPENBLAS_ROOT=C:\\BLAS
- OPENBLAS_ROOT_DIR=C:\\BLAS
before_install:
# Install base python, and ensure it's on the PATH.
- choco install python --version 3.8.6
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
# Download and unzip OpenBLAS.
- wget https://github.com/xianyi/OpenBLAS/releases/download/v0.3.12/OpenBLAS-0.3.12-x64.zip -q -O openblas.zip
- mkdir C:\\BLAS
- 7z x openblas.zip -oc:\\BLAS
install:
- python3 -m pip install cibuildwheel==1.6.4
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse
<<: *build_deploy_common
9 changes: 8 additions & 1 deletion cmake/Modules/FindOpenBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ SET(Open_BLAS_LIB_SEARCH_PATHS
)

FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES openblas_config.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
if(WIN32)
# The official OpenBLAS github releases (-x64) name the library
# `libopenblas.*`, whereas the default `CMAKE_FIND_LIBRARY_PREFIXES` does
# not contain `lib`.
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas libopenblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
else()
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
endif()
# maybe add the openblasp64 if available

SET(OpenBLAS_FOUND ON)
Expand Down

0 comments on commit f77bc27

Please sign in to comment.