CMakeLists.txt 16.7 KB
Newer Older
Dirk Mueller's avatar
Dirk Mueller committed
1
project(KDEBASE_WORKSPACE)
2 3 4
# set_package_properties appeared in cmake 2.8.6
# TODO: Remove when kdelibs >= 4.10 will be required
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
Dirk Mueller's avatar
Dirk Mueller committed
5

6 7
# Used e.g. in KDE4WorkspaceConfig.cmake, Alex
set(KDE4WORKSPACE_VERSION_MAJOR 4)
Albert Astals Cid's avatar
Albert Astals Cid committed
8
set(KDE4WORKSPACE_VERSION_MINOR 11)
Torgny Nyblom's avatar
Torgny Nyblom committed
9
set(KDE4WORKSPACE_VERSION_PATCH 8)
10 11
set(KDE4WORKSPACE_VERSION ${KDE4WORKSPACE_VERSION_MAJOR}.${KDE4WORKSPACE_VERSION_MINOR}.${KDE4WORKSPACE_VERSION_PATCH} )

Dirk Mueller's avatar
Dirk Mueller committed
12
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
13
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
Dirk Mueller's avatar
Dirk Mueller committed
14 15

#search packages used by KDE
16
set(QT_MIN_VERSION "4.8.0")
17

18
find_package(KDE4 4.9.4 REQUIRED)
19 20
include(KDE4Defaults)

21 22 23
option(WITH_XINERAMA "Xinerama support for multi-headed X displays" ON)

find_package(Strigi)
Dario Freddi's avatar
Dario Freddi committed
24

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
set_package_properties(Strigi PROPERTIES DESCRIPTION "Desktop indexing and search support"
                       URL "http://strigi.sourceforge.net"
                       TYPE REQUIRED
                      )

find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
                       URL "http://www.zlib.net"
                       TYPE REQUIRED
                      )

find_package(KActivities 6.0.0 CONFIG)
set_package_properties(KActivities PROPERTIES DESCRIPTION "Interface library for the activity manager"
                       URL "https://projects.kde.org/kactivities"
                       TYPE REQUIRED
                      )

find_package(DBusMenuQt 0.6.0)
set_package_properties(DBusMenuQt PROPERTIES DESCRIPTION "Support for notification area menus via the DBusMenu protocol"
                       URL "https://launchpad.net/libdbusmenu-qt"
                       TYPE REQUIRED
                      )

find_package(QImageBlitz)
set_package_properties(QImageBlitz PROPERTIES DESCRIPTION "An image effects library"
                       URL "http://sourceforge.net/projects/qimageblitz"
                       TYPE REQUIRED
                      )

find_package(KDeclarative QUIET CONFIG)
set_package_properties(KDeclarative PROPERTIES DESCRIPTION "KDE Declarative (QML) support from kdelibs"
                       URL "http://www.kde.org"
                       TYPE REQUIRED
                       PURPOSE "Required for building ksmserver"
                      )

61
macro_optional_find_package(OpenGL)
62 63 64 65
set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries"
                       URL "http://www.opengl.org"
                       TYPE OPTIONAL
                      )
66
macro_optional_find_package(OpenGLES)
67 68 69 70
set_package_properties(OpenGLES PROPERTIES DESCRIPTION "The OpenGLES libraries"
                       URL "http://www.khronos.org/opengles"
                       TYPE OPTIONAL
                      )
Dario Freddi's avatar
Dario Freddi committed
71 72 73 74 75
macro_optional_find_package(UDev)
set_package_properties(UDev PROPERTIES DESCRIPTION "The UDev Libraries"
                       TYPE OPTIONAL
                       PURPOSE "Allows support for UPower backend in PowerDevil - STRONGLY RECOMMENDED"
                      )
76

Martin Flöser's avatar
Martin Flöser committed
77 78 79 80 81 82
macro_optional_find_package(Wayland)
set_package_properties(Wayland PROPERTIES DESCRIPTION "The Wayland Client and Server libraries"
                       URL "http://wayland.freedesktop.org"
                       TYPE OPTIONAL
                       PURPOSE "Required for building KWin with Wayland support"
                      )
83
if(Q_WS_X11)
84
  find_package(XCB REQUIRED)
85 86 87 88 89 90 91 92 93 94
  set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
                         URL "http://xcb.freedesktop.org"
                         TYPE REQUIRED
                        )

  find_package(X11_XCB)
  set_package_properties(X11_XCB PROPERTIES DESCRIPTION "XCB X11 protocol client library"
                         TYPE REQUIRED
                        )

