1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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
338
339
340
341
342
343
344
|
project (unity)
cmake_minimum_required(VERSION 2.8.9)
include (cmake/Documentation.cmake)
include (cmake/pch.cmake)
include (GNUInstallDirs)
#
# Base bits
#
set (PROJECT_NAME "unity")
set (UNITY_MAJOR 7)
set (UNITY_MINOR 5)
set (UNITY_MICRO 0)
set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
set (UNITY_API_VERSION "6.0")
set (UNITY_COMPONENTS_VERSION "6")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGNOME_DESKTOP_USE_UNSTABLE_API -std=c++11 -fno-permissive")
set (CMAKE_CXX_FLAGS_DEBUG "-g3 -DUNITY_DEBUG_BUILD")
set (CMAKE_CXX_FLAGS_RELEASE "")
option(
ENABLE_X_SUPPORT
"Enable X.org support in unity"
ON
)
option(
ENABLE_UNIT_TESTS
"Enable Unity Unit Tests"
ON
)
# This is due to bug lp:668799 - qemu-arm segfaults executing msgmerge
option(
I18N_SUPPORT
"Enable I18N, do the .po file thing."
ON
)
option(
ENABLE_NETWORKAREAREGION_PLUGIN
"Enable Unity Network Area region Plugin"
OFF
)
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set (PIC_FLAGS "-fPIC")
endif()
if (ENABLE_X_SUPPORT)
add_definitions(-DUSE_X11)
message("Unity is configured with support for X.org")
else ()
message("Unity is configured with without X.org")
add_definitions(-DNO_X11)
endif ()
if (BUILD_GLES)
add_definitions(-DNUX_OPENGLES_20)
add_definitions(-DUSE_GLES)
set (UNITY_STANDALONE_LADD "unity-core-${UNITY_API_VERSION};m;pthread;dl")
else ()
set (UNITY_STANDALONE_LADD "unity-core-${UNITY_API_VERSION};m;pthread;dl;GL;GLU")
endif ()
if (CMAKE_BUILD_TYPE MATCHES coverage)
set (COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
# FIXME: Read below
# set (COVERAGE_INFO_FILE "${CMAKE_BINARY_DIR}/coverage-html.info")
# set (COVERAGE_HTML_DIR "${CMAKE_BINARY_DIR}/coverage-html")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" )
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" )
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
if (NOT GCOVR_EXECUTABLE)
message(FATAL_ERROR "Cannot enable coverage targets because gcovr was not found.")
else ()
message (STATUS "Enabling XML coverage report")
add_custom_target (coverage-xml
COMMAND "${GCOVR_EXECUTABLE}" --exclude="tests.*" --exclude="obj-.*" -x -r "${CMAKE_SOURCE_DIR}" -o "${COVERAGE_XML_FILE}")
endif()
# FIXME: This got commented out, as it forces a strict dependency on lcov
# find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${LCOV_ROOT}/bin")
# find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT} "${GENHTML_ROOT}/bin")
# if (NOT LCOV_EXECUTABLE)
# message(FATAL_ERROR "Cannot enable coverage targets because gcovr was not found.")
# elseif (NOT GENHTML_EXECUTABLE)
# message(FATAL_ERROR "Cannot enable coverage targets because genhtml was not found.")
# else ()
# message (STATUS "Enabling HTML coverage report")
# add_custom_target (coverage-html
# COMMAND "${LCOV_EXECUTABLE}" --directory "${CMAKE_BINARY_DIR}" --capture --output-file "${COVERAGE_INFO_FILE}"
# COMMAND "${GENHTML_EXECUTABLE}" --output-directory "${COVERAGE_HTML_DIR}" "${COVERAGE_INFO_FILE}")
# endif()
endif (CMAKE_BUILD_TYPE MATCHES coverage)
#
# Niceties
#
set (ARCHIVE_NAME unity-${UNITY_VERSION})
add_custom_target (pre-distcheck
COMMAND echo ""
&& echo "• Releasing Unity ${UNITY_VERSION}"
&& cd ${CMAKE_SOURCE_DIR}
&& echo "• Generating ChangeLog"
&& bzr log --gnu-changelog > ChangeLog
&& echo "• Generating AUTHORS"
&& bzr log --long --levels=0 | grep -e "^\\s*author:" | cut -d ":" -f 2 | sed "s/,/\n/g" | sed -r -f AUTHOR-glue | sort -u | uniq -i > AUTHORS
&& echo "• Running Distcheck"
)
add_custom_target (dist
COMMAND echo "• Creating Tarball"
&& bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
&& echo "• Signing Tarball"
&& gpg --armor --sign --detach-sig ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_dependencies(dist pre-distcheck)
add_custom_target (distcheck
COMMAND cd ${CMAKE_BINARY_DIR}
&& rm -rf ${ARCHIVE_NAME}
&& tar xf ${ARCHIVE_NAME}.tar.bz2
&& mkdir ${ARCHIVE_NAME}/build
&& cd ${ARCHIVE_NAME}/build
&& cmake -DCMAKE_INSTALL_PREFIX=../install -DGSETTINGS_LOCALINSTALL=ON .. -DCMAKE_MODULE_PATH=/usr/share/cmake
&& make
&& make install
&& make check-headless
)
add_dependencies(distcheck dist)
add_custom_target (post-distcheck
COMMAND echo "• Committing Release"
&& bzr commit -m\"Release ${UNITY_VERSION}\" --unchanged
&& echo "• Tagging Release"
&& bzr tag ${UNITY_VERSION}
&& echo "• Unity ${UNITY_VERSION} is ready for release."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_dependencies(post-distcheck distcheck)
add_custom_target (release)
add_dependencies (release distcheck)
#
# config.h
#
set (VERSION "${UNITY_VERSION}")
set (PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
set (UNITY_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}")
set (UNITY_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
set (UNITY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
set (PKGDATADIR "${UNITY_DATADIR}/icons")
set (SOURCEDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
set (BUILDDIR "${CMAKE_BINARY_DIR}")
set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/data")
set (LOCALE_DIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
# specify the domain directly rather than refering to a variable
# like ${PROJECT_NAME} to no confuse dh_translations
set (GETTEXT_PACKAGE "unity")
find_package (PkgConfig)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gtk+-3.0 --variable prefix OUTPUT_VARIABLE GTK_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} unity --variable lensesdir OUTPUT_VARIABLE LENSES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable indicatordir OUTPUT_VARIABLE INDICATORDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable iconsdir OUTPUT_VARIABLE INDICATORICONDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable prefix OUTPUT_VARIABLE INDICATORPREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
set (INDICATOR_SERVICE_DIR "${INDICATORPREFIX}/share/${PROJECT_NAME}/indicators")
configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
#
# i18n
#
find_package (Gettext REQUIRED)
set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
add_custom_command (OUTPUT ${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
COMMAND xgettext -c --from-code=UTF-8 --files-from ${CMAKE_SOURCE_DIR}/po/POTFILES.in --keyword=_ -o ${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot --copyright-holder="Canonical Ltd" --msgid-bugs-address="ayatana-dev@lists.launchpad.net" --no-wrap --no-location
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
if (I18N_SUPPORT)
if (GETTEXT_FOUND)
set (HAVE_GETTEXT true)
file (GLOB _translations ${CMAKE_SOURCE_DIR}/po/*.po)
GETTEXT_CREATE_TRANSLATIONS (${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
ALL ${_translations})
endif (GETTEXT_FOUND)
endif()
#
# Enable or disable boot logging
#
option (BOOT_LOGGER "Enable startup performance logging" OFF)
if (BOOT_LOGGER)
SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")
endif (BOOT_LOGGER)
SET (MAINTAINER_CXXFLAGS "-Werror -Wall -Wcast-align -Wempty-body -Wformat-security -Winit-self -Warray-bounds -Wno-error=deprecated-declarations")
option (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS "Disable errors when local typedefs are unused" ON)
if (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
SET (MAINTAINER_CXXFLAGS "${MAINTAINER_CXXFLAGS} -Wno-error=unused-local-typedefs")
endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
option (DISABLE_MAINTAINER_CXXFLAGS "Disable maintainer CXXFlags" OFF)
if (DISABLE_MAINTAINER_CXXFLAGS)
SET (MAINTAINER_CXXFLAGS "")
endif (DISABLE_MAINTAINER_CXXFLAGS)
# Make sure these flags are used for every build.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MAINTAINER_CXXFLAGS}")
#
# Compiz Plugins
#
set(UNITY_PROTOCOL_PRIVATE_DEPS unity-protocol-private>=7.1.0)
set(UNITY_PLUGIN_SHARED_DEPS
${UNITY_PROTOCOL_PRIVATE_DEPS}
appstream-glib
atk
atk-bridge-2.0
cairo>=1.13.1
dbusmenu-glib-0.4
dee-1.0
gio-2.0>=2.30.0
gio-unix-2.0
gmodule-2.0
gthread-2.0
gtk+-3.0>=3.1
indicator3-0.4>=0.4.90
json-glib-1.0
libbamf3>=0.5.3
gnome-desktop-3.0
libnotify
libstartup-notification-1.0
nux-4.0>=4.0.5
sigc++-2.0>=2.4.0
unity-misc>=0.4.0
xpathselect=1.4
zeitgeist-2.0
)
set(UNITY_PLUGIN_DEPS ${UNITY_PLUGIN_SHARED_DEPS})
if(ENABLE_X_SUPPORT)
set(UNITY_PLUGIN_DEPS
${UNITY_PLUGIN_DEPS}
compiz>=0.9.11
libgeis
x11
xfixes
xi>=1.6.99.1
xrender>=0.9
)
endif ()
pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
pkg_check_modules (CACHED_UNITY_PRIVATE_DEPS REQUIRED ${UNITY_PROTOCOL_PRIVATE_DEPS})
find_library (UNITY_PROTOCOL_PRIVATE_LIB unity-protocol-private ${CACHED_UNITY_PRIVATE_DEPS_LIBDIR} ${CACHED_UNITY_PRIVATE_DEPS_LIBRARY_DIRS})
set(UNITY_STANDALONE_LADD ${UNITY_STANDALONE_LADD} ${UNITY_PROTOCOL_PRIVATE_LIB})
add_subdirectory(a11y)
add_subdirectory(unity-shared)
add_subdirectory(dash)
add_subdirectory(launcher)
add_subdirectory(data)
if (ENABLE_X_SUPPORT)
add_subdirectory(hud)
add_subdirectory(lockscreen)
add_subdirectory(panel)
add_subdirectory(decorations)
add_subdirectory(plugins/unityshell)
add_subdirectory(plugins/unity-mt-grab-handles)
add_subdirectory(shortcuts)
add_subdirectory(shutdown)
add_subdirectory(unity-standalone)
if (ENABLE_NETWORKAREAREGION_PLUGIN)
add_subdirectory(plugins/networkarearegion)
endif (ENABLE_NETWORKAREAREGION_PLUGIN)
endif ()
add_subdirectory(doc)
add_subdirectory(services)
add_subdirectory(tools)
add_subdirectory(UnityCore)
add_subdirectory(guides)
add_subdirectory(gnome)
if (ENABLE_UNIT_TESTS)
add_subdirectory(tests)
else (ENABLE_UNIT_TESTS)
set (MISSING_TESTS_MSG "-- Tests disabled, compile with -DENABLE_UNIT_TESTS=ON")
add_custom_target (check COMMAND echo ${MISSING_TESTS_MSG})
add_custom_target (check-headless COMMAND echo ${MISSING_TESTS_MSG})
add_custom_target (gcheck COMMAND echo ${MISSING_TESTS_MSG})
endif (ENABLE_UNIT_TESTS)
# Resources
install (FILES resources/dash-widgets.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/themes)
file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")
install (FILES ${_datafiles} DESTINATION ${PKGDATADIR})
#
# docs
#
# check if doxygen is even installed
find_package(Doxygen)
if (DOXYGEN_FOUND STREQUAL "NO")
message("Doxygen not found. Documentation will not be built")
endif (DOXYGEN_FOUND STREQUAL "NO")
if (DOXYGEN_FOUND STREQUAL "YES")
set(TOP_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
# prepare doxygen configuration file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# add doxygen as target
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# cleanup $build/api-doc on "make clean"
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES api-doc)
endif (DOXYGEN_FOUND STREQUAL "YES")
|