macosqt.appmacdeployqt

Add to Qt project contents of directory as OS X bundle resource


I want to add to Qt project a contents of directory which contains: a bash script and a few java files inside other various sub-directories. I tried INCLUDEPATH and it didn't work.

I don't want the directory in the build directory, I want it inside the .app file (OS X bundle) so when I use macdeployqt they are all packed inside a .dmg file.


Solution

  • Files from this directory you have to add this way:

    APP_JAVA_FILES.files = <this directry>/Class1.java \
                           <this directry>/Class2.java
    APP_JAVA_FILES.path = Contents/Resources
    
    APP_JAVA_FILES2.files = <this directory>/sub-dir/Class3.java \
                           <this directory>/sub-dir/Class4.java
    APP_JAVA_FILES2.path = Contents/Resources/sub-dir
    
    APP_BASH_FILES = <this directory>/script.sh
    APP_BASH_FILES.path = Contents/Resources
    
    QMAKE_BUNDLE_DATA += APP_JAVA_FILES APP_JAVA_FILES2 APP_BASH_FILES
    

    Here is a documentation about this.