Development/CMake/Addons for KDE

< Development‎ | CMake
Revision as of 14:30, 15 June 2009 by G4 (Talk | contribs)

Jump to: navigation, search

A page to document the variables, macros and other useful stuff we have to use CMake as the KDE4 buildsystem.

Contents

Variables

The tools required to compile KDE software

  • KDE4_KCFGC_EXECUTABLE - the kconfig_compiler executable
  • KDE4_AUTOMOC_EXECUTABLE - the kde4automoc executable
  • KDE4_MEINPROC_EXECUTABLE - the meinproc4 executable
  • KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable

The location of the KDE libraries

  • KDE4_KDECORE_LIBS - the kdecore library and all depending libraries
  • KDE4_KDEUI_LIBS - the kdeui library and all depending libraries
  • KDE4_KIO_LIBS - the kio library and all depending libraries
  • KDE4_KPARTS_LIBS - the kparts library and all depending libraries
  • KDE4_KUTILS_LIBS - the kutils library and all depending libraries
  • KDE4_KDE3SUPPORT_LIBS - the kde3support library and all depending libraries
  • KDE4_KFILE_LIBS - the kfile library and all depending libraries
  • KDE4_KHTML_LIBS - the khtml library and all depending libraries
  • KDE4_KJS_LIBS - the kjs library and all depending libraries
  • KDE4_KNEWSTUFF2_LIBS - the knewstuff2 library and all depending libraries
  • KDE4_KDEPRINT_LIBS - the kdeprint library and all depending libraries
  • KDE4_KDNSSD_LIBS - the kdnssd library and all depending libraries
  • KDE4_KDESU_LIBS - the kdesu library and all depending libraries
  • KDE4_PHONON_LIBS - the phonon library and all depending librairies
  • KDE4_KDEFX_LIBS - the kdefx library and all depending librairies
  • KDE4_THREADWEAVER_LIBRARIES - the threadweaver library and all depending libraries
  • KDE4_SOLID_LIBS - the solid library and all depending libraries
  • KDE4_KNOTIFYCONFIG_LIBS - the knotify config library and all depending libraries
  • KDE4_KROSSCORE_LIBS - the kross core library and all depending libraries
  • KDE4_KROSSUI_LIBS - the kross ui library which includes core and all depending libraries
  • KDE4_KTEXTEDITOR_LIBS - the ktexteditor library and all depending libraries
  • KDE4_KNEPOMUK_LIBS - the knepomuk library and all depending libraries
  • KDE4_KMETADATA_LIBS - the kmetadata library and all depending libraries

The locations of install directories

They are all interpreted relative to CMAKE_INSTALL_PREFIX

  • BIN_INSTALL_DIR - the directory where executables be installed (default is prefix/bin)
  • SBIN_INSTALL_DIR - the directory where system executables will be installed (default is prefix/sbin)
  • LIB_INSTALL_DIR - the directory where libraries will be installed (default is prefix/lib)
  • CONFIG_INSTALL_DIR - the config file install dir
  • DATA_INSTALL_DIR - the parent directory where applications can install their data
  • HTML_INSTALL_DIR - the HTML install dir for documentation
  • ICON_INSTALL_DIR - the icon install dir (default is prefix/share/icons)
  • INFO_INSTALL_DIR - the kde info install dir (default is prefix/info)
  • KCFG_INSTALL_DIR - the install dir for kconfig files
  • LOCALE_INSTALL_DIR - the install dir for translations
  • MAN_INSTALL_DIR - the kde man page install dir (default is prefix/man)
  • MIME_INSTALL_DIR - the install dir for the mimetype desktop files
  • PLUGIN_INSTALL_DIR - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4)
  • SERVICES_INSTALL_DIR - the install dir for service (desktop, protocol, ...) files
  • SERVICETYPES_INSTALL_DIR - the install dir for servicestypes desktop files
  • SOUND_INSTALL_DIR - the install dir for sound files
  • TEMPLATES_INSTALL_DIR - the install dir for templates (Create new file...)
  • WALLPAPER_INSTALL_DIR - the install dir for wallpapers
  • KCONF_UPDATE_INSTALL_DIR - the kconf_update install dir
  • XDG_APPS_INSTALL_DIR - the XDG apps dir
  • XDG_DIRECTORY_INSTALL_DIR - the XDG directory
  • XDG_MIME_INSTALL_DIR - the XDG mimetypes install dir
  • DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces be installed (default is prefix/share/dbus-1/interfaces)
  • DBUS_SERVICES_INSTALL_DIR - the directory where dbus services be installed (default is prefix/share/dbus-1/services)

Macros

Lots of useful macros: (Question: Is there a URL to download these macros?)

  • KDE4_ADD_UI_FILES (SRCS_VAR file1.ui ... fileN.ui)

