diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index eb38573ae6d6fa3a99c37e3b47c0859ec4f531d7..fddf6905780208a51edeb7800080401bdde52ad2 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -8,7 +8,6 @@ set(modules DunePybindxiMacros.cmake DunePybindxiUtils.cmake - FindEigen3.cmake FindPythonLibsNew.cmake) install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR}) diff --git a/cmake/modules/DunePybindxiMacros.cmake b/cmake/modules/DunePybindxiMacros.cmake index 13150be8d79640c3e23690a39fe022eaba76b6a8..268f13bb0e77a9071882065eb962bac23587bd76 100644 --- a/cmake/modules/DunePybindxiMacros.cmake +++ b/cmake/modules/DunePybindxiMacros.cmake @@ -10,12 +10,12 @@ # dune-python's way of forcing a version dune_require_python_version(3.4) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Add a CMake parameter for choosing a desired Python version set(DUNE_PYBINDXI_PYTHON_VERSION "" CACHE STRING "Python version to use for dune-pybindxi") -set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7) -include(FindPythonLibsNew) +set(PYTHON_EXECUTABLE ${DUNE_PYTHON_VIRTUALENV_INTERPRETER}) find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED) set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "") @@ -25,24 +25,21 @@ set(PYTHON_MODULE_EXTENSION ${PYTHON_MODULE_EXTENSION} CACHE INTERNAL "") include(CheckCXXCompilerFlag) if(NOT MSVC AND NOT DUNE_PYBINDXI_CPP_STANDARD) - #check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG) - check_cxx_compiler_flag("-std=c++11" HAS_CPP11_FLAG) - - #if (HAS_CPP14_FLAG) - # set(DUNE_PYBINDXI_CPP_STANDARD -std=c++14) - #elseif (HAS_CPP11_FLAG) - if (HAS_CPP11_FLAG) - set(DUNE_PYBINDXI_CPP_STANDARD -std=c++11) - else() - message(FATAL_ERROR "Unsupported compiler -- pybind11 requires C++11 support!") - endif() - - set(DUNE_PYBINDXI_CPP_STANDARD ${DUNE_PYBINDXI_CPP_STANDARD} CACHE STRING + check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG) + check_cxx_compiler_flag("-std=c++11" HAS_CPP11_FLAG) + + if (HAS_CPP14_FLAG) + set(DUNE_PYBINDXI_CPP_STANDARD -std=c++14) + elseif (HAS_CPP11_FLAG) + set(DUNE_PYBINDXI_CPP_STANDARD -std=c++11) + else() + message(FATAL_ERROR "Unsupported compiler -- pybind11 requires C++11 support!") + endif() + + set(DUNE_PYBINDXI_CPP_STANDARD ${DUNE_PYBINDXI_CPP_STANDARD} CACHE STRING "C++ standard flag, e.g. -std=c++11 or -std=c++14. Defaults to C++11." FORCE) endif() include(DunePybindxiUtils) include(DunePybindxiHelper) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake deleted file mode 120000 index 948839ad10fd0ff6f72f5a43b2136357a2c993d7..0000000000000000000000000000000000000000 --- a/cmake/modules/FindEigen3.cmake +++ /dev/null @@ -1 +0,0 @@ -../../pybind11/tools/FindEigen3.cmake \ No newline at end of file diff --git a/pybind11/tools/FindPythonLibsNew.cmake b/pybind11/tools/FindPythonLibsNew.cmake index 1d2ed7274ada2c0fd5d2e9beb81ac90c8851cb86..221bb42e1d9e64eea223e03723ad1f8280eec2d9 100644 --- a/pybind11/tools/FindPythonLibsNew.cmake +++ b/pybind11/tools/FindPythonLibsNew.cmake @@ -50,18 +50,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= -# Checking for the extension makes sure that `LibsNew` was found and not just `Libs`. -if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION) - return() -endif() - -# Use the Python interpreter to find the libs. -if(PythonLibsNew_FIND_REQUIRED) - find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED) -else() - find_package(PythonInterp ${PythonLibsNew_FIND_VERSION}) -endif() - if(NOT PYTHONINTERP_FOUND) set(PYTHONLIBS_FOUND FALSE) return() @@ -116,13 +104,11 @@ list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH) # Make sure the Python has the same pointer-size as the chosen compiler # Skip if CMAKE_SIZEOF_VOID_P is not defined if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")) - if(PythonLibsNew_FIND_REQUIRED) - math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") - math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") - message(FATAL_ERROR - "Python config failure: Python is ${_PYTHON_BITS}-bit, " - "chosen compiler is ${_CMAKE_BITS}-bit") - endif() + math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") + math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") + message(FATAL_ERROR + "Python config failure: Python is ${_PYTHON_BITS}-bit, " + "chosen compiler is ${_CMAKE_BITS}-bit") set(PYTHONLIBS_FOUND FALSE) return() endif()