diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64a0258a..e8789628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -281,11 +281,10 @@ jobs: pybind11-cmake: needs: [build-ubuntu, build-mac] - # strategy: - # fail-fast: false - # matrix: - # python-version: [3.9] - runs-on: ubuntu-latest + strategy: + matrix: + platform: [ubuntu-20.04, ubuntu-latest] + runs-on: ${{ matrix.platform }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 460008e0..b123b89d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,15 @@ option(BUILD_PYTHON_BINDINGS "Build Python bindings with pybind11." OFF) option(BUILD_TESTING_PYTHON "Build Python tests only." OFF) if (BUILD_PYTHON_BINDINGS) + # In theory this is not required, as CMake selects the appropriate C++ standard + # However, as long as we support pybind11 < 2.6 we need to make sure that CMAKE_CXX_STANDARD + # is defined before find_package(pybind11 REQUIRED) to avoid that the CMake standard + # command line option is set by pybind11 via the PYBIND11_CPP_STANDARD variable, in a way that could + # interfere with CMake, see https://github.com/pybind/pybind11/blob/v2.4.3/tools/pybind11Tools.cmake#L21 + if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + endif() + find_package(pybind11 REQUIRED) add_subdirectory(python) endif() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 47fcd19c..8dc3b4cd 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,3 @@ -set(PYBIND11_CPP_STANDARD -std=c++11) pybind11_add_module(manifpy MODULE bindings_rn.cpp bindings_so2.cpp @@ -13,8 +12,8 @@ target_link_libraries(manifpy PRIVATE ${PROJECT_NAME}) # See e.g. https://pybind11.readthedocs.io/en/stable/advanced/cast/eigen.html#storage-orders target_compile_definitions(manifpy PRIVATE EIGEN_DEFAULT_TO_ROW_MAJOR) -# Set required C++11 flag -set_property(TARGET manifpy PROPERTY CXX_STANDARD 11) +# Specify that C++11 features are required +target_compile_features(manifpy PRIVATE cxx_nullptr) set_property(TARGET manifpy PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET manifpy PROPERTY CXX_EXTENSIONS OFF)