mirror of
https://git.yoctoproject.org/poky
synced 2026-02-05 16:28:43 +01:00
Currently, CMake has two ways of finding Python executables: FindPythonInterp and FindPython/FindPython3. FindPythonInterp is deprecated and may be removed at some point. Currently, python3native sets PYTHON_EXECUTABLE, which FindPythonInterp uses. This is a problem for a few reasons: - Setting PYTHON_EXECUTABLE as an environment variable doesn't work, as CMake needs it to be set as an explicit CMake option via -D. - Projects using the newer FindPython/FindPython3 don't pickup the right Python, as the newer routines use Python_EXECUTABLE and Python3_EXECUTABLE. Fix this by setting PYTHON_EXECUTABLE, Python_EXECUTABLE, and Python3_EXECUTABLE using -D options to EXTRA_OECMAKE. The CMake routines are documented below: https://cmake.org/cmake/help/latest/module/FindPythonInterp.html https://cmake.org/cmake/help/latest/module/FindPython.html https://cmake.org/cmake/help/latest/module/FindPython3.html (From OE-Core rev: a22200a646eaf42cd4902a2fe3358d29717ac129) Signed-off-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
27 lines
839 B
Plaintext
27 lines
839 B
Plaintext
inherit python3-dir
|
|
|
|
PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"
|
|
EXTRANATIVEPATH += "python3-native"
|
|
DEPENDS_append = " python3-native "
|
|
|
|
# python-config and other scripts are using distutils modules
|
|
# which we patch to access these variables
|
|
export STAGING_INCDIR
|
|
export STAGING_LIBDIR
|
|
|
|
# Packages can use
|
|
# find_package(PythonInterp REQUIRED)
|
|
# find_package(PythonLibs REQUIRED)
|
|
# which ends up using libs/includes from build host
|
|
# Therefore pre-empt that effort
|
|
export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
|
|
export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
|
|
|
|
export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
|
|
|
|
# suppress host user's site-packages dirs.
|
|
export PYTHONNOUSERSITE = "1"
|
|
|
|
# autoconf macros will use their internal default preference otherwise
|
|
export PYTHON
|