团队自研股票软件,关威信共总号:QStockView,下载
1.1 windows系统编译的Qt程序转到国产化麒麟linux中编译
(1)把Vs工程项目文件导入到Linux中
首先把vs的工程拷贝到linux里面(可以用虚拟机的共享文件夹功能),把工程里面的目录Debug、GeneratedFiles、Release、Win32、x64和文件…user、…sln、…vcxproj、…filters删掉。这里根据vs版本的不同删除的文件和目录也可能不同。只要保留.h、.cpp、.qrc(没有这个文件编译出来的Qt项目会显示不了图片)、.ui文件和Resources目录就可以了;
(5)生成pro文件
执行如下命令,会生成XXX.pro项目文件
qmake -project QT+=widgets
(6)生成makefile文件
执行命令qmake命令,或者用QtCreator打开项目文件.pro文件,然后执行构建—执行qmake,会生成makefile文件;
(7)修改pro文件,增加依赖库,头文件包含目录,编译命令;
######################################################################
# Automatically generated by qmake (3.1) Fri Apr 14 16:27:32 2023
######################################################################
#增加qt依赖
QT+=widgets gui
QT+=sql
QT+=core
QT+=printsupport
#设置编译类型
TEMPLATE = app
#输出目标,名称;
TARGET = AnalysisCenter
#设置中间生成文件的路径
MOC_DIR=$$PWD/temp/moc
RCC_DIR=$$PWD/temp/rcc
UI_DIR=$$PWD/temp/ui
OBJECTS_DIR=$$PWD/temp/obj
#设置程序输出路径,$$PWD为pro文件所在路径
DESTDIR=$$PWD/linuxx64
#设置包含文件路径
INCLUDEPATH += $$PWD/include/
INCLUDEPATH += $$PWD/include/HUIControl/
INCLUDEPATH += $$PWD/include/HUIControl/GeneratedFiles/
INCLUDEPATH += $$PWD/include/hpr/
INCLUDEPATH += $$PWD/include/videoplay/
INCLUDEPATH += $$PWD/include/hlog/
INCLUDEPATH += $$PWD/include/curl/
#设置文件编码格式,不然会出现中文乱码
QMAKE_CXXFLAGS +=-finput-charset=UTF-8 -fexec-charset=utf-8
#添加依赖库文件
LIBS += -L$$PWD/linuxx64/ -lhlog -lhpr -lHUIControl -lQt5Svg -lPlayCtrl -lSystemTransform -lcurl -lAnalyzeData
#-Wl,-rpath=设置依赖库路径为程序当前路径,不然Qt会默认使用安装包的库,造成错误;
LIBS += -Wl,-rpath=./
QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN'" -Wl,-rpath,"./" -Wl,-rpath-link,"$(DESTDIR)"
#设置依赖库路径
DEPENDPATH +=.
#自动生成的文件包含依赖关系
# The following define makes your compiler warn you if you use any
# feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Input
HEADERS += include/Algorithm.h \
include/AlgPublicDefine.h \
include/AnalyzeDataDefine.h \
include/AnalyzeDataNewInterface.h \
include/base_define.h \
include/CrashAPI.h \
FORMS += src/AddClusterTask.ui \
src/AddTaskItem.ui \
src/AddVedioAnaTask.ui \
src/AddVideoCollision.ui \
src/AnalysisTaskItem.ui \
src/CaseItem.ui \
src/CaseStateWidget.ui \
src/CCustomButton.ui \
src/Cluster.ui \
src/ClusterContainer.ui \
src/ClusterDetails.ui \
src/ClusterDetailsItem.ui \
src/ClusterLoadWait.ui \
src/WaringDialog.ui
SOURCES += src/AddClusterTask.cpp \
src/AddFileTaskItem.cpp \
src/AddVedioAnaTask.cpp \
src/AddVideoCollision.cpp \
src/AnalysisTaskItem.cpp \
src/aspectratiopixmaplabel.cpp \
src/CaseItem.cpp \
src/CaseStateWidget.cpp \
src/CCustomButton.cpp \
src/ClientAgent.cpp \
src/Cluster.cpp \
RESOURCES += src/facematch.qrc
标签:src,Qt,文件,windows,编译,PWD,ui,cpp,include From: https://www.cnblogs.com/bclshuai/p/17453758.html