~sil2100/compiz/raring_revert_3616

2890.4.4 by Thomas Voß
Switched to Google test.
1
#
2
# Main CMakeLists.txt for compiz
3
#
2092 by Dennis Kasprzyk
Initial version of CMake build system.
4
project (compiz)
5
2276 by Dennis Kasprzyk
New generalized build system.
6
set (CMAKE_MODULE_PATH_ORIG ${CMAKE_MODULE_PATH})
2609.1.67 by Sam Spilsbury
Added a simple CMake buildsystem extensions system
7
set (COMPIZ_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
8
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${COMPIZ_CMAKE_MODULE_PATH})
2890.4.4 by Thomas Voß
Switched to Google test.
9
3293.2.1 by Sam Spilsbury
Added suppressions for python and glib so that their leaks don't show up
10
include (CTest)
11
3279.4.425 by Sam Spilsbury
Set the memcheck options too
12
set (MEMORYCHECK_COMMAND_OPTIONS --trace-children=yes)
3293.2.1 by Sam Spilsbury
Added suppressions for python and glib so that their leaks don't show up
13
set (MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/tests/experimental-memcheck/compiz.supp CACHE FILEPATH "" FORCE)
3249.2.1 by smspillaz
Include Dart in CMakeLists and set MEMCHECK_COMMAND so that we can run the tests
14
15
include (Dart)
16
2890.4.4 by Thomas Voß
Switched to Google test.
17
# Common compiz CMake macros & functions.
2276 by Dennis Kasprzyk
New generalized build system.
18
include (CompizCommon)
2890.4.4 by Thomas Voß
Switched to Google test.
19
# Packaging-specific CMake macros & functions.
2609.1.67 by Sam Spilsbury
Added a simple CMake buildsystem extensions system
20
include (CompizPackage)
3262.3.62 by Sam Spilsbury
Added wrappers around recompilation code to ensure it only gets
21
22
# GSettings schema recompilation
23
include (CompizGSettings)
24
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
25
# Google Test and Xorg-GTest
26
include (GoogleTest)
27
include (XorgGTest)
28
2092 by Dennis Kasprzyk
Initial version of CMake build system.
29
include (cmake/base.cmake)
2890.4.4 by Thomas Voß
Switched to Google test.
30
# Check if specific function is present in library.
2092 by Dennis Kasprzyk
Initial version of CMake build system.
31
include (CheckFunctionExists)
2890.4.4 by Thomas Voß
Switched to Google test.
32
33
enable_testing()
34
35
# Import macro for doing coverage reporting
36
include(EnableCoverageReport)
37
38
#####################################################################
39
# Enable code coverage calculation with gcov/gcovr/lcov
40
# Usage:
41
#  * Switch build type to coverage (use ccmake or cmake-gui)
42
#  * Invoke make, make test, make coverage
43
#  * Find html report in subdir coveragereport
44
#  * Find xml report feasible for jenkins in coverage.xml
45
#####################################################################
46
IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
47
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
48
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
49
  SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
50
  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
51
ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
52
53
#set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRe" CACHE INTERNAL "" FORCE)
54
#if (NOT CMAKE_BUILD_TYPE)
55
#    set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
56
#endif (NOT CMAKE_BUILD_TYPE)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
57
2755.4.4 by Sam Spilsbury
Add a proper set of a release targets in the CMake buildsystem for all compiz
58
file (READ ${CMAKE_SOURCE_DIR}/VERSION COMPIZ_RELEASE_VERSION LIMIT 12 OFFSET 0)
59
string (STRIP ${COMPIZ_RELEASE_VERSION} COMPIZ_RELEASE_VERSION)
60
61
set (VERSION ${COMPIZ_RELEASE_VERSION})
2092 by Dennis Kasprzyk
Initial version of CMake build system.
62
2733.1.7 by Sam Spilsbury
Bump decoration API
63
set (DECOR_INTERFACE_VERSION 20110504)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
64
2569 by Sam Spilsbury
Add COMPIZ_ENABLE_PACKAGING option so that distros with default settings for prefix, etc don't override
65
if (COMPIZ_PACKAGING_ENABLED)
66
    set (prefix ${CMAKE_INSTALL_PREFIX}                   CACHE PATH "prefix")
67
    set (exec_prefix ${CMAKE_INSTALL_PREFIX}/bin          CACHE PATH "bindir")
