https://community.kde.org/index.php?title=Guidelines_and_HOWTOs/Making_apps_run_uninstalled&feed=atom&action=historyGuidelines and HOWTOs/Making apps run uninstalled - Revision history2024-03-29T06:55:31ZRevision history for this page on the wikiMediaWiki 1.40.2https://community.kde.org/index.php?title=Guidelines_and_HOWTOs/Making_apps_run_uninstalled&diff=79629&oldid=prevDfaure: Update status2018-03-05T21:54:35Z<p>Update status</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:54, 5 March 2018</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l31">Line 31:</td>
<td colspan="2" class="diff-lineno">Line 31:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li><b>Helper binaries</b> for unittests: an easy solution is to just change the current directory to the bin dir, so that <tt>./myhelper</tt> continues to work. This can be done with <tt>QDir::setCurrent(QCoreApplication::applicationDirPath());</tt></li></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li><b>Helper binaries</b> for unittests: an easy solution is to just change the current directory to the bin dir, so that <tt>./myhelper</tt> continues to work. This can be done with <tt>QDir::setCurrent(QCoreApplication::applicationDirPath());</tt></li></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><li><b>QML Components</b>. For the unittests to find them, organize your source directories like the install directory, and provide qmldir files in there with a "module" directive. See the kirigami framework for a working example.</li></ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></ul></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></ul></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Note that shared libs are correctly picked up from the builddir automatically - as long as you don't set LD_LIBRARY_PATH.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Note that shared libs are correctly picked up from the builddir automatically - as long as you don't set LD_LIBRARY_PATH.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>There are two issues <del style="font-weight: bold; text-decoration: none;">I didn</del>'t <del style="font-weight: bold; text-decoration: none;">solve </del>yet: trader queries that should find uninstalled desktop files, and <del style="font-weight: bold; text-decoration: none;">QML components, like in kirigami. It seems </del>that the <del style="font-weight: bold; text-decoration: none;">only solution for the latter is to reorganize the source dir to have the expected layout "org/kde/kirigami</del>.<del style="font-weight: bold; text-decoration: none;">2/*"?</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>There are two issues <ins style="font-weight: bold; text-decoration: none;">that aren</ins>'t <ins style="font-weight: bold; text-decoration: none;">solved </ins>yet: trader queries that should find uninstalled desktop files, and <ins style="font-weight: bold; text-decoration: none;">servicetype desktop files </ins>that <ins style="font-weight: bold; text-decoration: none;">define </ins>the <ins style="font-weight: bold; text-decoration: none;">type of service properties</ins>.</div></td></tr>
</table>Dfaurehttps://community.kde.org/index.php?title=Guidelines_and_HOWTOs/Making_apps_run_uninstalled&diff=78936&oldid=prevDfaure at 17:26, 24 December 20172017-12-24T17:26:32Z<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 17:26, 24 December 2017</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l32">Line 32:</td>
<td colspan="2" class="diff-lineno">Line 32:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li><b>Helper binaries</b> for unittests: an easy solution is to just change the current directory to the bin dir, so that <tt>./myhelper</tt> continues to work. This can be done with <tt>QDir::setCurrent(QCoreApplication::applicationDirPath());</tt></li></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li><b>Helper binaries</b> for unittests: an easy solution is to just change the current directory to the bin dir, so that <tt>./myhelper</tt> continues to work. This can be done with <tt>QDir::setCurrent(QCoreApplication::applicationDirPath());</tt></li></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></ul></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></ul></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Note that shared libs are correctly picked up from the builddir automatically - as long as you don't set LD_LIBRARY_PATH.</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>There are two issues I didn't solve yet: trader queries that should find uninstalled desktop files, and QML components, like in kirigami. It seems that the only solution for the latter is to reorganize the source dir to have the expected layout "org/kde/kirigami.2/*"?</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>There are two issues I didn't solve yet: trader queries that should find uninstalled desktop files, and QML components, like in kirigami. It seems that the only solution for the latter is to reorganize the source dir to have the expected layout "org/kde/kirigami.2/*"?</div></td></tr>
</table>Dfaurehttps://community.kde.org/index.php?title=Guidelines_and_HOWTOs/Making_apps_run_uninstalled&diff=78026&oldid=prevElvis Angelaccio: Add note about kcoreaddons_add_plugin setting LIBRARY_OUTPUT_DIRECTORY for free.2017-08-16T14:19:15Z<p>Add note about kcoreaddons_add_plugin setting LIBRARY_OUTPUT_DIRECTORY for free.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:19, 16 August 2017</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l18">Line 18:</td>
<td colspan="2" class="diff-lineno">Line 18:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li>Uninstalled <b>plugins</b> can be found at runtime if they are installed into the same subdir of the "bin" dir as they will be in their final destination. For instance, the cmake line <tt>install(TARGETS kio_file DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)</tt> indicates that you want the uninstalled plugin to be in builddir/bin/kf5/kio, which can be done with the following line:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li>Uninstalled <b>plugins</b> can be found at runtime if they are installed into the same subdir of the "bin" dir as they will be in their final destination. For instance, the cmake line <tt>install(TARGETS kio_file DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)</tt> indicates that you want the uninstalled plugin to be in builddir/bin/kf5/kio, which can be done with the following line:</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><tt>set_target_properties(kio_file PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/kio")</tt></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><tt>set_target_properties(kio_file PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/kio")</tt></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Qt uses the executable's current directory as one of the search paths for plugins, so this then works out of the box.</li></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Qt uses the executable's current directory as one of the search paths for plugins, so this then works out of the box<ins style="font-weight: bold; text-decoration: none;">.</ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Note: this is not necessary if you are creating the plugin with <tt>kcoreaddons_add_plugin</tt></ins>.</li></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li>If ctest complains that it can't find the <b>unittest</b> executable, the fix is very simple: instead of the old syntax <tt>add_test(testname myexec)</tt> you want to use the newer syntax <tt>add_test(NAME testname COMMAND myexec)</tt></li></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><li>If ctest complains that it can't find the <b>unittest</b> executable, the fix is very simple: instead of the old syntax <tt>add_test(testname myexec)</tt> you want to use the newer syntax <tt>add_test(NAME testname COMMAND myexec)</tt></li></div></td></tr>
</table>Elvis Angelacciohttps://community.kde.org/index.php?title=Guidelines_and_HOWTOs/Making_apps_run_uninstalled&diff=78015&oldid=prevDfaure: Created page with "In our Akademy presentation, Kévin and I showed the importance for a better developer story to be able to work on a KDE module without having to install it. Running unittests..."2017-08-15T21:28:18Z<p>Created page with "In our Akademy presentation, Kévin and I showed the importance for a better developer story to be able to work on a KDE module without having to install it. Running unittests..."</p>
<p><b>New page</b></p><div>In our Akademy presentation, Kévin and I showed the importance for a better developer story to be able to work on a KDE module without having to install it. Running unittests and running applications without installing the module at all is possible, it turns out, it just needs a bit of effort to set things up correctly.<br />
<br />
Once you require ECM version 5.38 (using <tt>find_package(ECM 5.38)</tt>), your libraries, plugins and executables will all go to the builddir's "bin" directory, instead of being built in the builddir where they are defined.<br />
Remember to wipe out your builddir first, to avoid running outdated unit tests!<br />
This change helps locating helper binaries, and plugins (depending on how they are loaded).<br />
<br />
After doing that, see if this works:<br />
<ul><br />
<li><tt>make uninstall</tt></li><br />
<li><tt>ctest .</tt> (or run the application)</li><br />
</ul><br />
Oops, usually it doesn't work. Here's what you might have to do to fix things.<br />
<br />
<ul><br />
<li><b>XMLGUI</b> files: since KDE Frameworks 5.4, they can be embedded into a qrc file so that they can be found without being installed. <br />
The qrc should put the xmlgui file under ":/kxmlgui5/". You can use the script kde-dev-scripts/kf5/bundle_data_files.pl to automate most of this change.</li><br />
<br />
<li>Uninstalled <b>plugins</b> can be found at runtime if they are installed into the same subdir of the "bin" dir as they will be in their final destination. For instance, the cmake line <tt>install(TARGETS kio_file DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)</tt> indicates that you want the uninstalled plugin to be in builddir/bin/kf5/kio, which can be done with the following line:<br />
<tt>set_target_properties(kio_file PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/kio")</tt><br />
Qt uses the executable's current directory as one of the search paths for plugins, so this then works out of the box.</li><br />
<br />
<li>If ctest complains that it can't find the <b>unittest</b> executable, the fix is very simple: instead of the old syntax <tt>add_test(testname myexec)</tt> you want to use the newer syntax <tt>add_test(NAME testname COMMAND myexec)</tt></li><br />
<br />
<li><b>Helper binaries</b> for libraries: look for them locally first. Example from KIO:<br />
<pre>QString kioexec = QCoreApplication::applicationDirPath() + "/kioexec";<br />
if (!QFileInfo::exists(kioexec))<br />
kioexec = CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kioexec"; // this was the original line of code<br />
</pre></li><br />
<br />
<li><b>Helper binaries</b> for unittests: an easy solution is to just change the current directory to the bin dir, so that <tt>./myhelper</tt> continues to work. This can be done with <tt>QDir::setCurrent(QCoreApplication::applicationDirPath());</tt></li><br />
</ul><br />
<br />
There are two issues I didn't solve yet: trader queries that should find uninstalled desktop files, and QML components, like in kirigami. It seems that the only solution for the latter is to reorganize the source dir to have the expected layout "org/kde/kirigami.2/*"?</div>Dfaure