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

Jump to: navigation, search
Line 1: Line 1:
 
{{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.
+
=== The Compiler ===
==== The Compiler ====
+
 
You can use either:
 
You can use either:
 
* (commercial) Visual Studio.NET (2003), Visual Studio 2005, or
 
* (commercial) Visual Studio.NET (2003), Visual Studio 2005, or
Line 19: Line 18:
 
</pre>
 
</pre>
  
==== CMake ====
+
=== CMake ===
 
[http://www.cmake.org CMake] is the make tool used by KDE.
 
[http://www.cmake.org CMake] is the make tool used by KDE.
 
* 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
 
* 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
Line 26: Line 25:
 
Install cmake in a path without spaces to avoid troubles (at least under win2k).
 
Install cmake in a path without spaces to avoid troubles (at least under win2k).
  
==== Perl ====
+
=== Perl ===
 
Perl is a script language used to generate files. Install a Perl for Windows, e.g. ActivePerl from http://www.activestate.com
 
Perl is a script language used to generate files. Install a Perl for Windows, e.g. ActivePerl from http://www.activestate.com
  
==== win32libs  ====
+
=== win32libs  ===
''win32libs'' contains a collection of libraries not available by default on Windows.
+
''win32libs'' contains a collection of libraries not available by default on Windows. See [[Getting_Started/Build/KDE4/Windows/3rd-party_libraries|3rd-party libraries required for KDElibs 4]].
See [[Getting_Started/Build/KDE4/Windows/3rd-party_libraries|3rd-party libraries required for KDElibs 4]].
+
  
=== Compile and Install ===
+
== Compile and Install ==
These libraries you must compile and install by your own.
+
These libraries have to be installed.
  
==== D-Bus for Windows ====
+
=== D-Bus for Windows ===
Be sure you've installed [[#win32libs|win32libs]]!
+
This library shouldn't be installed with the installer, you should rather [[http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/build_dbus|compile]] it yourself.
  
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].
+
=== Qt 4 ===
<pre>
+
This Framework can be downloaded with the installer, or you can [[http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/build_qt4|build it on your own]].
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
+
<tt>Build -> Configuration Manager</tt> menu.
+
 
+
'''Tip:''' to perform compilation and installation from the command line, type:
+
devenv /build Debug /project INSTALL dbus.sln
+
devenv /build Release /project INSTALL dbus.sln
+
 
+
Default target for the installation is <tt>%PROGRAMFILES%\dbus</tt>.
+
 
+
==== Qt 4 ====
+
Currently you need qt-copy from kde svn to successful compile kdelibs! Maybe a current snapshot from 4.3 also works fine.
+
 
+
# '''Get the Qt4 source code'''
+
#* Trolltech customers: get it from Trolltech. After running the exe file, the sources will be unpacked into a selected directory.
+
#* Open Source developers: check out ''qt-copy'' from http://websvn.kde.org/trunk/qt-copy/ with your favorite svn client. Then patch the source code with KDE's own patches first: <tt>cd qt-copy; bash apply_patches</tt>.
+
# '''Compile Qt4'''
+
#* 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>
+
qconfigure {PLATFORM} -openssl -I "<path to openssl headers>" \
+
-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].
+
  
==== kdesupport libs ====
+
=== kdesupport libs ===
 
There are several libs which will be required for building kdelibs. If you want to compile them yourself, you should [[Getting Started/Build/KDE4/Windows/build libraries from kdesupport|look here]].
 
There are several libs which will be required for building kdelibs. If you want to compile them yourself, you should [[Getting Started/Build/KDE4/Windows/build libraries from kdesupport|look here]].
 
Otherwise you can simply download them using the KDEWin-Installer.
 
Otherwise you can simply download them using the KDEWin-Installer.
Line 95: Line 49:
 
* qca2
 
* qca2
  
==== shared-mime-info ====
+
=== shared-mime-info ===
 
The shared-mime-info package, is the freedesktop MIME standard used now by KDE. Download update-mime-database-*.*-*-bin.zip from  
 
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.
 
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 ===
+
== Build KDElibs ==
 
Check out the sources and make another build directory at the same level as kdelibs:  
 
Check out the sources and make another build directory at the same level as kdelibs:  
 
<pre>
 
<pre>
Line 135: Line 89:
 
To also build the test programs add the option <tt>-DKDE4_BUILD_TESTS=1</tt> to the <tt>cmake</tt> command.
 
To also build the test programs add the option <tt>-DKDE4_BUILD_TESTS=1</tt> to the <tt>cmake</tt> command.
  
=== Troubles? ===
+
== Troubles? ==
 
*to enable the release build add <tt>-DCMAKE_BUILD_TYPE=Release</tt> to the <tt>cmake</tt> command
 
*to enable the release build add <tt>-DCMAKE_BUILD_TYPE=Release</tt> to the <tt>cmake</tt> command
 
*when kdewin32 is not found, try adding the cmake parameter (with YOUR path)<tt>-DGNUWIN32_DIR=c:/gnuwin32</tt>
 
*when kdewin32 is not found, try adding the cmake parameter (with YOUR path)<tt>-DGNUWIN32_DIR=c:/gnuwin32</tt>
Line 144: Line 98:
 
*whenever you update your checkout DON'T forget to rebuild '''AND''' reinstall kdewin32.lib
 
*whenever you update your checkout DON'T forget to rebuild '''AND''' reinstall kdewin32.lib
  
=== 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).
 
* (really optional for now) [http://www.openldap.org OpenLDAP]: LDAP (Lightweight Directory Access Protocol) libraries Needed to provide LDAP functionality in KDE
 
* (really optional for now) [http://www.openldap.org OpenLDAP]: LDAP (Lightweight Directory Access Protocol) libraries Needed to provide LDAP functionality in KDE
 
* (really optional for now) [http://asg.web.cmu.edu/sasl/sasl-library.html cyrus-sasl]: Cyrus SASL API needed to support authentication of logins
 
* (really optional for now) [http://asg.web.cmu.edu/sasl/sasl-library.html cyrus-sasl]: Cyrus SASL API needed to support authentication of logins
==== Build ====
+
=== Build ===
 
Check out the sources, make another build directory and build:  
 
Check out the sources, make another build directory and build:  
 
<pre>
 
<pre>
Line 164: Line 118:
 
</pre>
 
</pre>
  
=== 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).  

Revision as of 18:19, 19 July 2007

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

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

CMake

CMake is the make tool used by KDE.

  • use the most recent binaries from here http://www.cmake.org/files/v2.4/ (the filename should be like cmake-2.4.?-win32-x86.zip; you can also pick an .exe file instead of .zip). Make sure you use at least cmake 2.4.5
  • or get CMake from CVS and compile it yourself

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

Perl

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

win32libs

win32libs contains a collection of libraries not available by default on Windows. See 3rd-party libraries required for KDElibs 4.

Compile and Install

These libraries have to be installed.

D-Bus for Windows

This library shouldn't be installed with the installer, you should rather [[1]] it yourself.

Qt 4

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

kdesupport libs

There are several libs which will be required for building kdelibs. If you want to compile them yourself, you should look here. Otherwise you can simply download them using the KDEWin-Installer. You will need:

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

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:

cd {KDE_SOURCE_DIR}\trunk
svn up -N KDE
cd KDE
svn up kdelibs
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%;%PROGRAMFILES%\win32libs\lib;
         {location of your kdewin32 libs}\kdewin32\lib

Build KDE libraries with:

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

or use the IDE:

cmake -DCMAKE_INSTALL_PREFIX=%KDEDIR% -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

To also build the test programs add the option -DKDE4_BUILD_TESTS=1 to the cmake command.

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).
  • (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=%KDEDIR% -DCMAKE_BUILD_TYPE=Debug\
 -G"NMake Makefiles" ..\kdepimlibs
nmake
nmake install

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 [2] 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.

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