Reputation: 480
I'm using Qt Creator as my IDE for a non-Qt project, cross-compiled for arm-linux, to be deployed to a raspberry pi (Qt Creator is a pretty good IDE even when not using Qt!). The project doesn't use qmake to build, so there's no .pro file to modify.
I'd like to add a deployment step where the main executable, and maybe more things in the future, get copied over to the device, ready for testing or debugging. From the IDE, there seem to be no way to add files to be deployed:
All help pages I've seen say to add something to the INSTALL variable in your .pro file, but of course, that doesn't apply to me. Is there a way to do this, or is the "custom command" (and writing my own deployment script) my only option?
Upvotes: 0
Views: 3847
Reputation: 331
If you want to deploy let's say config folder to target device
├── embix.pro
├── main.cpp
├── main.h [TARGET DEVICE]
...
├── config ├── /etc/embix
│ ├── bbb │ ├── bbb
│ │ └── pin.conf │ │ └── pin.conf
│ ├── orangepi0 ------> │ ├── orangepi0
│ │ └── pin.conf │ │ └── pin.conf
│ └── rpi │ └── rpi
│ └── pin.conf │ └── pin.conf
In pro file do this
# Default rules for deployment.
target.path = /home/pi/$${TARGET}/bin // where your binary goes
# new deploy rule called config
myconf.files = ./config/* // from
myconf.path = /etc/$${TARGET} // to
!isEmpty(target.path): INSTALLS += target
!isEmpty(myconf.path): INSTALLS += myconf
Upvotes: 1
Reputation: 8238
Qt creator does not know anything about Raspberry Pi, MCUs and other devices. So yes, you need to write your own script, but it can be easily integrated into Qt creator. First, if you do not use qmake
, then I'll assume you are using Makefile
. If so, write your deployment script as the install
target of the Makefile and choose "local" deployment method in Qt Creator's run settings. Add Make
deploy step and write install
to Additional arguments text box.
You also may tune Qt Creator to run something other than the program you just built. For example, you may run a script which logs into remote RPi and runs what was installed. Another option is not to run anything. For example, I use Qt Creator to develop a program for a bare-metal MCU, so it starts immediately after flashing which in turn is triggered by make install
from Qt Creator's deployment stage. Qt Creator needs to run something locally when you press Run
button, so to stop it bothering me about executables I pointed it's Run stage in Run Settings to /usr/bin/true
binary.
Upvotes: 1