95 96 97 98 99 100
  find_package(X11 REQUIRED)
  set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
                         URL "http://www.x.org"
                         TYPE REQUIRED
                        )

101 102 103 104
  add_feature_info("Automated testing of X clients" X11_XTest_FOUND
                   "The X11 Testing Resource extension library is useful for automated testing of X clients")
  add_feature_info("libXau" X11_Xau_FOUND "The X11 Authorization Protocol library may be used by KDM")
  add_feature_info("LibXdmcp" X11_Xdmcp_FOUND "The X Display Manager Control Protocol library may be used by KDM")
105
  if(NOT X11_Xkbfile_FOUND)
106 107
    message(FATAL_ERROR "The X11 keyboard layout library was not found. Required for building keyboard modules.")
  endif()
108
  if(NOT X11_Xcomposite_FOUND)
109 110
    message(FATAL_ERROR "The X11 composite library was not found. Required for building the plasma tray and notifications widgets.")
  endif()
111
  if(NOT X11_Xdamage_FOUND)
112 113
    message(FATAL_ERROR "The X11 damaged region extension library was not found. Required for compositing support in KWin.")
  endif()
114
  if(NOT X11_Xrender_FOUND)
115 116
    message(FATAL_ERROR " The X Rendering Extension client library was not found. Required for XRender Compositing backend in KWin.")
  endif()
117
  if(NOT X11_Xfixes_FOUND)
118 119
    message(FATAL_ERROR "The X11 miscellaneous 'fixes' extension library was not found. Required for XRender Compositing backend in KWin.")
  endif()
120
  if(NOT X11_Xrandr_FOUND)
121 122
    message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.")
  endif()
123
  if(NOT OPENGL_FOUND AND NOT OPENGLES_FOUND)
124 125
    message(FATAL_ERROR "Either OpenGL or OpenGL ES 2.0 are required for Compositing support in KWin.")
  endif()
126
  if(NOT X11_Xcursor_FOUND)
127 128
    message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.")
  endif()
129 130
endif(Q_WS_X11)

131 132 133 134 135 136
macro_optional_find_package(GLIB2 2.0)
set_package_properties(GLIB2 PROPERTIES DESCRIPTION "Low-level core library for data structure handling, portability wrappers, etc."
                       URL "http://www.gtk.org"
                       TYPE OPTIONAL
                       PURPOSE "Needed to build the kxkb keyboard map control program and provide XMMS support in the Now Playing Plasma data engine"
                      )
137

138
macro_optional_find_package(Fontconfig)
139 140 141 142 143 144
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
                       URL "http://www.freedesktop.org/wiki/Software/fontconfig"
                       TYPE OPTIONAL
                       PURPOSE "Needed to build font configuration and installation tools"
                      )

145
#### Python support ( plasma scriptengines ) ####
146
macro_optional_find_package(PythonLibrary)
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
set_package_properties(PythonLibrary PROPERTIES DESCRIPTION "Python scripting language"
                       URL "http://python.org"
                       TYPE OPTIONAL
                       PURPOSE "Needed to build plasma scriptengine for python."
                      )

macro_optional_find_package(Soprano 2.7.56)
set_package_properties(Soprano PROPERTIES DESCRIPTION "Semantic Desktop Storing"
                       URL "http://soprano.sourceforge.net"
                       TYPE OPTIONAL
                       PURPOSE "Required to build Nepomuk features."
                      )

macro_optional_find_package(NepomukCore QUIET CONFIG)
set_package_properties(NepomukCore PROPERTIES DESCRIPTION "Nepomuk Core Library"
                       URL "https://projects.kde.org/nepomuk-core"
                       TYPE OPTIONAL
                       PURPOSE "Required to build Nepomuk features."
                      )

macro_optional_find_package(Boost 1.34.0 MODULE)
set_package_properties(Boost PROPERTIES DESCRIPTION "Boost C++ Libraries"
                       URL "http://www.boost.org"
                       TYPE OPTIONAL
                       PURPOSE "Required to build certain Plasma DataEngines (Akonadi, RSS, Calendar)"
                      )

macro_optional_find_package(Akonadi QUIET CONFIG)
set_package_properties(Akonadi PROPERTIES DESCRIPTION "An extensible cross-desktop storage service for PIM data"
                       URL "http://pim.kde.org/akonadi"
                       TYPE OPTIONAL
                       PURPOSE "Required to build certain Plasma DataEngines (Akonadi, Calendar)"
                      )

