Qt Program deploy to multi platform, how?

时光毁灭记忆、已成空白 提交于 2019-12-09 12:28:25

问题


Am new in Qt Programming and i would like to develop a program which i want to run in Windows, Linux(ubuntu), and Mac.

I heard that Qt support mutli-platform application development,

but my Question is that,

would any Qt library need to run these appilication in Ubuntu after i deployed or compiled?


回答1:


If you deploy on Ubuntu, and therefore use a .deb package, then your job is easy since you just have to require qt as a dependency and apt will automatically install it as needed.

Windows and Mac however do not have any "good" software management layer, so you have no choice but include the required Qt DLLs with your binary or compile a static one. On Windows you just have to make sure the DLLs are in the same directory as your program. Mac however requires some relinking to be done. This is a big pain, but fortunately Qt comes with a tool named macdeployqt which does this for you.

So according to my experience, Linux is the easiest platform to deploy to, followed by Windows, and Mac is a good last.

The link to the Qt deployment doc given above is a good starting point. If you need an example, I have written a couple of scripts to build the Windows binaries of a program of mine. You can have a look at these to get started.

Windows installer:
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/buildwin32releases.sh
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/tagainijisho.nsi




回答2:


Talking for the Linux side here, if you distribute your application as packages (deb, rpm) then you can use the package dependencies rules. If you define these rules correctly, then the package manager will install the Qt libraries you need when installing your application.



来源:https://stackoverflow.com/questions/2407319/qt-program-deploy-to-multi-platform-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!