~ubuntu-branches/ubuntu/quantal/unity/quantal

55.779.1 by Neil Jagdish Patel
Add a GTest target for make check
1
project (unity)
55.178.269 by Neil Jagdish Patel
Verison libunity
2
cmake_minimum_required(VERSION 2.8)
3
55.460.1 by Mathieu Trudel-Lapierre
Include manpages, and make them translatable.
4
include (cmake/Documentation.cmake)
5
55.178.263 by Neil Jagdish Patel
Build and install libunity and it's header
6
#
55.178.264 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
7
# Base bits
8
#
55.178.267 by Neil Jagdish Patel
Add support for translations
9
set (PROJECT_NAME "unity")
55.1863.132 by Łukasz 'sil2100' Zemczak
Release\ 6.0.0
10
set (UNITY_MAJOR 6)
55.1863.286 by Łukasz 'sil2100' Zemczak
Release\ 6.4.0
11
set (UNITY_MINOR 4)
55.359.956 by Neil Jagdish Patel
Release\ 4.16.0
12
set (UNITY_MICRO 0)
55.178.264 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
13
set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
55.1863.132 by Łukasz 'sil2100' Zemczak
Release\ 6.0.0
14
set (UNITY_API_VERSION "6.0")
55.178.264 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
15
55.912.10 by Tim Penhey
Make unity have debug builds again.
16
set (CMAKE_CXX_FLAGS "-DGNOME_DESKTOP_USE_UNSTABLE_API -std=c++0x -fno-permissive")
17
set (CMAKE_CXX_FLAGS_DEBUG "-g3")
18
set (CMAKE_CXX_FLAGS_RELEASE "")
55.799.1 by Bilal Akhtar
Add extra CXX flags to make compilation on GCC 4.5 and below, as strict as GCC 4.6
19
55.1982.4 by timo.jyrinki at canonical
Move the check to the top-level CMakeLists.txt
20
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
21
    set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm")
22
else ()
23
    set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm -lGL -lGLU")
24
endif ()
25
55.1350.6 by Alexandros Frantzis
GLES2: Fix GLES conditional in CMakeLists.txt.
26
if (BUILD_GLES)
55.2068.1 by Daniel van Vugt
USE_MODERN_COMPIZ_GL does not need to be a CMake option any more.
27
	SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNUX_OPENGLES_20 -DUSE_GLES")
55.1350.6 by Alexandros Frantzis
GLES2: Fix GLES conditional in CMakeLists.txt.
28
endif (BUILD_GLES)
55.1227.8 by Gord Allott
changed our make targets so that our standalone applications only build with the standalone-clients make target
29
55.178.264 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
30
#
55.178.283 by Neil Jagdish Patel
Add support for GTester and a make check target
31
# Niceties
32
#
33
set (ARCHIVE_NAME unity-${UNITY_VERSION})
55.359.695 by Neil Jagdish Patel
Fix make release deps
34
35
add_custom_target (pre-distcheck
36
  COMMAND echo ""
37
       && echo "• Releasing Unity ${UNITY_VERSION}"
38
       && cd ${CMAKE_SOURCE_DIR}
39
       && echo "• Generating ChangeLog"
40
       && bzr log --gnu-changelog > ChangeLog
41
       && echo "• Generating AUTHORS"
42
       && bzr log --long --levels=0 | grep -e "^\\s*author:" -e "^\\s*committer:" | cut -d ":" -f 2 | sed -r -f AUTHOR-glue | sort -u > AUTHORS
43
       && echo "• Committing Release"
44
       && bzr commit -m"Release ${UNITY_VERSION}" --unchanged
45
       && echo "• Tagging Release"
46
       && bzr tag ${UNITY_VERSION}
47
       && echo "• Running Distcheck"
48
  )
49
  
55.178.283 by Neil Jagdish Patel
Add support for GTester and a make check target
50
add_custom_target (dist
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
51
  COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
52
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
53
  )
