Calligra/Building/2/Developing With QtCreator

From KDE Community Wiki
< Calligra‎ | Building‎ | 2
Revision as of 17:56, 6 December 2010 by Cyrille (talk | contribs) (Created page with '==Building== First, you have to get the source of KOffice and install all dependencies. That is discribed best in the Building KOffice Arti...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Building

First, you have to get the source of KOffice and install all dependencies. That is discribed best in the Building KOffice Article, which would be anyway a good read, if you are building the first time. I have tested the following instructions on KOffice 2.2 trunk (rev. 1129718), QtCreator 1.3.1 and Qt 4.6.2.

  1. Start Creator, from the file menu call open and point it to the CMakeLists.txt file which is in the root of your koffice sourcetree. The CMake wizard should start.
  2. You can set an 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
    • find out kdedir: enter 'kde4-config --prefix' into the konsole, on my sys it was /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 koffice.
    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.