Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to process application assets files when creating .dmg on Mac OS X
We've just finished development of our application and are trying to create a .dmg disk image for public distribution. The applicaiton is developed with Qt 4.8.3 (binary framework installation) on Mac OS X. We've successfully used macdeployqt tool to create the application bundle along with a .dmg disk image file. The macdeployqt is magic and help copying Qt and 3rd party libraries into AppName.app/Contents/Frameworks directory. We can run the app from inside the bundle directory (AppName.app/Contents/MacOS) from either terminal ($ ./appname) or Finder (double mouse click).
However, after we installed the application using the .dmg file and run our app from the Launchpad, our app crashed at startup and the debug information indicates that the crash reason is that the assets files could not be loaded. Our app depends on quite a number of assets files (fonts, map data, palette data, help documents etc.) to run. We just copy these assets files into AppName.app/Contents/MacOS directory (where the executable file 'appname' resides) when we create the .dmg file as in our code these asset files are referenced in relative path.
So how to figure this issue out? Thanks in advance.
vtong last edited by
Did you create a Resource file and put your assets there?
Normally I put all to resource file and build.
Thank you for your help.
Could you be more specific on how to create a resource file and put all my assets files (100+) into this file?
vtong last edited by
You can also create a resource file from Qt Creator:
Hope this help and solve your issue
As a matter of fact, my project already consists of a .qrc resource file that specifying image resources for icons, button images and so on.
I thought your approach may not apply in my case, as my assets files are referenced by low-level modules projects (built as .dylib files) instead of the top-level Qt GUI app project. These asset files are loaded in the source code by specifying the file names. If these asset files are packed into a single Qt resource file, they cannot be referenced by the modules.