~didrocks/unity/launcher-bug-fix-fest

620.1.7 by Neil Jagdish Patel
[merge] trunk
1
  project (unity)
572.1.10 by Neil Jagdish Patel
Verison libunity
2
cmake_minimum_required(VERSION 2.8)
3
749.1.3 by Mikkel Kamstrup Erlandsen
Sync with trunk
4
729.4.1 by Mathieu Trudel-Lapierre
Include manpages, and make them translatable.
5
include (cmake/Documentation.cmake)
6
749.1.3 by Mikkel Kamstrup Erlandsen
Sync with trunk
7
subdirs (services tests tools doc)
572.1.4 by Neil Jagdish Patel
Build and install libunity and it's header
8
9
#
572.1.5 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
10
# Base bits
11
#
572.1.8 by Neil Jagdish Patel
Add support for translations
12
set (PROJECT_NAME "unity")
572.1.5 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
13
set (UNITY_MAJOR 3)
915 by Neil Jagdish Patel
[release] 3.6.0
14
set (UNITY_MINOR 6)
1020 by Neil Jagdish Patel
[release] 3.6.8
15
set (UNITY_MICRO 8)
572.1.5 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
16
set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
572.1.10 by Neil Jagdish Patel
Verison libunity
17
set (UNITY_API_VERSION "3.0")
572.1.5 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
18
19
#
572.1.24 by Neil Jagdish Patel
Add support for GTester and a make check target
20
# Niceties
21
#
22
set (ARCHIVE_NAME unity-${UNITY_VERSION})
23
add_custom_target (dist
24
    COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
25
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
26
    )
27
572.1.25 by Neil Jagdish Patel
Add make distcheck support
28
add_custom_target (distcheck
572.1.24 by Neil Jagdish Patel
Add support for GTester and a make check target
29
    COMMAND cd ${CMAKE_BINARY_DIR}
30
    && rm -rf ${ARCHIVE_NAME}
31
    && tar xf ${ARCHIVE_NAME}.tar.bz2
32
    && mkdir ${ARCHIVE_NAME}/build
33
    && cd ${ARCHIVE_NAME}/build
572.1.26 by Didier Roche
build in distcheck (with system path) and with latest nux
34
    && cmake -DCMAKE_INSTALL_PREFIX=../install -DGSETTINGS_LOCALINSTALL=ON .. -DCMAKE_MODULE_PATH=/usr/share/cmake
968 by Neil Jagdish Patel
[release] 3.6.6
35
    && make -j8
36
    && make -j8 install
572.1.24 by Neil Jagdish Patel
Add support for GTester and a make check target
37
    && make check
38
    )
39
add_dependencies(distcheck dist)
40
41
#
572.1.4 by Neil Jagdish Patel
Build and install libunity and it's header
42
# config.h
43
#
44
set (PREFIXDIR "${CMAKE_INSTALL_PREFIX}")
45
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
572.1.6 by Neil Jagdish Patel
Add in the data we need, removing everything else
46
set (PKGDATADIR "${DATADIR}/unity/${UNITY_MAJOR}")
572.1.4 by Neil Jagdish Patel
Build and install libunity and it's header
47
set (GETTEXT_PACKAGE "unity")
48
set (LOCALE_DIR "${DATADIR}/locale")
572.1.5 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
49
set (VERSION "${UNITY_VERSION}")
572.1.19 by Neil Jagdish Patel
Testing and jays branch
50
set (BUILDDIR "${CMAKE_BINARY_DIR}")
616.1.7 by Neil Jagdish Patel
add config.vapi and set the correct variable
51
set (TESTVALADIR "${CMAKE_SOURCE_DIR}/tests/vala")
572.1.4 by Neil Jagdish Patel
Build and install libunity and it's header
52
572.1.7 by Neil Jagdish Patel
Make sure we configure stuff out of tree too
53
configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
572.1.6 by Neil Jagdish Patel
Add in the data we need, removing everything else
54
55
#
56
# Data
57
#
581 by Neil Jagdish Patel
rename data directory so it doesn't get picked up by compiz magic
58
file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")
585 by Didier Roche
be coherent where installing data files
59
install (FILES ${_datafiles} DESTINATION ${PKGDATADIR})
572.1.8 by Neil Jagdish Patel
Add support for translations
60
703.1.1 by Michael Terry
install ccsm plugin icon
61
install (FILES plugin-unityshell.png DESTINATION ${DATADIR}/ccsm/icons/hicolor/64x64/apps)
62
572.1.8 by Neil Jagdish Patel
Add support for translations
63
#
64
# i18n
65
#
66
find_package (Gettext REQUIRED)
67
68
add_custom_command (OUTPUT ${CMAKE_SOURCE_DIR}/po/unity.pot
69
		COMMAND xgettext -c --files-from ${CMAKE_SOURCE_DIR}/po/POTFILES.in --keyword=_ -o ${CMAKE_SOURCE_DIR}/po/unity.pot --copyright-holder="Canonical Ltd" --msgid-bugs-address="ayatana-dev@lists.launchpad.net" --no-wrap --no-location
70
		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
71
		)
