Results 1 to 5 of 5

Thread: Mac: Copy Files Build Phase and qmake...

  1. #1
    Join Date
    Aug 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Mac: Copy Files Build Phase and qmake...

    Is there a way to add a Copy Files Build Phase for Mac Xcode projects using qmake?

    I'm still pretty new to Qt and I'm trying to clean up our qmake project file to get things working better on the Mac side. We've got a Framework that needs to be embedded inside our application's bundle ( foo.app/Contents/Frameworks ). Using Xcode you would add a Copy Files Build Phase for this particular framework and set its destination to the Frameworks folder. Is there any way to do this using qmake?

    Right now when I run qmake to create our Xcode project I have to add the Copy Files Build Phase manually every time but I'd much rather automate this so that the Xcode project won't need to be modified after running qmake. Any suggestions on how to do this? I've been searching around trying to figure this out but I can't find any hints as to what to do.

    Thanks!

    Dave Thorup
    Bibble Labs

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Mac: Copy Files Build Phase and qmake...

    See the docs about creating "installs" using qmake.

  3. #3
    Join Date
    Aug 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Mac: Copy Files Build Phase and qmake...

    Thanks for the hint but I still can't get it working. As far as I can tell you're supposed to create an install set as follows in your project file:

    frameworks.path = myApp.app/Contents/Frameworks
    frameworks.files = path/to/framework/*

    INSTALLS += frameworks

    I've tried this and nothing happens when I build my project in Xcode. Is there something else you need to do to get Xcode to "install" the files?

    I've even created a minimal project file if anyone else wants to try it out and confirm that it doesn't work, or point out what I'm doing wrong.

    qmakeTest.pro
    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Fri Sep 21 15:16:49 2007
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET = qmakeTest
    7. DEPENDPATH += .
    8. INCLUDEPATH += .
    9.  
    10. # Input
    11. SOURCES += main.cpp
    12.  
    13. images.path = qmakeTest.app/Contents/Images
    14. images.files = car.jpg
    15.  
    16. INSTALLS += images
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include <QWidget>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7. w.setGeometry(100, 100, 500, 355);
    8. w.show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    car.jpg is just a jpeg file that I want to be installed inside the app bundle in Contents/Images.

    Steps to follow:
    1. Put qmakeTest.pro, main.cpp & car.jpg (or your own file) in a folder.
    2. Run "qmake qmakeTest.pro"
    3. Open the generated Xcode project and build it.
    4. Look inside the application package and notice that there is no Images folder anywhere to be found.


    As far as I can tell this is how it should be done but nothing happens when I build the Xcode project. Any suggestions?

    Thanks

    Dave Thorup
    Bibble Labs

  4. #4
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Mac: Copy Files Build Phase and qmake...

    I use make instead of XCode. With make, the install target is "install". So here's what I do to build and populate the app bundle on Mac:

    make
    make install

  5. #5
    Join Date
    Aug 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Mac: Copy Files Build Phase and qmake...

    I'm not really interested in using makefiles though, I want to do this all within Xcode. Is there a way to do it in Xcode?

    Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.