Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Using scikit-build as buildsystem
  • Loading branch information
repagh committed Aug 21, 2018
commit b3168f477708cc5a65af185c5294f4d924f7d03e
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ before_install:
- if [[ $TEST_CONDA == 0 ]]; then
sudo apt-get install liblapack-dev libblas-dev;
sudo apt-get install gfortran;
sudo apt-get install cmake;
fi

install:
Expand Down Expand Up @@ -46,6 +47,11 @@ install:
# Make sure that fortran compiler can find conda libraries
#
- export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib";

# pip install scikit-build, one in conda repos is currently too old
- if [[ $TEST_CONDA == 0 ]]; then
pip install https://github.com/scikit-build/scikit-build/archive/0.7.1.zip;
fi
#
# Install the slycot package (two ways, to improve robustness). For the
# conda version, need to install lapack from conda-forge (no way to specify
Expand All @@ -56,11 +62,10 @@ install:
#
- if [[ $TEST_CONDA == 1 ]]; then
conda config --append channels conda-forge;
conda build --python "$TRAVIS_PYTHON_VERSION" conda-recipe;
conda install -c conda-forge lapack;
conda build --python "$TRAVIS_PYTHON_VERSION" conda-recipe-openblas;
conda install --override-channels -c local slycot;
else
LAPACKLIBS=lapack:blas python setup.py install;
python setup.py install;
fi
#
# coveralls not in conda repos :-(
Expand Down
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CMake file for use in conjunction with scikit-build

cmake_minimum_required(VERSION 3.4.0)

if (CMAKE_VERSION VERSION_GREATER "3.11.0")
cmake_policy(SET CMP0074 NEW)
endif()

project(slycot VERSION ${SLYCOT_VERSION})

# Fortran detection fails on windows, use the CMAKE_C_SIMULATE flag to
# force success
if(WIN32)
set(CMAKE_Fortran_SIMULATE_VERSION 19.0)
# set(CMAKE_Fortran_COMPILER_FORCED TRUE)
# set(CMAKE_C_COMPILER_VERSION 19.0)
endif()

enable_language(C)
enable_language(Fortran)

find_package(PythonLibs REQUIRED)
find_package(NumPy REQUIRED)
#set(BLA_VENDOR "OpenBLAS")
find_package(LAPACK REQUIRED)
message(STATUS "LAPACK: ${LAPACK_LIBRARIES}")
message(STATUS "Slycot version: ${SLYCOT_VERSION}")

# find python, standard packages, F2PY find flaky on Windows
if (NOT WIN32)
find_package(F2PY REQUIRED)
endif()

# pic option for flang not correct, remove for Windows
if (WIN32)
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "")
endif()

# base site dir, use python installation for location specific includes
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
"from distutils.sysconfig import get_python_lib as pl; print(pl())"
OUTPUT_VARIABLE PYTHON_SITE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(WIN32)
string(REPLACE "\\" "/" PYTHON_SITE ${PYTHON_SITE})
endif()

add_subdirectory(slycot)

81 changes: 77 additions & 4 deletions conda-recipe-openblas/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,89 @@
cd %RECIPE_DIR%
cd ..

set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
:: until scikit-build on conda-forge is updated to 0.6.1 or higher ...
"%PYTHON%" -m pip install "https://github.com/scikit-build/scikit-build/archive/0.7.1.zip"

:: indicating fortran compiler is essential
set FC=%BUILD_PREFIX%\Library\bin\flang.exe

:: The batch file created by conda-build sets a load of environment variables
:: Building worked fine without conda; apparently one or more of these
:: variables produce test & link failures. Resetting most of these here
set ARCH=
set BUILD=
set BUILD_PREFIX=
set CMAKE_GENERATOR=
set CommandPromptType=
set CPU_COUNT=
set DISTUTILS_USE_SDK=
set folder=
set cpu_optimization_target=
set fortran_compiler=
set Framework40Version=
set FrameworkDir=
set FrameworkDIR64=
set FrameworkVersion=
set FrameworkVersion64=
set ignore_build_only_deps=
set CFLAGS=
set CXXFLAGS=
set cxx_compiler=
set c_compiler=
set INCLUDE=
set LDFLAGS_SHARED=
set LIBPATH=
set LIB=;%LIB%
set MSSdk=
set MSYS2_ARG_CONV_EXCL=
set MSYS2_ENV_CONV_EXCL=
set NETFSXDIR=
set PIP_IGNORE_INSTALLED=
set platform=
set WindowsLibPath=
set WindowsSdkDir=
set CYGWIN_PREFIX=
set SRC_DIR=
set STDLIB_DIR=
set SUBDIR=
set SYS_PREFIX=
set target_platform=
set UCRTVersion=
set UniversalCRTSdkDir=
set VCINSTALLDIR=
set vc=
set win=
set VisualStudioVersion=
set VSINSTALLDIR=
set VSREGKEY=
set VS_MAJOR=
set VS_VERSION=
set VS_YEAR=
set WindowsSDKLibVersion=
set WindowsSDKVersion=
set WindowsSDKExecutablePath_x64=
set WindowsSDKExecutablePath_x86=

