From ffc7b9b44dc6f5d19c6de52257ab307ecaee4a87 Mon Sep 17 00:00:00 2001 From: Yannick Jadoul Date: Mon, 24 Aug 2020 01:23:40 +0200 Subject: [PATCH 1/3] 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 From 5c50da254437e569c35654c17258b54f781665c0 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 23 Aug 2020 08:40:25 -0400 Subject: [PATCH 2/3] 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 7698abf882175901eaabc71658d352dbaa64a58e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 24 Aug 2020 13:55:17 -0400 Subject: [PATCH 3/3] ci: args1/2, use args to override max cxx --- .github/workflows/ci.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07357b6d64..1db67a8eb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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,34 +27,28 @@ jobs: - runs-on: ubuntu-latest python: 3.6 arch: x64 - max-cxx-std: 17 args: > -DPYBIND11_FINDPYTHON=ON - runs-on: windows-2016 python: 3.7 arch: x86 - 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 - 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 @@ -64,21 +57,17 @@ jobs: - 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 }}" @@ -113,7 +102,7 @@ jobs: - name: Prepare env run: python -m pip install -r tests/requirements.txt --prefer-binary - - name: Configure C++11 ${{ matrix.args }} + - name: Configure C++11 ${{ matrix.args1 }} run: > cmake -S . -B . -DPYBIND11_WERROR=ON @@ -137,26 +126,26 @@ jobs: - name: Clean directory run: git clean -fdx - - name: Configure C++${{ matrix.max-cxx-std }} ${{ matrix.args }} + - 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: