I keep needing to do this. Each time I do, I have to rediscover how to do it.
Worse, I’m doing it slightly differently each time.
For interested parties, here’s what I just did for Qt 4.7.1. Worked for Qt 4.7.0, too.
I’m using MinGW, cmake, libexpat, and of course Qt. To begin, you need to build dbus itself for Windows, and then you can rebuild
- Make sure you have MinGW installed and correctly configured. Its bin directory should be in your path.
- Download cmake. Install.
- Download and install libexpat from http://www.winkde.org/pub/kde/ports/win32/repository-4.4/win32libs/(as suggested in the dbus documentation). You’ll want the lib archive. You’ll need the include directory no matter what for when you build QtDBus. Unpack these zips to
C:\Program Files\win32libs
. - Grab dbus from the repository, put it in
c:\dbus-1.4.0
. - Edit
dbus-1.4.0\cmake\CMakeLists.txt
, addset(LIBEXPAT_LIBRARIES "C:/Program Files/win32libs/lib/libexpat.lib") set(LIBEXPAT_INCLUDE_DIR "C:/Program Files/win32libs/include") set(LIBEXPAT_FOUND ON)
after
project(dbus)
- Start a Windows Command Prompt
mdkir c:\dbus && cd c:\dbus
cmake -G "MinGW Makefiles" ..\dbus-1.4.0\cmake -DDBUS_USE_EXPAT=on
mingw32-make
- Add
c:\dbus\bin
to your path. - Edit
c:\qt\4.7.1\src\dbus\dbus.pro
:win32 { wince*:LIBS_PRIVATE += -lws2 else:LIBS_PRIVATE += -lws2_32 \ -ladvapi32 \ -lnetapi32 \ -luser32 CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1 -Lc:/dbus/bin else:LIBS_PRIVATE += -ldbus-1 -Lc:/dbus/bin INCLUDEPATH += c:/dbus-1.4.0 c:/dbus }
- Start a Qt Command Shell.
cd c:\qt\4.7.1\src\dbus && qmake && mingw32-make
cd ..\.. && configure -dbus && mingw32-make
You don’t need to build QtDBus separately to begin with the way I do here (step 13) — but it’s much faster to do that and know it’s working than it is to start the configure / mingw32-make step, walk away, and find out an hour later that it died someplace in the middle because you messed up the path to dbus or something.
Your mileage may vary. I seem to remember fixing at least one compilation error in dbus at one point, but don’t remember precisely where or why. It wasn’t hard to do, though — something about a missing argument.