Solved Best practices for including external programs in a Qt program
-
When your code depends on external software and licensing allows it, do you include the external software with your distribution? If so, how do you get the Qt build system to include it?
I'm writing a piece of software that needs to call FFmpeg to encode some video. I was hoping that for my three main target platforms I could include the FFmpeg executable along with my Qt app to make things easier for my end-users, but I don't see a straightforward way of doing this using the Qt build system. In previous versions you could abuse the DEPLOYMENT variable to accomplish it, but since that was only supposed to be for WinCE and Symbian it's dead and gone now. Obviously in an ideal world each of the platforms would only include the one they need, but I'd be happy if I could just coax qmake into including an arbitrary directory alongside every build.
-
Qt build system
coax qmake
It's not clear which system are you using: qmake or QBS for qmake you can use the INSTALLS variable and for QBS see here
None of these systems is designed to be a retail installer by the way, maybe you can force linux users into using qmake but for windows and mac users a build-your-own solution is unusual. You can use the Qt Installer Framework to create real installers
P.S.
include the FFmpeg executable
FFmpeg also distributes libraries (in C) to incorporate in your software without the need to call an external executable.
https://www.ffmpeg.org/libavcodec.html -
@VRonin said in Best practices for including external programs in a Qt program:
FFmpeg also distributes libraries (in C) to incorporate in your software without the need to call an external executable.
https://www.ffmpeg.org/libavcodec.htmlYeah, you're right, I really ought to do it the proper way and use the library. Using the executable is easy and keeps my code relatively neat, but the price is probably too high. It wasn't clear from the qmake documentation (sorry for the confusion above, I am using qmake, not QBS) whether the INSTALL variable would be used only during the equivalent of a "make install", or if it would also copy the files during a normal development build.
-
during the equivalent of a "make install"
yes, that will work during make install.
While a "normal build" should not deploy, you can use QMAKE_EXTRA_TARGETS to achieve your result