PDA

View Full Version : Mac: Copy Files Build Phase and qmake...



kuwan
30th August 2007, 18:29
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

wysota
19th September 2007, 10:46
See the docs about creating "installs" using qmake.

kuwan
21st September 2007, 23:59
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

################################################## ####################
# Automatically generated by qmake (2.01a) Fri Sep 21 15:16:49 2007
################################################## ####################

TEMPLATE = app
TARGET = qmakeTest
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += main.cpp

images.path = qmakeTest.app/Contents/Images
images.files = car.jpg

INSTALLS += images


main.cpp

#include <QApplication>
#include <QWidget>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget w;
w.setGeometry(100, 100, 500, 355);
w.show();
return app.exec();
}


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

Steps to follow:

Put qmakeTest.pro, main.cpp & car.jpg (or your own file) in a folder.
Run "qmake qmakeTest.pro"
Open the generated Xcode project and build it.
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

Brandybuck
22nd September 2007, 19:58
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

kuwan
25th September 2007, 20:59
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.