72
73
if (${GETTEXT_FOUND} STREQUAL "TRUE")
74
        set (HAVE_GETTEXT true)
75
        file (GLOB _translations ${CMAKE_SOURCE_DIR}/po/*.po)
76
        GETTEXT_CREATE_TRANSLATIONS (${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
77
                ALL ${_translations})
78
endif (${GETTEXT_FOUND} STREQUAL "TRUE")
572.1.13 by Neil Jagdish Patel
Build the compiz plugin
79
80
#
711.2.1 by Alex Launi
Add compile time support for perf logging, otherwise make it a noop
81
# Enable or disable boot logging
82
# 
83
option (BOOT_LOGGER "Enable startup performance logging" OFF)
84
if (BOOT_LOGGER)
85
    SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")
86
endif (BOOT_LOGGER)
87
867.2.1 by Neil Jagdish Patel
Enable -Werror and other fun flags
88
SET (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self")
89
option (DISABLE_MAINTAINER_CFLAGS "Disable maintainer CFlags" OFF)
90
if (DISABLE_MAINTAINER_CFLAGS)
91
  SET (MAINTAINER_CFLAGS "")
92
endif (DISABLE_MAINTAINER_CFLAGS)
93
711.2.1 by Alex Launi
Add compile time support for perf logging, otherwise make it a noop
94
#
572.1.13 by Neil Jagdish Patel
Build the compiz plugin
95
# src (Compiz Plugin)
96
#
968.1.1 by Jason Smith
Implement touch support
97
set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk;unity-misc;gconf-2.0;libutouch-geis")
572.1.17 by Neil Jagdish Patel
Add first bits of unity teshhhhhhting
98
572.1.13 by Neil Jagdish Patel
Build the compiz plugin
99
find_package (Compiz REQUIRED)
100
include (CompizPlugin)
579 by Neil Jagdish Patel
Drop library versioning and rename the unity plugin
101
compiz_plugin (unityshell
572.1.17 by Neil Jagdish Patel
Add first bits of unity teshhhhhhting
102
               PKGDEPS ${UNITY_PLUGIN_DEPS}
729.5.1 by Sam Spilsbury
Improve spread handling:
103
               PLUGINDEPS composite opengl
867.2.1 by Neil Jagdish Patel
Enable -Werror and other fun flags
104
               CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${CMAKE_INSTALL_PREFIX}/share/unity/3\"' -I${CMAKE_BINARY_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CFLAGS}"
572.1.24 by Neil Jagdish Patel
Add support for GTester and a make check target
105
               )
900.1.1 by Sam Spilsbury
Add mt grab handles
106
107
#
108
# UTouch things
109
#
110
111
compiz_add_plugins_in_folder ("${CMAKE_SOURCE_DIR}/utouch")
112
572.1.14 by Neil Jagdish Patel
Build the plugin
113
#
114
# GSettings Schema
115
#
116
SET (UNITY_SCHEMAS "com.canonical.Unity.gschema.xml")
117
118
# Have an option to not install the schema into where GLib is
119
option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
120
if (GSETTINGS_LOCALINSTALL)
121
    SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
122
else (GSETTINGS_LOCALINSTALL)
123
    execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix  OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
124
    SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
125
endif (GSETTINGS_LOCALINSTALL)
126
127
# Run the validator and error if it fails
128
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas  OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
129
execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
572.1.19 by Neil Jagdish Patel
Testing and jays branch
130
572.1.14 by Neil Jagdish Patel
Build the plugin
131
if (_schemas_invalid)
132
  message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
133
endif (_schemas_invalid)
134
135
# Actually install and recomple schemas
136
message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
137
install (FILES ${UNITY_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
138
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
139
install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
572.1.19 by Neil Jagdish Patel
Testing and jays branch
140
141
# For testing
142
configure_file (${CMAKE_SOURCE_DIR}/${UNITY_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_SCHEMAS})
143
execute_process (COMMAND ${_glib_comple_schemas} ${CMAKE_BINARY_DIR}/settings)
749.1.1 by Mikkel Kamstrup Erlandsen
libunity is dead! Long live lp:libunity
144