Skip to content

Commit

Permalink
ci/kuiper: added a way to differentiate between the Python Interprete…
Browse files Browse the repository at this point in the history
…r used by the Host and the one used by the Targer

	- also make sure the Python found by cmake is the same version as the one bundled in the Appimage

Signed-off-by: Bindea Cristian <[email protected]>
  • Loading branch information
bindea-cristian committed Jun 3, 2024
1 parent 2c3c191 commit 3eafb97
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CI/kuiper/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ export QT_PLUGIN_PATH=$HERE/usr/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$HERE/usr/plugins/platforms
export LD_LIBRARY_PATH=$HERE/usr/lib

python_dir=$(find "$HERE/usr/lib/" -maxdepth 1 -type d -name "python3.*")
export PYTHONHOME=$python_dir
export PYTHONPATH=$python_dir:$python_dir/lib-dynload:$python_dir/site-packages:$python_dir/encodings
echo "Starting Scopy"
ldd $HERE/usr/bin/scopy
exec $HERE/usr/bin/scopy
4 changes: 4 additions & 0 deletions CI/kuiper/kuiper_build_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ QWT_BRANCH=qwt-multiaxes-updated
LIBTINYIIOD_BRANCH=master
IIOEMU_BRANCH=master

export APPIMAGE=1

PYTHON_VERSION=python3.9 # default python version used in CI scripts, can be changed to match locally installed python

STAGING_AREA=$SRC_DIR/CI/kuiper/staging
SYSROOT=$STAGING_AREA/sysroot
SYSROOT_TAR=$STAGING_AREA/sysroot.tar.gz
Expand Down
11 changes: 8 additions & 3 deletions CI/kuiper/kuiper_build_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ set_config_opts() {
install_packages() {
sudo apt update
sudo apt install -y build-essential cmake unzip gfortran gcc git bison libtool \
python3 pip gperf pkg-config gdb-multiarch g++ flex texinfo gawk openssl \
${PYTHON_VERSION}-full pip gperf pkg-config gdb-multiarch g++ flex texinfo gawk openssl \
pigz libncurses-dev autoconf automake tar figlet liborc-0.4-dev* patchelf libc6-dev-armhf-cross squashfs-tools
pip install mako
}
Expand Down Expand Up @@ -255,7 +255,8 @@ build_scopy() {
echo "### Building scopy"
pushd $SRC_DIR
CURRENT_BUILD_CMAKE_OPTS="\
-DCLONE_IIO_EMU=OFF
-DCLONE_IIO_EMU=OFF \
-DPYTHON_EXECUTABLE=/usr/bin/python3.9
"
build_with_cmake
popd
Expand Down Expand Up @@ -302,7 +303,10 @@ create_appdir(){


cp -r $QT_LOCATION/plugins $APP_DIR/usr
cp -r $SYSROOT/lib/python3.9 $APP_DIR/usr/lib
# search for the python version linked by cmake and copy inside the appimage the same version
FOUND_PYTHON_VERSION=$(grep 'PYTHON_VERSION' $SRC_DIR/build/CMakeCache.txt | awk -F= '{print $2}' | grep -o 'python[0-9]\+\.[0-9]\+')
python_path=/usr/lib/$FOUND_PYTHON_VERSION
cp -r $python_path $APP_DIR/usr/lib
cp -r $SYSROOT/share/libsigrokdecode/decoders $APP_DIR/usr/lib

cp $QT_LOCATION/lib/libQt5XcbQpa.so* $APP_DIR/usr/lib
Expand All @@ -326,6 +330,7 @@ create_appdir(){
cp $SYSROOT/lib/arm-linux-gnueabihf/libXdmcp.so* $APP_DIR/usr/lib
cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libXau.so* $APP_DIR/usr/lib
cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libxcb.so* $APP_DIR/usr/lib
cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libffi.so* $APP_DIR/usr/lib
}


Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ if(PYTHON_EXECUTABLE)
else()
message(STATUS "Using default Python EXECUTABLE")
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
message (STATUS "Found Python " ${Python3_VERSION} " at " ${Python3_EXECUTABLE} " and " ${Python3_LIBRARY})

if(CMAKE_SYSTEM_PROCESSOR MATCHES arm)
find_package(Python3 3.9 EXACT REQUIRED COMPONENTS Interpreter)
message (STATUS "Host Python Interpreter " ${Python3_EXECUTABLE})
set(Python3_EXECUTABLE ${CMAKE_SYSROOT}/bin/python3.9)
message (STATUS "Target Python Interpreter " ${Python3_EXECUTABLE})
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
message (STATUS "Python Interpreter " ${Python3_EXECUTABLE})
message (STATUS "Python Libraries " ${Python3_LIBRARIES})
endif()
set(PYTHON_VERSION python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} CACHE STRING "PYTHON_USED")

function(dump_cmake_variables)
Expand Down

0 comments on commit 3eafb97

Please sign in to comment.