CMakeLists.txt 3.78 KB
Newer Older
1
# Geary build script
2
# Copyright 2011-2014 Yorba Foundation
3 4 5 6 7 8
#
# Check http://webdev.elementaryos.org/docs/developer-guide/cmake for documentation

cmake_minimum_required(VERSION 2.8)
cmake_policy(VERSION 2.6)

9
project(geary C)
10 11 12 13 14 15 16

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )

#
# Base bits
#
set(GETTEXT_PACKAGE "geary")
17
set(RELEASE_NAME "Lightweight email client for GNOME.")
Charles Lindsay's avatar
Charles Lindsay committed
18
set(VERSION "0.5.1")
19
set(VERSION_INFO "Release")
20
set(LANGUAGE_SUPPORT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/locale)
21

22 23 24 25 26
# Packaging filenamesnames.
set(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
set(ARCHIVE_FULL_NAME ${ARCHIVE_BASE_NAME}.tar.xz)
set(ARCHIVE_DEBUILD_FULL_NAME ${CMAKE_PROJECT_NAME}_${VERSION}.orig.tar.xz)

27
option(DEBUG "Build for debugging." OFF)
28 29
option(ICON_UPDATE "Run gtk-update-icon-cache after the install." ON)
option(DESKTOP_UPDATE "Run update-desktop-database after the install." ON)
30
option(DESKTOP_VALIDATE "Check generated desktop file for errors during build." ON)
31

32 33 34 35
if (DEBUG)
    message(STATUS "Debug build")
endif ()

36 37 38 39 40 41 42 43
if (ICON_UPDATE)
    message(STATUS "Icon cache will be updated")
endif ()

if (DESKTOP_UPDATE)
    message(STATUS "Desktop database will be updated")
endif ()

44 45 46 47
if (DESKTOP_VALIDATE)
    message(STATUS "Generated desktop file will be checked for errors")
endif ()

48 49
find_package(PkgConfig)
pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
50
pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
51 52 53 54 55 56 57

# CMake's range-checking syntax doesn't allow for a bare less-than, so using
# improbably high version numbers to indicate maximum
pkg_check_modules(WEBKITGTK24X QUIET webkitgtk-3.0>=2.3.0)
pkg_check_modules(WEBKITGTK22X QUIET webkitgtk-3.0>=2.2.0 webkitgtk-3.0<=2.2.100)
pkg_check_modules(WEBKITGTK20X QUIET webkitgtk-3.0>=2.0.0 webkitgtk-3.0<=2.0.100)
pkg_check_modules(WEBKITGTK110X QUIET webkitgtk-3.0>=1.10.0 webkitgtk-3.0<=1.10.2)
58

59 60 61 62 63 64 65
# intl
include(Gettext)
if (XGETTEXT_FOUND)
    message(STATUS "xgettext found")
else ()
    message(STATUS "xgettext not found")
endif ()
66

67 68 69 70 71 72 73 74 75 76
#
# Uninstall target
#
configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY
)

add_custom_target(
77
    uninstall-base
78 79 80 81 82 83
    COMMAND 
        ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
    COMMAND 
        ${glib_schema_compiler} ${GSETTINGS_DIR}
)

84 85 86 87 88 89 90 91
add_custom_target(
    uninstall
)

# We add this dependency using add_dependencies (which makes it run first) rather than
# a depends clause in add_custom_target (which would make it run last).
add_dependencies(uninstall uninstall-base)

92 93 94 95 96 97
# This gets fired in the root-level Makefile to ensure an post-uninstall cleanup happens after
# everything has has been removed
add_custom_target(
    post-uninstall
)

Eric Gregory's avatar
Eric Gregory committed
98 99
# Dist
# This generates the dist tarballs
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
add_custom_target(
    dist
    COMMAND 
        git archive --prefix=${ARCHIVE_BASE_NAME}/ HEAD
        | xz -z > ${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME}
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

# Ubuntu
# Builds the source Debian package used for the Launchpad PPA
add_custom_target(
    ubuntu_pre
    DEPENDS
        dist
    COMMAND 
        ${CMAKE_COMMAND} -E copy ${ARCHIVE_FULL_NAME} ${ARCHIVE_DEBUILD_FULL_NAME}
    COMMAND
        tar xvfx ${ARCHIVE_FULL_NAME}
)

add_custom_target(
    ubuntu
    DEPENDS
        ubuntu_pre
    COMMAND
        ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/debian" 
        "${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_BASE_NAME}/debian"
    COMMAND 
        debuild -S -k$ENV{GPGKEY}
    COMMAND

    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_BASE_NAME}"
)
Eric Gregory's avatar
Eric Gregory committed
133

134 135 136
add_subdirectory(desktop)
add_subdirectory(help)
add_subdirectory(icons)
137
add_subdirectory(po)
138 139 140 141 142
add_subdirectory(sql)
add_subdirectory(src)
add_subdirectory(theming)
add_subdirectory(ui)