Difference between revisions of "Getting Started/Build/Windows/MS Visual Studio"

Jump to: navigation, search
(The Compiler)
(The Compiler)
Line 26: Line 26:
 
</pre>
 
</pre>
  
More info on this is [http://www.microsoft.com/express/2005/platformsdk/default.aspx available].
+
More info on this is [http://www.microsoft.com/express/2005/platformsdk/default.aspx available] (step #3).
  
 
{{Note|We are testing possibility of using the new [http://www.microsoft.com/express/download/ msvc 2008 express]. Any comments appreciated.}}
 
{{Note|We are testing possibility of using the new [http://www.microsoft.com/express/download/ msvc 2008 express]. Any comments appreciated.}}

Revision as of 11:48, 15 January 2008

noframe
 
This section needs improvements: Please help us to

cleanup confusing sections and fix sections which contain a todo


This page is outdated - please don't use it anymore unless you know exactly what you do. Use Getting_Started/Build/KDE4/Windows/emerge instead
Ktip.png
 
Tip
Note: This page is about KDE 4. It isn't applicable for KDE 3 development.
noframe
 
This section needs improvements: Please help us to

cleanup confusing sections and fix sections which contain a todo


This page has been moved out of kdelibs.com wiki page.

Contents

Basic Tools

Kdewin-Installer

This is a program that lets you easily install all the requirements for building kdelibs. It also has a list of tools in its list that are helpful and needed, like the mingw compiler suite, subversion clients, debugging tools and so on.

The kdewin-installer is available in a GUI and console-only form from the kdewin-installer download page.

The Compiler

You can use either:

Express Edition users: If you want to generate project files for Visual C++ then you must add the Platform SDK include and library directory to the default directories of the IDE:

Open Visual C++, go to Tool->Options
in "Projects and Solutions" go to "VC++ Directories"

On the right add the paths to your Platform SDK files:
for "Library Files": YOUR_PLATFORM_SDK_PATH\lib
for "Include Files": YOUR_PLATFORM_SDK_PATH\include

More info on this is available (step #3).

noframe
 
Note
We are testing possibility of using the new msvc 2008 express. Any comments appreciated.

CMake

CMake is the make tool used by KDE. You can get the most recent binaries from here. Use the Win32 Installer or the zip archive. Make sure you use at least cmake 2.4.5

On Windows 2000, it's recommended to install cmake in a path without spaces to avoid troubles.

Compile and Install additional libraries

These libraries have to be installed:

D-Bus for Windows

This library can be downloaded and installed with the installer (use the package name dbus-msvc) or you can compile it by yourself.

Qt 4

This Framework can be downloaded with the installer, or you can build it on your own.

KDESupport Libraries

There are several libraries which will be required for building kdelibs. You may want to compile them yourself or simply download them using the KDEWin-Installer. You will need:

  • kdewin32 (compiled with msvc)
  • strigi
  • soprano
  • qca2
  • qimageblitz

Environment Settings

To set up a build environment, follow the steps over here. If you have Cygwin installed, please be sure to remove Cygwin's /bin out of your path.

Build KDElibs

Check out the sources and make another build directory at the same level as kdelibs:

svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
cd ..
mkdir kdelibs-build
cd kdelibs-build

Now you have to add some paths to your PATH environment variable simliar to this:

set PATH=%QTDIR%\bin;%PATH%;%INSTALL_PATH%\lib;

Build KDE libraries with:

cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DCMAKE_BUILD_TYPE=Debug\
 -G"NMake Makefiles" ..\kdelibs
nmake
nmake install

or use the IDE:

cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DCMAKE_BUILD_TYPE=Debug\
 -G "Visual Studio 8 2005" ..\kdelibs

(use -G "Visual Studio 7 .NET 2003" for the older compiler)

In the latter case kdelibs.sln solution file will be created. Build and install the Debug and Release builds with the IDE. Tip: to do this from command line, type:

devenv /build Debug /project INSTALL kdelibs.sln
devenv /build Release /project INSTALL kdelibs.sln

The devenv command is not available in the Express Edition.

If you use makefiles and also want to build the test programs add the option -DKDE4_BUILD_TESTS=1 to the cmake command. This is not necessary for the IDE projects.

Troubles?

  • to enable the release build add -DCMAKE_BUILD_TYPE=Release to the cmake command
  • when kdewin32 is not found, try adding the cmake parameter (with YOUR path)-DGNUWIN32_DIR=c:/gnuwin32
  • don't use a cygwin or mingw shell, you will get errors because these shells use UNIX path names
  • you could restart the configure process by deleting CMakeCache.txt
  • you could test for only one library by deleting the assignment in CMakeCache.txt
  • ask for more help on kde-buildsystem@kde.org mailing list
  • whenever you update your checkout DON'T forget to rebuild AND reinstall kdewin32.lib

Going further: kdepimlibs

kdepimlibs are needed by kdebase or other modules like koffice.

Requirements

kdepimlibs require:

  • boost libraries. Download the tarball. As boost is consisted of headers only, unpack the tarball and copy boost subdirectory to %KDEDIR%\include. Then add use set BOOST_ROOT=%KDEDIR%\include (you may want to add it to your environment.bat file as well).
  • gpgme libraries, needed to provide GNU Privacy Guard support in KDE PIM applications
  • (really optional for now) OpenLDAP: LDAP (Lightweight Directory Access Protocol) libraries Needed to provide LDAP functionality in KDE
  • (really optional for now) cyrus-sasl: Cyrus SASL API needed to support authentication of logins

Build

Check out the sources, make another build directory and build:

cd {KDE_SOURCE_DIR}\trunk\KDE
svn up kdepimlibs
mkdir kdepimlibs-build
cd kdelibs-build
cmake -DCMAKE_INSTALL_PREFIX=%KDEDIRS% -DCMAKE_BUILD_TYPE=Debug\
 -G"NMake Makefiles" ..\kdepimlibs
nmake
nmake install

or use Visual Studio:

cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DCMAKE_BUILD_TYPE=Debug\
 -G "Visual Studio 8 2005" ..\kdepimlibs

(use -G "Visual Studio 7 .NET 2003" for the older compiler)

In the latter case kdepimlibs.sln solution file will be created. Build and install the Debug and Release builds with the IDE. Tip: to do this from command line, type:

devenv /build Debug /project INSTALL kdepimlibs.sln
devenv /build Release /project INSTALL kdepimlibs.sln

The devenv command is not available in the Express Edition.

Going further: kofficelibs

(work in progress, to be moved to KOffice wiki)

kofficelibs are needed for apps like KWord or Kexi.

Requirements

kofficelibs require:

  • Little cms library. Download the newest lcms-1.??.zip from [1] and uncompress. To build it with msvc, go to Projects subdir and choose a subdir for your compiler (i.e. Vc7 or Vc2005).
    1. Then you will see lcms.sln solution file - you can click it to open in the msvc IDE. But first, you need to fix some paths in the project files. You probably have %KDEDIR%\lib\jpeg.lib, not libjpeg.lib, so edit tifficc.vcproj, tiffdiff.vcproj and jpegicc.vcproj and change libjpeg.lib to jpeg.lib in AdditionalDependencies variable. Then add full path to your %KDEDIR%\include directory (where tiffio.h resides) in AdditionalIncludeDirectories variable, (note: do it by expanding KDEDIR environment variable, i.e the result should be like:
      AdditionalIncludeDirectories="..\..\include;f:\kde4\include"
      Then add AdditionalLibraryDirectories="c:\your\path\to\kde\lib" line just after every two occurences of AdditionalIncludeDirectories=. All the changes are presented in this pseudo-patch (change f:\ paths to your KDEDIR location!).
    2. You probbaly want to skip building Python wrapper, so click on Build->Configuration Manager menu command and check off "Build" in "Python" line.
    3. Select "Build Solution" menu command. After successful build, you should notice:Build: 9 succeeded, 0 failed, 1 skipped
    4. To also build Release versions of the binaries, in the Configuration Manager, change active configuration to Release and repeat steps 1-3.
    5. Copy the compiled binaries. From your lcms-1.??\Lib\Ms copy *.lib files to %KDEDIR%\lib. From lcms-1.??\bin copy *.dll and *.exe files to %KDEDIR%\bin.
    6. Copy lcms headers: from lcms-1.??\include copy *.h to %KDEDIR%\include.
    7. Later when you will run cmake for kofficelibs, you get message like -- Found lcms version 1.16, F:/kde4/lib/lcms.lib.

Useful links

List of libraries that are needed to build KDE on windows (most of these are already installed by the kde-installer)

3rd-party libraries required for KDElibs 4.


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal