When you develop a program with QT, will you be looking forward to sharing your results with your little friends?
But the QT library is not OS X standard, so we have to copy the library to the app package, so that the app can be run on other computers that do not have QT installed.
Fortunately, QT provides us with the MACDEPLOYQT tool, which is the simplest of all platforms to publish QT-written programs on OS X.
Note: My computer is configured with a QT bin environment, so you can use MACDEPLOYQT directly
If not configured, you can use the absolute path to find.
The absolute path to MACDEPLOYQT on my computer is:/APPLICATIONS/QT5.4.1/5.4/CLANG_64/BIN/MACDEPLOYQT
1. Release the Widgets program
1.1: This is more convenient. Select release mode, compile
1.2: Run MACDEPLOYQT
For my project, the command is:
Macdeployqt/users/jason/desktop/build-untitled-desktop_5_4_0_64bit-release/untitled.app-dmg
Then go to the carriage and pack.
After that we will find that the app directory has more than one DMG file
This DMG file, inside the app is our release of the app. Copy the DMG to someone else and you can use it directly.
Note: If you copy the app files directly to others, others are unable to run directly, there will be permissions problems (to use chmod to the executable file plus x permission to run).
And after compressing (zip or dmg), copy to others, others can be run directly, no permissions problems.
Note:-DMG means that after copying a good library, generate a DMG file, can not add this parameter.
2. Release the QUICK2 program
This is a little bit more troublesome
2.1: Then, release mode, compile
2.2: Open the terminal, first switch the target directory of the compilation
For my project, the command is:
Cd/users/jason/desktop/build-untitled-desktop_5_4_0_64bit-release
2.3: Run MACDEPLOYQT
For my project, the command is:
MACDEPLOYQT untitled.app-qmldir=. /untitled-dmg
Then go to the carriage and pack.
Note: Unlike the Widgets release program, Untitled.app this name, to enter directly, do not write./untitled.app or other absolute/relative paths, otherwise the packaged files cannot be used!! will be error!!!
Note 2:-qmldir=. /untitled means to be in a. /untitled directory has qml files, let macdeployqt to analyze them, to use the library to find.
Reference: http://blog.csdn.net/wsj18808050/article/details/44223065
Qt for Mac: Publishers (Widgets and Quick2)