Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 17 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions docs/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down