CMakeLists.txt 3.41 KB
Newer Older
1 2 3 4 5 6 7 8
# Geary build script
# Copyright 2011-2012 Yorba Foundation
#
# 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.")
Jim Nelson's avatar
Jim Nelson committed
18
set(VERSION "0.2.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 28
set(GLADE_FILES ui/composer.glade ui/login.glade ui/message.glade ui/password-dialog.glade
    ui/preferences.glade ui/toolbar.glade)
29

30
option(DEBUG "Build for debugging." OFF)
31 32 33
option(ICON_UPDATE "Run gtk-update-icon-cache after the install." ON)
option(DESKTOP_UPDATE "Run update-desktop-database after the install." ON)

34 35 36 37
if (DEBUG)
    message(STATUS "Debug build")
endif ()

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

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

46 47 48
find_package(PkgConfig)
pkg_check_modules(LIBINDICATE QUIET indicate-0.7>=0.6.1)
pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
49
pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
50
pkg_check_modules(LIBGRANITE QUIET granite>=0.1.5)
51

52 53 54 55 56 57 58
# intl
include(Gettext)
if (XGETTEXT_FOUND)
    message(STATUS "xgettext found")
else ()
    message(STATUS "xgettext not found")
endif ()
59

60 61 62 63 64 65 66 67 68 69
#
# Uninstall target
#
configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY
)

add_custom_target(
70
    uninstall-base
71 72 73 74 75 76
    COMMAND 
        ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
    COMMAND 
        ${glib_schema_compiler} ${GSETTINGS_DIR}
)

77 78 79 80 81 82 83 84
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)

85 86 87 88 89 90
# 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
91 92
# Dist
# This generates the dist tarballs
93 94 95 96 97 98 99 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
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
126

127 128 129
add_subdirectory(desktop)
add_subdirectory(help)
add_subdirectory(icons)
130
add_subdirectory(po)
131 132 133 134 135
add_subdirectory(sql)
add_subdirectory(src)
add_subdirectory(theming)
add_subdirectory(ui)