2018.3.20:Now KDevPlatform repo is merged into the KDevelop repo, and there is no need to go through the steps mentioned in this post to get things working.However, the last section still applies in order to not load plugins from the system-wide KDevelop installation.
KDevelop is tightly coupled with KDevPlatform and from time to time you need to hack them both when developing. But then without caution, you’ll link against the system bundled KDevPlatform libraries and spend the whole day trying to find out why the hall the code you wrote didn’t have any effects.
That’s annoying and here’s how to make sure you are linking to the right copy.
Your awesome super hacked KDevPlatform need to be compiled and installed to somewhere first, say
~/stage. Don’t install it to any standard path like
/usr/local just to avoid messing with the rest of the system. As a rule of thumb, if you need sudo privilege when doing
make install, then you probably should consider somewhere else.
mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=~/stage .. make install
This should give you bunch of files in
share, somewhat similar to your system root.
cmake makes life easier by its
find_package mechanism that automatically find required libraries for you. But sometime you need more control over that.
find_package actually does is to find a cmake file provided by the library you required that can configure itself. (read the doc if you are interested in the exact detailed procedure). In our case, the files are:
tree ~/stage/lib64/cmake/KDevPlatform ~/stage/lib64/cmake/KDevPlatform ├── KDevPlatformConfig.cmake ├── KDevPlatformConfigVersion.cmake ├── KDevPlatformMacros.cmake ├── KDevPlatformTargets.cmake └── KDevPlatformTargets-debug.cmake
We just need a way to tell cmake where they are by appending that path to
CMAKE_PREFIX_PATH when configuring KDevelop.
mkdir build && cd build cmake -DCMAKE_PREFIX_PATH=~/stage/lib64/cmake \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=~/stage \ .. make install
This way cmake will find your newly built KDevPlatform.
Hint: you can locally change KDevPlatform version to a higher number than the one in the system and modify KDevelop to require at least that number. Then you can be sure that you are building against the custom build of KDevPlatform.
In order to run KDevelop built this way, you have to specify various paths so that system can load correct version of dynamic libraries and kdevelop itself can find its data in correct place.
env QT_PLUGIN_PATH=~/stage/lib64/plugins \ LD_LIBRARY_PATH=~/stage/lib64 \ XDG_DATA_DIRS=~/stage/share:$XDG_DATA_DIRS \ ~/stage/bin/kdevelop