Difference between revisions of "Projects/KDE on Windows/Compiling Applications"

Jump to: navigation, search
m (typo)
(Compiling (third-party) applications for KDE on Windows)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Compiling (third-party) applications for KDE on Windows =
+
= Compiling (third-party) applications for KDE on Windows(outdated) =
 +
'''The following paragraphs are outdated, the only recommended way to build KDE based applications on Windows is [http://techbase.kde.org/Getting_Started/Build/Windows/emerge emerge]. This page is left for documentation purposes.
 +
'''
 
This page gives instructions on how to build a KDE based application on Windows. It is mostly targeted at developers / power users of KDE applications which are not regularly included in the KDE on Windows installer. This typically applies to third-party applications, but may be of interest to developers of applications inside the KDE software collection / repository as well.
 
This page gives instructions on how to build a KDE based application on Windows. It is mostly targeted at developers / power users of KDE applications which are not regularly included in the KDE on Windows installer. This typically applies to third-party applications, but may be of interest to developers of applications inside the KDE software collection / repository as well.
  
Line 24: Line 26:
  
 
== Further preparations ==
 
== Further preparations ==
* '''Hack for KDE 4.4.4''': You will need to edit the file ''KDEDIR''\share\apps\cmake\modules\KDELibs4LibraryTargets-release.cmake around lines 20 and 36) and replace "U:" by "${_IMPORT_PREFIX}".  
+
* '''Hack for KDE 4.4.4''': You will need to edit the file ''KDEDIR''\share\apps\cmake\modules\KDELibs4LibraryTargets-release.cmake around lines 20 and 36) and replace "U:" by "${_IMPORT_PREFIX}".
 +
* The same goes for KDE 4.5.4: replace "L:" by "${_IMPORT_PREFIX}".
  
 
== Procedure ==
 
== Procedure ==
 
Well give the procedure in the form of a .bat file, below. Run this from your source folder.
 
Well give the procedure in the form of a .bat file, below. Run this from your source folder.
  
<code>
+
<syntaxhighlight lang="text">
 
REM modify these lines to match according to your installation:
 
REM modify these lines to match according to your installation:
 
SET KDEPREFIX=C:\KDE
 
SET KDEPREFIX=C:\KDE
Line 59: Line 62:
 
REM to install to a different path (e.g. for packaging) use
 
REM to install to a different path (e.g. for packaging) use
 
REM mingw32-make install DESTDIR=Some\Other\Folder
 
REM mingw32-make install DESTDIR=Some\Other\Folder
</code>
+
</syntaxhighlight>
 +
 
 +
== Troubleshooting ==
 +
This did not work for you? You can ask for help on kde-windows@kde.org or irc://irc.freenode.net/kde-windows .
  
 
== What next? ==
 
== What next? ==
 
So you got it to work? Great! Then probably your next concern is how to distribute the binaries you just compiled. See [[Projects/KDE_on_Windows/Packaging]] for that.
 
So you got it to work? Great! Then probably your next concern is how to distribute the binaries you just compiled. See [[Projects/KDE_on_Windows/Packaging]] for that.

Latest revision as of 22:56, 9 June 2013

Contents

[edit] Compiling (third-party) applications for KDE on Windows(outdated)

The following paragraphs are outdated, the only recommended way to build KDE based applications on Windows is emerge. This page is left for documentation purposes. This page gives instructions on how to build a KDE based application on Windows. It is mostly targeted at developers / power users of KDE applications which are not regularly included in the KDE on Windows installer. This typically applies to third-party applications, but may be of interest to developers of applications inside the KDE software collection / repository as well.

Note however that in many cases using emerge may be a better alternative, esp. if you want to compile your application against the most recent development version of KDE.

[edit] Requirements

  • Naturally, you need an installation of KDE. Use the KDE on Windows installer to install it.
    • On the third page of the installer, select "Package Manager mode", and be sure to pick the compiler that you intend to use. For simplicity, we will assume you use "MinGW4" (32bit).
    • Be sure to install at least the following packages:
      • cmake (Bin)
      • automoc (Bin)
      • kdebase-runtime-mingw4 (Bin)
      • kdebase-workspace-mingw4 (Bin)
      • kdelibs-mingw4 (Bin, Devel)
      • qt-mingw4 (Bin, Devel)
      • phonon-mingw4 (Bin, Devel)
      • soprano-mingw4 (Bin, Devel)
      • Many more needed dependencies will be included automatically
      • Depending on the application you may need to select additional packages, such as e.g. kdepimlibs (Bin, Devel)
    • NOTE Package "automoc" is not included in the 4.4.4-release, at the time of this writing. You can download the 4.3.2-version, and unpack this to you KDE installation root.
  • Install MinGW4. These days MinGW has a relatively simple installer. See [1] for further info. Be sure to install at least the C++ compiler.
  • You need perl. E.g. from [2] . TODO: check whether perl is available from the installer.

[edit] Further preparations

  • Hack for KDE 4.4.4: You will need to edit the file KDEDIR\share\apps\cmake\modules\KDELibs4LibraryTargets-release.cmake around lines 20 and 36) and replace "U:" by "${_IMPORT_PREFIX}".
  • The same goes for KDE 4.5.4: replace "L:" by "${_IMPORT_PREFIX}".

[edit] Procedure

Well give the procedure in the form of a .bat file, below. Run this from your source folder.

REM modify these lines to match according to your installation:
SET KDEPREFIX=C:\KDE
SET MINGWPREFIX=C:\mingw
SET PERLPREFIX=C:\Perl
 
REM you may want to add some cmake flags:
SET ADD_CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=Release
REM this addition appears to be needed for KDE 4.4.x with MinGW 4.5.x:
SET ADD_CMAKE_FLAGS=%ADD_CMAKE_FLAGS% -DCMAKE_EXE_LINKER_FLAGS="--static-libc++ --static-libcc"
 
REM --------------------------------------------
REM everything below should not need customizing
REM --------------------------------------------
 
REM add required entries to the search path.
REM NOTE: some entries may already be present, but this will do no harm.
SET PATH=%MINGWPREFIX%\bin;%KDEPREFIX%\bin;%KDEPREFIX%\lib;%PERLPREFIX%\bin;%PATH%
 
REM we build in a subdirectory "build" of the sources.
SET SOURCE_DIR=%~dp0
cd %~dp0
mkdir build
cd build
 
cmake %SOURCE_DIR% -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%KDEPREFIX% %ADD_CMAKE_FLAGS%
mingw32-make install
 
REM to install to a different path (e.g. for packaging) use
REM mingw32-make install DESTDIR=Some\Other\Folder

[edit] Troubleshooting

This did not work for you? You can ask for help on kde-windows@kde.org or irc://irc.freenode.net/kde-windows .

[edit] What next?

So you got it to work? Great! Then probably your next concern is how to distribute the binaries you just compiled. See Projects/KDE_on_Windows/Packaging for that.


This page was last modified on 9 June 2013, at 22:56. This page has been accessed 4,733 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal