Setting a .pro file for a resource project.
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"
Code:
- src/
-- media/
--- icons/
--- sounds/
--- styles/
-- code/
-- bin/
After "build"
Code:
- 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!
Re: Setting a .pro file for a resource project.
Yes, you can. You have to create an install target and fill it out properly. Consult our wiki and/or qmake docs for details.
Re: Setting a .pro file for a resource project.
Mmm...Sorry but I don't understand how can i write it. This is my media/themes/default/default.pro file:
Code:
style.path = ../../../bin/themes/default
style.files = ./*
INSTALLS += style
but it doesn't work (the build process fails).
Re: Setting a .pro file for a resource project.
Code:
style.path = ../../bin/themes/default
FILES_TO_INSTALL = file1 file2 file3 ...
style.files = FILES_TO_INSTALL
INSTALLS += style
Re: Setting a .pro file for a resource project.
Code:
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...
Re: Setting a .pro file for a resource project.
Quote:
Originally Posted by
zuck
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".
Quote:
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.
Re: Setting a .pro file for a resource project.
Quote:
Originally Posted by
wysota
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.
Quote:
No, you are using qmake to build your project. You are using Qt Creator to edit files from your project.
Yes, you are right :)
Re: Setting a .pro file for a resource project.
Quote:
Originally Posted by
zuck
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.
Re: Setting a .pro file for a resource project.
Thanks! It works! ;)
This is the final code:
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 ;)
Re: Setting a .pro file for a resource project.
Yes, it does. I thought it was obvious, sorry for not mentioning it explicitely.