Skip to content

Commit 95355fd

Browse files
committed
fix building for conda
* update recipes to follow developments in conda-build * fix cmakelists.txt and setup.py * base version calculation on git data * do not detect or require cxx from scikit-build/cmake
1 parent 2d19788 commit 95355fd

File tree

9 files changed

+150
-235
lines changed

9 files changed

+150
-235
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ if (CMAKE_VERSION VERSION_GREATER "3.11.99")
66
cmake_policy(SET CMP0074 NEW)
77
endif()
88

9-
project(slycot VERSION ${SLYCOT_VERSION})
9+
project(slycot VERSION ${SLYCOT_VERSION} LANGUAGES NONE)
1010

1111
# Fortran detection fails on windows, use the CMAKE_C_SIMULATE flag to
1212
# force success
1313
if(WIN32)
1414
set(CMAKE_Fortran_SIMULATE_VERSION 19.0)
15-
# set(CMAKE_Fortran_COMPILER_FORCED TRUE)
16-
# set(CMAKE_C_COMPILER_VERSION 19.0)
1715
endif()
1816

17+
# this does not seem to work, maybe scikit-build's doing? the cxx compiler is
18+
# still tested
1919
enable_language(C)
2020
enable_language(Fortran)
2121

conda-recipe-openblas/bld.bat

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,13 @@
22
cd %RECIPE_DIR%
33
cd ..
44

5-
:: indicating fortran compiler is essential
6-
set FC=%BUILD_PREFIX%\Library\bin\flang.exe
5+
:: Clear old build attempts
6+
RD /S /Q _skbuild
77

8-
:: The batch file created by conda-build sets a load of environment variables
9-
:: Building worked fine without conda; apparently one or more of these
10-
:: variables produce test & link failures. Resetting most of these here
11-
set ARCH=
12-
set BUILD=
13-
set BUILD_PREFIX=
14-
set CMAKE_GENERATOR=
15-
set CommandPromptType=
16-
set CPU_COUNT=
17-
set DISTUTILS_USE_SDK=
18-
set folder=
19-
set cpu_optimization_target=
20-
set fortran_compiler=
21-
set Framework40Version=
22-
set FrameworkDir=
23-
set FrameworkDIR64=
24-
set FrameworkVersion=
25-
set FrameworkVersion64=
26-
set ignore_build_only_deps=
27-
set CFLAGS=
28-
set CXXFLAGS=
29-
set cxx_compiler=
30-
set c_compiler=
31-
set INCLUDE=
32-
set LDFLAGS_SHARED=
33-
set LIBPATH=
34-
set LIB=;%LIB%
35-
set MSSdk=
36-
set MSYS2_ARG_CONV_EXCL=
37-
set MSYS2_ENV_CONV_EXCL=
38-
set NETFSXDIR=
39-
set PIP_IGNORE_INSTALLED=
40-
set platform=
41-
set WindowsLibPath=
42-
set WindowsSdkDir=
43-
set CYGWIN_PREFIX=
44-
set SRC_DIR=
45-
set STDLIB_DIR=
46-
set SUBDIR=
47-
set SYS_PREFIX=
48-
set target_platform=
49-
set UCRTVersion=
50-
set UniversalCRTSdkDir=
51-
set VCINSTALLDIR=
52-
set vc=
53-
set win=
54-
set VisualStudioVersion=
55-
set VSINSTALLDIR=
56-
set VSREGKEY=
57-
set VS_MAJOR=
58-
set VS_VERSION=
59-
set VS_YEAR=
60-
set WindowsSDKLibVersion=
61-
set WindowsSDKVersion=
62-
set WindowsSDKExecutablePath_x64=
63-
set WindowsSDKExecutablePath_x86=
64-
65-
:: information on remaining variables
66-
set
67-
68-
set BLAS_ROOT=%CONDA_PREFIX%
69-
set LAPACK_ROOT=%CONDA_PREFIX%
8+
set BLAS_ROOT=%PREFIX%
9+
set LAPACK_ROOT=%PREFIX%
10+
set NUMPY_INCLUDE=%PREFIX%\Include
11+
set F2PY=%PREFIX%\Scripts\f2py.exe
7012

7113
"%PYTHON%" setup.py install
7214

conda-recipe-openblas/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ cd $RECIPE_DIR/..
33

44
# specify where CMAKE will search for lapack and blas
55
# needs recent cmake (conda's 3.12) and policy CMP0074 NEW
6-
export BLAS_ROOT=${CONDA_PREFIX}
7-
export LAPACK_ROOT=${CONDA_PREFIX}
6+
# the ${PREFIX} points to conda-build's host environment
7+
export BLAS_ROOT=${PREFIX}
8+
export LAPACK_ROOT=${PREFIX}
89

10+
# ensure we are not building with old cmake files
11+
rm -rf _skbuild
12+
13+
# do the build
914
$PYTHON setup.py install

conda-recipe-openblas/meta.yaml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,55 @@
11
package:
22
name: slycot
3-
version: "0.3.3"
3+
version: {{ environ.get('GIT_DESCRIBE_TAG', 'v0.0.0')[1:] }}
4+
5+
source:
6+
git_url: ../
47

