Merge lp:~dobey/pay-service/use-cmake-extras into lp:pay-service

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 54
Merged at revision: 54
Proposed branch: lp:~dobey/pay-service/use-cmake-extras
Merge into: lp:pay-service
Diff against target: 377 lines (+17/-279)
7 files modified
CMakeLists.txt (+12/-32)
cmake/EnableCoverageReport.cmake (+0/-158)
cmake/FindLcov.cmake (+0/-35)
cmake/Findgcovr.cmake (+0/-43)
debian/control (+3/-4)
debian/rules (+1/-6)
libpay/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~dobey/pay-service/use-cmake-extras
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Approve
Review via email: mp+259851@code.launchpad.net

Commit message

Remove the explicit gcc 4.9 requirement.
Remove the locally included coverage cmake modules.
Use cmake-extras to enable coverage.
Add dependencies for cmake-extras, gcovr, and lcov.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM.

We should do this with all of our packages.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-05-13 14:17:31 +0000
3+++ CMakeLists.txt 2015-06-16 17:54:00 +0000
4@@ -7,7 +7,6 @@
5 set (PACKAGE ${CMAKE_PROJECT_NAME})
6
7 option (enable_tests "Build the package's automatic tests." ON)
8-option (enable_lcov "Generate lcov code coverage reports." OFF)
9
10 if (${enable_tests})
11 enable_testing ()
12@@ -63,9 +62,6 @@
13 COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz
14 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
15
16-add_custom_target (clean-coverage
17- COMMAND find ${CMAKE_BINARY_DIR} -name '*.gcda' | xargs rm -f)
18-
19 add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 --inline-suppr
20 ${CMAKE_SOURCE_DIR}/src
21 ${CMAKE_SOURCE_DIR}/tests)
22@@ -78,20 +74,6 @@
23 set (CXX_WARNING_ARGS " -Wall -Wextra -pedantic -Wno-missing-field-initializers")
24
25 ##
26-## Coverage Flags
27-##
28-
29-if (${enable_tests})
30- if (${enable_lcov})
31- include(EnableCoverageReport) # Using gcov CMake modules from https://code.cor-lab.org/projects/rsc
32- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
33- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" )
34- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" )
35- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
36- endif ()
37-endif ()
38-
39-##
40 ## Subdirectories
41 ##
42
43@@ -108,17 +90,15 @@
44 ##
45 ## Coverage Reports
46 ##
47-
48-if (${enable_tests})
49- if (${enable_lcov})
50- set(filter-list)
51- list(APPEND filter-list "/usr/include")
52- list(APPEND filter-list "${CMAKE_SOURCE_DIR}/tests/*")
53- if (NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
54- list(APPEND filter-list "${CMAKE_BINARY_DIR}/*")
55- endif()
56- ENABLE_COVERAGE_REPORT(TARGETS pay-service FILTER ${filter-list})
57- endif ()
58-endif ()
59-
60-
61+include(EnableCoverageReport)
62+set(filter-list)
63+list(APPEND filter-list "/usr/include")
64+list(APPEND filter-list "${CMAKE_SOURCE_DIR}/tests/*")
65+if (NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
66+ list(APPEND filter-list "${CMAKE_BINARY_DIR}/*")
67+endif()
68+ENABLE_COVERAGE_REPORT(
69+ TARGETS libpay pay-service-lib pay-service
70+ TESTS dbus-interface-tests item-memory-tests webclient-curl-tests verification-http-tests purchase-ual-tests libpay-tests
71+ FILTER ${filter-list}
72+)
73
74=== removed file 'cmake/EnableCoverageReport.cmake'
75--- cmake/EnableCoverageReport.cmake 2014-05-06 14:22:33 +0000
76+++ cmake/EnableCoverageReport.cmake 1970-01-01 00:00:00 +0000
77@@ -1,158 +0,0 @@
78-# - Creates a special coverage build type and target on GCC.
79-#
80-# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
81-# for selected targets. Optional arguments to this function are used to filter
82-# unwanted results using globbing expressions. Moreover targets with tests for
83-# the source code can be specified to trigger regenerating the report if the
84-# test has changed
85-#
86-# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
87-#
88-# To generate a coverage report first build the project with
89-# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
90-#
91-# The coverage report is based on gcov. Depending on the availability of lcov
92-# a HTML report will be generated and/or an XML report of gcovr is found.
93-# The generated coverage target executes all found solutions. Special targets
94-# exist to create e.g. only the xml report: coverage-xml.
95-#
96-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
97-#
98-# This file may be licensed under the terms of the
99-# GNU Lesser General Public License Version 3 (the ``LGPL''),
100-# or (at your option) any later version.
101-#
102-# Software distributed under the License is distributed
103-# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
104-# express or implied. See the LGPL for the specific language
105-# governing rights and limitations.
106-#
107-# You should have received a copy of the LGPL along with this
108-# program. If not, go to http://www.gnu.org/licenses/lgpl.html
109-# or write to the Free Software Foundation, Inc.,
110-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
111-#
112-# The development of this software was supported by:
113-# CoR-Lab, Research Institute for Cognition and Robotics
114-# Bielefeld University
115-
116-FIND_PACKAGE(Lcov)
117-FIND_PACKAGE(gcovr)
118-
119-FUNCTION(ENABLE_COVERAGE_REPORT)
120-
121- # argument parsing
122- SET(MULTI_VALUE_ARGS FILTER TARGETS TESTS)
123- CMAKE_PARSE_ARGUMENTS(ENABLE_COVERAGE_REPORT "" "" "${MULTI_VALUE_ARGS}" ${ARGN})
124-
125- SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
126- SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
127- SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
128- SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
129- SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
130-
131- # decide if there is any tool to create coverage data
132- SET(TOOL_FOUND FALSE)
133- IF(LCOV_FOUND OR GCOVR_FOUND)
134- SET(TOOL_FOUND TRUE)
135- ENDIF()
136- IF(NOT TOOL_FOUND)
137- MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
138- ENDIF()
139-
140- STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
141- IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
142-
143- MESSAGE(STATUS "Coverage support enabled for targets: ${ENABLE_COVERAGE_REPORT_TARGETS}")
144-
145- # create coverage build type
146- SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
147- SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
148- SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
149-
150- # instrument targets
151- SET_TARGET_PROPERTIES(${ENABLE_COVERAGE_REPORT_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
152- LINK_FLAGS --coverage)
153-
154- # html report
155- IF (LCOV_FOUND)
156-
157- MESSAGE(STATUS "Enabling HTML coverage report")
158-
159- # set up coverage target
160-
161- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
162- COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
163- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
164- COMMENT "Collecting coverage data"
165- DEPENDS ${ENABLE_COVERAGE_REPORT_TARGETS} ${ENABLE_COVERAGE_REPORT_TESTS}
166- VERBATIM)
167-
168- # filter unwanted stuff
169- LIST(LENGTH ENABLE_COVERAGE_REPORT_FILTER FILTER_LENGTH)
170- IF(${FILTER_LENGTH} GREATER 0)
171- SET(FILTER COMMAND ${LCOV_EXECUTABLE})
172- FOREACH(F ${ENABLE_COVERAGE_REPORT_FILTER})
173- SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
174- ENDFOREACH()
175- SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
176- ELSE()
177- SET(FILTER "")
178- ENDIF()
179-
180- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
181- COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
182- ${FILTER}
183- DEPENDS ${COVERAGE_RAW_FILE}
184- COMMENT "Filtering recorded coverage data for project-relevant entries"
185- VERBATIM)
186- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
187- COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
188- COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
189- DEPENDS ${COVERAGE_FILTERED_FILE}
190- COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
191- VERBATIM)
192-
193- ADD_CUSTOM_TARGET(coverage-html
194- DEPENDS ${COVERAGE_REPORT_DIR})
195-
196- ENDIF()
197-
198- # xml coverage report
199- IF(GCOVR_FOUND)
200-
201- MESSAGE(STATUS "Enabling XML coverage report")
202-
203- # gcovr cannot write directly to a file so the execution needs to
204- # be wrapped in a cmake file that generates the file output
205- FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
206- "SET(ENV{LANG} en)\n")
207- FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
208- "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
209-
210- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
211- COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
212- COMMENT "Generating coverage XML report"
213- VERBATIM)
214-
215- ADD_CUSTOM_TARGET(coverage-xml
216- DEPENDS ${COVERAGE_XML_FILE})
217-
218- ENDIF()
219-
220- # provide a global coverage target executing both steps if available
221- SET(GLOBAL_DEPENDS "")
222- IF(LCOV_FOUND)
223- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
224- ENDIF()
225- IF(GCOVR_FOUND)
226- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
227- ENDIF()
228- IF(LCOV_FOUND OR GCOVR_FOUND)
229- ADD_CUSTOM_TARGET(coverage
230- DEPENDS ${GLOBAL_DEPENDS})
231- ENDIF()
232-
233- ENDIF()
234-
235-ENDFUNCTION()
236
237=== removed file 'cmake/FindLcov.cmake'
238--- cmake/FindLcov.cmake 2014-05-06 14:22:33 +0000
239+++ cmake/FindLcov.cmake 1970-01-01 00:00:00 +0000
240@@ -1,35 +0,0 @@
241-# - Find lcov
242-# Will define:
243-#
244-# LCOV_EXECUTABLE - the lcov binary
245-# GENHTML_EXECUTABLE - the genhtml executable
246-#
247-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
248-#
249-# This file may be licensed under the terms of the
250-# GNU Lesser General Public License Version 3 (the ``LGPL''),
251-# or (at your option) any later version.
252-#
253-# Software distributed under the License is distributed
254-# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
255-# express or implied. See the LGPL for the specific language
256-# governing rights and limitations.
257-#
258-# You should have received a copy of the LGPL along with this
259-# program. If not, go to http://www.gnu.org/licenses/lgpl.html
260-# or write to the Free Software Foundation, Inc.,
261-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
262-#
263-# The development of this software was supported by:
264-# CoR-Lab, Research Institute for Cognition and Robotics
265-# Bielefeld University
266-
267-INCLUDE(FindPackageHandleStandardArgs)
268-
269-FIND_PROGRAM(LCOV_EXECUTABLE lcov)
270-FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
271-
272-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
273-
274-# only visible in advanced view
275-MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
276
277=== removed file 'cmake/Findgcovr.cmake'
278--- cmake/Findgcovr.cmake 2014-05-06 14:22:33 +0000
279+++ cmake/Findgcovr.cmake 1970-01-01 00:00:00 +0000
280@@ -1,43 +0,0 @@
281-# - Find gcovr scrip
282-# Will define:
283-#
284-# GCOVR_EXECUTABLE - the gcovr script
285-#
286-# Uses:
287-#
288-# GCOVR_ROOT - root to search for the script
289-#
290-# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
291-#
292-# This file may be licensed under the terms of the
293-# GNU Lesser General Public License Version 3 (the ``LGPL''),
294-# or (at your option) any later version.
295-#
296-# Software distributed under the License is distributed
297-# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
298-# express or implied. See the LGPL for the specific language
299-# governing rights and limitations.
300-#
301-# You should have received a copy of the LGPL along with this
302-# program. If not, go to http://www.gnu.org/licenses/lgpl.html
303-# or write to the Free Software Foundation, Inc.,
304-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
305-#
306-# The development of this software was supported by:
307-# CoR-Lab, Research Institute for Cognition and Robotics
308-# Bielefeld University
309-
310-INCLUDE(FindPackageHandleStandardArgs)
311-
312-FIND_PROGRAM(GCOVR_EXECUTABLE gcovr
313- HINTS ${GCOVR_ROOT}
314- "${GCOVR_ROOT}/bin"
315- "${GCOVR_ROOT}/share/python"
316- "/usr/share/python"
317- "/usr/local/share/python"
318- "${CMAKE_INSTALL_PREFIX}/share/python")
319-
320-FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
321-
322-# only visible in advanced view
323-MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
324
325=== modified file 'debian/control'
326--- debian/control 2015-05-13 14:17:31 +0000
327+++ debian/control 2015-06-16 17:54:00 +0000
328@@ -5,14 +5,13 @@
329 Build-Depends: astyle,
330 click-dev,
331 cmake,
332+ cmake-extras,
333 dbus,
334 dbus-test-runner,
335 debhelper (>= 9),
336+ gcovr,
337 google-mock,
338-# We rely on C++11 features, and to prevent from ABI breaks
339-# in libstdc++ causing us issues, we explicitly select a G++
340-# version.
341- g++-4.9,
342+ lcov,
343 libaccounts-qt5-dev,
344 libclick-0.4-dev,
345 libcurl4-gnutls-dev,
346
347=== modified file 'debian/rules'
348--- debian/rules 2014-07-21 16:23:40 +0000
349+++ debian/rules 2015-06-16 17:54:00 +0000
350@@ -6,13 +6,8 @@
351
352 include /usr/share/dpkg/default.mk
353
354-# Explicitly selecting a G{CC,++}-version here to avoid accidental
355-# ABI breaks introduced by toolchain updates.
356-export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
357-export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
358-
359 override_dh_auto_configure:
360- dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/pay-service -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/$(DEB_HOST_MULTIARCH)/ -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
361+ dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/pay-service -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/$(DEB_HOST_MULTIARCH)/
362
363 %:
364 dh $@ --fail-missing --with click
365
366=== modified file 'libpay/CMakeLists.txt'
367--- libpay/CMakeLists.txt 2015-03-27 17:06:05 +0000
368+++ libpay/CMakeLists.txt 2015-06-16 17:54:00 +0000
369@@ -30,7 +30,7 @@
370 )
371
372 target_link_libraries(libpay ${SERVICE_DEPS_LIBRARIES} common-lib)
373-set_target_properties(libpay PROPERTIES LINK_FLAGS "${ldflags} -Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libpay.map")
374+set_target_properties(libpay PROPERTIES LINK_FLAGS "${ldflags} -Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libpay.map ")
375 set_target_properties(libpay PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libpay.map")
376
377 ######################

Subscribers

People subscribed via source and target branches

to all changes: