Add note that VS2017 requires /permissive- to build in C++17 mode (#2431)

* Add note that VS2017 requires /permissive- to build in C++17 mode

* ci: test C++17 on MSVC 2017

* ci: args1/2, use args to override max cxx

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Yannick Jadoul 2020-08-24 20:31:20 +02:00 committed by GitHub
parent b3d8fec066
commit 43f390ad85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 29 deletions

View File

@ -16,7 +16,6 @@ jobs:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64]
max-cxx-std: [17]
python:
- 2.7
- 3.5
@ -28,56 +27,47 @@ jobs:
- runs-on: ubuntu-latest
python: 3.6
arch: x64
max-cxx-std: 17
args: "-DPYBIND11_FINDPYTHON=ON"
- runs-on: macos-latest
python: 3.7
arch: x64
max-cxx-std: 17
args: "-DPYBIND11_FINDPYTHON=ON"
args: >
-DPYBIND11_FINDPYTHON=ON
- runs-on: windows-2016
python: 3.7
arch: x86
max-cxx-std: 14
args2: >
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
- runs-on: windows-latest
python: 3.6
arch: x64
max-cxx-std: 17
args: "-DPYBIND11_FINDPYTHON=ON"
args: >
-DPYBIND11_FINDPYTHON=ON
- runs-on: windows-latest
python: 3.7
arch: x64
max-cxx-std: 17
- runs-on: ubuntu-latest
python: 3.9-dev
arch: x64
max-cxx-std: 17
- runs-on: macos-latest
python: 3.9-dev
arch: x64
max-cxx-std: 17
args: >
-DPYBIND11_FINDPYTHON=ON
exclude:
# Currently 32bit only, and we build 64bit
- runs-on: windows-latest
python: pypy2
arch: x64
max-cxx-std: 17
- runs-on: windows-latest
python: pypy3
arch: x64
max-cxx-std: 17
# Currently broken on embed_test
- runs-on: windows-latest
python: 3.8
arch: x64
max-cxx-std: 17
- runs-on: windows-latest
python: 3.9-dev
arch: x64
max-cxx-std: 17
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • ${{ matrix.arch }} ${{ matrix.args }}"
@ -92,8 +82,7 @@ jobs:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
- name: Setup Boost
if: runner.os != 'macOS'
- name: Setup Boost (Windows / Linux latest)
run: echo "::set-env name=BOOST_ROOT::$BOOST_ROOT_1_72_0"
- name: Update CMake
@ -113,8 +102,7 @@ jobs:
- name: Prepare env
run: python -m pip install -r tests/requirements.txt --prefer-binary
- name: Configure C++11 ${{ matrix.args }}
shell: bash
- name: Configure C++11 ${{ matrix.args1 }}
run: >
cmake -S . -B .
-DPYBIND11_WERROR=ON
@ -138,26 +126,26 @@ jobs:
- name: Clean directory
run: git clean -fdx
- name: Configure C++${{ matrix.max-cxx-std }} ${{ matrix.args }}
shell: bash
- name: Configure ${{ matrix.args2 }}
run: >
cmake -S . -B build2
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=${{ matrix.max-cxx-std }}
-DCMAKE_CXX_STANDARD=17
${{ matrix.args }}
${{ matrix.args2 }}
- name: Build C++${{ matrix.max-cxx-std }}
- name: Build
run: cmake --build build2 -j 2
- name: Python tests C++${{ matrix.max-cxx-std }}
- name: Python tests
run: cmake --build build2 --target pytest
- name: C++${{ matrix.max-cxx-std }} tests
- name: C++ tests
run: cmake --build build2 --target cpptest
- name: Interface test C++${{ matrix.max-cxx-std }}
- name: Interface test
run: cmake --build build2 --target test_cmake_build
clang:

View File

@ -35,6 +35,14 @@ Windows
On Windows, only **Visual Studio 2015** and newer are supported since pybind11 relies
on various C++11 language features that break older versions of Visual Studio.
.. Note::
To use the C++17 in Visual Studio 2017 (MSVC 14.1), pybind11 requires the flag
``/permissive-`` to be passed to the compiler `to enforce standard conformance`_. When
building with Visual Studio 2019, this is not strictly necessary, but still adviced.
.. _`to enforce standard conformance`: https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=vs-2017
To compile and run the tests:
.. code-block:: batch