Tag Archives: kde

Exporting symbols only for testing.

I finally tried out what I wanted to try for some time now. The problem (if you can call it a problem) I had is that one of the libs I worked on for my GSoC contained class that I wanted to test but that I did not want to expose to the rest of the world. As I did not have the time nor the knowledge to make that happen I just exported the classes so that the testcode could link against it.

Well that changed today and I took some time to figure this out. (Note: I’m not an expert on C++, libraries and such so if I do stupid things here, let me know). In the KPilot code we have an KPILOT_EXPORT define which looks like this:

#include <kdemacros.h>

#ifndef KPILOT_EXPORT
# if defined(MAKE_KPILOT_LIB)
/* We are building this library */
# define KPILOT_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define KPILOT_EXPORT KDE_IMPORT
# endif
#endif

The way I understand this snippet is that it makes the symbol that is prefixed with it visible anyhow. But what I wanted is that the symbol is only exported when the tests are enabled. Therefore I added another define which looks like this:

#ifndef KPILOT_TEST_EXPORT
# if defined(HAVE_TESTS_ENABLED)
# define KPILOT_TEST_EXPORT KDE_EXPORT
# else
# define KPILOT_TEST_EXPORT KDE_NO_EXPORT
# endif
#endif

To make this work I added this to the CMakeLists.txt file:

string(COMPARE EQUAL ${KDE4_BUILD_TESTS} "ON" buildtests)
macro_bool_to_01(buildtests HAVE_TESTS_ENABLED)
configure_file(config-kpilot.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kpilot.h )

And the config-kpilot.h.cmake file got a line added that looks like:

#cmakedefine HAVE_TESTS_ENABLED

Now I can use:

class KPILOT_TEST_EXPORT IDMapperXmlSource
{
....
};

and the given class gets only global in the library when testing is enabled. I wondered why there is no such export in kdemacros.h as I found this quite a nice solution. The library won’t export symbols in release mode, which is a bit cleaner than just exporting everyting only to be able to test imo. But as said, I’m only a novice on this kind of things =:). This whole thing made wondering if there is some GUI tool to explore libraries. Continue reading

Posted in coding | Tagged , | 6 Comments

The future of KPilot

Now the Google Summer of Code approaches its end I’d like to share some thoughts on KPilot. First of these is that I was slightly surprised by the responses I got on an earlier blog. I know that there are still KPilot users but in some sense I did not really believe it. So if you are a user and want to use it in KDE4 please let us know. It is really encouraging when getting some nice message from someone out there . I know, we are not so good in keeping our website up to date, so you might also want to drop by in #kpilot on irc.freenode.org or at our personal websites. Furthermore, you can follow development activities at the KPilot ohloh site.

That said, what are the plans for KPilot? Our major goal is to release a new KPilot version with KDE 4.2. So that will be in six months or so. In the past couple of months we have done a lot of work to get KPilot syncing with akonadi and the results are promising. At the end of this GSoC (that is, after two weeks from now) we have “working” todo, contacts and calendar conduits. Working is quoted as polishing of the KPilot code as well as some kdepim/akonadi code is needed. How usefull KPilot will be at release time also depends a bit on the other kdepim applications as none of them (except mailody?) are ported to Akonadi yet if I’m correct. However at 4.2 that has changed (we hope) and therefore the following conduits will be released then:

  • calendar
  • contacts
  • file installer
  • memofile
  • time
  • todos

The results of this GSoC and the previous one is that most conduits share way more code than they did before. This should make the maintenance and bugfixing a bit easier for us.

We also slimmed down our focus. KPilot will be the application to synchronize your KDE PIM data with your palm device. This means that we will remove the old database viewers that where in it in the 3.5 series. The viewer code is old, not good working, does not have any real purpose and we do not have time/energy to work on that. In return of that you will get category synchronization for each record based conduit. I have been thinking a bit about the gui of KPilot but have no clear idea yet how it should look. So good ideas on this are welcome.

Besides the “getting things working again” again, the codebase needs a lot of clean up. But first things first. All in all, this should make KPilot should survive another KDE series. Continue reading

Posted in coding | Tagged , , | 17 Comments