Skip to content

Commit

Permalink
[Conf] Upgraded CMake files for Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
da115115 committed Jun 26, 2022
1 parent 58ef151 commit 23299cf
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 14 deletions.
52 changes: 41 additions & 11 deletions config/FindBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)

function(_boost_get_existing_target component target_var)
set(names "${component}")
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9]+)?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
list(APPEND names
"${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python
Expand All @@ -407,7 +407,7 @@ function(_boost_get_existing_target component target_var)
if(TARGET "${prefix}::${name}")
# The target may be an INTERFACE library that wraps around a single other
# target for compatibility. Unwrap this layer so we can extract real info.
if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$")
if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9]+)$")
set(name_nv "${CMAKE_MATCH_1}")
if(TARGET "${prefix}::${name_nv}")
get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE)
Expand All @@ -430,7 +430,7 @@ endfunction()

function(_boost_get_canonical_target_name component target_var)
string(TOLOWER "${component}" component)
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9]+)?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
set(${target_var} "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" PARENT_SCOPE)
else()
Expand Down Expand Up @@ -917,14 +917,14 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
if(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0)
# From GCC 5 and clang 4, versioning changes and minor becomes patch.
# For those compilers, patch is exclude from compiler tag in Boost 1.69+ library naming.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4) OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3)
set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
if(Boost_VERSION_STRING VERSION_LESS 1.34)
set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
else()
Expand Down Expand Up @@ -1004,7 +1004,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
# against the new release.

# Handle Python version suffixes
if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9]+)\$")
set(component "${CMAKE_MATCH_1}")
set(component_python_version "${CMAKE_MATCH_2}")
endif()
Expand Down Expand Up @@ -1335,7 +1335,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
else()
elseif(Boost_VERSION_STRING VERSION_LESS 1.77.0)
set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
Expand All @@ -1350,7 +1350,37 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.77.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
elseif(Boost_VERSION_STRING VERSION_LESS 1.78.0)
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
set(_Boost_IOSTREAMS_DEPENDENCIES regex)
set(_Boost_JSON_DEPENDENCIES container)
set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
set(_Boost_MPI_DEPENDENCIES serialization)
set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
set(_Boost_THREAD_DEPENDENCIES chrono atomic)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
else()
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
set(_Boost_IOSTREAMS_DEPENDENCIES regex)
set(_Boost_JSON_DEPENDENCIES container)
set(_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex chrono atomic)
set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
set(_Boost_MPI_DEPENDENCIES serialization)
set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
set(_Boost_THREAD_DEPENDENCIES chrono atomic)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.79.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
Expand Down Expand Up @@ -1378,7 +1408,7 @@ endfunction()
#
function(_Boost_COMPONENT_HEADERS component _hdrs)
# Handle Python version suffixes
if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
if(component MATCHES "^(python|mpi_python|numpy)([0-9]+|[0-9]\\.[0-9]+)\$")
set(component "${CMAKE_MATCH_1}")
set(component_python_version "${CMAKE_MATCH_2}")
endif()
Expand Down Expand Up @@ -1623,7 +1653,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
"1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
Expand Down Expand Up @@ -2135,7 +2165,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$")
set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$")
elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9]+)\$")
set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}")
Expand Down
5 changes: 5 additions & 0 deletions config/FindPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.

.. note::

This hint will be ignored on ``Windows`` because static libraries are not
available on this platform.

``Python_FIND_ABI``
.. versionadded:: 3.16

Expand Down
3 changes: 2 additions & 1 deletion config/FindPython/Support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3")
set(_${_PYTHON_PREFIX}_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_${_PYTHON_PREFIX}_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "2")
set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
else()
Expand Down Expand Up @@ -98,6 +98,7 @@ macro (_PYTHON_FIND_FRAMEWORKS)
${_pff_CMAKE_FRAMEWORK_PATH}
~/Library/Frameworks
/usr/local/Frameworks
/opt/homebrew/Frameworks
${CMAKE_SYSTEM_FRAMEWORK_PATH})
list (REMOVE_DUPLICATES _pff_frameworks)
foreach (_pff_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
Expand Down
5 changes: 5 additions & 0 deletions config/FindPython2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.

.. note::

This hint will be ignored on ``Windows`` because static libraries are not
available on this platform.

``Python2_FIND_STRATEGY``
.. versionadded:: 3.15

Expand Down
5 changes: 5 additions & 0 deletions config/FindPython3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.

.. note::

This hint will be ignored on ``Windows`` because static libraries are not
available on this platform.

``Python3_FIND_ABI``
.. versionadded:: 3.16

Expand Down
2 changes: 1 addition & 1 deletion config/FindPythonInterp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ unset(_Python_NAMES)

set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)

if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
Expand Down
2 changes: 1 addition & 1 deletion config/FindPythonLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ set(CMAKE_FIND_FRAMEWORK LAST)

set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)

if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
Expand Down

0 comments on commit 23299cf

Please sign in to comment.