diff --git a/config/FindDoxygenWrapper.cmake b/config/FindDoxygenWrapper.cmake index 5c4a654d..90487ec9 100644 --- a/config/FindDoxygenWrapper.cmake +++ b/config/FindDoxygenWrapper.cmake @@ -5,7 +5,11 @@ # Extract the version information if (DOXYGEN_FOUND STREQUAL "YES") - execute_process (COMMAND ${DOXYGEN_EXECUTABLE} --version OUTPUT_VARIABLE MY_TMP) + execute_process ( + COMMAND ${DOXYGEN_EXECUTABLE} --version + OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE + ) set (DOXYGEN_VERSION ${MY_TMP}) # Check the version requirement only diff --git a/config/FindMySQL.cmake b/config/FindMySQL.cmake index c61653b1..1aa3def0 100644 --- a/config/FindMySQL.cmake +++ b/config/FindMySQL.cmake @@ -23,17 +23,29 @@ if (UNIX) if (MYSQL_CONFIG) message (STATUS "Using mysql-config: ${MYSQL_CONFIG}") # Set VERSION - execute_process (COMMAND ${MYSQL_CONFIG} --version OUTPUT_VARIABLE MY_TMP) - set (MYSQL_VERSION ${MY_TMP}) + execute_process ( + COMMAND ${MYSQL_CONFIG} --version + OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + set (MYSQL_VERSION ${MY_TMP}) # Set INCLUDE_DIR - execute_process (COMMAND ${MYSQL_CONFIG} --include OUTPUT_VARIABLE MY_TMP) + execute_process ( + COMMAND ${MYSQL_CONFIG} --include + OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE + ) string (REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}") set (MYSQL_ADD_INCLUDE_PATH ${MY_TMP} CACHE FILEPATH INTERNAL) #message("[DEBUG] MYSQL ADD_INCLUDE_PATH : ${MYSQL_ADD_INCLUDE_PATH}") # set LIBRARY_DIR - execute_process (COMMAND ${MYSQL_CONFIG} --libs_r OUTPUT_VARIABLE MY_TMP) + execute_process ( + COMMAND ${MYSQL_CONFIG} --libs_r + OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE + ) set (MYSQL_ADD_LIBRARIES "") string (REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}") diff --git a/config/FindPython.cmake b/config/FindPython.cmake index 19b6c2a0..31ef1c7d 100644 --- a/config/FindPython.cmake +++ b/config/FindPython.cmake @@ -125,28 +125,38 @@ This module will set the following variables in your project ``Python_STDLIB`` Standard platform independent installation directory. - Information returned by ``sysconfig.get_path('stdlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` + or else ``sysconfig.get_path('stdlib')``. ``Python_STDARCH`` Standard platform dependent installation directory. - Information returned by ``sysconfig.get_path('platstdlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` + or else ``sysconfig.get_path('platstdlib')``. ``Python_SITELIB`` Third-party platform independent installation directory. - Information returned by ``sysconfig.get_path('purelib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` + or else ``sysconfig.get_path('purelib')``. ``Python_SITEARCH`` Third-party platform dependent installation directory. - Information returned by ``sysconfig.get_path('platlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` + or else ``sysconfig.get_path('platlib')``. ``Python_SOABI`` .. versionadded:: 3.17 Extension suffix for modules. - Information computed from ``sysconfig.get_config_var('EXT_SUFFIX')`` or - ``sysconfig.get_config_var('SOABI')`` or - ``python3-config --extension-suffix``. + Information computed from ``distutils.sysconfig.get_config_var('EXT_SUFFIX')`` + or ``distutils.sysconfig.get_config_var('SOABI')`` or + ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is + not available, ``sysconfig.get_config_var('EXT_SUFFIX')`` or + ``sysconfig.get_config_var('SOABI')`` are used. ``Python_SOSABI`` .. versionadded:: 3.26 @@ -325,8 +335,6 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. - See also ``Python_FIND_UNVERSIONED_NAMES``. - ``Python_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -434,8 +442,6 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. - See also ``Python_FIND_STRATEGY``. - Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/config/FindPython/Support.cmake b/config/FindPython/Support.cmake index 08ab9c02..b56f6716 100644 --- a/config/FindPython/Support.cmake +++ b/config/FindPython/Support.cmake @@ -192,25 +192,28 @@ function (_PYTHON_GET_REGISTRIES _PYTHON_PGR_REGISTRY_PATHS) if (implementation STREQUAL "CPython") foreach (version IN LISTS _PGR_VERSION) string (REPLACE "." "" version_no_dots ${version}) - list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) - list (APPEND registries ${reg_paths}) + list (APPEND registries + [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] + [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath]) if (version VERSION_GREATER_EQUAL "3.5") # cmake_host_system_information is not usable in bootstrap get_filename_component (arch "[HKEY_CURRENT_USER\\Software\\Python\\PythonCore\\${version};SysArchitecture]" NAME) - string (REPLACE "bit" "" arch "${arch}") - if (arch IN_LIST _${_PYTHON_PREFIX}_ARCH) - list (APPEND registries [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) + if (arch MATCHES "(${_${_PYTHON_PREFIX}_ARCH}|${_${_PYTHON_PREFIX}_ARCH2})bit") + list (APPEND registries + [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) endif() else() - list (APPEND registries [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) - endif() - list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) - list (APPEND registries ${reg_paths}) - list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) - list (APPEND registries ${reg_paths}) - list (APPEND registries [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}/InstallPath]) - list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) - list (APPEND registries ${reg_paths}) + list (APPEND registries + [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) + endif() + list (APPEND registries + [HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] + [HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath] + [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] + [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath] + [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}/InstallPath] + [HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] + [HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath]) endforeach() elseif (implementation STREQUAL "IronPython") foreach (version IN LISTS _PGR_VERSION) @@ -474,7 +477,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) set (config_flag "--${NAME}") endif() string (TOLOWER "${config_flag}" config_flag) - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} ${config_flag} + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" ${config_flag} RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -500,7 +503,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) if (_${_PYTHON_PREFIX}_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING) if (NAME STREQUAL "PREFIX") - execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))" + execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -517,7 +520,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) set (_scheme "posix_prefix") endif() execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))" + "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -530,7 +533,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) elseif (NAME STREQUAL "SOABI") # first step: compute SOABI form EXT_SUFFIX config variable execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')\nexcept Exception:\n from distutils import sysconfig;sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')" + "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')\nexcept Exception:\n import sysconfig;sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -551,7 +554,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) # second step: use SOABI or SO config variables as fallback if (NOT _values) execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))\nexcept Exception:\n from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))" + "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))" RESULT_VARIABLE _result OUTPUT_VARIABLE _soabi ERROR_QUIET @@ -592,7 +595,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) set (config_flag "LIBPL") endif() execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))" + "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -752,43 +755,12 @@ function (_PYTHON_GET_VERSION) endfunction() function (_PYTHON_GET_LAUNCHER _PYTHON_PGL_NAME) - cmake_parse_arguments (PARSE_ARGV 1 _PGL "INTERPRETER;COMPILER" "CONFIG" "") + cmake_parse_arguments (PARSE_ARGV 1 _PGL "INTERPRETER;COMPILER" "" "") unset (${_PYTHON_PGL_NAME} PARENT_SCOPE) if ((_PGL_INTERPRETER AND NOT _${_PYTHON_PREFIX}_EXECUTABLE) - OR (_PGL_COMPILER AND NOT _${_PYTHON_PREFIX}_COMPILER) - OR (_PGL_CONFIG AND NOT _${_PYTHON_PREFIX}_CONFIG)) - return() - endif() - - if (_PGL_CONFIG) - # default config script can be launched directly - set (${_PYTHON_PGL_NAME} "${_${_PYTHON_PREFIX}_CONFIG}" PARENT_SCOPE) - - if (NOT MINGW) - return() - endif() - # on MINGW environment, python-config script may require bash to be launched - execute_process (COMMAND cygpath.exe -u "${_${_PYTHON_PREFIX}_CONFIG}" - RESULT_VARIABLE _result - OUTPUT_VARIABLE _config - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (_result) - # impossible to convert path, keep default config - return() - endif() - execute_process (COMMAND bash.exe "${_config}" --prefix - RESULT_VARIABLE _result - OUTPUT_QUIET - ERROR_QUIET) - if (_result) - # fail to execute through bash, keep default config - return() - endif() - - set(${_PYTHON_PGL_NAME} bash.exe "${_config}" PARENT_SCOPE) + OR (_PGL_COMPILER AND NOT _${_PYTHON_PREFIX}_COMPILER)) return() endif() @@ -801,7 +773,7 @@ function (_PYTHON_GET_LAUNCHER _PYTHON_PGL_NAME) AND ext STREQUAL ".exe") set (${_PYTHON_PGL_NAME} "${${_PYTHON_PREFIX}_DOTNET_LAUNCHER}" PARENT_SCOPE) endif() - elseif (_PGL_COMPILER) + else() get_filename_component (name "${_${_PYTHON_PREFIX}_COMPILER}" NAME) get_filename_component (ext "${_${_PYTHON_PREFIX}_COMPILER}" LAST_EXT) if (name IN_LIST _${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES @@ -955,33 +927,6 @@ function (_PYTHON_VALIDATE_INTERPRETER) set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND") return() endif() - - if (WIN32) - # In this case, check if the interpreter is compatible with the target processor architecture - if (NOT CMAKE_GENERATOR_PLATFORM AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM" OR CMAKE_GENERATOR_PLATFORM MATCHES "ARM") - set(target_arm TRUE) - else() - set(target_arm FALSE) - endif() - execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys, sysconfig; sys.stdout.write(sysconfig.get_platform())" - RESULT_VARIABLE result - OUTPUT_VARIABLE platform - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(TOUPPER "${platform}" platform) - if (result OR ((target_arm AND NOT platform MATCHES "ARM") OR - (NOT target_arm AND platform MATCHES "ARM"))) - # interpreter not usable or has wrong architecture - if (result) - set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"") - else() - set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Wrong architecture for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"") - endif() - set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND") - return() - endif() - endif() endif() endfunction() @@ -1012,7 +957,7 @@ function (_PYTHON_VALIDATE_COMPILER) # retrieve python environment version from compiler set (working_dir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") + file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${working_dir}/version.py" @@ -1474,37 +1419,19 @@ if (CMAKE_SIZEOF_VOID_P) OR "Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # In this case, search only for 64bit or 32bit + set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH}) set (_${_PYTHON_PREFIX}_REGISTRY_VIEW REGISTRY_VIEW ${_${_PYTHON_PREFIX}_ARCH}) - if (WIN32 AND (NOT CMAKE_GENERATOR_PLATFORM AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM" - OR CMAKE_GENERATOR_PLATFORM MATCHES "ARM")) - # search exclusively ARM architecture: 64bit or 32bit - if (_${_PYTHON_PREFIX}_ARCH EQUAL 64) - set (_${_PYTHON_PREFIX}_ARCH ARM64) - else() - set (_${_PYTHON_PREFIX}_ARCH ARM) - endif() - endif() else() if (_${_PYTHON_PREFIX}_ARCH EQUAL "32") - if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") - # search first ARM architectures: 32bit and then 64bit - list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM ARM64) - endif() - list (APPEND _${_PYTHON_PREFIX}_ARCH 64) + set (_${_PYTHON_PREFIX}_ARCH2 64) else() - if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") - # search first ARM architectures: 64bit and then 32bit - list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM64 ARM) - endif() - list (APPEND _${_PYTHON_PREFIX}_ARCH 32) + set (_${_PYTHON_PREFIX}_ARCH2 32) endif() endif() else() # architecture unknown, search for both 64bit and 32bit - set (_${_PYTHON_PREFIX}_ARCH 64 32) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") - list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM64 ARM) - endif() + set (_${_PYTHON_PREFIX}_ARCH 64) + set (_${_PYTHON_PREFIX}_ARCH2 32) endif() # IronPython support @@ -1512,7 +1439,7 @@ unset (_${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES) unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES) unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS) if (CMAKE_SIZEOF_VOID_P) - if (CMAKE_SIZEOF_VOID_P EQUAL "4") + if (_${_PYTHON_PREFIX}_ARCH EQUAL "32") set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x86") else() set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x64") @@ -2121,6 +2048,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 3 ${_PYTHON_PREFIX}_VERSION_PATCH) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 4 _${_PYTHON_PREFIX}_ARCH) + set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH}) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 5 _${_PYTHON_PREFIX}_ABIFLAGS) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 6 ${_PYTHON_PREFIX}_SOABI) @@ -2170,27 +2098,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if (NOT _${_PYTHON_PREFIX}_RESULT) if (${_PYTHON_PREFIX}_IS64BIT) set (_${_PYTHON_PREFIX}_ARCH 64) + set (_${_PYTHON_PREFIX}_ARCH2 64) else() set (_${_PYTHON_PREFIX}_ARCH 32) - endif() - endif() - - if (WIN32) - # check if architecture is Intel or ARM - execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys; import sysconfig; sys.stdout.write(sysconfig.get_platform())" - RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT - OUTPUT_VARIABLE _${_PYTHON_PREFIX}_PLATFORM - ERROR_VARIABLE ${_PYTHON_PREFIX}_PLATFORM) - if (NOT _${_PYTHON_PREFIX}_RESULT) - string(TOUPPER "${_${_PYTHON_PREFIX}_PLATFORM}" _${_PYTHON_PREFIX}_PLATFORM) - if (_${_PYTHON_PREFIX}_PLATFORM MATCHES "ARM") - if (${_PYTHON_PREFIX}_IS64BIT) - set (_${_PYTHON_PREFIX}_ARCH ARM64) - else() - set (_${_PYTHON_PREFIX}_ARCH ARM) - endif() - endif() + set (_${_PYTHON_PREFIX}_ARCH2 32) endif() endif() endif() @@ -2228,7 +2139,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # retrieve various package installation directories execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\nif sys.version_info >= (3,10):\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nelse:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))" + "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))" RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS ERROR_QUIET) @@ -2551,7 +2462,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # retrieve python environment version from compiler _python_get_launcher (_${_PYTHON_PREFIX}_COMPILER_LAUNCHER COMPILER) set (_${_PYTHON_PREFIX}_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") + file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") execute_process (COMMAND ${_${_PYTHON_PREFIX}_COMPILER_LAUNCHER} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" @@ -2762,23 +2673,20 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS NO_DEFAULT_PATH) endif() - _python_get_launcher (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER CONFIG "${_${_PYTHON_PREFIX}_CONFIG}") - if (_${_PYTHON_PREFIX}_CONFIG) - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --prefix + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --help RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE __${_PYTHON_PREFIX}_HELP - ERROR_VARIABLE __${_PYTHON_PREFIX}_HELP + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if (_${_PYTHON_PREFIX}_RESULT) # assume config tool is not usable unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) endif() endif() if (_${_PYTHON_PREFIX}_CONFIG) - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --abiflags + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --abiflags RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE __${_PYTHON_PREFIX}_ABIFLAGS ERROR_QUIET @@ -2790,25 +2698,22 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT __${_PYTHON_PREFIX}_ABIFLAGS IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS) # Wrong ABI unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) endif() endif() if (_${_PYTHON_PREFIX}_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE) # check that config tool match library architecture - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --configdir + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --configdir RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE _${_PYTHON_PREFIX}_CONFIGDIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if (_${_PYTHON_PREFIX}_RESULT) unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) else() string(FIND "${_${_PYTHON_PREFIX}_CONFIGDIR}" "${CMAKE_LIBRARY_ARCHITECTURE}" _${_PYTHON_PREFIX}_RESULT) if (_${_PYTHON_PREFIX}_RESULT EQUAL -1) unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) endif() endif() endif() @@ -2854,10 +2759,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS unset (_${_PYTHON_PREFIX}_CONFIG_NAMES) - _python_get_launcher (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER CONFIG "${_${_PYTHON_PREFIX}_CONFIG}") - if (_${_PYTHON_PREFIX}_CONFIG) - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --prefix + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --help RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE __${_PYTHON_PREFIX}_HELP ERROR_QUIET @@ -2865,7 +2768,6 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS if (_${_PYTHON_PREFIX}_RESULT) # assume config tool is not usable unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) endif() endif() @@ -2873,7 +2775,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS continue() endif() - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --abiflags + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --abiflags RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE __${_PYTHON_PREFIX}_ABIFLAGS ERROR_QUIET @@ -2885,26 +2787,23 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT __${_PYTHON_PREFIX}_ABIFLAGS IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS) # Wrong ABI unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) continue() endif() if (_${_PYTHON_PREFIX}_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE) # check that config tool match library architecture - execute_process (COMMAND ${_${_PYTHON_PREFIX}_CONFIG_LAUNCHER} --configdir + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --configdir RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE _${_PYTHON_PREFIX}_CONFIGDIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if (_${_PYTHON_PREFIX}_RESULT) unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) continue() endif() string (FIND "${_${_PYTHON_PREFIX}_CONFIGDIR}" "${CMAKE_LIBRARY_ARCHITECTURE}" _${_PYTHON_PREFIX}_RESULT) if (_${_PYTHON_PREFIX}_RESULT EQUAL -1) unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_CONFIG_LAUNCHER) continue() endif() endif() diff --git a/config/FindPython2.cmake b/config/FindPython2.cmake index 4c7ab5ce..41d9b689 100644 --- a/config/FindPython2.cmake +++ b/config/FindPython2.cmake @@ -112,23 +112,27 @@ This module will set the following variables in your project ``Python2_STDLIB`` Standard platform independent installation directory. - Information returned by ``sysconfig.get_path('stdlib')`` or else - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` + or else ``sysconfig.get_path('stdlib')``. ``Python2_STDARCH`` Standard platform dependent installation directory. - Information returned by ``sysconfig.get_path('platstdlib')`` or else - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` + or else ``sysconfig.get_path('platstdlib')``. ``Python2_SITELIB`` Third-party platform independent installation directory. - Information returned by ``sysconfig.get_path('purelib')`` or else - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` + or else ``sysconfig.get_path('purelib')``. ``Python2_SITEARCH`` Third-party platform dependent installation directory. - Information returned by ``sysconfig.get_path('platlib')`` or else - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` + or else ``sysconfig.get_path('platlib')``. ``Python2_Compiler_FOUND`` System has the Python 2 compiler. ``Python2_COMPILER`` @@ -230,8 +234,6 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. - See also ``Python2_FIND_UNVERSIONED_NAMES``. - ``Python2_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -339,8 +341,6 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. - See also ``Python2_FIND_STRATEGY``. - Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/config/FindPython3.cmake b/config/FindPython3.cmake index 901565bd..ae086e85 100644 --- a/config/FindPython3.cmake +++ b/config/FindPython3.cmake @@ -126,28 +126,38 @@ This module will set the following variables in your project ``Python3_STDLIB`` Standard platform independent installation directory. - Information returned by ``sysconfig.get_path('stdlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` + or else ``sysconfig.get_path('stdlib')``. ``Python3_STDARCH`` Standard platform dependent installation directory. - Information returned by ``sysconfig.get_path('platstdlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` + or else ``sysconfig.get_path('platstdlib')``. ``Python3_SITELIB`` Third-party platform independent installation directory. - Information returned by ``sysconfig.get_path('purelib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` + or else ``sysconfig.get_path('purelib')``. ``Python3_SITEARCH`` Third-party platform dependent installation directory. - Information returned by ``sysconfig.get_path('platlib')``. + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` + or else ``sysconfig.get_path('platlib')``. ``Python3_SOABI`` .. versionadded:: 3.17 Extension suffix for modules. - Information computed from ``sysconfig.get_config_var('EXT_SUFFIX')`` or - ``sysconfig.get_config_var('SOABI')`` or - ``python3-config --extension-suffix``. + Information computed from ``distutils.sysconfig.get_config_var('EXT_SUFFIX')`` + or ``distutils.sysconfig.get_config_var('SOABI')`` or + ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is + not available, ``sysconfig.get_config_var('EXT_SUFFIX')`` or + ``sysconfig.get_config_var('SOABI')`` are used. ``Python3_SOSABI`` .. versionadded:: 3.26 @@ -323,8 +333,6 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. - See also ``Python3_FIND_UNVERSIONED_NAMES``. - ``Python3_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -432,8 +440,6 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. - See also ``Python3_FIND_STRATEGY``. - Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/config/FindPythonInterp.cmake b/config/FindPythonInterp.cmake index 443c6ebf..e6dd2984 100644 --- a/config/FindPythonInterp.cmake +++ b/config/FindPythonInterp.cmake @@ -5,9 +5,6 @@ FindPythonInterp ---------------- -.. versionchanged:: 3.27 - This module is available only if policy :policy:`CMP0148` is not set to ``NEW``. - .. deprecated:: 3.12 Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. @@ -53,16 +50,6 @@ of PYTHON_LIBRARIES. #]=======================================================================] -cmake_policy(GET CMP0148 _FindPythonInterp_CMP0148) -if(_FindPythonInterp_CMP0148 STREQUAL "NEW") - message(FATAL_ERROR "The FindPythonInterp module has been removed by policy CMP0148.") -endif() - -if(_FindPythonInterp_testing) - set(_FindPythonInterp_included TRUE) - return() -endif() - unset(_Python_NAMES) set(_PYTHON1_VERSIONS 1.6 1.5) diff --git a/config/FindPythonLibs.cmake b/config/FindPythonLibs.cmake index b13d96b2..8dfd060b 100644 --- a/config/FindPythonLibs.cmake +++ b/config/FindPythonLibs.cmake @@ -5,9 +5,6 @@ FindPythonLibs -------------- -.. versionchanged:: 3.27 - This module is available only if policy :policy:`CMP0148` is not set to ``NEW``. - .. deprecated:: 3.12 Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. @@ -48,16 +45,6 @@ get the currently active Python version by default with a consistent version of PYTHON_LIBRARIES. #]=======================================================================] -cmake_policy(GET CMP0148 _FindPythonLibs_CMP0148) -if(_FindPythonLibs_CMP0148 STREQUAL "NEW") - message(FATAL_ERROR "The FindPythonLibs module has been removed by policy CMP0148.") -endif() - -if(_FindPythonLibs_testing) - set(_FindPythonLibs_included TRUE) - return() -endif() - # Use the executable's path as a hint set(_Python_LIBRARY_PATH_HINT) if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}")