Guidelines and HOWTOs/Build from source/edk: Difference between revisions

From KDE Community Wiki
(Introduce edk documentation)
 
(Archived)
Tag: Replaced
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
<tt>edk</tt> is a Python script that can be used to easily build KDE projects. Once <tt>edk</tt> is properly installed and configured, building any KDE project is as easy as invoking <code>edk</code> from the git root of the project.
{{Note|This page is archived. See page history.}}
 
== Motivations ==
 
You may be interested in <tt>edk</tt> if:
 
* You are a new contributor looking for a simple development environment
* You are a new contributor and you want to build just one application
* You want to build KDE projects on top of an existing Plasma environment
* You want to build KDE projects on top of a third party environment (e.g. Gnome or Unity)
* You are tired to manually call <code>cmake</code>, <code>make</code>, <code>make test</code>, ...
 
== How does it work? ==
<tt>edk</tt> is designed to just build, install and (optionally) "run" your project (as <tt>edk</tt> is primarily designed for applications with a single executable). You don't need to worry about setting up a development environment (besides installing <tt>edk</tt> itself).
 
<tt>edk</tt> is not a replacement of [https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source kdesrc-build]. It doesn't download source code and it doesn't resolve dependencies (in fact, <tt>edk</tt> assumes that all build-dependencies are already satisfied). If you want to build the whole KDE stack, <tt>kdesrc-build</tt> [https://blogs.kde.org/2016/05/16/compiling-all-qt5-kf5-plasma5-kdepim5-apps is still the way to go].
 
== Installation ==
 
<syntaxhighlight lang="bash">
git clone git://anongit.kde.org/scratch/elvisangelaccio/edk.git
# assuming that $HOME/bin is in your $PATH
ln -s $PWD/edk/edk.py $HOME/bin/edk
mkdir ~/.config/edk
cp edk/config.ini.example ~/.config/edk/config.ini
cp edk/env.sh.example ~/config/edk/env.sh
</syntaxhighlight>
 
{{Note| You can replace <code>~/.config</code> with <code>$XDG_CONFIG_HOME</code>, if you have this variable set }}
 
== Usage ==
=== Build a project ===
From the git root of the project:
 
  edk
 
The script will perform the following operations:
 
* Source whatever environment variables are exported in <code>$XDG_CONFIG_HOME/edk/env.sh</code>
* Build the CMake-based project found in <code>$(pwd)</code> in a <tt>build</tt> subdirectory
* Install the project in <code>$EDK</code>. This variable must be defined in <code>env.sh</code> so that <tt>edk</tt> can automatically pass the <code>-DCMAKE_INSTALL_PREFIX</code> argument to <tt>cmake</tt>.
* Run the project tests (if available)
 
=== Run the project ===
 
Once the project is built, you can run it with:
 
  edk -r
 
This assumes that you have configured the <code>project</code> key in the <code>[global]</code> section of the config file. The value of this key is used as the name of the executable to run, unless you define an <code>executable</code> key in the <code>[project]</code> section.
 
If you don't have the <tt>project</tt> key (or if you want to override it), you can use as alternative:
 
  edk -p foo -r
 
If you want to pass arguments to the project:
 
  edk -r --foo --bar=XXX
 
=== Debug the project ===
 
Similarly to the -r option, it's also possible to run the project with a debugger (only gdb for now):
 
  edk -d
 
This will execute <code>gdb <executable></code>.
 
{{Note| The <tt>-r</tt> and <tt>-d</tt> options are mutually exclusive. }}
 
=== Clean build ===
 
  edk -c
 
This will delete the build directory before performing a new build.
 
== Configuration ==
 
=== Build with Ninja ===
 
Add <code>-GNinja</code> in the <code>cmake-options</code> of your <tt>config.ini</tt> file (either in the <code>[global]</code> section on in a project-specific section).

Latest revision as of 00:16, 28 September 2022

Note

This page is archived. See page history.