~ci-train-bot/unity-scopes-shell/unity-scopes-shell-ubuntu-zesty-2110

1 by Michal Hruby
Initial commit
1
cmake_minimum_required(VERSION 2.8.9)
2
3
project(unity-scopes-shell C CXX)
4
5
if(${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
6
   message(FATAL_ERROR "In-tree build attempt detected, aborting. Set your build dir outside your source dir, delete CMakeCache.txt from source root and try again.")
7
endif()
8
9
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
10
2 by Michal Hruby
Make things work
11
# Instruct CMake to run moc automatically when needed.
12
set(CMAKE_AUTOMOC ON)
185.3.12 by Pete Woods
Support scope activation in test harness
13
set(CMAKE_INCLUDE_CURRENT_DIR ON)
2 by Michal Hruby
Make things work
14
15
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
16
1 by Michal Hruby
Initial commit
17
include(EnableCoverageReport)
18
#####################################################################
19
# Enable code coverage calculation with gcov/gcovr/lcov
20
# Usage:
21
#  * Switch build type to coverage (use ccmake or cmake-gui)
22
#  * Invoke make, make test, make coverage (or ninja if you use that backend)
23
#  * Find html report in subdir coveragereport
24
#  * Find xml report feasible for jenkins in coverage.xml
25
#####################################################################
26
if(cmake_build_type_lower MATCHES coverage)
27
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
28
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" )
29
  set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" )
30
  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
31
  ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP} FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)
32
endif()
33
34
# Make sure we have all the needed symbols
185.4.72 by Pawel Stolowski
Link with PYTHON_LIBRARIES.
35
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
36
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,defs")
1 by Michal Hruby
Initial commit
37
38
# Static C++ checks
39
add_custom_target(cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2
40
                                       ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
41
98.1.5 by Pete Woods
Look for PkgConfig just once
42
find_package(PkgConfig)
185.2.12 by Marcus Tomlinson
Added localization
43
find_package(Intltool)
185.3.61 by Pete Woods
Fix CMake warnings on Vivid
44
find_package(Qt5Concurrent)
1 by Michal Hruby
Initial commit
45
find_package(Qt5Core)
108.2.1 by Pete Woods
Add Qt wrapper around ubuntu location service
46
find_package(Qt5DBus)
1 by Michal Hruby
Initial commit
47
find_package(Qt5Qml)
48
find_package(Qt5Quick)
49
find_package(Qt5Gui)
281.5.1 by Pawel Stolowski
Early cut at using Qt location api
50
find_package(Qt5Positioning)
185.4.76 by Pete Woods
Filter scope harness symbols and add debian symbols file
51
find_package(Qt5Test)
185.3.42 by Pete Woods
Match URIs by regular expression
52
find_package(Boost COMPONENTS regex REQUIRED)
1 by Michal Hruby
Initial commit
53
339.1.12 by Marcus Tomlinson
Require libunity-scopes>=1.0.7
54
pkg_check_modules(SCOPESLIB REQUIRED libunity-scopes>=1.0.7)
291.1.18 by Pawel Stolowski
Fix version
55
pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=12)
185.3.1 by Pete Woods
Pull out test utils into non-dependent library
56
211.3.15 by Marcus Tomlinson
Consolidate pkg_check_modules calls to top level CMakeLists.txt
57
pkg_check_modules(GSETTINGSQT REQUIRED gsettings-qt)
58
pkg_check_modules(ONLINE_ACCOUNTS_CLIENT REQUIRED OnlineAccountsClient)
59
1 by Michal Hruby
Initial commit
60
# Standard install paths
61
include(GNUInstallDirs)
62
16 by Michal Hruby
Clean up pkg-config files
63
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugindir_suffix unity-shell-api OUTPUT_VARIABLE SHELL_PLUGINDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
64
if(SHELL_PLUGINDIR STREQUAL "")
65
    set(SHELL_PLUGINDIR ${CMAKE_INSTALL_LIBDIR}/unity8/qml)
66
endif()
1 by Michal Hruby
Initial commit
67
68
include_directories(
69
    ${CMAKE_CURRENT_BINARY_DIR}
70
    ${CMAKE_CURRENT_SOURCE_DIR}
71
    )
72
73
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
74
75
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
76
77
if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo")
78
    option(Werror "Treat warnings as errors" ON)
79
else()
80
    option(Werror "Treat warnings as errors" OFF)
81
endif()
82
250.1.6 by Pawel Stolowski
New files.
83
# Check the distribution we are building for, set scope harness version and so accordingly
250.1.4 by Pawel Stolowski
Fixes.
84
execute_process(COMMAND lsb_release -c -s OUTPUT_VARIABLE DISTRIBUTION OUTPUT_STRIP_TRAILING_WHITESPACE)
250.1.6 by Pawel Stolowski
New files.
85
file(READ debian/HARNESS_VERSION HARNESS_FULL_VERSION)
86
string(STRIP ${HARNESS_FULL_VERSION} HARNESS_FULL_VERSION)
87
88
# Parse out the three components.
89
STRING(REGEX MATCHALL "[0-9]+" full_version_components ${HARNESS_FULL_VERSION})
90
LIST(GET full_version_components 0 HARNESS_MAJOR)
91
LIST(GET full_version_components 1 HARNESS_MINOR)
92
LIST(GET full_version_components 2 HARNESS_MICRO)
93
94
set(HARNESS_SO_VERSION ${HARNESS_MAJOR})
95
if(NOT ${DISTRIBUTION} MATCHES "vivid")
96
    math(EXPR HARNESS_SO_VERSION "${HARNESS_SO_VERSION} + 1")
250.1.4 by Pawel Stolowski
Fixes.
97
endif()
98
1 by Michal Hruby
Initial commit
99
if (Werror)
100
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
101
endif()
102
103
# gtk and unity-core (actually sigc++) do not like Qt defining macros named
104
# "signals" and "slots"
105
add_definitions(-DQT_NO_KEYWORDS)
281.3.19 by Pawel Stolowski
Enable model updates debug
106
add_definitions(-DVERBOSE_MODEL_UPDATES)
1 by Michal Hruby
Initial commit
107
185.2.12 by Marcus Tomlinson
Added localization
108
# Translation
109
set(GETTEXT_PACKAGE "unity-plugin-scopes")
266.2.2 by Pawel Stolowski
Fix vars
110
add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
111
add_definitions(-DLOCALE_DIR="${CMAKE_INSTALL_FULL_DATADIR}/locale")
185.2.12 by Marcus Tomlinson
Added localization
112
1 by Michal Hruby
Initial commit
113
# Tests
114
include(CTest)
115
enable_testing()
94.1.3 by Pete Woods
Scopes support result TTL properties
116
ADD_CUSTOM_TARGET(
117
    check
242.2.2 by Pawel Stolowski
Merged preview-widget-update from vivid branch
118
    ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
94.1.3 by Pete Woods
Scopes support result TTL properties
119
)
120
1 by Michal Hruby
Initial commit
121
# add subdirectories to build
122
add_subdirectory(src)
123
add_subdirectory(tests)
3 by Michal Hruby
Add a pkgconfig file
124
add_subdirectory(data)
281.5.1 by Pawel Stolowski
Early cut at using Qt location api
125
#add_subdirectory(tools)
185.2.12 by Marcus Tomlinson
Added localization
126
add_subdirectory(po)
211.4.1 by Pawel Stolowski
Sphinx skeleton files
127
add_subdirectory(docs)