Use this to add Qt designer ui files to your application/library.

  • KDE4_ADD_UI3_FILES (SRCS_VAR file1.ui ... fileN.ui)

Use this to add Qt designer ui files from Qt version 3 to your application/library.

  • KDE4_ADD_KCFG_FILES (SRCS_VAR [GENERATE_MOC] file1.kcfgc ... fileN.kcfgc)

Use this to add KDE config compiler files to your application/library.

Use optional GENERATE_MOC to generate moc if you use signals in your kcfg files.

  • KDE4_ADD_WIDGET_FILES (SRCS_VAR file1.widgets ... fileN.widgets)

Use this to add widget description files for the makekdewidgets code generator for Qt Designer plugins.

  • KDE4_ADD_PLUGIN ( name [WITH_PREFIX] file1 ... fileN )

Create a KDE plugin (KPart, kioslave, etc.) from the given source files.

It supports KDE4_ENABLE_FINAL.

If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.

It creates and installs an appropriate libtool la-file.

  • KDE4_ADD_KDEINIT_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN)

Create a KDE application in the form of a module loadable via kdeinit.

A library named kdeinit_<name> will be created and a small executable which links to it.

It supports KDE4_ENABLE_FINAL

If the executable has to be run from the buildtree (e.g. unit tests and code generators used later on when compiling), set the option RUN_UNINSTALLED.

If the executable doesn't have a GUI, use the option NOGUI. By default on OS X application bundles are created, with the NOGUI option no bundles but simple executables are created. Currently it doesn't have any effect on other platforms.

  • KDE4_ADD_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN)

Equivalent to ADD_EXECUTABLE(), but additionally adds some more features:

** support for KDE4_ENABLE_FINAL
** support for automoc
** automatic RPATH handling

If the executable has to be run from the buildtree (e.g. unit tests and code generators used later on when compiling), set the option RUN_UNINSTALLED.

If the executable doesn't have a GUI, use the option NOGUI. By default on OS X application bundles are created, with the NOGUI option no bundles but simple executables are created. Currently it doesn't have any effect on other platforms.

  • KDE4_ADD_LIBRARY (name [STATIC | SHARED | MODULE ] file1 ... fileN)

Equivalent to ADD_LIBRARY(), but additionally it supports KDE4_ENABLE_FINAL and under Windows it adds a -DMAKE_<name>_LIB definition to the compilation.

  • KDE4_ADD_UNIT_TEST (testname [TESTNAME targetname] file1 ... fileN)

Add a unit test, which is executed when running make test

It will be built with RPATH pointing to the build dir

The targets are always created, but only built for the "all" target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target are created but not built by default. You can build them by manually building the target.

The name of the target can be specified using TESTNAME <targetname>, if it is not given the macro will default to the <testname>

  • KDE4_ADD_TEST_EXECUTABLE (name file1 ... fileN)

Add a test executable

It will be built with RPATH pointing to the build dir

The targets are always created, but only built for the "all" target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target are created but not built by default. You can build them by manually building the target.

KDESRCDIR is set to the source directory of the test, this can be used with KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); to be able to use xmlgui and other things in the test, that normally require installation

  • KDE4_UPDATE_ICONCACHE()

Notifies the icon cache that new icons have been installed by updating mtime of ${ICON_INSTALL_DIR}/hicolor directory.

  • KDE4_INSTALL_ICONS(path theme)

Installs all png and svgz files in the current directory to the icon directory given in path, in the subdirectory for the given icon theme.

  • KDE4_ADD_APP_ICON(appsources pattern)

Mac OS X and Windows only: Adds application icon to target source list. This macro adds an application icon to the specified target. Mac OS X notes: the application icon is added to a Mac OS X bundle so that Finder and friends show the right thing. Windows notes: the application icon(s) are compiled into the application binary.

Parameters:

  1. 'appsources' - specifies the list of source files
  2. 'pattern' - regular expression for searching application icons

Examples: KDE4_ADD_APP_ICON(myapp_sources "pics/cr*-myapp.png") or KDE4_ADD_APP_ICON(myapp_sources "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/myapp.png")

  • KDE4_CREATE_HANDBOOK( docbookfile )

Create the handbook from the docbookfile (using meinproc)

  • KDE4_SET_CUSTOM_TARGET_PROPERTY - deprecated, do not use
  • KDE4_GET_CUSTOM_TARGET_PROPERTY - deprecated, do not use
  • KDE4_MOC_HEADERS
  • KDE4_HANDLE_AUTOMOC
  • KDE4_CREATE_FINAL_FILES
  • KDE4_REMOVE_OBSOLETE_CMAKE_FILES
  • KDE4_NO_ENABLE_FINAL

Automoc

There is a separate wiki page for Automoc4, which is now part of kdesupport.


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