58
build:
6-
number: 0
9+
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
10+
string: py{{ environ.get('PY_VER').replace('.', '') }}{{ environ.get('GIT_DESCRIBE_HASH', '') }}_obl_{{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
711

812
requirements:
9-
host:
10-
- python {{PY_VER}}
11-
- flang # [win]
12-
- {{ compiler('c') }} # [win]
13-
- {{ compiler('fortran') }} # [not win]
14-
- numpy
15-
- scikit-build >=0.8.0
16-
1713
build:
18-
- numpy
19-
- libflang # [win]
20-
- libgfortran # [not win]
14+
- python {{ PY_VER }}
15+
- numpy >=1.16
16+
- openblas >=0.3.0
17+
- {{ compiler('c') }} # [not osx]
18+
- gcc # [osx]
19+
- {{ compiler('fortran') }} # [linux]
20+
- scikit-build >=0.8.0
21+
22+
host:
23+
- python {{ PY_VER }}
24+
- flang # [win]
25+
- numpy >=1.16
2126
- openblas >=0.3.0
27+
- libgfortran-ng # [not-win]
28+
- libgcc-ng # [linux]
29+
- scikit-build >=0.8.0
2230
# on Windows, this relies on having visual studio CE 2015
2331
# this link needed quite some searching, please do not delete!
2432
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409
2533

2634
run:
27-
- numpy
35+
- python {{ PY_VER }}
36+
- numpy >=1.16
2837
- openblas >=0.3.0
29-
- libgfortran # [not win]
30-
- libflang # [win]
38+
- libgfortran-ng # [not win]
39+
- libgcc-ng # [linux]
40+
- libflang # [win]
3141

3242
test:
3343
requires:
34-
- numpy
35-
- openblas
3644
- python {{PY_VER}}
37-
- libgfortran # [not win]
38-
- libflang # [win]
3945
imports:
4046
- slycot
4147

4248
about:
4349
home: https://github.com/python-control/slycot
4450
license: GPLv2
4551
summary: 'A wrapper for the SLICOT control and systems library'
52+
53+
# on OSX, the SDK for 10.9 is currently needed
54+
# download the 10.9 sdk from https://github.com/phracker/MacOSX-SDKs/releases
55+
# unpack and set environment variable CONDA_BUILD_SYSROOT to that location

conda-recipe/bld.bat

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
cd %RECIPE_DIR%
33
cd ..
44

5-
set F77=%BUILD_PREFIX%\Library\bin\flang.exe
6-
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
5+
:: clean old build attempts
6+
RD /S /Q _skbuild
7+
8+
set BLAS_ROOT=%PREFIX%
9+
set LAPACK_ROOT=%PREFIX%
10+
set NUMPY_INCLUDE=%PREFIX%\Include
11+
set F2PY=%PREFIX%\Scripts\f2py.exe
712

8-
"%PYTHON%" setup.py build
913
"%PYTHON%" setup.py install
1014

1115
if errorlevel 1 exit 1

conda-recipe/build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
cd $RECIPE_DIR/..
2+
3+
# specify where CMAKE will search for lapack and blas
4+
# needs recent cmake (conda's 3.12) and policy CMP0074 NEW
5+
# the ${PREFIX} points to conda-build's host environment
6+
export BLAS_ROOT=${PREFIX}
7+
export LAPACK_ROOT=${PREFIX}
8+
9+
# ensure we are not building with old cmake files
10+
rm -rf _skbuild
11+
12+
env
13+
14+
# do the build
215
$PYTHON setup.py install

conda-recipe/meta.yaml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
11
package:
22
name: slycot
3-
version: "0.3.3"
3+
version: {{ environ.get('GIT_DESCRIBE_TAG', 'v0.0.0')[1:] }}
4+
5+
source:
6+
git_url: ../
47

58
build:
6-
number: 0
9+
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
10+
string: py{{ environ.get('PY_VER').replace('.', '') }}{{ environ.get('GIT_DESCRIBE_HASH', '') }}_mkl_{{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
711

812
requirements:
9-
host:
13+
# note: the osx build is with gcc for now, due to problems with the
14+
# conda-supplied clang and library linking see e.g.
15+
# https://github.com/conda-forge/mpi-feedstock issue #4
16+
# conda-forge might have the configuration in place for clang build and link?
17+
build:
1018
- python {{PY_VER}}
11-
- numpy
12-
- flang # [win]
13-
- {{ compiler('c') }} # [win]
14-
- {{ compiler('fortran') }} # [not win]
15-
- scikit-build >=0.8.0
19+
- numpy >=1.16
20+
- {{ compiler('c') }} # [not osx]
21+
- gcc # [osx]
22+
- {{ compiler('fortran') }} # [linux]
23+
- scikit-build >=0.8.0
1624

17-
build:
18-
- numpy
19-
- libflang # [win]
20-
- libgfortran # [not win]
21-
- lapack
25+
host:
26+
- python {{ PY_VER }}
27+
- flang # [win]
28+
- numpy >=1.16
29+
- mkl
30+
- libgfortran-ng # [not win]
31+
- libgcc-ng # [linux]
32+
- libflang # [win]
33+
- scikit-build >=0.8.0
2234
# on Windows, this relies on having visual studio CE 2015
2335
# this link needed quite some searching, please do not delete!
2436
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409
2537

2638
run:
27-
- numpy
28-
- lapack
29-
- libgfortran # [not win]
30-
- libflang # [win]
39+
- python {{ PY_VER }}
40+
- numpy >=1.16
41+
- mkl
42+
- libgfortran-ng # [not win]
43+
- libgcc-ng # [linux]
44+
- libflang # [win]
3145

3246
test:
3347
requires:
34-
- numpy
35-
- lapack
3648
- python {{PY_VER}}
37-
- libgfortran # [not win]
38-
- libflang # [win]
3949
imports:
4050
- slycot
4151

0 commit comments

Comments
 (0)