55.359.956 by Neil Jagdish Patel
Release\ 4.16.0
54
add_dependencies(dist pre-distcheck)
55.178.283 by Neil Jagdish Patel
Add support for GTester and a make check target
55
55.178.284 by Neil Jagdish Patel
Add make distcheck support
56
add_custom_target (distcheck
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
57
  COMMAND cd ${CMAKE_BINARY_DIR}
58
       && rm -rf ${ARCHIVE_NAME}
59
       && tar xf ${ARCHIVE_NAME}.tar.bz2
60
       && mkdir ${ARCHIVE_NAME}/build
61
       && cd ${ARCHIVE_NAME}/build
62
       && cmake -DCMAKE_INSTALL_PREFIX=../install -DGSETTINGS_LOCALINSTALL=ON .. -DCMAKE_MODULE_PATH=/usr/share/cmake
55.798.4 by Neil Jagdish Patel
Go back to the early 00s
63
       && make -j4
64
       && make -j4 install
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
65
       && make check
66
  )
55.178.283 by Neil Jagdish Patel
Add support for GTester and a make check target
67
add_dependencies(distcheck dist)
68
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
69
add_custom_target (post-distcheck
70
  COMMAND echo "• Signing Tarball"
71
       && gpg --armor --sign --detach-sig ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
72
       && echo "• Pushing Branch"
73
       && bzr push
74
       && echo "• Publishing Tarball"
55.359.635 by Neil Jagdish Patel
Fix typos
75
       && lp-project-upload unity ${UNITY_VERSION} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
76
       && echo ""
77
       && echo "• Unity ${UNITY_VERSION} Released."
78
  )
55.359.695 by Neil Jagdish Patel
Fix make release deps
79
add_dependencies(post-distcheck distcheck)
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
80
81
add_custom_target (release)
55.359.695 by Neil Jagdish Patel
Fix make release deps
82
add_dependencies (release post-distcheck)
55.798.1 by Neil Jagdish Patel
Add a few new make targets to make my life easier during releases.
83
55.178.283 by Neil Jagdish Patel
Add support for GTester and a make check target
84
#
55.178.263 by Neil Jagdish Patel
Build and install libunity and it's header
85
# config.h
86
#
87
set (PREFIXDIR "${CMAKE_INSTALL_PREFIX}")
88
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
55.178.265 by Neil Jagdish Patel
Add in the data we need, removing everything else
89
set (PKGDATADIR "${DATADIR}/unity/${UNITY_MAJOR}")
55.178.263 by Neil Jagdish Patel
Build and install libunity and it's header
90
set (GETTEXT_PACKAGE "unity")
91
set (LOCALE_DIR "${DATADIR}/locale")
55.178.264 by Neil Jagdish Patel
Create and install the pkgconfig file. Serve up kittens to be slaughtered by the god of CMake
92
set (VERSION "${UNITY_VERSION}")
55.178.278 by Neil Jagdish Patel
Testing and jays branch
93
set (BUILDDIR "${CMAKE_BINARY_DIR}")
55.178.263 by Neil Jagdish Patel
Build and install libunity and it's header
94
55.178.266 by Neil Jagdish Patel
Make sure we configure stuff out of tree too
95
configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
55.178.265 by Neil Jagdish Patel
Add in the data we need, removing everything else
96
97
#
55.178.267 by Neil Jagdish Patel
Add support for translations
98
# i18n
99
#
100
find_package (Gettext REQUIRED)
101
55.2117.2 by Sam Spilsbury
Generate unity g-c-c integration files
102
set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
103
55.178.267 by Neil Jagdish Patel
Add support for translations
104
add_custom_command (OUTPUT ${CMAKE_SOURCE_DIR}/po/unity.pot
105
		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
106
		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
107
		)
108
109
if (${GETTEXT_FOUND} STREQUAL "TRUE")
110
        set (HAVE_GETTEXT true)
