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>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fc92101..1db67a8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,7 +16,6 @@
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64]
- max-cxx-std: [17]
python:
- 2.7
- 3.5
@@ -28,56 +27,47 @@
- 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 @@
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 @@
- 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 @@
- 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:
diff --git a/docs/basics.rst b/docs/basics.rst
index 7bf4d42..6bb5f98 100644
--- a/docs/basics.rst
+++ b/docs/basics.rst
@@ -35,6 +35,14 @@
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