PDA

View Full Version : Setting a .pro file for a resource project.



zuck
7th April 2009, 09:29
Hi!

I want to manage resource media files (icons, stylesheets, sounds, ecc.) as separated files without a built-in resource ".qrc" file.

All these resources are located in a "media" subfolder in my source tree. I need to copy this sub-tree (which has its root in the media folder) in the dest directory (a classic "bin/" directory).

Before "build"


- src/

-- media/
--- icons/
--- sounds/
--- styles/

-- code/

-- bin/


After "build"


- src/

-- media/
--- icons/
--- sounds/
--- styles/

-- code/

-- bin/
--- code.bin
--- media/
---- icons/
---- sounds/
---- styles/


Can I use a .pro file for this (so i can use QCreator to build all project files)?

Thanks!

wysota
7th April 2009, 10:27
Yes, you can. You have to create an install target and fill it out properly. Consult our wiki and/or qmake docs for details.

zuck
7th April 2009, 14:48
Mmm...Sorry but I don't understand how can i write it. This is my media/themes/default/default.pro file:



style.path = ../../../bin/themes/default
style.files = ./*
INSTALLS += style


but it doesn't work (the build process fails).

wysota
7th April 2009, 15:13
style.path = ../../bin/themes/default
FILES_TO_INSTALL = file1 file2 file3 ...
style.files = FILES_TO_INSTALL
INSTALLS += style

zuck
7th April 2009, 17:01
error: undefined reference to `main'.
error: collect2: ld returned 1 exit status.


Which template should I use for my project? "app" or "lib"?

P.S. I'm using QtCreator for build my projects...

wysota
7th April 2009, 21:14
Which template should I use for my project? "app" or "lib"?
It doesn't matter for the installation part. Use the one that's relevant to your project. If your project is an application, use "app", if it's a library use "lib".


P.S. I'm using QtCreator for build my projects...
No, you are using qmake to build your project. You are using Qt Creator to edit files from your project.

zuck
8th April 2009, 09:51
It doesn't matter for the installation part. Use the one that's relevant to your project. If your project is an application, use "app", if it's a library use "lib".

Ok but the original goal was to create a stand-alone project for all resource files and another one for my main application code. If it's impossible I can merge my environment into a single project.



No, you are using qmake to build your project. You are using Qt Creator to edit files from your project.

Yes, you are right :)

wysota
8th April 2009, 13:09
Ok but the original goal was to create a stand-alone project for all resource files and another one for my main application code. If it's impossible I can merge my environment into a single project.
Merge it into one project. It doesn't make sense to separate them.

zuck
8th April 2009, 22:35
Thanks! It works! ;)

This is the final code:



# ... CUT ...

# Media files.
MEDIASRCDIR = themes/default
MEDIADESTDIR = $$DESTDIR/$$MEDIASRCDIR
style.path = $$MEDIADESTDIR
style.files = $$MEDIASRCDIR/*
INSTALLS += style


It needs a make install command to works ;)

wysota
9th April 2009, 06:49
Yes, it does. I thought it was obvious, sorry for not mentioning it explicitely.