MADDE/Packaging
(New page: ===Introduction=== This guide explains how to take a simple Qt application and compile it so that it deploys to the N900 with an Icon.) |
|||
(16 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
+ | {{MADDE}} | ||
+ | |||
===Introduction=== | ===Introduction=== | ||
- | This guide explains how to take a simple Qt application and compile it so that it deploys to the N900 with an Icon. | + | This guide explains how to take a simple [[Qt-Maemo|Qt]] application and compile it so that it deploys to the [[Nokia N900|N900]] with an Icon. It is supposed to be step by step guide on how to take a (simple) Qt app and package and deploy it with an Icon using [[MADDE]]. |
+ | |||
+ | === Prerequisites === | ||
+ | |||
+ | The project I have is simple, 1 window called mainwindow. | ||
+ | |||
+ | '''Note:''' As a convention I like to keep all my code together, so I have created any extra files in the "src" folder. | ||
+ | |||
+ | === Steps === | ||
+ | |||
+ | <ol> | ||
+ | <li>Create simple project through MADDE. | ||
+ | mad pscreate -t qt_simple projectname</li> | ||
+ | |||
+ | <li>Edit and test with Qt Creator (or whatever your favorite tool is).</li> | ||
+ | |||
+ | <li>Once ready to deploy create a clean empty top level folder <code><projectname>-0.x</code> where <code>x</code> is your revision number, for example <code>C:\Madde\0.5\home\shep\wwcalc-0.1</code> in the OS | ||
+ | '''Note: the following 3 steps apply each time you go to build.''' | ||
+ | <ol><li>ensure there is no <code>debian</code> folder at the same level as <code>src</code></li> | ||
+ | <li>ensure there is no folder structure called <code><projectname>-0.x-orig</code> left over from a failed compile</li> | ||
+ | <li>remove old compiles from the <code>Madde\home\user</code>, for example <code>C:\Madde\0.5\home\Shep</code> folder.</li></ol></li> | ||
+ | |||
+ | <li>Copy the <code>src</code> folder from the tested Qt project into the <code><projectname-0.x</code> folder</li> | ||
+ | |||
+ | <li>Create (or obtain) an application Icon. This should be a 64x64 PNG. Call it <code><projectname>.png</code> and place it in the <code>src</code> folder.</li> | ||
+ | |||
+ | <li>Again inside the <code>src</code> folder create a new file called <code><projectname>.desktop</code> | ||
+ | Code: | ||
+ | <pre> | ||
+ | [Desktop Entry] | ||
+ | Encoding=UTF-8 | ||
+ | Version=0.x | ||
+ | Type=Application | ||
+ | Name=<Long Descriptive Project Name> | ||
+ | Exec=/usr/bin/<projectname> | ||
+ | Icon=<projectname> | ||
+ | X-HildonDesk-ShowInToolbar=true | ||
+ | X-Osso-Type=application/x-executable | ||
+ | </pre></li> | ||
+ | |||
+ | <li>Inside the <code>src</code> folder added a file called <code>src.pro</code>. Getting this right is the key to getting the Makefile correct and hence the install working. At the end of this file there is a section called <code>INSTALLS += ...</code> for every file you want installed in a location you need an entry here. In the example here we install the target, icon and desktop files. | ||
+ | Code: | ||
+ | <pre> | ||
+ | TARGET = wwcalc | ||
+ | TEMPLATE = app | ||
+ | SOURCES += qtmain.cpp \ | ||
+ | mainwindow.cpp | ||
+ | HEADERS += mainwindow.h | ||
+ | FORMS += mainwindow.ui | ||
+ | |||
+ | unix { | ||
+ | PREFIX = /usr | ||
+ | BINDIR = $$PREFIX/bin | ||
+ | DATADIR =$$PREFIX/share | ||
+ | |||
+ | DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\" | ||
+ | |||
+ | #MAKE INSTALL | ||
+ | |||
+ | INSTALLS += target desktop icon64 | ||
+ | |||
+ | target.path =$$BINDIR | ||
+ | |||
+ | desktop.path = $$DATADIR/applications/hildon | ||
+ | desktop.files += wwcalc.desktop | ||
+ | |||
+ | icon64.path = $$DATADIR/icons/hicolor/64x64/apps | ||
+ | icon64.files += wwcalc.png | ||
+ | } | ||
+ | </pre></li> | ||
+ | |||
+ | <li>Up one level and inside the top level folder (that is, <code>C:\Madde\0.5\home\<YOU!>\<projectname>-0.x</code> ) create a file called <code><projectname>.pro</code> with the following exact contents. | ||
+ | Code: | ||
+ | <pre> | ||
+ | TEMPLATE = subdirs | ||
+ | SUBDIRS = src | ||
+ | </pre></li> | ||
+ | |||
+ | <li>In Madde make sure the [[MADDE/Device runtime|runtime is up and connectible]] and then execute. | ||
+ | Code: | ||
+ | <pre> | ||
+ | mad dh_make --createorig --single -e foo.bar@gmail.com -c gpl | ||
+ | </pre> | ||
+ | ''Several people have commented that mad qmake is not required, but I find there are times that it is, ignore this next line if you wish'' | ||
+ | <pre> | ||
+ | mad qmake | ||
+ | mad dpkg-buildpackage | ||
+ | mad remote -r org.maemo.<projectname> send ../<projectname>_0.x-1_armel.deb | ||
+ | mad remote -r org.maemo.<projectname> install <projectname>_0.x-1_armel.deb</pre></li> | ||
+ | |||
+ | <li>Uninstalling - from an X_Terminal. | ||
+ | Code: | ||
+ | <pre> | ||
+ | sudo gainroot | ||
+ | dpkg -r <projectname></pre></li></ol> | ||
+ | |||
+ | == Additional information == | ||
+ | |||
+ | * [[Packaging a Qt application]] | ||
+ | * [[Packaging]] | ||
+ | |||
+ | [[Category:Development]] | ||
+ | [[Category:Qt]] |
Latest revision as of 13:55, 18 June 2010
MADDE is currently a technology preview. These instructions are liable to change as development progresses. If some of the components do not work as expected, please add your question to the MADDE talk thread and follow up the discussion. tablets-dev.nokia.com is down, see MADDE#Installation for alternatives. |
Contents |
[edit] Introduction
This guide explains how to take a simple Qt application and compile it so that it deploys to the N900 with an Icon. It is supposed to be step by step guide on how to take a (simple) Qt app and package and deploy it with an Icon using MADDE.
[edit] Prerequisites
The project I have is simple, 1 window called mainwindow.
Note: As a convention I like to keep all my code together, so I have created any extra files in the "src" folder.
[edit] Steps
- Create simple project through MADDE. mad pscreate -t qt_simple projectname
- Edit and test with Qt Creator (or whatever your favorite tool is).
- Once ready to deploy create a clean empty top level folder
<projectname>-0.x
wherex
is your revision number, for exampleC:\Madde\0.5\home\shep\wwcalc-0.1
in the OS Note: the following 3 steps apply each time you go to build.- ensure there is no
debian
folder at the same level assrc
- ensure there is no folder structure called
<projectname>-0.x-orig
left over from a failed compile - remove old compiles from the
Madde\home\user
, for exampleC:\Madde\0.5\home\Shep
folder.
- ensure there is no
- Copy the
src
folder from the tested Qt project into the<projectname-0.x
folder - Create (or obtain) an application Icon. This should be a 64x64 PNG. Call it
<projectname>.png
and place it in thesrc
folder. - Again inside the
src
folder create a new file called<projectname>.desktop
Code:[Desktop Entry] Encoding=UTF-8 Version=0.x Type=Application Name=<Long Descriptive Project Name> Exec=/usr/bin/<projectname> Icon=<projectname> X-HildonDesk-ShowInToolbar=true X-Osso-Type=application/x-executable
- Inside the
src
folder added a file calledsrc.pro
. Getting this right is the key to getting the Makefile correct and hence the install working. At the end of this file there is a section calledINSTALLS += ...
for every file you want installed in a location you need an entry here. In the example here we install the target, icon and desktop files. Code:TARGET = wwcalc TEMPLATE = app SOURCES += qtmain.cpp \ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui unix { PREFIX = /usr BINDIR = $$PREFIX/bin DATADIR =$$PREFIX/share DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\" #MAKE INSTALL INSTALLS += target desktop icon64 target.path =$$BINDIR desktop.path = $$DATADIR/applications/hildon desktop.files += wwcalc.desktop icon64.path = $$DATADIR/icons/hicolor/64x64/apps icon64.files += wwcalc.png }
- Up one level and inside the top level folder (that is,
C:\Madde\0.5\home\<YOU!>\<projectname>-0.x
) create a file called<projectname>.pro
with the following exact contents. Code:TEMPLATE = subdirs SUBDIRS = src
- In Madde make sure the runtime is up and connectible and then execute.
Code:
mad dh_make --createorig --single -e foo.bar@gmail.com -c gpl
Several people have commented that mad qmake is not required, but I find there are times that it is, ignore this next line if you wish
mad qmake mad dpkg-buildpackage mad remote -r org.maemo.<projectname> send ../<projectname>_0.x-1_armel.deb mad remote -r org.maemo.<projectname> install <projectname>_0.x-1_armel.deb
- Uninstalling - from an X_Terminal.
Code:
sudo gainroot dpkg -r <projectname>
[edit] Additional information
- This page was last modified on 18 June 2010, at 13:55.
- This page has been accessed 29,013 times.