-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
150 lines (116 loc) · 3.96 KB
/
CMakeLists.txt
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
project(ubuntu-app-launch C CXX)
cmake_minimum_required(VERSION 2.8.9)
##########################
# Version Info
##########################
set(API_VERSION 3)
set(ABI_VERSION 4)
##########################
# Options
##########################
option (enable_tests "Build tests" ON)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
set(PACKAGE ${CMAKE_PROJECT_NAME})
##########################
# Dependent Packages
##########################
find_package(PkgConfig REQUIRED)
find_package(GObjectIntrospection REQUIRED)
include(GNUInstallDirs)
include(CheckIncludeFile)
include(CheckFunctionExists)
include(UseGlibGeneration)
include(UseGdbusCodegen)
include(UseConstantBuilder)
include(UseLttngGenTp)
# Workaround for libexecdir on debian
if (EXISTS "/etc/debian_version")
set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
endif()
set(pkglibexecdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}")
execute_process(COMMAND dpkg-architecture -qDEB_BUILD_MULTIARCH
OUTPUT_VARIABLE UBUNTU_APP_LAUNCH_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(ubuntu_app_launch_arch "${UBUNTU_APP_LAUNCH_ARCH}")
add_compile_options(
# Because we believe in quality
-Wall -Werror
-g
-pthread
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
enable_testing()
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
include_directories(${GOBJECT2_INCLUDE_DIRS})
pkg_check_modules(GIO2 REQUIRED gio-2.0 gio-unix-2.0)
include_directories(${GIO2_INCLUDE_DIRS})
pkg_check_modules(JSONGLIB REQUIRED json-glib-1.0>=1.1.2)
include_directories(${JSONGLIB_INCLUDE_DIRS})
pkg_check_modules(ZEITGEIST REQUIRED zeitgeist-2.0)
include_directories(${ZEITGEIST_INCLUDE_DIRS})
pkg_check_modules(DBUS REQUIRED dbus-1)
include_directories(${DBUS_INCLUDE_DIRS})
pkg_check_modules(DBUSTEST REQUIRED dbustest-1>=14.04.0)
include_directories(${DBUSTEST_INCLUDE_DIRS})
pkg_check_modules(LTTNG REQUIRED lttng-ust)
include_directories(${LTTNG_INCLUDE_DIRS})
pkg_check_modules(CGMANAGER REQUIRED libcgmanager)
include_directories(${CGMANAGER_INCLUDE_DIRS})
pkg_check_modules(MIR REQUIRED mirclient)
include_directories(${MIR_INCLUDE_DIRS})
pkg_check_modules(WHOOPSIE REQUIRED libwhoopsie)
include_directories(${WHOOPSIE_INCLUDE_DIRS})
pkg_check_modules(LIBERTINE REQUIRED libertine)
include_directories(${LIBERTINE_INCLUDE_DIRS})
pkg_check_modules(CURL libcurl>=7.47)
include_directories(${CURL_INCLUDE_DIRS})
pkg_check_modules(UNITY_API REQUIRED libunity-api)
include_directories(${UNITY_API_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
add_definitions( -DXMIR_HELPER="${pkglibexecdir}/xmir-helper" )
add_definitions( -DSNAPPY_XMIR="${CMAKE_INSTALL_FULL_BINDIR}/snappy-xmir" )
add_subdirectory(libubuntu-app-launch)
add_subdirectory(tools)
add_subdirectory(ubuntu-app-test)
add_subdirectory(utils)
# testing & coverage
if (${enable_tests})
enable_testing ()
add_subdirectory(tests)
endif ()
find_package(CoverageReport)
set(filter-list)
list(APPEND filter-list "/usr/include")
list(APPEND filter-list "${CMAKE_SOURCE_DIR}/tests/*")
if (NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
list(APPEND filter-list "${CMAKE_BINARY_DIR}/*")
endif()
ENABLE_COVERAGE_REPORT(
TARGETS
ubuntu-launcher
launcher-static
TESTS
application-icon-finder-test
application-info-desktop-test
exec-util-test
failure-test
helper-test
helper-handshake-test
jobs-base-test
libual-test
libual-cpp-test
list-apps
snapd-info-test
zg-test
FILTER
${filter-list}
)