:: information on remaining variables
set

set BLAS_ROOT=%CONDA_PREFIX%
set LAPACK_ROOT=%CONDA_PREFIX%

"%PYTHON%" setup.py build
"%PYTHON%" setup.py install

:: remove scikit-build again, don't want to include that
"%PYTHON%" -m pip uninstall --yes scikit-build
"%PYTHON%" -m pip uninstall --yes packaging
"%PYTHON%" -m pip uninstall --yes pyparsing
"%PYTHON%" -m pip uninstall --yes setuptools
"%PYTHON%" -m pip uninstall --yes six
"%PYTHON%" -m pip uninstall --yes wheel

if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: http://docs.continlsuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
20 changes: 20 additions & 0 deletions conda-recipe-openblas/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@

cd $RECIPE_DIR/..
# HACK, until scikit-build is updated to 0.7.1 or higher ...
$PYTHON -m pip install \
https://github.com/scikit-build/scikit-build/archive/0.7.1.zip

env

# specify where CMAKE will search for lapack and blas
# needs recent cmake (conda's 3.12) and policy CMP0074 NEW
export BLAS_ROOT=${CONDA_PREFIX}
export LAPACK_ROOT=${CONDA_PREFIX}

$PYTHON setup.py install

# same HACK, remove again
$PYTHON -m pip uninstall --yes scikit-build
$PYTHON -m pip uninstall --yes packaging
$PYTHON -m pip uninstall --yes pyparsing
$PYTHON -m pip uninstall --yes setuptools
$PYTHON -m pip uninstall --yes six
$PYTHON -m pip uninstall --yes wheel
26 changes: 19 additions & 7 deletions conda-recipe-openblas/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@ build:

requirements:
host:
- python {{PY_VER}}
- cmake
- pip
- flang # [win]
- {{ compiler('c') }} # [win]
- {{ compiler('fortran') }} # [not win]
- numpy
- openblas >=0.3.0
build:
- numpy
- pyparsing
- setuptools
- wheel
- six
- packaging
- libflang # [win]
- libgfortran # [not win]
- python

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
- openblas >=0.3.0
# on Windows, this relies on having visual studio CE 2015
# this link needed quite some searching, please do not delete!
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409

run:
- numpy
- openblas >=0.3.0
Expand All @@ -28,7 +36,11 @@ requirements:

test:
requires:
- numpy
- openblas
- python {{PY_VER}}
- libgfortran # [not win]
- libflang # [win]
imports:
- slycot

Expand Down
7 changes: 7 additions & 0 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
cd %RECIPE_DIR%
cd ..

:: until scikit-build is updated to 0.7.1 or higher ...
"%PYTHON%" -m pip install "https://github.com/scikit-build/scikit-build/archive/0.7.1.zip"

set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
set LAPACKLIBS=lapack:blas

"%PYTHON%" setup.py build
"%PYTHON%" setup.py install

:: remove scikit-build again, don't want to include that
"%PYTHON%" -m pip uninstall --yes scikit-build

if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.
Expand Down
6 changes: 5 additions & 1 deletion conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
cd $RECIPE_DIR/..
export LAPACKLIBS=lapack:blas
# HACK, until scikit-build is updated to 0.7.1 or higher ...
$PYTHON -m pip install \
https://github.com/scikit-build/scikit-build/archive/0.7.1.zip
$PYTHON setup.py install
# same HACK
$PYTHON -m pip uninstall --yes scikit-build
26 changes: 19 additions & 7 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@ build:

requirements:
host:
- numpy
- lapack
- libflang # [win]
- libgfortran # [not win]
- python {{PY_VER}}
- cmake
- pip
- numpy
- flang # [win]
- {{ compiler('c') }} # [win]
- {{ compiler('fortran') }} # [not win]

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
- numpy
- pyparsing
- setuptools
- wheel
- six
- packaging
- libflang # [win]
- libgfortran # [not win]
- lapack
# on Windows, this relies on having visual studio CE 2015
# this link needed quite some searching, please do not delete!
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409
Expand All @@ -29,7 +37,11 @@ requirements:

test:
requires:
- numpy
- lapack
- python {{PY_VER}}
- libgfortran # [not win]
- libflang # [win]
imports:
- slycot

Expand Down
Loading