QT5移植arm/aarch64平台

qt版本:qt-everywhere-src-5.12.9

给出QT移植的方法,以及解决QT-rgb24显示的问题。不更改Linux驱动下,让QT正常显示。(我已经以补丁的形式反馈给了官方)

要点:

  • 更改qmake
  • configure配置
  • 可能会遇到arm端的fb为24bit时显示rgb通道不对应的情况(显示为bgr),网上没啥解决办法苦读源码解决的。

移植流程可以参考正点原子的教程(我这里只给出重点需要更改的部分),具体文件:

qt移植相关资料,以及解决rgb24bit显示问题-Linux文档类资源-CSDN下载

1、qmake

#
# qmake configuration for building with aarch64-linux-gnu-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv8-a -lts
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv8-a -lts

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC                = aarch64-linux-gnu-gcc
QMAKE_CXX               = aarch64-linux-gnu-g++
QMAKE_LINK              = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB        = aarch64-linux-gnu-g++

# modifications to linux.conf
QMAKE_AR                = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = aarch64-linux-gnu-objcopy
QMAKE_NM                = aarch64-linux-gnu-nm -P
QMAKE_STRIP             = aarch64-linux-gnu-strip
load(qt_config)

2、configure(auto.sh)

#!/bin/bash

./configure -prefix /data/horizon_x3/codes/QT5 \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-extprefix /opt/QT5 \
-xplatform linux-aarch64-gnu-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/data/horizon_x3/codes/tslib-1.22/install_dir/include \
-L/data/horizon_x3/codes/tslib-1.22/install_dir/lib \
-recheck-all

exit

以上一般都能在arm(嵌入式端)正常显示了。自己写个demo测测,可能会有rgb通道显示的问题:

解决办法:找到qt-everywhere-src-5.12.9\qtbase\src\plugins\platforms\linuxfb下的文件

在QT进行绘制时可以mScreenImage.rgbSwapped()可以转变通道对应关系。代码有点多就不贴了。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值