Jump to content

Calligra/Building Calligra on Windows: Difference between revisions

From KDE Community Wiki
Stuartmd (talk | contribs)
Created page with "{{Note|''These instructions are a work in progress, being based on the Linux Build instructions, there are some sections which need updating.''}} These instructions are for Unix..."
 
Miabrahams (talk | contribs)
 
(87 intermediate revisions by 13 users not shown)
Line 1: Line 1:
[[../Building|« Back to general building instructions]]
{{Note|''These instructions are a work in progress, being based on the Linux Build instructions, there are some sections which need updating.''}}
{{Note|''These instructions are a work in progress, being based on the Linux Build instructions, there are some sections which need updating.''}}


These instructions are for Unix and similar operating systems.
These instructions are for the Windows operating systems.


See also:
See also:
*[[/Nightly Builds/]]
* Building Krita on Windows, the easy way [[/BuildKritaOnWindows/]]
*[[/Developing With KDevelop/]]
*Nightly Builds <!-- [[/Nightly Builds/]] -->
*[[/Developing With QtCreator/]]
*Developing With...<!--[[/Developing With QtCreator/]]-->
*[http://techbase.kde.org/Projects/KDE_on_Windows Pages about compiling KDE software for Windows]
*[http://techbase.kde.org/Projects/KDE_on_Windows Pages about compiling KDE software for Windows]
*[http://techbase.kde.org/Getting_Started/Build/KDE4/Mac_OS_X Pages about compiling KDE software for Mac OS X]
*[https://wiki.kubuntu.org/CompilingKoffice2 Community HOWTO dedicated to building for Kubuntu]
*[http://community.kde.org/Sysadmin/GitKdeOrgManual kde's git infrastructure manual]
*[http://community.kde.org/Sysadmin/GitKdeOrgManual kde's git infrastructure manual]
*[http://techbase.kde.org/Development/Tutorials/Git KDE and Git for developers]
*[http://techbase.kde.org/Development/Tutorials/Git KDE and Git for developers]
*[http://git.or.cz/course/svn.html git crash course]
*[http://git.or.cz/course/svn.html git crash course]
*[http://forum.kde.org/viewtopic.php?f=139&t=92880 script for building Calligra (build only krita by default, but easilly configurable)]
<!--* Scripts? [http://forum.kde.org/viewtopic.php?f=139&t=92880 script for building Calligra (build only krita by default, but easilly configurable)]-->
 


<!--
Note: if you want to build FreOffice using the Nokia Qt SDK, please check out the [http://techbase.kde.org/index.php?title=User:Kumarafaque&oldid=54703 build instructions on techbase].
Note: if you want to build FreOffice using the Nokia Qt SDK, please check out the [http://techbase.kde.org/index.php?title=User:Kumarafaque&oldid=54703 build instructions on techbase].
 
-->


= Preparation =
= Preparation =
== Automated Approach ==
First you should have windows 7 or later installed.
If you're a unix user and tired of install windows manually, here is a sample packer template for auto-unattend installation of Windows 7 SP1 x64 in virtualbox:
<pre>
git clone https://github.com/philacs/calligra-windows-dev-env-setup.git
cd calligra-windows-dev-env-setup
</pre>
replace <code>ProductKey</code> and <code>Windows 7 PROFESSIONAL</code> in <code>scripts/Autounattend.xml</code> to use your ProductKey and Edition, replace <code>"iso_url"</code> in <code>win7x64.json</code> to the location of your windows 7 iso file. <code>kde</code> folder will be copied to <code>C:/kde</code> so put anything you want to copy there. Install packer following [http://www.packer.io/intro/getting-started/setup.html this link], make sure your computer connected to the Internet so it can download needed softwares, then
<pre>
packer build win7x64.json
</pre>
Virtualbox Appliance files will be generated under <code>output-virtualbox-iso</code> folder, import the ovf file in virtualbox to use it.


If you don't use the packer.io builder provided, still [https://github.com/philacs/calligra-windows-dev-env-setup/archive/master.zip download the git repo] and copy <code>kderoot</code> folder as <code>C:/kderoot</code> manually to continue next step.


== Recommended setup ==
Now download and install kde windows build dependencies. Run<code>C:/kderoot/install-kde-build-deps.bat</code>, an application will be downloaded through IE and click "Run" in the upcoming dialog, then the install starts. The installation is automated including reboot handling, wait until everything finish.
Here is recommendation of a directory structure:
;$HOME/kde4/src/:source code
;$HOME/kde4/build/calligra:directory that Calligra will be built in
;$HOME/kde4/inst:directory that Calligra will be installed in


The ''build'' directory is needed because you cannot (or should not) build Calligra inside the source directory; the source and build directory have to be separated.  
[TODO] Download pre-built calligra dependencies by running <code>C:/kderoot/install-calligra-build-deps.bat</code>.


'''Advantages of this setup:'''
== Manual Approach ==
*It is possible to have different builds (e.g. with different options out of the same source code)
*[http://techbase.kde.org/Getting_Started/Increased_Productivity_in_KDE4_with_Scripts David Faure's scripts] can be used to make development easier. With those scripts "make" can be typed in the source directory and building will happen in the right (build) directory automatically.


Also, check the [http://techbase.kde.org/Getting_Started/Build/KDE4 Techbase instructions on setting up a build environment]. That contains some useful scripts and functions.
=== Setup Directories ===
Here is standard directory structure for building KDE applications:
;<nowiki>C:\kderoot</nowiki>:KDE on Windows root directory


== Getting the source code ==
From your %USERPROFILE% directory (assuming you are the only local user)
There are two options: to get the source code for the latest stable version or for the for the development version. The later option is needed to test, check and give feedback about features that is in development and have not been released yet. If unsure pick the stable version.
;kde4\src\:source code
;kde4\build\calligra:directory that Calligra will be built in
;kde4\inst\:directory that Calligra will be installed in


=== Getting the source code for the latest stable version ===
You can create this structure by opening a command prompt (cmd.exe) and typing:
cd %USERPROFILE%
mkdir kde4
mkdir kde4\build
mkdir kde4\build\calligra
mkdir kde4\inst
mkdir kde4\src


The latest stable Calligra version is '''{{Calligra/Stable}}'''.
* Visit download.kde.org for the latest source code: [http://download.kde.org/download.php?url=stable/calligra-{{Calligra/Stable}}/calligra-{{Calligra/Stable}}.tar.bz2 calligra-{{Calligra/Stable}}.tar.bz2]
* Check release notes on [http://www.calligra-suite.org/ calligra.org]


=== Install Dependencies ===
Before you begin, you will need to have a minimal set of software installed on your PC:
* '''Python 3.4 (x86, not 64-bit)'''
* '''Git'''
* '''Microsoft Windows SDK 7.1 with Service Pack 1'''  ([http://blogs.msdn.com/b/vcblog/archive/2011/03/31/10148110.aspx Instructions are here.])


=== Get the source code for the development version ===


{{Warning|You cannot convert your KOffice SVN checkout to a Calligra git checkout. You will need to get the Calligra source code using git and manually apply your changes again.}}
This assumes you want to use MSVC2010. These two posts [[http://mail.kde.org/pipermail/kde-windows/2014-August/008886.html]] and [[http://mail.kde.org/pipermail/kde-windows/2014-August/008887.html]] are about using kde-4.12 with MSVC2013.


The latest development version of Calligra is '''{{Calligra/Unstable}}''' {{Calligra/Stage}}; developers always refer to it as to '''Master'''. Once tested and released, it will become the new current stable version {{Calligra/UnstableBranch}}.
===Configure Emerge===
"emerge" is a Python-based set of scripts which download and build a lot of software KDE depends on. When it works properly emerge very convenient to use, however it must be configured with care. [https://techbase.kde.org/Getting_Started/Build/Windows/emerge You can learn more about emerge here].  


XXX: Here we should explain local branches, staging and always-release-ready Master, if we have that setup. XXX
Begin by downloading the emerge repository.


*'''Option 1: directly from git'''
git clone git://anongit.kde.org/emerge.git
cd emerge
git checkout kde-4.13
mkdir ..\etc
copy kdesettings-example.bat ..\etc\kdesettings.bat
(Note: the instructions below use the kde-4.13 branch.  However the author never had success with kde-4.13 and MSVC2013, so perhaps kde-4.12 would be the better choice.)


To retrieve the source code from Git you have to use the following setup:
Next you must tell emerge about your build environment.  To do this you will need to make the following changes to etc/kdesettings.bat:
* Update KDEROOT
* Set KDECOMPILER=msvc2010 (or msvc2012 or msvc2013)
* Set EMERGE_USE_SHORT_PATH=True
* Set EMERGE_PYTHON_PATH to your Python installation(default assumes in Program Files)
* Update WINDOWSSDKDIR to point to your installation of the Windows SDK
* Set EMERGE_SOURCEONLY=True


Add the following text to your ~/.gitconfig:  
When using MS Visual Studio 2010, make sure you have SP1. MS VS 2012 and 2013 may have problems compiling Qt 4.8.5 (see [http://ftp.mi.fu-berlin.de/OpenMS/release-documentation/html/install_win.html] and [http://stackoverflow.com/questions/12113400/compiling-qt-4-8-x-for-visual-studio-2012] for details).


<nowiki>[url "git://anongit.kde.org/"]</nowiki>
One you have done this, you should navigate to the emerge directory and call
    insteadOf = kde:
  kdeenv
  [url "ssh://[email protected]/"]
    pushInsteadOf = kde:


Then execute
This sets up the development environment that you will need to use in order to build the KDE libraries, their dependencies and Calligra.


  $ git clone kde:calligra
===Emerge KDE libraries===
In order to install the bare minimum set up of KDE libraries, you will need to run a series of calls to emerge, which will take some time:
  emerge qt
emerge kdelibs
emerge kde-runtime
emerge boost (required for required for the core libraries, stage, sheets and krita)


By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.


Note that pushing your changes will only work if you have a KDE developer identity (https://identity.kde.org/register.php).


The $HOME/kde4/src/calligra directory will be created regardless of the way how the source code has been downloaded.
Users familiar with development on Linux platforms may also wish to install another couple of libraries
emerge coreutils
emerge grep


*'''Option 2: download a repository tarball'''
There are some additional optional libraries that can be used by Calligra, again ''emerge'' is used to install them:
emerge lcms2
emerge eigen2
emerge okular (only needed to build a calligra plugin for okular)
emerge exiv2
emerge soprano
emerge librdf-src


Go to https://projects.kde.org/projects/calligra/repository. Press the "Tarball" button. Copy the url text and paste it on your command line. It will look like:
Wordperfect document and graphics support is contained in two additional libraries:  
emerge libwpd
emerge libwpg


wget -c http://anongit.kde.org/calligra/calligra-latest.tar.gz
== Getting the source code ==
As Windows support is still being improved, it is recommended that you use the development version. If you require stability, it is recommended that you take advantage of the nightly builds.


Unpack and cd into directory, then run
The latest development version of Calligra is '''{{Calligra/Unstable}}''' {{Calligra/Stage}}; developers always refer to it as to '''Master'''. Once tested and released, it will become the new current stable version {{Calligra/UnstableBranch}}.


$ ./initrepo.sh


From now on, you can run
To retrieve the source code from Git you have to use the following setup:


$ git pull
Add the following text to %USERPROFILE%\.gitconfig:


to update, or
<nowiki>[url "git://anongit.kde.org/"]</nowiki>
    insteadOf = kde:
[url "ssh://[email protected]/"]
    pushInsteadOf = kde:
[core]
    autocrlf=false


$ git rebase origin/master
Then execute


if you have local changes
git clone kde:calligra


By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.


*'''Option 3: if beta or rc version was released''', the source code for the latest beta can be found on KDE's ftp [ftp://ftp.kde.org/pub/kde/unstable/calligra-latest/ calligra-latest]. Uncompress the code so that $HOME/kde4/src/calligra is created.
Note that pushing your changes will only work if you have a KDE developer identity (https://identity.kde.org/register.php).


= Build requirements =
This will create a 'calligra' subdirectory with the complete source tree.
This section provides information about '''hard''' (required) and '''optional''' software packages needed to build the Calligra software.


== Hard dependencies ==
= Build Calligra =
From your home directory, navigate to the build\calliga subdirectory and execute cmake to configure the project for building with the following lines:
cd kde4\build\calligra
# with versions <= 2.6
cmake -DCMAKE_INSTALL_PREFIX=<nowiki>..\..\inst</nowiki> <nowiki>..\..\src\calligra</nowiki> -DCMAKE_BUILD_TYPE=%EMERGE_BUILDTYPE% -G "NMake Makefiles JOM" -DTINY=off -DBUILD_active=off -DBUILD_mobile=off -DBUILD_kexi=off
# with versions >= 2.7
cmake -DCMAKE_INSTALL_PREFIX=<nowiki>..\..\inst</nowiki> <nowiki>..\..\src\calligra</nowiki> -DCMAKE_BUILD_TYPE=%EMERGE_BUILDTYPE% -G "NMake Makefiles JOM" -DBUILD_kexi=off


{{Note|'''A note for developers:''' to add (or remove) a hard dependency, an explanation of the reason, and possibly a discussion must be posted in advance on calligra-devel@kde.org. The new dependency need to be packaged in the most widely used distributions (Debian, Fedora Core, OpenSuSE, (K)ubuntu). First try to make your new feature optional.}}
Here we are telling cmake that:
* We want to install Calligra into ~/kde4/inst
* The source files are located at ~/kde4/src/calligra
* We are building to the same type (RelWithDebInfo / Debug) as used to build the Qt and KDE libraries, by reading the value of ''EMERGE_BUILDTYPE''
* We are selectively disabling some portions of the build with the -DBUILD_xxxx=on|off commands. 'active' and 'mobile' are not applicable to the desktop build, while flow and kexi (at the time of writing) were still undergoing testing on the platform.


Following are the general must-have dependencies for Calligra:
* Qt 4.6.0 or newer
*kdelibs and kdelibs development files
**the minimal requirement is currently 4.3.0, any 4.3, 4.4 or 4.5 release packaged in your distribution is OK
**On opensuse the development package is called libkde4-devel; on Ubuntu and Debian it is called kdelibs5-dev. (TODO: add info for other distributions)
**Calligra should also build fine with either kdelibs from ''git'' repository (see [http://techbase.kde.org/Getting_Started/Build/KDE4 techbase] for an explanation on how to compile kdelibs from svn), needed for parts of Calligra build with the Mobile Frameworks Profile of the KDE platform (kword, kspread, kpresenter, krita)
* kdebase/runtime 4.3 or newer
* cmake 2.6.2 or newer
* lcms 1.18 or newer
* libpng development package (libpng14-devel on opensuse, libpng-dev on Ubuntu/Debian)
** development packages for other libraries may be needed; on ubuntu/Debian these can be installed using 'apt-get build-dep kdelibs5'


For Tables:
{{Note|You can selectively build applications by using the <nowiki>-DBUILD_application=off</nowiki> command to disable building of those you do not want. If you have a full cmake install, you can use the ''<nowiki>cmake-gui</nowiki>'' application to let you make changes to the configuration.}}
* libeigen 2.0


For Krita:
Then, to build Calligra, type:
* libeigen 2.0
jom -j 20
* libexiv2 >= 0.16
* libqimageblitz


For Stage:
{{Note|''jom'' is a multi-core port of ''nmake''. You can specify the number of course use with the ''-j#'' parameter. e.g. ''jom -j8'' would instruct it to use 8 processes.  Setting a large number will instruct it to use all the cores on your machine.}}
* boost


For Kexi:
* sqlite3 and sqlite3-devel packages (package names can differ on various distributions), version >= 3.6.16


== Optional dependencies ==
This will take a while. Once it has completed, type this command to install the software:
jom install


All optional dependencies are logged at the end of the cmake run, so it is easy to figure out what is missing. The buildsystem also reports what component will bot be built because given missing dependency.
<!-- Including "build debug" info
'''Debugging options.''' Instead of setting CMAKE_BUILD_TYPE to "RelWithDebInfo" for cmake which gives an optimized Calligra with debug information, useful for bug reporting, one can set CMAKE_BUILD_TYPE to "Debug" to get a slower Calligra but with even more interesting debuggong (backtrace) information. For this replace ''-DCMAKE_BUILD_TYPE=RelWithDebInfo'' in the above cmake command with ''-DCMAKE_BUILD_TYPE=Debug''.
-->


== Simplified installation of dependencies on various distributions ==
Please follow the [[Calligra/Building_Calligra_on_Windows#Running_Calligra_applications|Running Calligra Applications]] instructions before trying to run an application.
{{Note|Most distribution don't ship calligra yet, so you may replace it by "koffice" or "koffice2" in those command lines}}
*'''deb-based distributions (Debian, Ubuntu...):''' All the dependencies used for the packages can be installed by running
apt-get build-dep {packagename}
for instance on Ubuntu:
sudo apt-get build-dep calligra


*'''OpenSuSE:''' All the dependencies used for building Calligra can be installed by running:
= Running Calligra applications =
zypper si -d calligra
There are two options to make the Calligra applications available for running.


*'''Fedora:''' All the dependencies used for building Calligra can be installed by running:
*'''Option 1: Being able to run Calligra applications from the command line.''' If you have installed Calligra in a different prefix than KDElibs (which was recommended in this document), you may want to set the following environment variable:  
yum-builddep calligra


*'''ArchLinux:''' All the dependencies used for building Calligra can be installed by running:
set KDEDIRS=\path\to\install;%KDEDIRS%
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo pacman -S kdelibs kdepimlibs qca lcms2 hicolor-icon-theme sqlite3 gsl glew qimageblitz poppler-qt shared-mime-info openexr libqtgtl libpqxx freetds fftw libspnav automoc4 boost cmake eigen git pkgconfig pstoedit libwpd libwpg kdegraphics-libs docbook-xml docbook-xsl libgsf create-svn</pre>
set PATH=\path\to\install\bin;%PATH%
set KDEHOME=\path\to\a\config\dir


*'''Chakra:''' All the dependencies used for building Calligra can be installed by running:(need to enable unstable repo)
And then you need to execute:
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo pacman -S kdelibs kdepimlibs qca lcms2 hicolor-icon-theme sqlite3 gsl glew qimageblitz poppler-qt shared-mime-info openexr libqtgtl libpqxx freetds fftw libspnav automoc4 boost cmake eigen git pkgconfig pstoedit libwpd libwpg kdegraphics-common libgsf docbook-xml docbook-xsl create-svn</pre>
kbuildsycoca4


= Build Calligra =
For example for the recommended directory structure:
{{Note|It is '''not''' possible to build Calligra in the source directory. Set up your directories as described in the [[#Recommended_setup|Recommended setup]] section above}}
set KDEDIRS=%USERPROFILE%\kde4\inst;%KDEDIRS%
set PATH=%USERPROFILE%\kde4\inst\bin;%PATH%
set KDEHOME=%USERPROFILE%\kde4\.kde


Type:
Here we are setting KDEHOME to be saved.
mkdir -p $HOME/kde4/build/calligra
mkdir -p $HOME/kde4/inst
cd $HOME/kde4/build/calligra
cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde4/inst $HOME/kde4/src/calligra -DCMAKE_BUILD_TYPE=RelWithDebInfo


''cmakekde'' tool can be used as explained on [http://techbase.kde.org/Getting_Started/Build/KDE4 the build instructions for KDE4].
If you are using Windows Powershell, the commands are:
$KDEDIRS = $KDEDIRS + ";\path\to\install"
$Path = $Path + ";\path\to\install\bin"
$KDEHOME = $KDEHOME + "\path\to\a\config\dir"


Then type:
*'''Option 2: Being able to run Calligra applications from the menu or by clicking on desktop icons.''' Instead of using ''KDEDIRS'', you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:
make


Note that on dual-core machines compilation can be '''greatly speed up''' with the -j parameter of the ''make'' program, for example for dual-core:
  [Directories]
  make -j4
  prefixes=%USERPROFILE%\kde4\inst
and for quad-core:
  make -j8


Then type this command to install the software:
And then you need to execute:
  make install
  update-mime-database %KDEROOT%\share\mime
 
kbuildsycoca4 --noincremental
'''Debugging options.''' Instead of setting CMAKE_BUILD_TYPE to "RelWithDebInfo" for cmake which gives an optimized Calligra with debug information, useful for bug reporting, one can set CMAKE_BUILD_TYPE to "Debug" to get a slower Calligra but with even more interesting debuggong (backtrace) information. For this replace ''-DCMAKE_BUILD_TYPE=RelWithDebInfo'' in the above cmake command with ''-DCMAKE_BUILD_TYPE=Debug''.


Please follow the [[Building/Building_Calligra#Running_Calligra_applications|Running Calligra Applications]] instructions before trying to run an application.
The advantage of this is that KDE4 will always look for the services where Calligra is installed.


= Updating the already built software =
= Updating the already built software =
If the source code has been checked out Subversion from trunk or a branch, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.
If the source code has been checked out, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.


Type:
Type:
  cd $HOME/kde4/src/calligra
  cd <nowiki>%USERPROFILE%\kde4\src\calligra</nowiki>
  git pull
  git pull --rebase
  cd $HOME/kde4/build/calligra
  cd <nowiki>%USERPROFILE%\kde4\build\calligra</nowiki>
  make
  jom
  make install
  jom install


{{Note|''make -j4'' or ''make -j8'' can be used instead of ''make'' to speedup the build on multicore machines}}
<!--
 
= Build only selected applications from Calligra =
{{Note|The above recipe will not work if the source code has not been obtained from Subversion}}


= Build only selected applications from Calligra =
CMake comes with a command-line tool ''ccmake'' that lets you configure build options. You can use it after executing cmake and ''before'' executing make. To use it, go to the build directory and issue the following commands:
CMake comes with a command-line tool ''ccmake'' that lets you configure build options. You can use it after executing cmake and ''before'' executing make. To use it, go to the build directory and issue the following commands:
  cd $HOME/kde4/build/calligra
  cd $HOME/kde4/build/calligra
Line 202: Line 234:
For applications that you do '''not''' want to compile, set the corresponding BUILD_{application} variable to "off", replacing {application} by the app's name. For instance, setting ''BUILD_krita'' to ''off'' will prevent Krita from being built.
For applications that you do '''not''' want to compile, set the corresponding BUILD_{application} variable to "off", replacing {application} by the app's name. For instance, setting ''BUILD_krita'' to ''off'' will prevent Krita from being built.


Alternatively you can run "-DBUILD_{application}=off" from the cmake command line.
You can edit the cmake command line, with "-DBUILD_{application}=off" from the cmake command line.
 
-->
= Running Calligra applications =
There are two options to make the Calligra applications available for running.
 
*'''Option 1: Being able to run Calligra applications from the command line.''' If you have installed Calligra in a different prefix than KDElibs (which was recommended in this document), you may want to set the following environment variable:
 
export KDEDIRS=/path/to/install:$KDEDIRS
export PATH=/path/to/install/bin:$PATH
export KDEHOME=/path/to/a/config/dir
 
And then you need to execute:
kbuildsycoca4
 
For example for the recommended directory structure:
export KDEDIRS=$HOME/kde4/inst:$KDEDIRS
export PATH=$HOME/kde4/inst/bin:$PATH
export KDEHOME=$HOME/kde4/.kde
 
It is important to set KDEHOME to a directory different of $HOME/.kde, and if the directory does not exist, it will be created automatically.
 
*'''Option 2: Being able to run Calligra applications from the menu or by clicking on desktop icons.''' Instead of using ''KDEDIRS'', you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:
 
[Directories]
prefixes=/path/to/install
 
And then you need to execute:
kbuildsycoca4
 
The advantage of this is that KDE4 will always look for the services where Calligra is installed.
For example for the recommended directory structure:
 
[Directories]
prefixes=$HOME/kde4/inst.


= Executing unit tests =
= Executing unit tests =
To be able to execute unit tests, you need to explicitely enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command in the build directory:
To be able to execute unit tests, you need to explicitely enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command in the build directory:


  cd $HOME/kde4/build/calligra
  cd %USERPROFILE%/kde4/build/calligra
  cmake -DKDE4_BUILD_TESTS=ON .
  cmake -DKDE4_BUILD_TESTS=ON .


Or you can run <code>ccmake .</code> in the buld directory and set KDE4_BUILD_TESTS to "on".
Or you can run cmake-gui in the buld directory and set KDE4_BUILD_TESTS to "on".
 
It is then recommended that before running the tests, you first execute
 
jom install


You can then run the test by executing:
You can then run the test by executing:


  make test
  jom test


or individually in the tests directories.
or individually in the tests directories.
It is recommended to execute
make install
before running tests.


= CMake Build Options =
= CMake Build Options =
When you enter your build directory, you can type "ccmake ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.
When you enter your build directory, you can type "cmake-gui ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.


Here is list for Krita related options:
Here is list for Krita related options:
Line 271: Line 269:
= Possible issues =
= Possible issues =


== Calligra apps don't start ==
If the Calligra applications do not start properly, or you see the window flash up then disappear, then you need to check the [[#Running_Calligra_applications|Running Calligra Applications]] section earlier and make sure you've run update-mime-database and kbuildsycoca4.
You can get some additional insight by installing DebugView, which will let you see warnings and error messages reported by the programs.
This is available on [http://technet.microsoft.com/en-us/sysinternals/bb896647 Microsoft Technet].
<!--
If you get errors when running an application like:
If you get errors when running an application like:


Line 279: Line 285:


or crashes when starting an application, then you very likely have a version of Calligra installed through your package manager. '''As emphasized earlier in this document, you can only have one version of Calligra, and you should uninstall your packaged Calligra'''.
or crashes when starting an application, then you very likely have a version of Calligra installed through your package manager. '''As emphasized earlier in this document, you can only have one version of Calligra, and you should uninstall your packaged Calligra'''.
-->
The sources for the WIX-based installer for Calligra on Windows are at https://gitorious.org/calligra-installer-for-windows

Latest revision as of 02:33, 27 June 2015

« Back to general building instructions

Note

These instructions are a work in progress, being based on the Linux Build instructions, there are some sections which need updating.


These instructions are for the Windows operating systems.

See also:


Preparation

Automated Approach

First you should have windows 7 or later installed. If you're a unix user and tired of install windows manually, here is a sample packer template for auto-unattend installation of Windows 7 SP1 x64 in virtualbox:

git clone https://github.com/philacs/calligra-windows-dev-env-setup.git
cd calligra-windows-dev-env-setup

replace ProductKey and Windows 7 PROFESSIONAL in scripts/Autounattend.xml to use your ProductKey and Edition, replace "iso_url" in win7x64.json to the location of your windows 7 iso file. kde folder will be copied to C:/kde so put anything you want to copy there. Install packer following this link, make sure your computer connected to the Internet so it can download needed softwares, then

packer build win7x64.json

Virtualbox Appliance files will be generated under output-virtualbox-iso folder, import the ovf file in virtualbox to use it.

If you don't use the packer.io builder provided, still download the git repo and copy kderoot folder as C:/kderoot manually to continue next step.

Now download and install kde windows build dependencies. RunC:/kderoot/install-kde-build-deps.bat, an application will be downloaded through IE and click "Run" in the upcoming dialog, then the install starts. The installation is automated including reboot handling, wait until everything finish.

[TODO] Download pre-built calligra dependencies by running C:/kderoot/install-calligra-build-deps.bat.

Manual Approach

Setup Directories

Here is standard directory structure for building KDE applications:

C:\kderoot
KDE on Windows root directory

From your %USERPROFILE% directory (assuming you are the only local user)

kde4\src\
source code
kde4\build\calligra
directory that Calligra will be built in
kde4\inst\
directory that Calligra will be installed in

You can create this structure by opening a command prompt (cmd.exe) and typing:

cd %USERPROFILE% 
mkdir kde4
mkdir kde4\build
mkdir kde4\build\calligra
mkdir kde4\inst
mkdir kde4\src


Install Dependencies

Before you begin, you will need to have a minimal set of software installed on your PC:


This assumes you want to use MSVC2010. These two posts [[1]] and [[2]] are about using kde-4.12 with MSVC2013.

Configure Emerge

"emerge" is a Python-based set of scripts which download and build a lot of software KDE depends on. When it works properly emerge very convenient to use, however it must be configured with care. You can learn more about emerge here.

Begin by downloading the emerge repository.

git clone git://anongit.kde.org/emerge.git
cd emerge
git checkout kde-4.13
mkdir ..\etc
copy kdesettings-example.bat ..\etc\kdesettings.bat

(Note: the instructions below use the kde-4.13 branch. However the author never had success with kde-4.13 and MSVC2013, so perhaps kde-4.12 would be the better choice.)

Next you must tell emerge about your build environment. To do this you will need to make the following changes to etc/kdesettings.bat:

  • Update KDEROOT
  • Set KDECOMPILER=msvc2010 (or msvc2012 or msvc2013)
  • Set EMERGE_USE_SHORT_PATH=True
  • Set EMERGE_PYTHON_PATH to your Python installation(default assumes in Program Files)
  • Update WINDOWSSDKDIR to point to your installation of the Windows SDK
  • Set EMERGE_SOURCEONLY=True

When using MS Visual Studio 2010, make sure you have SP1. MS VS 2012 and 2013 may have problems compiling Qt 4.8.5 (see [3] and [4] for details).

One you have done this, you should navigate to the emerge directory and call

kdeenv

This sets up the development environment that you will need to use in order to build the KDE libraries, their dependencies and Calligra.

Emerge KDE libraries

In order to install the bare minimum set up of KDE libraries, you will need to run a series of calls to emerge, which will take some time:

emerge qt
emerge kdelibs
emerge kde-runtime
emerge boost (required for required for the core libraries, stage, sheets and krita)


Users familiar with development on Linux platforms may also wish to install another couple of libraries

emerge coreutils
emerge grep

There are some additional optional libraries that can be used by Calligra, again emerge is used to install them:

emerge lcms2
emerge eigen2
emerge okular (only needed to build a calligra plugin for okular)
emerge exiv2
emerge soprano
emerge librdf-src

Wordperfect document and graphics support is contained in two additional libraries:

emerge libwpd
emerge libwpg

Getting the source code

As Windows support is still being improved, it is recommended that you use the development version. If you require stability, it is recommended that you take advantage of the nightly builds.

The latest development version of Calligra is 3.1.0 Alpha; developers always refer to it as to Master. Once tested and released, it will become the new current stable version 3.1.


To retrieve the source code from Git you have to use the following setup:

Add the following text to %USERPROFILE%\.gitconfig:

[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "ssh://[email protected]/"]
    pushInsteadOf = kde:
[core]
    autocrlf=false

Then execute

git clone kde:calligra

By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.

Note that pushing your changes will only work if you have a KDE developer identity (https://identity.kde.org/register.php).

This will create a 'calligra' subdirectory with the complete source tree.

Build Calligra

From your home directory, navigate to the build\calliga subdirectory and execute cmake to configure the project for building with the following lines:

cd kde4\build\calligra
# with versions <= 2.6
cmake -DCMAKE_INSTALL_PREFIX=..\..\inst ..\..\src\calligra -DCMAKE_BUILD_TYPE=%EMERGE_BUILDTYPE% -G "NMake Makefiles JOM" -DTINY=off -DBUILD_active=off -DBUILD_mobile=off -DBUILD_kexi=off
# with versions >= 2.7
cmake -DCMAKE_INSTALL_PREFIX=..\..\inst ..\..\src\calligra -DCMAKE_BUILD_TYPE=%EMERGE_BUILDTYPE% -G "NMake Makefiles JOM" -DBUILD_kexi=off

Here we are telling cmake that:

  • We want to install Calligra into ~/kde4/inst
  • The source files are located at ~/kde4/src/calligra
  • We are building to the same type (RelWithDebInfo / Debug) as used to build the Qt and KDE libraries, by reading the value of EMERGE_BUILDTYPE
  • We are selectively disabling some portions of the build with the -DBUILD_xxxx=on|off commands. 'active' and 'mobile' are not applicable to the desktop build, while flow and kexi (at the time of writing) were still undergoing testing on the platform.


Note

You can selectively build applications by using the -DBUILD_application=off command to disable building of those you do not want. If you have a full cmake install, you can use the cmake-gui application to let you make changes to the configuration.


Then, to build Calligra, type:

jom -j 20

Note

jom is a multi-core port of nmake. You can specify the number of course use with the -j# parameter. e.g. jom -j8 would instruct it to use 8 processes. Setting a large number will instruct it to use all the cores on your machine.


This will take a while. Once it has completed, type this command to install the software:

jom install


Please follow the Running Calligra Applications instructions before trying to run an application.

Running Calligra applications

There are two options to make the Calligra applications available for running.

  • Option 1: Being able to run Calligra applications from the command line. If you have installed Calligra in a different prefix than KDElibs (which was recommended in this document), you may want to set the following environment variable:
set KDEDIRS=\path\to\install;%KDEDIRS%
set PATH=\path\to\install\bin;%PATH%
set KDEHOME=\path\to\a\config\dir

And then you need to execute:

kbuildsycoca4

For example for the recommended directory structure:

set KDEDIRS=%USERPROFILE%\kde4\inst;%KDEDIRS%
set PATH=%USERPROFILE%\kde4\inst\bin;%PATH%
set KDEHOME=%USERPROFILE%\kde4\.kde

Here we are setting KDEHOME to be saved.

If you are using Windows Powershell, the commands are:

$KDEDIRS = $KDEDIRS + ";\path\to\install"
$Path = $Path + ";\path\to\install\bin"
$KDEHOME = $KDEHOME + "\path\to\a\config\dir"
  • Option 2: Being able to run Calligra applications from the menu or by clicking on desktop icons. Instead of using KDEDIRS, you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:
[Directories]
prefixes=%USERPROFILE%\kde4\inst

And then you need to execute:

update-mime-database %KDEROOT%\share\mime
kbuildsycoca4 --noincremental

The advantage of this is that KDE4 will always look for the services where Calligra is installed.

Updating the already built software

If the source code has been checked out, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.

Type:

cd %USERPROFILE%\kde4\src\calligra
git pull --rebase
cd %USERPROFILE%\kde4\build\calligra
jom
jom install


Executing unit tests

To be able to execute unit tests, you need to explicitely enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command in the build directory:

cd %USERPROFILE%/kde4/build/calligra
cmake -DKDE4_BUILD_TESTS=ON .

Or you can run cmake-gui in the buld directory and set KDE4_BUILD_TESTS to "on".

It is then recommended that before running the tests, you first execute

jom install

You can then run the test by executing:

jom test

or individually in the tests directories.

CMake Build Options

When you enter your build directory, you can type "cmake-gui ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.

Here is list for Krita related options:

  • HAVE_MEMORY_LEAK_TRACKER [On/Off] - You can turn on compilation of the tool in krita which detects memory leak. If you want to help debug Krita memory usage, it is useful. Otherwise you just slow down your Krita.
  • HAVE_BACKTRACE_SUPPORT [On/Off] - It is related to the memory leak tool. If you activate, you will be able to see code path which leads to memory leak.

Resources

Possible issues

Calligra apps don't start

If the Calligra applications do not start properly, or you see the window flash up then disappear, then you need to check the Running Calligra Applications section earlier and make sure you've run update-mime-database and kbuildsycoca4.

You can get some additional insight by installing DebugView, which will let you see warnings and error messages reported by the programs. This is available on Microsoft Technet.

The sources for the WIX-based installer for Calligra on Windows are at https://gitorious.org/calligra-installer-for-windows