Add libpixy2 (C++ and Python) to image (#85)

This commit is contained in:
Peter Johnson 2019-02-09 21:52:28 -08:00 committed by GitHub
parent ee70b90853
commit 01f025ac12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -6,3 +6,5 @@ python3.5-dev
python3-numpy
python3-pybind11
python3-pip
libusb-1.0-0-dev
swig

View File

@ -55,6 +55,10 @@ wget -nc -nv -O robotpy-cscore.tar.gz \
wget -nc -nv -O pybind11.tar.gz \
https://github.com/pybind/pybind11/archive/v2.2.tar.gz
# pixy2
wget -nc -nv -O pixy2.tar.gz \
https://github.com/charmedlabs/pixy2/archive/2adc6caba774a3056448d0feb0c6b89855a392f4.tar.gz
popd
#
@ -92,6 +96,13 @@ tar xzf "${DOWNLOAD_DIR}/pybind11.tar.gz"
mv pybind11-* pybind11
popd
# pixy2
tar xzf "${DOWNLOAD_DIR}/pixy2.tar.gz"
mv pixy2-* pixy2
rm -rf pixy2/releases
sed -i -e 's/python/python3/g;s/_pixy.so/_pixy.*.so/' pixy2/scripts/build_python_demos.sh
sed -i -e 's/print/#print/' pixy2/src/host/libpixyusb2_examples/python_demos/setup.py
popd
#
@ -315,6 +326,21 @@ arm-raspbian9-linux-gnueabihf-g++ \
popd
#
# Build pixy2
#
on_chroot << EOF
pushd /usr/src/pixy2/scripts
./build_libpixyusb2.sh
./build_python_demos.sh
popd
EOF
install -m 644 "${EXTRACT_DIR}/pixy2/build/libpixyusb2/libpixy2.a" "${ROOTFS_DIR}/usr/local/frc/lib/"
install -m 644 "${EXTRACT_DIR}/pixy2/build/python_demos/pixy.py" "${ROOTFS_DIR}/usr/local/lib/python3.5/dist-packages/"
install -m 755 ${EXTRACT_DIR}/pixy2/build/python_demos/_pixy.*.so "${ROOTFS_DIR}/usr/local/lib/python3.5/dist-packages/"
rm -rf "${EXTRACT_DIR}/pixy2/build"
#
# Finish up
#