111
        file (GLOB _translations ${CMAKE_SOURCE_DIR}/po/*.po)
112
        GETTEXT_CREATE_TRANSLATIONS (${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
113
                ALL ${_translations})
114
endif (${GETTEXT_FOUND} STREQUAL "TRUE")
55.178.272 by Neil Jagdish Patel
Build the compiz plugin
115
116
#
55.422.1 by Alex Launi
Add compile time support for perf logging, otherwise make it a noop
117
# Enable or disable boot logging
118
# 
119
option (BOOT_LOGGER "Enable startup performance logging" OFF)
120
if (BOOT_LOGGER)
121
    SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")
122
endif (BOOT_LOGGER)
123
55.2021.1 by Tim Penhey
Stop turning off the uninitialized check.
124
SET (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wempty-body -Wformat-security -Winit-self -Warray-bounds")
55.544.1 by Neil Jagdish Patel
Enable -Werror and other fun flags
125
option (DISABLE_MAINTAINER_CFLAGS "Disable maintainer CFlags" OFF)
126
if (DISABLE_MAINTAINER_CFLAGS)
127
  SET (MAINTAINER_CFLAGS "")
128
endif (DISABLE_MAINTAINER_CFLAGS)
129
55.422.1 by Alex Launi
Add compile time support for perf logging, otherwise make it a noop
130
#
55.812.1 by Neil Jagdish Patel
Initial go at making things sane again
131
# Compiz Plugins
55.178.272 by Neil Jagdish Patel
Build the compiz plugin
132
#
55.2044.1 by Łukasz 'sil2100' Zemczak
Add the libunity private directory to unityshell.so RPATH, so that it can easily find the libunity-protocol-private.so library on load.
133
55.2118.2 by Sam Spilsbury
Also dep on dbus-glib-1
134
set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis")
55.2017.2 by Michal Hruby
Make it link as well
135
# FIXME: unity-protocol-private shouldn't be there, but building of unityshell is just broken
55.2093.3 by Pawel Stolowski
Previews - implemented PreviewClosed() signal.
136
set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.95.1")
55.1973.1 by Jay Taoko
* Merged with Unity trunk.
137
55.1866.1 by Gord Allott
panel and dash moved to subdirectories
138
find_package (PkgConfig)
139
pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
55.2044.1 by Łukasz 'sil2100' Zemczak
Add the libunity private directory to unityshell.so RPATH, so that it can easily find the libunity-protocol-private.so library on load.
140
pkg_check_modules (CACHED_UNITY_PRIVATE_DEPS REQUIRED ${UNITY_PROTOCOL_PRIVATE_DEPS})
55.1866.1 by Gord Allott
panel and dash moved to subdirectories
141
add_subdirectory(unity-shared)
142
add_subdirectory(panel)
143
add_subdirectory(dash)
55.1866.2 by Gord Allott
added hud
144
add_subdirectory(hud)
55.1866.3 by Gord Allott
launcher and switcher added
145
add_subdirectory(launcher)
55.1866.4 by Gord Allott
shortcuts and unityshell working woo
146
add_subdirectory(shortcuts)
55.1878.1 by Gord Allott
Snapshot before refactoring components
147
add_subdirectory(unity-standalone)
55.1866.4 by Gord Allott
shortcuts and unityshell working woo
148
add_subdirectory(plugins/unityshell)
55.2072.2 by Gord Allott
add preview baseclass and build system
149
add_subdirectory(plugins/networkarearegion)
55.1866.4 by Gord Allott
shortcuts and unityshell working woo
150
add_subdirectory(plugins/unitydialog)
55.2072.2 by Gord Allott
add preview baseclass and build system
151
add_subdirectory(plugins/unity-mt-grab-handles)
55.803.2 by Sam Spilsbury
Add unity dialog plugin to build
152
55.1227.8 by Gord Allott
changed our make targets so that our standalone applications only build with the standalone-clients make target
153
# subdirs
154
add_subdirectory(doc)
55.1564.3 by Gord Allott
more graceful handling of no gtest
155
55.1564.4 by Thomas Voß
Introduced a cached variable for google-test source path.
156
# Check for google test and build it locally
157
set(
158
  GTEST_ROOT_DIR
159
  "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake
160
  CACHE
161
  PATH
162
  "Path to Google test srcs"
163
)
164
55.1599.18 by Brandon Schaefer
Removed comments added by me...
165
find_path(GTEST_INCLUDE_DIR gtest/gtest.h)
166
if (GTEST_INCLUDE_DIR)
167
  #FIXME - hardcoded is bad!
55.1564.4 by Thomas Voß
Introduced a cached variable for google-test source path.
168
  add_subdirectory(
169
    ${GTEST_ROOT_DIR}
170
    gtest
171
  )
55.1599.18 by Brandon Schaefer
Removed comments added by me...
172
endif(GTEST_INCLUDE_DIR)
55.1564.3 by Gord Allott
more graceful handling of no gtest
173
55.1227.8 by Gord Allott
changed our make targets so that our standalone applications only build with the standalone-clients make target
174
add_subdirectory(services)
55.1866.4 by Gord Allott
shortcuts and unityshell working woo
175
add_subdirectory(tests)
55.1227.8 by Gord Allott
changed our make targets so that our standalone applications only build with the standalone-clients make target
176
add_subdirectory(tools)
177
add_subdirectory(UnityCore)
178
add_subdirectory(guides)
55.1350.1 by Marc Ordinas i Llopis
GLES2: Ported changes to files outside plugins/unityshell.
179
55.2117.2 by Sam Spilsbury
Generate unity g-c-c integration files
180
add_subdirectory(gnome)
181
55.803.2 by Sam Spilsbury
Add unity dialog plugin to build
182
#
55.178.273 by Neil Jagdish Patel
Build the plugin
183
# GSettings Schema
184
#
185
SET (UNITY_SCHEMAS "com.canonical.Unity.gschema.xml")
186
187
# Have an option to not install the schema into where GLib is
188
option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
189
if (GSETTINGS_LOCALINSTALL)
190
    SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
191
else (GSETTINGS_LOCALINSTALL)
192
    execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix  OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
193
    SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
194
endif (GSETTINGS_LOCALINSTALL)
195
196
# Run the validator and error if it fails
197
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas  OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
198
execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
55.178.278 by Neil Jagdish Patel
Testing and jays branch
199
55.178.273 by Neil Jagdish Patel
Build the plugin
200
if (_schemas_invalid)
201
  message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
202
endif (_schemas_invalid)
203
204
# Actually install and recomple schemas
205
message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
206
install (FILES ${UNITY_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
207
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
208
install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
55.178.278 by Neil Jagdish Patel
Testing and jays branch
209
210
# For testing
211
configure_file (${CMAKE_SOURCE_DIR}/${UNITY_SCHEMAS} ${CMAKE_BINARY_DIR}/settings/${UNITY_SCHEMAS})
212
execute_process (COMMAND ${_glib_comple_schemas} ${CMAKE_BINARY_DIR}/settings)
55.469.1 by Mikkel Kamstrup Erlandsen
libunity is dead! Long live lp:libunity
213
55.794.1 by Gord Allott
Enables doxygen documentation building, for internal use only. use make doxygen
214
#
215
# docs
216
#
217
218
# check if doxygen is even installed
219
find_package(Doxygen)
220
if (DOXYGEN_FOUND STREQUAL "NO")
55.796.1 by Gord Allott
fix for me breaking trunk, doxygen no longer fatal errors if its not installed
221
  message("Doxygen not found. Documentation will not be built")
55.794.1 by Gord Allott
Enables doxygen documentation building, for internal use only. use make doxygen
222
endif (DOXYGEN_FOUND STREQUAL "NO")
223
55.796.1 by Gord Allott
fix for me breaking trunk, doxygen no longer fatal errors if its not installed
224
if (DOXYGEN_FOUND STREQUAL "YES")
225
  set(TOP_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
226
227
  # prepare doxygen configuration file
228
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
229
230
  # add doxygen as target
231
  add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
232
233
  # cleanup $build/api-doc on "make clean"
234
  set_property(DIRECTORY APPEND PROPERTY
235
         ADDITIONAL_MAKE_CLEAN_FILES api-doc)
236
237
endif (DOXYGEN_FOUND STREQUAL "YES")