[Qgis-developer] Running QGIS from build directory

Tim Sutton lists at linfiniti.com
Thu Aug 4 04:12:38 EDT 2011


Hi Martin

On Mon, Jul 25, 2011 at 8:08 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> Hi devs
>
> finally I got this done: ability to run QGIS directly from the
> directory where you build it. No need to run 'make install' everytime
> as it was necessary before. Now it is possible to run/debug QGIS from
> your favourite IDE without having to add additional install steps
> and/or set custom run command. It's in git master.
>
> Some notes to the solution:
> The built executables, libraries and modules are now created in
> "output" subdir within your build directory. The rest of the files
> (svg, resources etc) are accessed from the source tree. In order to
> find out whether qgis is installed or not we look for source_path.txt
> file in the path where qgis binary is created. CMake creates this file
> with path to source tree. This way QGIS is able to set the paths
> properly. There are few new methods in QgsApplication that tell
> whether QGIS runs from build directory and what paths are used for
> source tree and build output.
>
> I have tested on linux only so far. It should not affect the
> functionality when installed. There are few things I am aware of that
> do not work right now when run from build directory (though they work
> when installed):
> - python plugins included in source tree (fTools, installer, gdal
> tools, osm) are not visible. Their source files would need to be
> copied to some directory so that they see the generated files -
> otherwise they would fail to start
> - help viewer does not open help files
>
> Comments are welcome.
>

Cool stuff! Next we can try to make our unit tests run from there. If
I try to manually run a test e.g.

output/bin/qgis_rasterlayertest

it doesnt pick up any providers. I notice also that the binaries
placed in the output dir still will pick up system qgis libs e.g.:

[bin] ldd qgis_rasterlayertest
libqgis_core.so.1.8.0 => /usr/local/lib/libqgis_core.so.1.8.0
(0x00007f6305787000)

Though for QGIS they are correct:

[bin] ldd qgis | grep core
	libqgis_core.so.1.8.0 =>
/home/timlinux/dev/cpp/Quantum-GIS/build-master-qtcreator/output/lib/libqgis_core.so.1.8.0
(0x00007fccd97c3000)

Also at runtime they use resources from the system install e.g.:

[bin] ./qgis_applicationtest
********* Start testing of TestQgsApplication *********
Config: Using QTest library 4.7.2, Qt 4.7.2
QDEBUG : TestQgsApplication::initTestCase() Application state:
Prefix              : /usr/local
Plugin Path         : /usr/local/lib/qgis/plugins
Package Data Path   : /usr/local/share/qgis
Active Theme Name   :
Active Theme Path   : :/images/themes//
Default Theme Path  : :/images/themes/default/
SVG Search Paths    : /usr/local/share/qgis/svg/
User DB Path        : /usr/local/share/qgis/resources/qgis.db

PASS   : TestQgsApplication::initTestCase()
QDEBUG : TestQgsApplication::checkTheme() Checking if a theme icon exists:
QDEBUG : TestQgsApplication::checkTheme()
:/images/themes/default//mIconProjectionDisabled.png
FAIL!  : TestQgsApplication::checkTheme() '!myPixmap.isNull()'
returned FALSE. ()
   Loc: [/home/timlinux/dev/cpp/Quantum-GIS/tests/src/core/testqgsapplication.cpp(54)]
PASS   : TestQgsApplication::cleanupTestCase()
Totals: 2 passed, 1 failed, 0 skipped
********* Finished testing of TestQgsApplication *********


I am really looking forward to getting the test suite under way. How
did you tell cmake to link to the correct libs for QGIS? perhaps we
can apply the same approach to the test dir?

Regards

Tim

> Martin
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list