SDK使用教程

SDK:Software Development kit 软件开发工具包,一般是特定平台的软件包、软件框架、硬件平台、操作系统等建立应用软件的开发工具的集合。

1、资源
Qt开发是要依赖OS提供的SDK
Qt5.3.2使用的是poky1.7
Qt5.6.2使用的是fsl-imx-fb

2、安装
拷贝到 Linux下的/opt 下进行安装,
sh poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.7_20150530.sh

3、配置qtcreator.sh启动文件
以Qt5.6.2平台为例子,假设安装SDK时的路径为:/opt/fsl-imx-fb/4.1.15-2.0.1,如果你安装的路径与本文不一致,请修改下面配置你的路径
source /opt/fsl-imx-fb/4.1.15-2.0.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

# Add environment variables for i.MX6Q
export SDKTARGETSYSROOT= /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi
export OE_QMAKE_AR="arm-poky-linux-gnueabi-ar"
export OE_QMAKE_CC="arm-poky-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export OE_QMAKE_CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
export OE_QMAKE_COMPILER="arm-poky-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export OE_QMAKE_CXX="arm-poky-linux-gnueabi-g++  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export OE_QMAKE_CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/timotheus/projects/fsl-4.1.15_2.0.0-bsp/build-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
export OE_QMAKE_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export OE_QMAKE_LINK="arm-poky-linux-gnueabi-g++  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export OE_QMAKE_STRIP="arm-poky-linux-gnueabi-strip"
export QT_CFLAGS_DBUS="-I /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/dbus-1.0 -I /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/dbus-1.0/include"
export QT_LIBS_DBUS="-ldbus-1"
export QT_CFLAGS_PULSEAUDIO="-D_REENTRANT -I /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/glib-2.0 -I /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/glib-2.0/include"
export QT_LIBS_PULSEAUDIO="-lpulse-mainloop-glib -lpulse -lglib-2.0"
export QMAKE_INCDIR_OPENGL_ES2=" /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/libdrm"
export QMAKE_LIBDIR_OPENGL_ES2=""
export QMAKE_LIBS_OPENGL_ES2="-lGLESv2 -lEGL -lGAL"
export QMAKE_INCDIR_LIBUDEV=""
export QMAKE_LIBS_LIBUDEV="-ludev -lrt  DEFINES +="
export QT_NO_XKB QMAKE_INCDIR_EGL=" /opt/fsl-imx-fb/4.1.15-2.0.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/libdrm"
export QMAKE_LIBS_EGL="-lEGL"
export QMAKE_CFLAGS_XCB=""
export QMAKE_LIBS_XCB="-lxcb-sync -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb-randr -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-icccm -lxcb"
# End

4、添加Qt版本
在Qt-工具-构建和运行-Qt Versions,通过qmake进行添加
如果报错qmake添加不成功,则SDK有问题,或者安装时出错了

5、添加编译器
【注意】编译器的类型要选择Custom,否则有可能编译不生效

6、添加构建套件(kit)

7、hello测试
编写Qt的hello进行测试,能够构建成功,则SDK可以使用


你可能感兴趣的:(Qt)