嵌入式Linux开发中qt.conf配置

Qt程序启动时会用QLibraryInfo类载入qt.conf文件,qt.conf主要用于配置qt编译环境,如qt头文件所在路径,qt动态库所在路径等。如果没有qt.conf,qt会采用硬编码在qmake内的路径
如下是常用的qt.conf路径及功能

[Paths]
#待续
Prefix = /usr
Headers = /usr/include/qt5
Libraries = /usr/lib64
ArchData = /usr/lib64
Data = /usr/share
Binaries = /usr/bin
LibraryExecutables = /usr/lib64/qt5/libexec
Plugins = /usr/lib64/plugins
Qml2Imports = /usr/lib64/qml
Translations = /usr/share/translations
Documentation = /usr/share/doc
Settings = /etc
Examples = /usr/share/examples
Tests = /usr/share/tests

#编译程序的根目录
HostPrefix = /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux

#编译环境中的可执行文件路径,(用于编译),此目录下是运行在Linux服务器端的qmake
HostBinaries = /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/bin/qt5
HostLibraries = /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/lib

#qt的sysroot,也就是编译环境的根目录(用于链接和运行),此目录下是运行在嵌入式板端的动态库等
Sysroot = /opt/poky/3.1.5/sysroots/aarch64-poky-linux

#qt的data根目录,主要是为了让qmake找到所需的模块,如core,gui等,此目录下应该存在各模块的pri文件,如modules/qt_lib_core.pri
HostData = /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/qt5

#编译环境的类别
HostSpec = linux-oe-g++

具体qt.conf可以写哪些参数,可以读qmake/property.cpp代码来进一步了解。

上一篇:docker 重启报错


下一篇:每天一道题(岛屿类型问题)