~jpakkane/+junk/gtestfix

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
# Copyright © 2013 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 3,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Authors:
#     Antti Kaijanmäki <antti.kaijanmaki@canonical.com>

cmake_minimum_required(VERSION 2.8)
project(connectivity-cpp)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)

include(EnableCoverageReport)
include(GNUInstallDirs)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fPIC -fvisibility=hidden -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -pedantic -Wextra -fPIC -pthread")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")

#####################################################################
# Enable code coverage calculation with gcov/gcovr/lcov
# Usage:
#  * Switch build type to coverage (use ccmake or cmake-gui)
#  * Invoke make, make test, make coverage
#  * Find html report in subdir coveragereport
#  * Find xml report feasible for jenkins in coverage.xml
#####################################################################
IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
  SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])

set(CONNECTIVITY_CPP_VERSION_MAJOR 0)
set(CONNECTIVITY_CPP_VERSION_MINOR 0)
set(CONNECTIVITY_CPP_VERSION_PATCH 1)

include(CTest)

find_package(PkgConfig REQUIRED)

include_directories(include)
include_directories(dbus-cpp)

pkg_check_modules(
    PROPERTIESCPP REQUIRED
    properties-cpp
)
include_directories(${PROPERTIESCPP_INCLUDE_DIRS})

pkg_check_modules(
    DBUSCPP REQUIRED
    dbus-cpp
)
include_directories(${DBUSCPP_INCLUDE_DIRS})

pkg_check_modules(
    NETWORKMANAGER REQUIRED
    NetworkManager
)
include_directories(${NETWORKMANAGER_NCLUDE_DIRS})

# list these here to have them visible in Qt Creator
set(CONNECTIVITY_INTERFACES
    include/com/ubuntu/connectivity/networking/link.h
    include/com/ubuntu/connectivity/networking/manager.h
    include/com/ubuntu/connectivity/networking/service.h

    include/com/ubuntu/connectivity/networking/service/tethering/service.h
    include/com/ubuntu/connectivity/networking/service/tor/service.h
    include/com/ubuntu/connectivity/networking/service/vpn/service.h

    include/com/ubuntu/connectivity/networking/wifi/access-point.h
    include/com/ubuntu/connectivity/networking/wifi/link.h

    include/com/ubuntu/connectivity/networking/wwan/link.h
)
add_custom_target(QtCreatorHeaderHack SOURCES ${CONNECTIVITY_INTERFACES})

add_subdirectory(data)
add_subdirectory(doc)
add_subdirectory(examples)
add_subdirectory(tests)
add_subdirectory(src)

install(
	DIRECTORY include
	DESTINATION include/connectivity-cpp-${CONNECTIVITY_CPP_VERSION_MAJOR}
)

enable_coverage_report(TARGETS connectivity_cpp
                       FILTER ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)