Skip to content

Building on Windows

amireh edited this page Jun 13, 2011 · 4 revisions

First I must admit I have very little experience building stuff on Windows and much less using CMake, and that's probably the reason I found it to be a PITA. Anyway, here's how I managed to compile Karazeh on Windows, if you face such issues, I hope this helps.

CMake finding packages

I install/build all the libraries I use under C:\Workspace\Build, so you should adapt the following to your environment. Open up karazeh/CMakeLists.txt and edit accordingly:

Qt: CMake needs to find the qmake executable, so by assigning the CMAKE_PREFIX_PATH variable, it will look under bin/ directories of assigned paths and will find qmake. So:

SET( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} C:/Workspace/Build/Qt4.7.3 )

libcurl, BZip2, and log4cpp

SET( CMAKE_LIBRARY_PATH 
    ${CMAKE_LIBRARY_PATH} 
    C:/Workspace/Build/libcurl/lib
    C:/Workspace/Build/bzip2/Release
    C:/Workspace/Build/log4cpp/Release )
SET( CMAKE_INCLUDE_PATH 
    ${CMAKE_INCLUDE_PATH} 
    C:/Workspace/Build/libcurl/include
    C:/Workspace/Build/bzip2/include
    C:/Workspace/Build/log4cpp/include )

boost

I ended up setting an environment variable BOOST_ROOT to point to my boost installation. To do that (under XP), I went to System Properties -> Advanced -> Environment Variables and added the following key:

BOOST_ROOT => C:\Workspace\Build\boost_1_46

Building libcurl

Straightforward from their docs, I ran a VS console shell, and under curl/winbuild I built it using: nmake /f makefile.vc mode=static VC=10 DEBUG=no

The output will be built in curl/build, I then moved that directory to my C:\Workspace\Build\libcurl and pointed CMake at it.

Building boost

For Karazeh, you only need boost system and filesystem, and optionally boost thread. Refer to their installation guide for more info. But note that I used the multithreaded version of boost to build Karazeh.

Building BZip2

The VC++ project provided with the package didn't work for me, but building it is very simple. I created a new VC solution, and added the following files:

src/blocksort.c
src/bzlib.c
src/compress.c
src/crctable.c
src/decompress.c
src/huffman.c
src/randtable.c
include/bzlib.h
include/bzlib_private.h

I built it as a static release library.

Precompiled dependencies package

I will provide a precompiled 32bit package of the dependencies that includes libcurl, libbzip2, and log4cpp. I will also see to providing a 64bit package, but I have no 64bit machine at the moment.

Update: the 32bit package is now hosted on SourceForge

Known issues

  • [Windows] building Karazeh with boost's thread support might raise some errors that have to do with int64_t, if such a thing happens, it's caused by log4cpp which #defines int64_t __int64_t in config-win32.h (fixed: see Pixy.h)

Notes

  • I didn't get to test the POCO and Intel TBB thread wrappers on Windows yet, so I'm not aware of any issues that could rise