Jump to content

Calligra/Building/2/Developing With QtCreator

From KDE Community Wiki
Revision as of 17:11, 13 November 2014 by Jstaniek (talk | contribs) (Building)

First, you have to get the source of Calligra and install all dependencies. That is discribed best in the Building Calligra article, which would be anyway a must read, if you are building the first time. Following recipes were tested for Calligra 2.x , QtCreator 2.x or newer and Qt 4.8.x.

Note

This is a simplified Calligra- and CMake- specific recipe, more extensive documentation is at [1].


  1. Start Qt Creator, use File -> Open File or Project the menu and point it to the CMakeLists.txt file which is in the root of your Calligra source tree. The CMake wizard should start.
  2. In the Build Location wizard's page you can set a custom build directory, but I left the standard one (/path/to/source/qtcreator-build).
  3. On the following page you should add at least the install-dir build option:

    -DCMAKE_INSTALL_PREFIX=/home/user/devel/kde/
    Depending on what kind of build you want, you can also add these:
    • For a full development build.
      -DKDE4_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE:STRING=debugfull
    • For a build where you want to be able to report bugs (backtraces) and maybe develop on
      -DBUILD_TESTS=0 -DCMAKE_BUILD_TYPE:STRING=debugfull
    • For a fast running release build, not really useful for development.
      -DKDE4_BUILD_TESTS=0 -DBUILD_TESTS=0 -DCMAKE_BUILD_TYPE=release
    • I used the following string:
      -DCMAKE_INSTALL_PREFIX=/home/damdam/progn/kde/inst -DCMAKE_BUILD_TYPE:STRING=debugfull
  4. After finishing the wizard, change to the Project view.
  5. Edit the make build step and set the additional arguments to install
  6. Add build step:
    enable, name=Kbuildsycoca4, command=kbuildsycoca4, working dir=$BUILDDIR, command args=
  7. Add the following variables to the build environment (you can use the Batch Edit button for convenience, see Qt Creator Manual, just note you cannot use $HOME and other variables there):
    • find out kdedir: enter 'kde4-config --prefix' into the konsole, it's usually /usr
    • KDEDIRS=/home/damdam/progn/kde/inst:/usr
    • LD_LIBRARY_PATH=/home/damdam/progn/kde/inst/lib
  8. Assure, that Run Environment -> Base environment = Build Environment

Now you can select in Project -> Active run configuration, which program should start.

With this guide it's possible to run and to debug, svn works too. Adding a breakpoint works in my case only after the application is started already in debug mode. After setting the breakpoint, the debugger seems to stop, but starts again automatically (don't click on continue, that is evil).

Speed up

  • Open a console in /path/to/source/qtcreator-build and type 'ccmake .', there you can switch off unneeded parts of Calligra.
    What I've enabled for developing Krita: BUILD_colorengines, BUILD_dockers, BUILD_krita, BUILD_libkowmf (needed by vectorshape), BUILD_vectorshape
    I've not touched any variable below BZIP2_EXECUTABLE.
  • Open the project settings and add --quiet -j 3 to Build Steps->Make->Additional arguments, where 3 is the thread count (3 works better than 2 on my Athlon x2)
  • Move kdedirs and ld lib path to .bashrc:
    export LD_LIBRARY_PATH=/home/damdam/progn/kde/inst/lib
    export KDEDIRS=/home/damdam/progn/kde/inst:/usr
    run .bashrc, so that these two varis get exported and then run kbuildsycoca4. Finally remove it from the build steps.
    If you update modules in cmake or there are bigger lib changes, you have to run kbuildsycoca4 on yourself, but it doesn't get started every time compiling.