一.SDK工具的准备
请参考 如何脱离petalinux环境直接编译vcu-gst-app
1.配置Qt sdk
petalinux-config -c rootfs
设置Petalinux Package Groups -> packagegroup-petalinux-qt -> populate_sdk_qt5 退出保存
2.生成并安装sdk
petalinux-build --sdk
petalinux-package --sysroot
build sdk这步根据电脑配置,可能需要半小时到一小时
二.安装Qt
1.查看petalinux对应的Qt版本号
根据结果可以看出版本为5.13.2
xlx@u16:/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots$ find -name libQt*
./aarch64-xilinx-linux/usr/lib/libQt5WaylandClient.prl
./aarch64-xilinx-linux/usr/lib/libQt53DQuickExtras.so.5
./aarch64-xilinx-linux/usr/lib/libQt5Xml.so
./aarch64-xilinx-linux/usr/lib/libQt5PublishSubscribe.so
./aarch64-xilinx-linux/usr/lib/libQt5DesignerComponents.so.5.13
./aarch64-xilinx-linux/usr/lib/libQt5Widgets.so
./aarch64-xilinx-linux/usr/lib/libQt5EglFSDeviceIntegration.so.5
./aarch64-xilinx-linux/usr/lib/libQt5QmlDevTools.prl
./aarch64-xilinx-linux/usr/lib/libQt53DCore.so.5
./aarch64-xilinx-linux/usr/lib/libQt5Qml.so.5.13
./aarch64-xilinx-linux/usr/lib/libQt5SerialPort.so.5.13.2
./aarch64-xilinx-linux/usr/lib/libQt5SerialPort.prl
........
........
........
2.从Qt官网下载对应的版本
https://download.qt.io/archive/qt/5.13/5.13.2/qt-opensource-linux-x64-5.13.2.run
在安装的时候需要注册一个账号
三.配置Qt Creator
Tools -> Options
1.手动添加Compilers
2.手动添加Qt Versions
3.手动增加Kits
四、编译工程
1.源代码
xlx@u16:/opt/work/p202/vcu-qt/vcu_qt$ tree
.
├── font
│ └── luxisr.ttf
├── images
│ ├── backFolder.png
│ ├── close.png
│ ├── downArrow.png
│ ├── dropdown.png
│ ├── error.png
│ ├── folder.png
│ ├── fullScreen.png
│ ├── pause.png
│ ├── play_arrow.png
│ ├── sampleImg.png
│ ├── textFile.png
│ ├── upArrow.png
│ ├── xilinxLogo.png
│ └── zynqLogo.png
├── include
│ ├── CPUStat.h
│ ├── dirop.h
│ ├── maincontroller.h
│ └── video_cfg.h
├── qml
│ ├── AudioSettingsTab.qml
│ ├── CodecDropDown.qml
│ ├── ConfigProperty.qml
│ ├── ControlVu.qml
│ ├── EncDecPanel.qml
│ ├── EncParamTab.qml
│ ├── ErrorMessage.qml
│ ├── FileListVu.qml
│ ├── FileTab.qml
│ ├── InputSettingsPopup.qml
│ ├── KeypadPopup.qml
│ ├── main.qml
│ ├── NumberKeyPad.qml
│ ├── NumSrcVu.qml
│ ├── OptionsScrollVu.qml
│ ├── OutputDropDown.qml
│ ├── PresetProperties.qml
│ ├── QuadrantView.qml
│ ├── StatusView.qml
│ ├── StreaminPopup.qml
│ └── StreamOutTab.qml
├── qml.qrc
├── README.md
├── src
│ ├── CPUStat.cpp
│ ├── dirop.cpp
│ ├── maincontroller.cpp
│ ├── main.cpp
│ └── video_cfg.cpp
├── vcu_qt.pro
└── vcu_qt.pro.user
5 directories, 49 files
2.修改搜索路径
在Qt Creator中打开vcu_qt.pro 根据自己的sdk安装目录和vcu-gst-app的目录,修改对应的搜索路径
INCLUDEPATH += \
include \
/opt/work/p202/vcu-gst-app/lib/vcu_gst_lib/include \
/opt/work/p202/vcu-gst-app/lib/vcu_apm_lib/include \
/opt/work/p202/vcu-gst-app/lib/vcu_video_lib/include \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/include/gstreamer-1.0 \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/include/gstreamer-1.0/gst \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/include/glib-2.0 \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/lib/glib-2.0/include \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/lib/gstreamer-1.0/include \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/lib/gstreamer-1.0/include/gst \
/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/include
QMAKE_LIBDIR_FLAGS += \
-L/opt/work/p202/vcu-gst-app/ \
-L/opt/work/p202/vcu-gst-app/lib/vcu_video_lib/Release \
-L/opt/work/p202/vcu-gst-app/lib/vcu_video_lib/Debug \
-L/opt/work/p202/vcu-gst-app/lib/vcu_gst_lib/Release \
-L/opt/work/p202/vcu-gst-app/lib/vcu_gst_lib/Debug \
-L/opt/work/p202/vcu-gst-app/lib/vcu_apm_lib/Release \
-L/opt/work/p202/vcu-gst-app/lib/vcu_apm_lib/Debug \
-L/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/lib \
-L/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/lib \
-L/opt/work/p202/xilinx-vcu-zcu106-v2020.2-final/images/linux/sdk/sysroots/aarch64-xilinx-linux/usr/lib/gstreamer-1.0
3.编译输出
编译后输出文件为…/build-vcu_qt-xilinx_c-Debug/vcu_qt,复制到开发板运行即可
xlx@u16:/opt/work/p202/vcu-qt/build-vcu_qt-xilinx_c-Debug$ tree
.
├── Makefile
├── moc
│ ├── moc_dirop.cpp
│ ├── moc_maincontroller.cpp
│ └── moc_predefs.h
├── obj
│ ├── CPUStat.o
│ ├── dirop.o
│ ├── maincontroller.o
│ ├── main.o
│ ├── moc_dirop.o
│ ├── moc_maincontroller.o
│ ├── qrc_qml.o
│ └── video_cfg.o
├── qrc_qml.cpp
└── vcu_qt
2 directories, 14 files
开发板上根据实际情况,可能需要设置以下环境变量
vi /etc/profile 增加
export QTDIR=/usr/local/qt/
export PATH=$QTDIR/lib:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=/usr/local/qt/plugins
4.其他问题(可选)
编译时#include 提示文件不存在 ? 解决方案1: 在 pro 文件里面 QT += network ? 解决方案2: 写 #include <QtNetwork/QtNetwork>
|