Qt Program deploy to multi platform, how?

2019-03-29 08:30发布

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?

2条回答
家丑人穷心不美
2楼-- · 2019-03-29 08:55

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

查看更多
爷、活的狠高调
3楼-- · 2019-03-29 08:55

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.

查看更多
登录 后发表回答