68
    set (libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}  CACHE PATH "libdir")
69
    set (includedir ${CMAKE_INSTALL_PREFIX}/include       CACHE PATH "includedir")
70
    set (datadir ${CMAKE_INSTALL_PREFIX}/share            CACHE PATH "datadir")
71
else (COMPIZ_PACKAGING_ENABLED)
72
    set (prefix ${CMAKE_INSTALL_PREFIX}                 )
73
    set (exec_prefix ${CMAKE_INSTALL_PREFIX}/bin        )
74
    set (libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
75
    set (includedir ${CMAKE_INSTALL_PREFIX}/include     )
76
    set (datadir ${CMAKE_INSTALL_PREFIX}/share          )
77
endif (COMPIZ_PACKAGING_ENABLED)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
78
79
set (compiz_plugindir ${libdir}/compiz)
2695 by Sam Spilsbury
Fix the loading and installation of images - core images should
80
set (compiz_sharedir ${datadir}/compiz/)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
81
set (compiz_metadatadir ${datadir}/compiz)
2276 by Dennis Kasprzyk
New generalized build system.
82
set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
83
3420.4.1 by Sam Spilsbury
Clean up the CMake code around the python modules and uninstalling
84
# Force re-generation of uninstall script
85
compiz_set (_compiz_uninstall_rule_created FALSE)
86
3262.3.62 by Sam Spilsbury
Added wrappers around recompilation code to ensure it only gets
87
# Don't allow subdirectories to add schema recompile rule
88
set_property (GLOBAL
3360.1.1 by Sam Spilsbury
Regenerate the local settings recompilation rule when cmake is re-run
89
	      PROPERTY GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE
90
	      TRUE)
91
set_property (GLOBAL
3262.3.62 by Sam Spilsbury
Added wrappers around recompilation code to ensure it only gets
92
	      PROPERTY COMPIZ_INHIBIT_ADD_INSTALL_RECOMPILE_RULE
93
	      TRUE)
94
2890.4.4 by Thomas Voß
Switched to Google test.
95
# Translation
2092 by Dennis Kasprzyk
Initial version of CMake build system.
96
set (ALL_LINGUAS af ar bg bn bn_IN bs ca cs cy da de el en_GB en_US es eu et fi fr gl gu he hi hr hu id it ja ka km ko lo lt mk mr nb nl or pa pl pt pt_BR ro ru sk sl sr sv ta tr uk vi xh zh_CN zh_TW zu)
97
set (GETTEXT_PACKAGE compiz)
98
99
set (COMPIZ_REQUIRES
2494 by Sam Spilsbury
Link required libraries explicitly.
100
    x11
101
    xext
2109 by Dennis Kasprzyk
Link compiz against xdamage and xcomposite to prevent segmentation faults on shutdown.
102
    xdamage
103
    xcomposite
2092 by Dennis Kasprzyk
Initial version of CMake build system.
104
    x11-xcb
105
    xrandr
106
    xinerama
2489.1.9 by Guillaume Seguin
Cleaner Xext dep
107
    xext
2092 by Dennis Kasprzyk
Initial version of CMake build system.
108
    ice
109
    sm
110
    libxml-2.0
111
    libxslt
2610 by Jason Smith
First pass at glib loop, invariably breaking things
112
    glib-2.0
113
    gio-2.0
2665.2.1 by Sam Spilsbury
Port C based glib to C++ glibmm
114
    glibmm-2.4
2162 by Dennis Kasprzyk
Fixed pkg-config check.
115
    "libstartup-notification-1.0 >= 0.7"
2092 by Dennis Kasprzyk
Initial version of CMake build system.
116
)
117
118
set (DECORATION_REQUIRES xrender)
119
2276 by Dennis Kasprzyk
New generalized build system.
120
compiz_pkg_check_modules (COMPIZ REQUIRED ${COMPIZ_REQUIRES})
121
compiz_pkg_check_modules (LIBDECORATION REQUIRED ${DECORATION_REQUIRES})
122
123
include (CompizDefaults)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
124
2099 by Dennis Kasprzyk
Added CMake package generation and fixed compiling
125
set (_compiz_package_string "Compiz ${VERSION}")
2978.1.5 by smspillaz
Fix typo
126
set (_compiz_package "Compiz")
2092 by Dennis Kasprzyk
Initial version of CMake build system.
127
2276 by Dennis Kasprzyk
New generalized build system.
128
compiz_configure_file (${compiz_SOURCE_DIR}/config.h.core.in ${compiz_BINARY_DIR}/generated/config.h)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
129
2294 by Dennis Kasprzyk
Avoid unneeded recompilation after cmake execution.
130
compiz_configure_file (
2096 by Dennis Kasprzyk
Generate compiz.pc
131
    ${CMAKE_SOURCE_DIR}/compiz.pc.in
132
    ${CMAKE_BINARY_DIR}/compiz.pc
133
    COMPIZ_REQUIRES
134
    COMPIZ_CFLAGS
135
)
136
2276 by Dennis Kasprzyk
New generalized build system.
137
install (
138
    FILES ${CMAKE_BINARY_DIR}/compiz.pc
3217.2.1 by smspillaz
Remove COMPIZ_DESTDIR
139
    DESTINATION ${libdir}/pkgconfig
2276 by Dennis Kasprzyk
New generalized build system.
140
)
141
3506.1.54 by Sam Spilsbury
The Find* modules might go inside the xorg-gtest build process before we get a chance to set COMPIZ_INTERNAL_INCLUDES, set it first
142
set (COMPIZ_INTERNAL_INCLUDES
143
    ${CMAKE_CURRENT_SOURCE_DIR}/include
144
    ${CMAKE_CURRENT_SOURCE_DIR}/src
145
    ${CMAKE_CURRENT_SOURCE_DIR}/src/timer/include
146
    ${CMAKE_CURRENT_SOURCE_DIR}/src/string/include
147
    ${CMAKE_CURRENT_SOURCE_DIR}/src/pluginclasshandler/include
148
    ${CMAKE_CURRENT_SOURCE_DIR}/src/point/include
149
    ${CMAKE_CURRENT_SOURCE_DIR}/src/rect/include
150
    ${CMAKE_CURRENT_SOURCE_DIR}/src/servergrab/include
151
    ${CMAKE_CURRENT_SOURCE_DIR}/src/region/include
152
    ${CMAKE_CURRENT_SOURCE_DIR}/src/window/geometry/include
153
    ${CMAKE_CURRENT_SOURCE_DIR}/src/window/geometry-saver/include
154
    ${CMAKE_CURRENT_SOURCE_DIR}/src/window/extents/include
155
    ${CMAKE_CURRENT_SOURCE_DIR}/src/window/constrainment/include
156
    ${CMAKE_CURRENT_SOURCE_DIR}/src/logmessage/include)
157
3270.1.1 by smspillaz
Fix COMPIZ_BUILD_TESTING being set to OFF
158
if (COMPIZ_BUILD_TESTING)
159
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
160
    find_package (GoogleTest)
161
162
    if (GOOGLE_TEST_AND_MOCK_FOUND)
163
164
	build_google_test_locally (${CMAKE_BINARY_DIR}/__gtest)
165
166
	if (BUILD_XORG_GTEST)
167
168
	    find_package (XorgGTest)
169
3554.6.12 by Sam Spilsbury
Force the stdout to remain open, and brute-force getting a connection.
170
	    set (COMPIZ_XORG_GTEST_DIR ${CMAKE_BINARY_DIR}/__xorg_gtest CACHE PATH "Path to Xorg GTest build dir" FORCE)
171
	    set (COMPIZ_XORG_GTEST_WRAPPER ${COMPIZ_XORG_GTEST_DIR}/xorg_gtest_wrapper CACHE PATH "Path to Xorg GTest wrapper" FORCE)
172
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
173
	    if (XORG_GTEST_FOUND)
174
175
		build_xorg_gtest_locally (${CMAKE_BINARY_DIR}/__xorg_gtest)
176
177
	    else (XORG_GTEST_FOUND)
178
179
		set (BUILD_XORG_GTEST FALSE)
180
181
	    endif (XORG_GTEST_FOUND)
182
183
	endif (BUILD_XORG_GTEST)
184
185
    else (GOOGLE_TEST_AND_MOCK_FOUND)
186
3554.6.3 by Sam Spilsbury
Add the right dependencies and ensure we don't build any tests if COMPIZ_BUILD_TESTING is off
187
	set (COMPIZ_BUILD_TESTING OFF CACHE BOOL "" FORCE)
188
	set (BUILD_XORG_GTEST OFF CACHE BOOL "" FORCE)
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
189
190
    endif (GOOGLE_TEST_AND_MOCK_FOUND)
3270.1.1 by smspillaz
Fix COMPIZ_BUILD_TESTING being set to OFF
191
3554.6.3 by Sam Spilsbury
Add the right dependencies and ensure we don't build any tests if COMPIZ_BUILD_TESTING is off
192
else (COMPIZ_BUILD_TESTING)
193
194
    set (BUILD_XORG_GTEST OFF CACHE BOOL "" FORCE)
195
3270.1.1 by smspillaz
Fix COMPIZ_BUILD_TESTING being set to OFF
196
endif (COMPIZ_BUILD_TESTING)
2890.5.2 by Sam Spilsbury
Style fixes, use google-mock
197
2890.4.4 by Thomas Voß
Switched to Google test.
198
# Add the rest of compiz
2276 by Dennis Kasprzyk
New generalized build system.
199
add_subdirectory (cmake)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
200
add_subdirectory (include)
201
add_subdirectory (images)
202
add_subdirectory (libdecoration)
203
add_subdirectory (gtk)
204
add_subdirectory (kde)
205
add_subdirectory (po)
206
add_subdirectory (metadata)
2285 by Dennis Kasprzyk
Use bcop in core.
207
add_subdirectory (src)
3203.2.1 by smspillaz
Enable libcompizconfig for building. Move ccp to plugins/
208
add_subdirectory (compizconfig)
2276 by Dennis Kasprzyk
New generalized build system.
209
add_subdirectory (xslt)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
210
add_subdirectory (plugins)
2919.2.1 by Robert Ancell
Added Xig Testing infrastructure to compiz
211
add_subdirectory (tests)
2092 by Dennis Kasprzyk
Initial version of CMake build system.
212
3620.3.3 by MC Return
Fixed all guaruntee->guarantee typos, except those in the changelogs
213
# Leave last - the cmake_install.cmake script is guaranteed
3262.3.62 by Sam Spilsbury
Added wrappers around recompilation code to ensure it only gets
214
# to run in a single job, and we need to force GSettings
215
# schema recompilation to happen after all other install
216
# targets (there is no way to set install target dependencies)
217
# in CMake
3262.3.66 by Sam Spilsbury
Added postinst
218
add_subdirectory (postinst)
3262.3.62 by Sam Spilsbury
Added wrappers around recompilation code to ensure it only gets
219
2543 by Sam Spilsbury
Added compiz_ensure_linkage function and dropped some more rpath stuff
220
compiz_ensure_linkage ()
2276 by Dennis Kasprzyk
New generalized build system.
221
compiz_package_generation ("Compiz")
222
compiz_add_uninstall ()
2534 by Sam Spilsbury
Add compiz_add_git_dist macro to CompizCommon
223
compiz_add_git_dist ()
2755.4.2 by Sam Spilsbury
Added a distcheck target
224
compiz_add_distcheck ()
2755.4.4 by Sam Spilsbury
Add a proper set of a release targets in the CMake buildsystem for all compiz
225
compiz_add_release ()
226
compiz_add_release_signoff ()
2276 by Dennis Kasprzyk
New generalized build system.
227
3285.1.1 by Sam Spilsbury
Generate the CTestFile.cmake using cmake itself (LP: #1024214)
228
if (COMPIZ_BUILD_TESTING)
229
    compiz_generate_testfile_target ()
230
endif (COMPIZ_BUILD_TESTING)
231
2095 by Dennis Kasprzyk
Provide summary configure output and create compiz-common.h
232
_print_configure_results ()
233
2276 by Dennis Kasprzyk
New generalized build system.
234
_check_compiz_cmake_macro (${CMAKE_MODULE_PATH_ORIG})
235
2890.4.4 by Thomas Voß
Switched to Google test.
236
# Enable coverage reporting for compiz
3298.1.1 by Sam Spilsbury
Mark coverage reports correctly
237
compiz_generate_coverage_report()
2890.4.4 by Thomas Voß
Switched to Google test.
238
2095 by Dennis Kasprzyk
Provide summary configure output and create compiz-common.h
239