When I use the Qt Creator to create a Qt Quick / QML project it adds DEPLOYMENTFOLDERS to the .pro file. I can use this directive to get some folders/files copied to the build directory upon building (compilation) of the application.
How can I use this in a simple Qt Widget based application?
Qt Creator doesn't add it for a simple Qt project and when I manually do it, it's not working.
This is my project file:
folder_01.source = sounds
#folder_01.target =
DEPLOYMENTFOLDERS += folder_01
QT += core gui widgets
TARGET = myApp
TEMPLATE = app
SOURCES += main.cpp
I tried "/sounds" and "sounds/*" and thinks like that. But nothing works. What am I missing here?
I was researching this and stumbled on this unanswered question.
Basically I do advocate using the resource system but when you're doing rapid UI development (qml) waiting for the Resource file to compile can be an irritation so I wanted to simply copy this files over.
What is confusing here is the source/target mean slightly different things. The best way to describe it is copy this -> this root
as opposed to copy this -> here
My build simply wants my resources "raw" on the path so I am copying folder->/
Here's an example of the project file I have:
folder_qml.source = qml
folder_qml.target = /
folder_js.source = js
folder_js.target = /
folder_img.source = img
folder_img.target = /
DEPLOYMENTFOLDERS += folder_qml folder_js folder_img
When you build you can verify the output:
10:41:57: Starting: "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe"
C:/Qt/Qt5.2.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Development/Subversion/MyBuild-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
Copying application data...
60 File(s) copied
12 File(s) copied
6 File(s) copied
mingw32-make[1]: Leaving directory 'C:/Development/Subversion/MyBuild-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
Copying application data...
60 File(s) copied
12 File(s) copied
6 File(s) copied
10:41:58: The process "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe" exited normally.
The resulting build looks like:
/Build dir/
+ release
+ debug
+ qml
+ js
+ img
Makefile.Release
Makefile.Debug
Makefile
I hope this helps answer your question. I didn't find any documentation on it so I just played with it until it worked. (It is very helpful with mock-data for tests).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With