181
macro_optional_find_package(KdepimLibs 4.10.68 QUIET CONFIG)
182 183 184 185 186 187
set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries"
                       URL "http://pim.kde.org"
                       TYPE OPTIONAL
                       PURPOSE "Required to build certain Plasma DataEngines (Akonadi, Calendar)"
                      )

188
macro_optional_find_package(QJSON)
189 190 191 192 193
set_package_properties(QJSON PROPERTIES DESCRIPTION "Library to manage JSON objects with Qt"
                       URL "http://qjson.sourceforge.net/"
                       TYPE OPTIONAL
                       PURPOSE "Required to build Chrome/Chromium support for Plasma Bookmarks Runners"
                      )
194

195

Dirk Mueller's avatar
Dirk Mueller committed
196
include(ConfigureChecks.cmake)
Allen Winter's avatar
Allen Winter committed
197 198 199 200 201 202 203 204 205
if(NOT WIN32)
  configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h )
  configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h )
  if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
    set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${CMAKE_INSTALL_PREFIX}/share/icons:$XCURSOR_PATH\":~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"; export XCURSOR_PATH")
  endif(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
  configure_file(startkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/startkde  @ONLY)
endif(NOT WIN32)
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h )
Dirk Mueller's avatar
Dirk Mueller committed
206

Allen Winter's avatar
Allen Winter committed
207
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
208
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
209
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KACTIVITIES_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/libs)
210 211 212

add_definitions(-DDISABLE_NEPOMUK_LEGACY)

213
# libs
214
add_subdirectory(cmake)
215
add_subdirectory(libs)
216

217
# system settings (kcontrol replacement)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
218 219 220
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
   macro_optional_add_subdirectory( systemsettings )
