From: Daniel Arndt Date: Sat, 4 Jan 2020 17:31:27 +0000 (+0100) Subject: Restructure python-bindings CMakeLists.txt files X-Git-Tag: v9.2.0-rc1~559^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=138c0279ae8f59ac78164de7614bb0786d78fc15;p=dealii.git Restructure python-bindings CMakeLists.txt files --- diff --git a/contrib/python-bindings/CMakeLists.txt b/contrib/python-bindings/CMakeLists.txt index a7e2f53d5e..884b8322c3 100644 --- a/contrib/python-bindings/CMakeLists.txt +++ b/contrib/python-bindings/CMakeLists.txt @@ -18,6 +18,64 @@ IF(DEAL_II_COMPONENT_PYTHON_BINDINGS) MESSAGE(STATUS "") MESSAGE(STATUS "Setting up python bindings") + # + # Find Python: + # + INCLUDE(FindPythonInterp) + INCLUDE(FindPythonLibs) + + IF(FEATURE_BOOST_BUNDLED_CONFIGURED) + MESSAGE(FATAL_ERROR + "DEAL_II_COMPONENT_PYTHON_BINDINGS has unmet configuration requirements: " + "Python bindings require an external boost library, but deal.II was " + "configured with bundled boost." + ) + ENDIF() + + # + # As of 1.67, boost requires specifying the suffix for the python + # component manually. + # + UNSET(Boost_FOUND) + IF(${BOOST_VERSION} VERSION_LESS 1.67) + _FIND_PACKAGE(Boost 1.59 COMPONENTS python REQUIRED) + ELSE() + _FIND_PACKAGE(Boost 1.67 COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} REQUIRED) + ENDIF() + + IF(NOT Boost_FOUND) + MESSAGE(FATAL_ERROR + "DEAL_II_COMPONENT_PYTHON_BINDINGS has unmet configuration requirements: " + "The external boost library does not provide Boost.Python" + ) + ENDIF() + + # + # FIXME: Once finalized, reconsider moving this definitions into + # cmake/setup_dealii.cmake + # + # General information about deal.II: + # + # PYTHON_BINDINGS_BASE_NAME *) + # PYTHON_BINDINGS_DEBUG_NAME *) + # PYTHON_BINDINGS_RELEASE_NAME *) + # + # Information about paths, install locations and names: + # + # DEAL_II_PYTHON_RELDIR *) **) + # + # *) Can be overwritten by the command line via -D<...> + # **) We do a best effort guess on site-packages location... + # + + SET_IF_EMPTY(PYTHON_BINDINGS_BASE_NAME "PyDealII") + SET_IF_EMPTY(PYTHON_BINDINGS_DEBUG_NAME "Debug") + SET_IF_EMPTY(PYTHON_BINDINGS_RELEASE_NAME "Release") + + SET_IF_EMPTY(DEAL_II_PYTHON_RELDIR + "${DEAL_II_LIBRARY_RELDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/${PYTHON_BINDINGS_BASE_NAME}" + ) + ADD_SUBDIRECTORY(source) MESSAGE(STATUS "Setting up python bindings - Done") diff --git a/contrib/python-bindings/source/CMakeLists.txt b/contrib/python-bindings/source/CMakeLists.txt index a76c202ee9..5dd35adcc8 100644 --- a/contrib/python-bindings/source/CMakeLists.txt +++ b/contrib/python-bindings/source/CMakeLists.txt @@ -13,65 +13,6 @@ ## ## --------------------------------------------------------------------- -# -# Find Python: -# - -INCLUDE(FindPythonInterp) -INCLUDE(FindPythonLibs) - -IF(FEATURE_BOOST_BUNDLED_CONFIGURED) - MESSAGE(FATAL_ERROR - "DEAL_II_COMPONENT_PYTHON_BINDINGS has unmet configuration requirements: " - "Python bindings require an external boost library, but deal.II was " - "configured with bundled boost." - ) -ENDIF() - -# -# As of 1.67, boost requires specifying the suffix for the python -# component manually. -# -UNSET(Boost_FOUND) -IF(${BOOST_VERSION} VERSION_LESS 1.67) - _FIND_PACKAGE(Boost 1.59 COMPONENTS python REQUIRED) -ELSE() - _FIND_PACKAGE(Boost 1.67 COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} REQUIRED) -ENDIF() - -IF(NOT Boost_FOUND) - MESSAGE(FATAL_ERROR - "DEAL_II_COMPONENT_PYTHON_BINDINGS has unmet configuration requirements: " - "The external boost library does not provide Boost.Python" - ) -ENDIF() - -# -# FIXME: Once finalized, reconsider moving this definitions into -# cmake/setup_dealii.cmake -# -# General information about deal.II: -# -# PYTHON_BINDINGS_BASE_NAME *) -# PYTHON_BINDINGS_DEBUG_NAME *) -# PYTHON_BINDINGS_RELEASE_NAME *) -# -# Information about paths, install locations and names: -# -# DEAL_II_PYTHON_RELDIR *) **) -# -# *) Can be overwritten by the command line via -D<...> -# **) We do a best effort guess on site-packages location... -# - -SET_IF_EMPTY(PYTHON_BINDINGS_BASE_NAME "PyDealII") -SET_IF_EMPTY(PYTHON_BINDINGS_DEBUG_NAME "Debug") -SET_IF_EMPTY(PYTHON_BINDINGS_RELEASE_NAME "Release") - -SET_IF_EMPTY(DEAL_II_PYTHON_RELDIR - "${DEAL_II_LIBRARY_RELDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/${PYTHON_BINDINGS_BASE_NAME}" - ) - INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR}/include/ ${CMAKE_SOURCE_DIR}/include/