Skip to content

Commit c7c7705

Browse files
authored
Merge pull request pybind#361 from dean0x7d/barebones
Test absence of optional dependencies and CMake automatic discovery functions
2 parents 7b748ce + 14bd10d commit c7c7705

File tree

2 files changed

+53
-53
lines changed

2 files changed

+53
-53
lines changed

.travis.yml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,62 @@ sudo: false
33
matrix:
44
include:
55
- os: linux
6-
compiler: gcc-4.8
76
env: PYTHON=2.7 CPP=11 GCC=4.8
87
addons:
98
apt:
10-
sources:
11-
- ubuntu-toolchain-r-test
12-
- kubuntu-backports # cmake 2.8.12
13-
packages:
14-
- g++-4.8
15-
- cmake
9+
sources: [ubuntu-toolchain-r-test, kubuntu-backports]
10+
packages: [g++-4.8, cmake]
1611
- os: linux
17-
compiler: gcc-4.8
1812
env: PYTHON=3.5 CPP=11 GCC=4.8
1913
addons:
2014
apt:
21-
sources:
22-
- ubuntu-toolchain-r-test
23-
- deadsnakes
24-
- kubuntu-backports # cmake 2.8.12
25-
packages:
26-
- g++-4.8
27-
- python3.5-dev
28-
- cmake
15+
sources: [ubuntu-toolchain-r-test, kubuntu-backports, deadsnakes]
16+
packages: [g++-4.8, cmake, python3.5-dev]
17+
- sudo: true
18+
services: docker
19+
env: PYTHON=2.7 CPP=14 GCC=6
20+
- sudo: true
21+
services: docker
22+
env: PYTHON=3.5 CPP=14 GCC=6
2923
- os: osx
3024
osx_image: xcode7.3
31-
env: PYTHON=2.7 CPP=14
25+
env: PYTHON=2.7 CPP=14 CLANG
3226
- os: osx
3327
osx_image: xcode7.3
34-
env: PYTHON=3.5 CPP=14
35-
- compiler: gcc-6
36-
services: docker
37-
sudo: true
38-
env: PYTHON=2.7 CPP=14 DOCKER=debian:testing NATIVE_DEPS=1
39-
install:
40-
- >
41-
docker exec --tty "$containerid" apt-get -y --no-install-recommends install
42-
python2.7-dev python-pip python-setuptools python-scipy libeigen3-dev
43-
cmake make g++
44-
- compiler: gcc-6
45-
services: docker
46-
sudo: true
47-
env: PYTHON=3.5 CPP=14 DOCKER=debian:testing NATIVE_DEPS=1
48-
install:
49-
- >
50-
docker exec --tty "$containerid" apt-get -y --no-install-recommends install
51-
python3.5-dev python3-pip python3-setuptools python3-scipy libeigen3-dev
52-
cmake make g++
28+
env: PYTHON=3.5 CPP=14 CLANG
29+
# A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen)
30+
# and also tests the automatic discovery functions in CMake (Python version, C++ standard).
31+
- os: linux
32+
env: BAREBONES
33+
addons:
34+
apt:
35+
sources: [ubuntu-toolchain-r-test, kubuntu-backports]
36+
packages: [g++-4.8, cmake]
37+
install: false
5338
# Documentation build:
5439
- os: linux
5540
language: docs
56-
compiler: sphinx
57-
env: PYTHON=2.7 DOCS=1
41+
env: DOCS
5842
install: pip install sphinx sphinx_rtd_theme
5943
script: make -C docs html SPHINX_OPTIONS=-W
6044
cache:
6145
directories:
6246
- $HOME/.cache/pip
63-
- ccache
47+
- $HOME/Library/Caches/pip
6448
before_install:
6549
- |
50+
# Configure build variables
51+
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
52+
if [ -z "$GCC" ]; then export GCC=4.8; fi
53+
export CXX=g++-$GCC CC=gcc-$GCC;
54+
if [ "$GCC" = "6" ]; then export DOCKER=debian:testing CXX=g++ CC=gcc; fi
55+
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
56+
export CXX=clang++ CC=clang;
57+
fi
58+
if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi
59+
if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
60+
- |
61+
# Initialize enviornment
6662
if [ -n "$DOCKER" ]; then
6763
docker pull $DOCKER
6864
export containerid=$(docker run --detach --tty \
@@ -73,36 +69,40 @@ before_install:
7369
docker exec --tty "$containerid" apt-get update
7470
docker exec --tty "$containerid" apt-get -y upgrade
7571
export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
76-
fi
77-
- |
78-
if [ -z "$NATIVE_DEPS" ]; then
72+
else
7973
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
80-
if [ -n "$GCC" ]; then export CXX=g++-$GCC CC=gcc-$GCC; fi
8174
pip install --user --upgrade pip virtualenv
8275
virtualenv -p python$PYTHON venv
8376
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
84-
if [ "${PYTHON:0:1}" = "3" ]; then
85-
PMAJOR=3; brew update; brew install python$PMAJOR;
77+
if [ "$PY" = "3" ]; then
78+
brew update; brew install python$PY;
8679
else
8780
curl -fsSL -O https://bootstrap.pypa.io/get-pip.py
8881
sudo -H python get-pip.py
8982
fi
90-
pip$PMAJOR install --user --upgrade pip virtualenv
91-
python$PMAJOR -m virtualenv venv
83+
pip$PY install --user --upgrade pip virtualenv
84+
python$PY -m virtualenv venv
9285
fi
9386
source venv/bin/activate
9487
fi
9588
install:
9689
- |
97-
pip install numpy scipy
90+
# Install dependencies
91+
if [ -n "$DOCKER" ]; then
92+
docker exec --tty "$containerid" apt-get -y --no-install-recommends install \
93+
python$PYTHON-dev python$PY-pip python$PY-setuptools python$PY-scipy \
94+
libeigen3-dev cmake make g++
95+
else
96+
pip install numpy scipy
9897
99-
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.2.9.tar.gz
100-
tar xzf eigen.tar.gz
101-
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-dc6cfdf9bcec"
98+
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.2.9.tar.gz
99+
tar xzf eigen.tar.gz
100+
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-dc6cfdf9bcec"
101+
fi
102102
script:
103103
- $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
104104
-DPYBIND11_PYTHON_VERSION=$PYTHON
105-
-DPYBIND11_CPP_STANDARD=-std=c++$CPP
105+
-DPYBIND11_CPP_STANDARD=$CPP
106106
-DPYBIND11_WERROR=ON
107107
- $SCRIPT_RUN_PREFIX make pytest -j 2
108108
after_script:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if(NOT MSVC AND NOT PYBIND11_CPP_STANDARD)
4141
endif()
4242

4343
set(PYBIND11_CPP_STANDARD ${PYBIND11_CPP_STANDARD} CACHE STRING
44-
"C++ standard flag, e.g. -std=c++11 or -std=c++14. Defaults to latest available.")
44+
"C++ standard flag, e.g. -std=c++11 or -std=c++14. Defaults to latest available." FORCE)
4545
endif()
4646

4747
# Cache variables so pybind11_add_module can be used in parent projects

0 commit comments

Comments
 (0)