2023-04-14 17:19:52 +08:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(program_name python)
|
2024-10-18 13:25:41 +08:00
|
|
|
set(program_version 3.12.7)
|
2023-12-08 17:25:03 +08:00
|
|
|
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
|
|
|
|
set(build_arch $ENV{PROCESSOR_ARCHITEW6432})
|
2023-04-14 17:19:52 +08:00
|
|
|
else()
|
2023-12-08 17:25:03 +08:00
|
|
|
set(build_arch $ENV{PROCESSOR_ARCHITECTURE})
|
|
|
|
endif()
|
|
|
|
if(build_arch MATCHES "^(ARM|arm)64$")
|
|
|
|
set(tool_subdirectory "python-${program_version}-arm64")
|
2024-10-18 13:25:41 +08:00
|
|
|
# https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-arm64.zip
|
2023-12-08 17:25:03 +08:00
|
|
|
set(download_urls "https://www.python.org/ftp/python/${program_version}/python-${program_version}-embed-arm64.zip")
|
|
|
|
set(download_filename "python-${program_version}-embed-arm64.zip")
|
2024-10-18 13:25:41 +08:00
|
|
|
set(download_sha512 D1D1183682D20AC057C45BF2AD264B6568CDEB54A1502823C76A2448386CAEF79A3AB9EA8FF57A5C023D432590FCCB5E3E9980F8760CD9BAAC5A2A82BA240D73)
|
2023-12-08 17:25:03 +08:00
|
|
|
elseif(build_arch MATCHES "(amd|AMD)64")
|
2023-04-14 17:19:52 +08:00
|
|
|
set(tool_subdirectory "python-${program_version}-x64")
|
2024-10-18 13:25:41 +08:00
|
|
|
# https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-amd64.zip
|
2023-04-14 17:19:52 +08:00
|
|
|
set(download_urls "https://www.python.org/ftp/python/${program_version}/python-${program_version}-embed-amd64.zip")
|
|
|
|
set(download_filename "python-${program_version}-embed-amd64.zip")
|
2024-10-18 13:25:41 +08:00
|
|
|
set(download_sha512 2F67A8487A9EDECE26B73AAB27E75249E538938AD976D371A9411B54DBAE20AFEAC82B406AD4EEEE38B1CF6F407E7620679D30C0FFF82EC8E8AE62268C322D59)
|
2023-12-08 17:25:03 +08:00
|
|
|
else()
|
|
|
|
set(tool_subdirectory "python-${program_version}-x86")
|
2024-10-18 13:25:41 +08:00
|
|
|
# https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-win32.zip
|
2023-12-08 17:25:03 +08:00
|
|
|
set(download_urls "https://www.python.org/ftp/python/${program_version}/python-${program_version}-embed-win32.zip")
|
|
|
|
set(download_filename "python-${program_version}-embed-win32.zip")
|
2024-10-18 13:25:41 +08:00
|
|
|
set(download_sha512 15542080E0CC25C574391218107FE843006E8C5A7161D1CD48CF14A3C47155C0244587273D9C747F35B15EA17676869ECCE079214824214C1A62ABFC86AD9F9B)
|
2023-04-14 17:19:52 +08:00
|
|
|
endif()
|
2023-08-08 04:19:53 +08:00
|
|
|
|
2023-04-14 17:19:52 +08:00
|
|
|
set(paths_to_search "${DOWNLOADS}/tools/python/${tool_subdirectory}")
|
2024-10-18 13:25:41 +08:00
|
|
|
|
|
|
|
# We want to be able to import stuff from outside of this embeddable package.
|
|
|
|
# https://docs.python.org/3/library/sys_path_init.html#pth-files
|
|
|
|
string(REGEX MATCH "^3\\.[0-9]+" _python_version_plain "${program_version}")
|
|
|
|
string(REPLACE "." "" _python_version_plain "${_python_version_plain}")
|
|
|
|
vcpkg_list(SET post_install_command "${CMAKE_COMMAND}" -E rm "python${_python_version_plain}._pth")
|
2023-04-14 17:19:52 +08:00
|
|
|
else()
|
|
|
|
set(program_name python3)
|
|
|
|
set(brew_package_name "python")
|
|
|
|
set(apt_package_name "python3")
|
|
|
|
endif()
|