summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-09-04 17:22:11 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-07 07:47:24 +0100
commit7379b6347b53c198ad6ce7bc8a65639a909efe36 (patch)
treeee8d9e9de13e5aa2acea3553b8f0d341bb50d1a6
parent4349b933ad82c205611d95b9b10c02e5181a6031 (diff)
downloadpoky-7379b6347b53c198ad6ce7bc8a65639a909efe36.tar.gz
python3native, pythonnative: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR
packages can use find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) while we control PYTHON pointing to native py3 the libs and include directories will then point to build host version, which can result in unexpected combination and if we are lucky we get errors if its quite different e.g. py2 libs/includes and py3 executable This variable can be then used to export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR so that above find_packages can work correctly see [1] for how it happens in cmake LLDB uses it see [2] [1] https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake [2] https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226 (From OE-Core rev: e45c06fe6f9a21c2cd06ae003cb112556382f81e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/python3native.bbclass8
-rw-r--r--meta/classes/pythonnative.bbclass8
2 files changed, 16 insertions, 0 deletions
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index a3acaf61bb..d98fb4c758 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -9,6 +9,14 @@ DEPENDS_append = " python3-native "
9export STAGING_INCDIR 9export STAGING_INCDIR
10export STAGING_LIBDIR 10export STAGING_LIBDIR
11 11
12# Packages can use
13# find_package(PythonInterp REQUIRED)
14# find_package(PythonLibs REQUIRED)
15# which ends up using libs/includes from build host
16# Therefore pre-empt that effort
17export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
18export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
19
12export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" 20export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
13 21
14# suppress host user's site-packages dirs. 22# suppress host user's site-packages dirs.
diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass
index ae6600cd15..0e9019d1e2 100644
--- a/meta/classes/pythonnative.bbclass
+++ b/meta/classes/pythonnative.bbclass
@@ -12,6 +12,14 @@ DEPENDS_append = " python-native "
12export STAGING_INCDIR 12export STAGING_INCDIR
13export STAGING_LIBDIR 13export STAGING_LIBDIR
14 14
15# Packages can use
16# find_package(PythonInterp REQUIRED)
17# find_package(PythonLibs REQUIRED)
18# which ends up using libs/includes from build host
19# Therefore pre-empt that effort
20export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
21export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
22
15# suppress host user's site-packages dirs. 23# suppress host user's site-packages dirs.
16export PYTHONNOUSERSITE = "1" 24export PYTHONNOUSERSITE = "1"
17 25