{{improve|''This page is outdated - please don't use it anymore unless you know exactly what you do. Use [[Getting_Started/Build/KDE4/Windows/emerge|emerge]] instead''}}

{{KDE4}}

{{KDE4}}

{{improve|''This page has been moved out of [http://kdelibs.com/wiki/index.php/Building_KDElibs_4_using_MS_Visual_Studio kdelibs.com] wiki page.''}}

{{improve|''This page has been moved out of [http://kdelibs.com/wiki/index.php/Building_KDElibs_4_using_MS_Visual_Studio kdelibs.com] wiki page.''}}

−

=== Install ===

+

== Basic Tools ==

−

Install following, no compiling is required.

+

=== Kdewin-Installer ===

−

==== The Compiler ====

+

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.

{{Note|It is recommended to install Visual studio into a path not containing spaces. To do this, change the installation path from the proposed ..\Program Files\ to something like c:\vc9.}}

−

On the right add the paths to your Platform SDK files:

+

{{warning|Visual Studio 2005 SP1 or free (as in beer) Express 2005 are no longer supported. Moreover the Express version is not available at microsoft.com.}}

−

for "Library Files": YOUR_PLATFORM_SDK_PATH\lib

+

−

for "Include Files": YOUR_PLATFORM_SDK_PATH\include

+

−

</pre>

+

−

==== CMake ====

+

====Visual Studio 2008 SP1====

−

[http://www.cmake.org CMake] is the make tool used by KDE.

+

There is not much to do - installer of the commercial version sets up the environment. Just do not forget to run <tt>vcvarsall.bat</tt> to set your environment variables.

−

* use the most recent binaries from here [http://www.cmake.org/files/v2.4/ http://www.cmake.org/files/v2.4/] (the filename should be like <tt>cmake-2.4.?-win32-x86.zip</tt>; you can also pick an .exe file instead of .zip). Make sure you use at least cmake 2.4.5

+

−

* or get CMake from [http://cmake.org/HTML/Download.html#cvs CVS] and compile it yourself

+

−

Install cmake in a path without spaces to avoid troubles (at least under win2k).

+

====Visual Studio 2008 SP1 Express Edition====

+

Install it using the Web Install (downloader) at [http://www.microsoft.com/express/download/ http://www.microsoft.com/express/download]. It takes about 130 MB of download, assuming no MS SQL Server is selected.

−

==== Perl ====

+

The installer also downloads the Windows SDK. It is installed into %PROGRAMFILES%\Microsoft SDKs\Windows.

−

Perl is a script language used to generate files. Install a Perl for Windows, e.g. ActivePerl from http://www.activestate.com

+

Only version 6.0a is installed by the Visual Studio 2008 Express installer, while 6.1 is required to compile KDE components. So also download and install [http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&displaylang=en version 6.1, i.e. Windows SDK for Windows Server 2008] by hand. See also the [http://msdn.microsoft.com/en-us/windowsserver/dd146047.aspx Which SDK is Right for Me?] document.

−

==== win32libs ====

+

=== Improve Integration with the Visual Studio Environment ===

−

''win32libs'' contains a collection of libraries not available by default on Windows.

You can get the most recent binaries from [http://www.cmake.org/HTML/Download.html here]. Use the Win32 Installer or the zip archive. Make sure you use at least cmake 2.4.5

−

==== D-Bus for Windows ====

+

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

−

Be sure you've installed [[#win32libs|win32libs]]!

+

−

Download the latest [http://sourceforge.net/project/showfiles.php?group_id=171968 winDBus sources] (which are already patched) and extract them into "C:\svn\windbus" or get the latest [http://sourceforge.net/svn/?group_id=171968 svn sources].

+

== Compile and Install additional libraries ==

−

<pre>

+

These libraries have to be installed:

−

cd c:\svn\windbus

+

−

patch -p0 < DBus-win32.patch

+

−

cd ..

+

−

mkdir windbus-build

+

−

cd windbus-build

+

−

cmake -G "Visual Studio 8 2005" ..\windbus\cmake\

+

−

</pre>

+

−

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

+

−

<tt>dbus.sln</tt> solution file will be created. Build and '''install''' the Debug and Release builds with the IDE. You can switch between the Debug and Release configuration in the

+

=== D-Bus for Windows ===

−

<tt>Build -> Configuration Manager</tt> menu.

+

This library can be downloaded and installed with the installer (use the package name dbus-msvc) or you can [[Getting_Started/Build/KDE4/Windows/Building DBus|compile]] it by yourself.

−

'''Tip:''' to perform compilation and installation from the command line, type:

+

=== Qt 4 ===

−

devenv /build Debug /project INSTALL dbus.sln

+

This Framework can be downloaded with the installer, or you can [[Getting_Started/Build/Windows/Building Qt 4|build it on your own]].

−

devenv /build Release /project INSTALL dbus.sln

+

−

Default target for the installation is <tt>%PROGRAMFILES%\dbus</tt>.

+

=== KDESupport Libraries ===

+

There are several libraries which will be required for building kdelibs. [[Getting Started/Build/Windows/Building KDESupport Libraries|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

−

==== Qt 4 ====

+

=== Environment Settings ===

−

Currently you need qt-copy from kde svn to successful compile kdelibs! Maybe a current snapshot from 4.3 also works fine.

+

To set up a build environment, follow the steps over [[Getting Started/Build/Windows/Environment|here]]. '''If you have Cygwin installed, please be sure to remove Cygwin's /bin out of your path.'''

−

# '''Get the Qt4 source code'''

+

== Build KDElibs ==

−

#* Trolltech customers: get it from Trolltech. After running the exe file, the sources will be unpacked into a selected directory.

+

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

#* Trolltech customers: just start <tt>configure.exe</tt> and perform the installation.

+

−

#* Open Source developers: Get from unofficial (but legal) Qt4 patches for MSVC>=7.x from [http://sourceforge.net/project/showfiles.php?group_id=49109&package_id=165202 http://sourceforge.net/projects/qtwin/]. Make sure to use the once for qt-copy! Note that Trolltech does not provide support for these compilers, so '''do not post any question about this patch to the Trolltech's mailing list'''. The files are stored in the [http://qtwin.svn.sourceforge.net/viewvc/qtwin/qt-4/trunk/qtwin_patch Sourceforge SVN repository].

+

−

#** Unpack the file in the main Qt4 directory and apply the patches to Qt4: call <tt>installpatch4x.bat</tt> in the DOS window, or just run this batch file.

+

−

#** Configure Qt4: You will need openssl support - so make sure it's enabled!

+

−

Also make sure that configure.exe find openssl headers and libs:

+

<pre>

<pre>

−

qconfigure {PLATFORM} -openssl -I "<path to openssl headers>" \

+

svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs

−

-L "<path to openssl libs>" -qdbus -I "<path to windbus headers>" \

+

−

-L "<path to windbus libs>"

+

−

</pre>

+

−

<tt>{PLATFORM}</tt> can be <tt>msvc.net</tt> for msvc .NET (2003) or <tt>msvc2005</tt> for msvc 2005.

+

−

This is needed to simplify path names in the future if you did not use the commercial <tt>configure.exe</tt> GUI installer:

+

−

<pre>

+

−

set QTDIR={your qt installation directory}

+

−

</pre>

+

−

+

−

'''Note:''' this (QTDIR) and the subsequent environment variables described below on this page could be set globally in the "System" applet, Advanced->Environment Variables. Optionally, if you want to have multiple configurations (e.g. Qt3 and Qt4) on the same machine and account, you can enter appropriate ''set'' commands into a single .bat file, e.g. <tt>environment.bat</tt> which you can then execute once in a new ''cmd'' shell.

+

−

+

−

See also alternative instructions at [http://qtnode.net/wiki?title=Qt4_with_Visual_Studio qtnode.net].

+

−

+

−

==== kdewin32 ====

+

−

kdewin32 is a support library required specifically for Windows in order to be able to build KDElibs.

+

−

+

−

We will refer to <tt>{KDE_SOURCE_DIR}</tt> as to a directory of your choice where you want to keep KDE source code and its "build" directories. You need enough of disk space for this. '''Do not''' use paths with spaces to avoid potential problems.

+

−

+

−

<pre>

+

−

cd {KDE_SOURCE_DIR}

+

−

svn co -N svn://anonsvn.kde.org/home/kde/trunk

+

−

</pre>

+

−

Note: if you want to use your KDE SVN account with write access type this instead: <tt>svn --username={yourname} co -N https://svn.kde.org/home/kde/trunk</tt>. Use the --username and https address for every command mentioned below too.

You'll need some more libs which are located in http://websvn.kde.org/trunk/kdesupport/

+

−

They're all compilable with cmake (if not, let us know)

+

−

+

−

===== strigi =====

+

−

strigi is required by kdelibs:

+

−

<pre>

+

−

cd kdesupport

+

−

svn up strigi

+

−

mkdir strigi-build

+

−

cd strigi-build

+

−

cmake -DCMAKE_INSTALL_PREFIX=%KDEDIR% -DCMAKE_BUILD_TYPE=Debug\

+

−

-G"NMake Makefiles" ..\strigi

+

−

nmake

+

−

nmake install

+

−

</pre>

+

−

===== soprano =====

+

−

Soprano is also needed, it depends on 'redland' library which is available through the kdewin installer. Development versions of KDElibs now require soprano both in release and debug versions, so we're using two build directories: soprano-build and soprano-build-rel.

+

−

<pre>

+

−

cd kdesupport

+

−

svn up soprano

+

−

mkdir soprano-build

+

−

cd soprano-build

+

−

cmake -DCMAKE_INSTALL_PREFIX=%KDEDIR% -DCMAKE_BUILD_TYPE=Debug\

+

−

-G"NMake Makefiles" ..\soprano

+

−

nmake

+

−

nmake install

+

cd ..

cd ..

−

mkdir soprano-build-rel

−

cd soprano-build-rel

−

cmake -DCMAKE_INSTALL_PREFIX=%KDEDIR% -DCMAKE_BUILD_TYPE=Release\

−

-G"NMake Makefiles" ..\soprano

−

nmake

−

nmake install

−

</pre>

−

===== qca =====

−

qca2 is needed to compile some apps (e.g. Kopete)

−

<pre>

−

cd qca2

−

svn up qca2

−

mkdir qca2-build

−

cd qca2-build

−

cmake -DCMAKE_INSTALL_PREFIX=%KDEDIR% -DCMAKE_BUILD_TYPE=Debug\

−

-G"NMake Makefiles" ..\qca2

−

nmake

−

nmake install

−

</pre>

−

−

==== shared-mime-info ====

−

The shared-mime-info package, is the freedesktop MIME standard used now by KDE. Download update-mime-database-*.*-*-bin.zip from

−

http://82.149.170.66/kde-windows/win32libs/zip/single/ and unpack the archive to kde4/ directory to get share/mime/ directory and bin/update-mime-database.exe program.

−

−

=== Build KDElibs ===

−

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

−

<pre>

−

cd {KDE_SOURCE_DIR}\trunk

−

svn up -N KDE

−

cd KDE

−

svn up kdelibs

mkdir kdelibs-build

mkdir kdelibs-build

cd kdelibs-build

cd kdelibs-build

Line 179:

Line 66:

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

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

*Don't use an automoc4 executable with spaces in the path, or you will get strange error messages when running nmake (seems to be a nmake bug)

−

=== Going further: kdepimlibs ===

+

== Going further: kdepimlibs ==

'''kdepimlibs''' are needed by kdebase or other modules like koffice.

'''kdepimlibs''' are needed by kdebase or other modules like koffice.

−

==== Requirements ====

+

=== Requirements ===

kdepimlibs require:

kdepimlibs require:

−

* [http://boost.org/ boost libraries]. Download the tarball. As boost is consisted of headers only, unpack the tarball and copy <tt>boost</tt> subdirectory to <tt>%KDEDIR%\include</tt>. Then add use <tt>set BOOST_ROOT=%KDEDIR%\include</tt> (you may want to add it to your <tt>environment.bat</tt> file as well).

+

*[http://boost.org/ boost libraries]. Download the tarball. As boost is consisted of headers only, unpack the tarball and copy <tt>boost</tt> subdirectory to <tt>%KDEDIR%\include</tt>. Then add use <tt>set BOOST_ROOT=%KDEDIR%\include</tt> (you may want to add it to your <tt>environment.bat</tt> file as well).

In the latter case <tt>kdepimlibs.sln</tt> 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 ===

+

== Going further: kofficelibs ==

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

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

'''kofficelibs''' are needed for apps like KWord or Kexi.

'''kofficelibs''' are needed for apps like KWord or Kexi.

−

==== Requirements ====

+

=== Requirements ===

kofficelibs require:

kofficelibs require:

*[http://www.littlecms.com Little cms] library. Download the newest lcms-1.??.zip from [http://www.littlecms.com/downloads.htm] and uncompress. To build it with msvc, go to <tt>Projects</tt> subdir and choose a subdir for your compiler (i.e. Vc7 or Vc2005).

*[http://www.littlecms.com Little cms] library. Download the newest lcms-1.??.zip from [http://www.littlecms.com/downloads.htm] and uncompress. To build it with msvc, go to <tt>Projects</tt> subdir and choose a subdir for your compiler (i.e. Vc7 or Vc2005).

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.

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).

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).

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!).

You probbaly want to skip building Python wrapper, so click on Build->Configuration Manager menu command and check off "Build" in "Python" line.