endif(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
221 222

# core apps
Carlo Segato's avatar
Carlo Segato committed
223
if(NOT WIN32)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
224 225 226
   macro_optional_add_subdirectory( kcheckpass )
   macro_optional_add_subdirectory( kwin )
   macro_optional_add_subdirectory( ksmserver )
227 228 229

   find_package(JPEG REQUIRED)
   find_package(PNG REQUIRED)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
230
   macro_optional_add_subdirectory( ksplash )
231

Aaron J. Seigo's avatar
Aaron J. Seigo committed
232 233
   macro_optional_add_subdirectory( powerdevil )
   macro_optional_add_subdirectory( qguiplatformplugin_kde )
234 235 236
   if (NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
      macro_optional_add_subdirectory( ksysguard )
   endif (NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
Carlo Segato's avatar
Carlo Segato committed
237
endif(NOT WIN32)
238

Aaron J. Seigo's avatar
Aaron J. Seigo committed
239 240 241 242 243
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
   macro_optional_add_subdirectory(kcontrol)
   macro_optional_add_subdirectory(klipper)
   macro_optional_add_subdirectory(kmenuedit)
   macro_optional_add_subdirectory(krunner)
244
   macro_optional_add_subdirectory(solid-actions-kcm)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
245 246
   macro_optional_add_subdirectory(kstartupconfig)
   macro_optional_add_subdirectory(freespacenotifier)
247
   macro_optional_add_subdirectory(kscreensaver)
248
   macro_optional_add_subdirectory(kinfocenter)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
249 250 251 252 253

   # data
   macro_optional_add_subdirectory(doc)

   if (Q_WS_X11)
254
      macro_optional_add_subdirectory(ktouchpadenabler)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
255 256 257 258 259 260 261
   endif (Q_WS_X11)

   if(NOT WIN32)
      macro_optional_add_subdirectory(kcminit)
      macro_optional_add_subdirectory(khotkeys)
      macro_optional_add_subdirectory(kwrited)
      macro_optional_add_subdirectory(ksystraycmd)
262
      macro_optional_add_subdirectory(appmenu)
Aaron J. Seigo's avatar
Aaron J. Seigo committed
263 264 265
   endif(NOT WIN32)

   if(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
Ralf Jung's avatar
Ralf Jung committed
266
      macro_optional_add_subdirectory( kdm )
Aaron J. Seigo's avatar
Aaron J. Seigo committed
267 268 269 270 271
   else(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
      message(STATUS "Xau lib or Xdmcp lib was missing. kdm will not compile")
   endif(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
endif(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")

272 273 274 275 276
if(NOT WIN32)
    # data
    macro_optional_add_subdirectory(cursors)
endif(NOT WIN32)

Aaron J. Seigo's avatar
Aaron J. Seigo committed
277 278
macro_optional_add_subdirectory(plasma)
macro_optional_add_subdirectory(statusnotifierwatcher)
279
macro_optional_add_subdirectory(kstyles)
280

281
########### install files ###############
Allen Winter's avatar
Allen Winter committed
282 283 284
if(NOT WIN32)
  install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startkde DESTINATION ${BIN_INSTALL_DIR})
endif(NOT WIN32)
285

286
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302

# make the libraries installed from kdebase/workspace available to other projects
# by creating and installing a KDE4WorkspaceConfig.cmake file, which will
# be searched and found by kdelibs/cmake/modules/FindKDE4Workspace.cmake. Alex

# now create the KDE4WorkspaceConfig.cmake file, which will be loaded by 
# kdelibs/cmake/modules/FindKDE4Workspace.cmake and which has to contain all information
# about the libraries installed from kdebase/workspace/libs/ anybody would like to have. Alex

# we need the absolute directories where stuff will be installed too
# but since the variables which contain the destinations can be relative
# or absolute paths, we need this macro to make them all absoulte, Alex
macro(MAKE_INSTALL_PATH_ABSOLUTE out in)
   if (IS_ABSOLUTE "${in}")    # IS_ABSOLUTE is new since cmake 2.4.8
      set(${out} "${in}")
   else (IS_ABSOLUTE "${in}")
303
      set(${out} "\${KDE4WORKSPACE_INSTALL_DIR}/${in}")
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
   endif (IS_ABSOLUTE "${in}")
endmacro(MAKE_INSTALL_PATH_ABSOLUTE out in)

make_install_path_absolute(KDE4WORKSPACE_LIB_DIR     ${LIB_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_LIBEXEC_DIR ${LIBEXEC_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_INCLUDE_DIR ${INCLUDE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_BIN_DIR     ${BIN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SBIN_DIR    ${SBIN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DATA_DIR    ${DATA_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_HTML_DIR    ${HTML_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_CONFIG_DIR  ${CONFIG_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_ICON_DIR    ${ICON_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_KCFG_DIR    ${KCFG_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_LOCALE_DIR  ${LOCALE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_MIME_DIR    ${MIME_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SOUND_DIR   ${SOUND_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_TEMPLATES_DIR    ${TEMPLATES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_WALLPAPER_DIR    ${WALLPAPER_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_KCONF_UPDATE_DIR    ${KCONF_UPDATE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_AUTOSTART_DIR    ${AUTOSTART_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_XDG_APPS_DIR        ${XDG_APPS_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_XDG_DIRECTORY_DIR   ${XDG_DIRECTORY_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SYSCONF_DIR ${SYSCONF_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_MAN_DIR     ${MAN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_INFO_DIR    ${INFO_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DBUS_INTERFACES_DIR ${DBUS_INTERFACES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DBUS_SERVICES_DIR   ${DBUS_SERVICES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SERVICES_DIR ${SERVICES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SERVICETYPES_DIR ${SERVICETYPES_INSTALL_DIR})

set(KDE4WORKSPACE_TARGET_PREFIX KDE4Workspace__)

configure_file(KDE4WorkspaceConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake" @ONLY)

338 339 340 341
# this file will be installed too and will be used by cmake when searching for the Config.cmake file to check the version of kdepimlibs, Alex
macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake 
                                     ${KDE4WORKSPACE_VERSION_MAJOR} ${KDE4WORKSPACE_VERSION_MINOR} ${KDE4WORKSPACE_VERSION_PATCH})

342
set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/KDE4Workspace/cmake)
343 344 345 346 347
# places where find_package() looks for FooConfig.cmake files:
# CMake >= 2.6.0 looks in lib/Foo*/cmake/, CMake >= 2.6.3 also looks in
# lib/cmake/Foo*/, which packagers prefer. So they can set the KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR
# option to have kdepimlibs install its Config file there. Alex
if(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
348
   set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/KDE4Workspace)
349 350
endif(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)

351
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake
352 353
              ${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake
        DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR})
354 355 356

install(EXPORT kdeworkspaceLibraryTargets 
        NAMESPACE ${KDE4WORKSPACE_TARGET_PREFIX}
357
        DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR}
358
        FILE KDE4WorkspaceLibraryTargets.cmake )
359 360