Calligra/Building/2/Developing With QtCreator: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Note|First, you have to get the source of Calligra and install all dependencies. That is described 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|First, you have to get the source of Calligra and install all dependencies. That is described 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. All paths here are kept similar to these explained on the ''Building Calligra'' page but make sure you use correct ones. }} | ||
{{Note|This is a simplified Calligra- and CMake- specific recipe, more extensive documentation is at [https://qt-project.org/doc/qtcreator-3.2/creator-project-cmake.html].}} | {{Note|This is a simplified Calligra- and CMake- specific recipe, more extensive documentation is at [https://qt-project.org/doc/qtcreator-3.2/creator-project-cmake.html].}} | ||
# Start Qt Creator, use File -> Open File or Project the menu and | # Start Qt Creator, use ''File -> Open File or Project'' from the menu and select CMakeLists.txt file which is in the root of your Calligra source tree directory. The CMake wizard should start. | ||
# In the ''Build Location'' wizard's page you can set a custom build directory | # In the ''Build Location'' wizard's page you can set a custom build directory. Better do not use the proposed one (/path/to/source/qtcreator-build) but /home/YOURLOGIN/kde4/build/calligra or something like this. If you built this code from command line before, it's best idea to use the same build dir as before. Thus you can use Creator-based and command line-based builds exchangeably. | ||
# Click Next. On the | # Click ''Next''. On the ''Run CMake'' wizard page you should add at least the install-dir build option:<br><br><pre>-DCMAKE_INSTALL_PREFIX=/home/YOURLOGIN/kde4/inst</pre>Depending on what kind of build you want, you can also append these options: | ||
#* For a build where you want to be able to obtain backtraces (good for bugfixing or reporting bugs)<br><pre>-DCMAKE_BUILD_TYPE=DebugFull</pre> | #* For a build where you want to be able to obtain backtraces (good for bugfixing or reporting bugs)<br><pre>-DCMAKE_BUILD_TYPE=DebugFull</pre> | ||
#* For building tests as well append <br><pre>-DKDE4_BUILD_TESTS=ON</pre> | #* For building tests as well append <br><pre>-DKDE4_BUILD_TESTS=ON</pre> |
Revision as of 17:43, 13 November 2014
- Start Qt Creator, use File -> Open File or Project from the menu and select CMakeLists.txt file which is in the root of your Calligra source tree directory. The CMake wizard should start.
- In the Build Location wizard's page you can set a custom build directory. Better do not use the proposed one (/path/to/source/qtcreator-build) but /home/YOURLOGIN/kde4/build/calligra or something like this. If you built this code from command line before, it's best idea to use the same build dir as before. Thus you can use Creator-based and command line-based builds exchangeably.
- Click Next. On the Run CMake wizard page you should add at least the install-dir build option:
-DCMAKE_INSTALL_PREFIX=/home/YOURLOGIN/kde4/inst
Depending on what kind of build you want, you can also append these options:- For a build where you want to be able to obtain backtraces (good for bugfixing or reporting bugs)
-DCMAKE_BUILD_TYPE=DebugFull
- For building tests as well append
-DKDE4_BUILD_TESTS=ON
- For a fast running release build (not really useful for development).
-DKDE4_BUILD_TESTS=0 -DBUILD_TESTS=0 -DCMAKE_BUILD_TYPE=Release
- For a build where you want to be able to obtain backtraces (good for bugfixing or reporting bugs)
- After finishing the wizard, change to the Project view.
- Edit the make build step and set the additional arguments to install
- Add build step:
enable, name=Kbuildsycoca4, command=kbuildsycoca4, working dir=$BUILDDIR, command args= - 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/YOURLOGIN/kde4/inst:/usr
- LD_LIBRARY_PATH=/home/YOURLOGIN/kde4/inst/lib
- 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/YOURLOGIN/kde4/inst/lib
export KDEDIRS=/home/YOURLOGIN/kde4/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.