Resource files in OS X bundle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Fixed links) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
= How to add resource files to an OS X application bundle = | = How to add resource files to an OS X application bundle = | ||
On OS X, applications are delivered as so called | On OS X, applications are delivered as so called "bundles". That's just a directory with a predefined structure and the suffix .app. You can learn more about the structure in the [http://doc.qt.io/qt-5/osx-deployment.html OS X specific deployment instructions] of the Qt documentation and in [http://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW13 Apple's own docs about application bundles]. | ||
If you have additional files that need to be distributed along your application that cannot be put into the | If you have additional files that need to be distributed along your application that cannot be put into the [http://doc.qt.io/qt-5/resources.html qrc resources] (eg. QML files), they have to be installed in the right place. For resource files this is YourFancyApplication.app/Contents/Resources. | ||
You can let qmake do all the copy work for you. Just add a snippet like this to your .pro file: | You can let qmake do all the copy work for you. Just add a snippet like this to your .pro file: | ||
<code> | <code> | ||
APP_QML_FILES.files = path/to/file1.qml path/to/file2.qml | |||
APP_QML_FILES.path = Contents/Resources | |||
QMAKE_BUNDLE_DATA += APP_QML_FILES | |||
</code> |
Latest revision as of 14:08, 24 March 2016
How to add resource files to an OS X application bundle
On OS X, applications are delivered as so called "bundles". That's just a directory with a predefined structure and the suffix .app. You can learn more about the structure in the OS X specific deployment instructions of the Qt documentation and in Apple's own docs about application bundles.
If you have additional files that need to be distributed along your application that cannot be put into the qrc resources (eg. QML files), they have to be installed in the right place. For resource files this is YourFancyApplication.app/Contents/Resources.
You can let qmake do all the copy work for you. Just add a snippet like this to your .pro file:
APP_QML_FILES.files = path/to/file1.qml path/to/file2.qml
APP_QML_FILES.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_QML_FILES