一、简述
QT3D是从qt5.5之后,开始加入源码中的,以前作为单独的模块存在。
二、资源下载
qt-5.5.1源码下载
三、编译前的准备
1.解压qt源码
mkdir -p /opt/qt5
cd
tar -xzvf qt-everywhere-opensource-src-5.5.1.tar.gz -C /opt/qt5
cd /opt/qt5
mv qt-everywhere-opensource-src-5.5.1 qt_src
2.解压imx53 gpu库
cd
tar -xzvf amd-gpu-bin-mx51-11.09.01_201112.tar.gz -C /opt/qt5
cd /opt/qt5
mkdir exlib-mx5
cp -rf /opt/qt5/amd-gpu-bin-mx51-11.09.01_201112/usr exlib-mx5/
3.Download the attached linux-imx5-g++.tar.gz and copy to qtbase/mkspecs/devices
cp -rf linux-imx53qsb-g++/ qt_src/qtbase/mkspecs/devices/
内容:
QMAKE_LIBS_EGL += -lEGL -lgsl-fsl
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lgsl-fsl
QMAKE_INCDIR_OPENVG += /opt/qt5/exlib-mx5/usr/include
QMAKE_LIBDIR_OPENVG += /opt/qt5/exlib-mx5/usr/lib
IMX6_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1
QMAKE_CFLAGS += $$IMX6_CFLAGS
QMAKE_CXXFLAGS += $$IMX6_CFLAGS
QMAKE_INCDIR_OPENGL_ES2 = /opt/qt5/exlib-mx5/usr/include
QMAKE_LIBDIR_OPENGL_ES2 = /opt/qt5/exlib-mx5/usr/lib
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 -lEGL -lgsl-fsl
QMAKE_INCDIR_EGL = /opt/qt5/exlib-mx5/usr/include
QMAKE_LIBDIR_EGL = /opt/qt5/exlib-mx5/usr/lib
4.编写配置脚本auto_config.sh
cd /opt/qt5
mkdir qt-build-mx5 qte-mx5
cd qt-build-mx5
内容:
#/bin/sh
/opt/qt5/qt_src/configure \
-v -prefix /opt/qt5/qte-mx5 \
-release \
-opensource -confirm-license \
-qt-sql-sqlite \
-qt-libpng \
-qt-libjpeg \
-qt-freetype \
-qt-pcre \
-qt-zlib \
-make examples \
-dbus \
-no-iconv \
-make libs \
-device imx5 \
-no-xcb \
-no-directfb \
-no-kms \
-no-openssl \
-eglfs \
-qpa eglfs \
-opengl es2 \
-openvg \
-device-option \
CROSS_COMPILE=/usr/local/arm/gnueabi-4.4.4/bin//arm-fsl-linux-gnueabi- \
拷贝 auto_config.sh 到qt-build-mx5
chmod 777 auto_config.sh
四、编译
cd /opt/qt5/qt-build-mx5
./auto_config.sh
确保下图箭头所指为yes
OpenGL / OpenVG:
EGL .................. yes
OpenGL ............... yes (OpenGL ES 2.0+)
OpenVG ............... yes-auto
PCRE ................... yes (bundled copy)
pkg-config ............. no
PulseAudio ............. no
QPA backends:
DirectFB ............. no
EGLFS ................ yes
EGLFS i.MX6....... . yes
EGLFS KMS .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
EGLFS X11 .......... no
LinuxFB .............. yes
XCB .................. no
Session management ..... yes
make
make install
安装目录/opt/qt5/qte-mx5
四,测试
1.添加相应的环境变量
打开板子上的文件 vi /etc/profile
结果如下图所示
export QT_ROOT=/opt/qte-mx5
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=eglfs:tty=/dev/fb0
export FB_MULTI_BUFFER=2
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QML2_IMPORT_PATH=$QT_ROOT/qml
export LD_LIBRARY_PATH=/lib:/usr/lib:$QT_ROOT/lib:$TSLIB_ROOT/lib
2.把相应的库放到相应的位置
通过nfs,把编译出来的qte-mx5下的所有文件放到上图的$QT_ROOT所指位置处
通过nfs,把exlib-mx5中所有的库,放到$LD_LIBRARY_PATH所指位置处
3.测试
运行quick中的demo
阅读(2000) | 评论(0) | 转发(0) |