Skip to content

Commit

Permalink
Modified pybind support for C++17 to fix issues with Xcode 11
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm committed Oct 4, 2019
1 parent b8763e9 commit edaecc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/pybind11/include/pybind11/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
# if __cplusplus >= 201402L
# define PYBIND11_CPP14
# if __cplusplus > 201402L /* Temporary: should be updated to >= the final C++17 value once known */
# if __cplusplus >= 201703L /* Temporary: should be updated to >= the final C++17 value once known */
# define PYBIND11_CPP17
# endif
# endif
Expand Down
2 changes: 1 addition & 1 deletion resources/pybind11/include/pybind11/stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# define PYBIND11_HAS_OPTIONAL 1
# endif
// std::experimental::optional (but not allowed in c++11 mode)
# if defined(PYBIND11_CPP14) && __has_include(<experimental/optional>)
# if defined(PYBIND11_CPP14) && __has_include(<experimental/optional>) && !__has_include(<optional>)
# include <experimental/optional>
# define PYBIND11_HAS_EXP_OPTIONAL 1
# endif
Expand Down
5 changes: 4 additions & 1 deletion resources/pybind11/tools/pybind11Tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ include(CMakeParseArguments)
function(select_cxx_standard)
if(NOT PYBIND11_CPP_STANDARD)
if(NOT MSVC)
check_cxx_compiler_flag("-std=c++17" HAS_CPP17_FLAG)
check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG)
check_cxx_compiler_flag("-std=c++11" HAS_CPP11_FLAG)

if (HAS_CPP14_FLAG)
if (HAS_CPP17_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++17)
elseif (HAS_CPP14_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++14)
elseif (HAS_CPP11_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++11)
Expand Down

0 comments on commit edaecc4

Please sign in to comment.