feat: new FindPython support (#2370)

* feat: FindPython support

* refactor: rename to PYBIND11_FINDPYTHON

* docs: Caps fixes

* feat: NOPYTHON mode

* test: check simple call

* docs: add changelog/upgrade guide

* feat: Support Python3 and Python2

* refactor: Use targets in tests

* fix: support CMake 3.4+

* feat: classic search also finds virtual environments

* docs: some updates from @wjakob's review

* fix: wrong name for QUIET mode variable, reported by @skoslowski

* refactor: cleaner output messaging

* fix: support debug Python's in FindPython mode too

* fixup! refactor: cleaner output messaging

* fix: missing pybind11_FOUND and pybind11_INCLUDE_DIR restored to subdir mode

* fix: nicer reporting of Python / PyPy

* fix: out-of-order variable fix

* docs: minor last-minute cleanup
This commit is contained in:
Henry Schreiner
2020-08-19 12:26:26 -04:00
committed by GitHub
parent 69821d9e75
commit 1729aae96f
24 changed files with 1117 additions and 395 deletions

View File

@@ -31,11 +31,13 @@ jobs:
arch: x64
max-cxx-std: 17
dev: false
args: "-DPYBIND11_FINDPYTHON=ON"
- runs-on: macos-latest
python: 3.7
arch: x64
max-cxx-std: 17
dev: false
args: "-DPYBIND11_FINDPYTHON=ON"
- runs-on: windows-2016
python: 3.7
arch: x86
@@ -46,6 +48,7 @@ jobs:
arch: x64
max-cxx-std: 17
dev: false
args: "-DPYBIND11_FINDPYTHON=ON"
- runs-on: windows-latest
python: 3.7
arch: x64
@@ -89,7 +92,7 @@ jobs:
dev: false
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • ${{ matrix.arch }}"
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • ${{ matrix.arch }} ${{ matrix.args }}"
runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.dev }}
@@ -106,6 +109,9 @@ jobs:
if: runner.os != 'macOS'
run: echo "::set-env name=BOOST_ROOT::$BOOST_ROOT_1_72_0"
- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.3
- name: Cache wheels
if: runner.os == 'macOS'
uses: actions/cache@v2
@@ -120,7 +126,7 @@ jobs:
- name: Prepare env
run: python -m pip install -r tests/requirements.txt
- name: Configure C++11
- name: Configure C++11 ${{ matrix.args }}
shell: bash
run: >
cmake -S . -B build
@@ -128,7 +134,7 @@ jobs:
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=11
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
${{ matrix.args }}
- name: Build C++11
run: cmake --build build -j 2
@@ -140,9 +146,9 @@ jobs:
run: cmake --build build --target cpptest -j 2
- name: Interface test C++11
run: cmake --build build --target test_cmake_build
run: cmake --build build --target test_cmake_build -v
- name: Configure C++${{ matrix.max-cxx-std }}
- name: Configure C++${{ matrix.max-cxx-std }} ${{ matrix.args }}
shell: bash
run: >
cmake -S . -B build2
@@ -150,7 +156,7 @@ jobs:
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=${{ matrix.max-cxx-std }}
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
${{ matrix.args }}
- name: Build C++${{ matrix.max-cxx-std }}
run: cmake --build build2 -j 2
@@ -350,14 +356,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install requirements
- name: Install system requirements
run: apk add doxygen python3-dev
- name: Ensure pip
run: python3 -m ensurepip
- name: Install python docs requirements
run: python3 -m pip install "sphinx<3" sphinx_rtd_theme breathe==4.13.1 pytest setuptools
- name: Install docs & setup requirements
run: python3 -m pip install -r docs/requirements.txt pytest setuptools
- name: Build docs
run: python3 -m sphinx -W -b html docs docs/.build

View File

@@ -14,19 +14,22 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-latest]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
arch: [x64]
cmake: [3.7, 3.18]
cmake: [3.18]
include:
- runs-on: windows-latest
- runs-on: ubuntu-latest
arch: x64
cmake: 3.18
cmake: 3.4
- runs-on: macos-latest
arch: x64
cmake: 3.7
# TODO: 3.8
- runs-on: windows-2016
arch: x86
cmake: 3.11
cmake: 3.8
- runs-on: windows-2016
arch: x86
@@ -63,3 +66,13 @@ jobs:
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
- name: Build
working-directory: build dir
if: github.event_name == 'workflow_dispatch'
run: cmake --build . --config Release
- name: Test
working-directory: build dir
if: github.event_name == 'workflow_dispatch'
run: cmake --build . --config Release --target check