From 1bc563e95275b777b80fb3c5280809c9c0234757 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 23 Aug 2020 08:40:25 -0400 Subject: [PATCH 1/2] ci: test C++17 on MSVC 2017 --- .github/workflows/ci.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc92101b2e..07357b6d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,21 +29,20 @@ jobs: 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 + max-cxx-std: 17 + 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 @@ -57,6 +56,8 @@ jobs: python: 3.9-dev arch: x64 max-cxx-std: 17 + args: > + -DPYBIND11_FINDPYTHON=ON exclude: # Currently 32bit only, and we build 64bit @@ -92,8 +93,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 @@ -114,7 +114,6 @@ jobs: run: python -m pip install -r tests/requirements.txt --prefer-binary - name: Configure C++11 ${{ matrix.args }} - shell: bash run: > cmake -S . -B . -DPYBIND11_WERROR=ON @@ -139,7 +138,6 @@ jobs: run: git clean -fdx - name: Configure C++${{ matrix.max-cxx-std }} ${{ matrix.args }} - shell: bash run: > cmake -S . -B build2 -DPYBIND11_WERROR=ON @@ -147,6 +145,7 @@ jobs: -DDOWNLOAD_EIGEN=ON -DCMAKE_CXX_STANDARD=${{ matrix.max-cxx-std }} ${{ matrix.args }} + ${{ matrix.args2 }} - name: Build C++${{ matrix.max-cxx-std }} run: cmake --build build2 -j 2 From fc439f9810b65b23a0e690d5bbcb93571ec005a8 Mon Sep 17 00:00:00 2001 From: Yannick Jadoul Date: Mon, 24 Aug 2020 01:23:40 +0200 Subject: [PATCH 2/2] Add note that VS2017 requires /permissive- to build in C++17 mode --- docs/basics.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/basics.rst b/docs/basics.rst index 7bf4d426d3..6bb5f98222 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -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