8c2a95dbe2
* Mir starts up and is able to display system settings * x86_64 only for now, because at least ubuntu-app-test did not build on aarch64 Based on PureTryOut's work. Getting it to this stage was a huge effort (as it shows in the package count: 111(!)). See the merge request for details. [skip ci]: this won't finish in CI; ollieparanoid made sure that everything builds for x86_64.
395 lines
15 KiB
Diff
395 lines
15 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index fd724b55..8e0e7525 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1,6 +1,5 @@
|
|
project(ubuntu-download-manager)
|
|
cmake_minimum_required(VERSION 2.8)
|
|
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -pthread")
|
|
|
|
# for dh_translations to extract the domain
|
|
@@ -11,7 +10,7 @@ add_definitions(-DI18N_DOMAIN="${GETTEXT_PACKAGE}")
|
|
# Standard install paths
|
|
include(GNUInstallDirs)
|
|
|
|
-include(EnableCoverageReport)
|
|
+find_package(CoverageReport)
|
|
#####################################################################
|
|
# Enable code coverage calculation with gcov/gcovr/lcov
|
|
# Usage:
|
|
diff --git a/cmake/modules/EnableCoverageReport.cmake b/cmake/modules/EnableCoverageReport.cmake
|
|
deleted file mode 100644
|
|
index dc8c8d29..00000000
|
|
--- a/cmake/modules/EnableCoverageReport.cmake
|
|
+++ /dev/null
|
|
@@ -1,153 +0,0 @@
|
|
-# - Creates a special coverage build type and target on GCC.
|
|
-#
|
|
-# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
|
|
-# for selected targets. Optional arguments to this function are used to filter
|
|
-# unwanted results using globbing expressions. Moreover targets with tests for
|
|
-# the source code can be specified to trigger regenerating the report if the
|
|
-# test has changed
|
|
-#
|
|
-# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
|
|
-#
|
|
-# To generate a coverage report first build the project with
|
|
-# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
|
|
-#
|
|
-# The coverage report is based on gcov. Depending on the availability of lcov
|
|
-# a HTML report will be generated and/or an XML report of gcovr is found.
|
|
-# The generated coverage target executes all found solutions. Special targets
|
|
-# exist to create e.g. only the xml report: coverage-xml.
|
|
-#
|
|
-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
|
|
-#
|
|
-# This program is free software; you can redistribute it
|
|
-# and/or modify it under the terms of the GNU General
|
|
-# Public License as published by the Free Software Foundation;
|
|
-# either version 2, or (at your option)
|
|
-# any later version.
|
|
-#
|
|
-# 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 General Public License for more details.
|
|
-#
|
|
-
|
|
-INCLUDE(ParseArguments)
|
|
-
|
|
-FIND_PACKAGE(Lcov)
|
|
-FIND_PACKAGE(gcovr)
|
|
-
|
|
-FUNCTION(ENABLE_COVERAGE_REPORT)
|
|
-
|
|
- # argument parsing
|
|
- PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
|
|
-
|
|
- SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
|
|
- SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
|
|
- SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
|
|
- SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
|
|
- SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
|
|
-
|
|
- # decide if there is any tool to create coverage data
|
|
- SET(TOOL_FOUND FALSE)
|
|
- IF(LCOV_FOUND OR GCOVR_FOUND)
|
|
- SET(TOOL_FOUND TRUE)
|
|
- ENDIF()
|
|
- IF(NOT TOOL_FOUND)
|
|
- MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
|
|
- ENDIF()
|
|
-
|
|
- STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
|
|
- IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
|
|
-
|
|
- MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
|
|
-
|
|
- # create coverage build type
|
|
- SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
|
|
- SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
|
|
- SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
|
|
-
|
|
- # instrument targets
|
|
- SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
|
|
- LINK_FLAGS --coverage)
|
|
-
|
|
- # html report
|
|
- IF (LCOV_FOUND)
|
|
-
|
|
- MESSAGE(STATUS "Enabling HTML coverage report")
|
|
-
|
|
- # set up coverage target
|
|
-
|
|
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
|
|
- COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
|
|
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
- COMMENT "Collecting coverage data"
|
|
- DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
|
|
- VERBATIM)
|
|
-
|
|
- # filter unwanted stuff
|
|
- LIST(LENGTH ARG_FILTER FILTER_LENGTH)
|
|
- IF(${FILTER_LENGTH} GREATER 0)
|
|
- SET(FILTER COMMAND ${LCOV_EXECUTABLE})
|
|
- FOREACH(F ${ARG_FILTER})
|
|
- SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
|
|
- ENDFOREACH()
|
|
- SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
|
|
- ELSE()
|
|
- SET(FILTER "")
|
|
- ENDIF()
|
|
-
|
|
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
|
|
- COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
|
|
- ${FILTER}
|
|
- DEPENDS ${COVERAGE_RAW_FILE}
|
|
- COMMENT "Filtering recorded coverage data for project-relevant entries"
|
|
- VERBATIM)
|
|
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
|
|
- COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
|
|
- COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
|
|
- DEPENDS ${COVERAGE_FILTERED_FILE}
|
|
- COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
|
|
- VERBATIM)
|
|
-
|
|
- ADD_CUSTOM_TARGET(coverage-html
|
|
- DEPENDS ${COVERAGE_REPORT_DIR})
|
|
-
|
|
- ENDIF()
|
|
-
|
|
- # xml coverage report
|
|
- IF(GCOVR_FOUND)
|
|
-
|
|
- MESSAGE(STATUS "Enabling XML coverage report")
|
|
-
|
|
- # gcovr cannot write directly to a file so the execution needs to
|
|
- # be wrapped in a cmake file that generates the file output
|
|
- FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
|
|
- "SET(ENV{LANG} en)\n")
|
|
- FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
|
|
- "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
|
|
-
|
|
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
|
|
- COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
|
|
- COMMENT "Generating coverage XML report"
|
|
- VERBATIM)
|
|
-
|
|
- ADD_CUSTOM_TARGET(coverage-xml
|
|
- DEPENDS ${COVERAGE_XML_FILE})
|
|
-
|
|
- ENDIF()
|
|
-
|
|
- # provide a global coverage target executing both steps if available
|
|
- SET(GLOBAL_DEPENDS "")
|
|
- IF(LCOV_FOUND)
|
|
- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
|
|
- ENDIF()
|
|
- IF(GCOVR_FOUND)
|
|
- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
|
|
- ENDIF()
|
|
- IF(LCOV_FOUND OR GCOVR_FOUND)
|
|
- ADD_CUSTOM_TARGET(coverage
|
|
- DEPENDS ${GLOBAL_DEPENDS})
|
|
- ENDIF()
|
|
-
|
|
- ENDIF()
|
|
-
|
|
-ENDFUNCTION()
|
|
diff --git a/cmake/modules/FindGtest.cmake b/cmake/modules/FindGtest.cmake
|
|
deleted file mode 100644
|
|
index 25350d59..00000000
|
|
--- a/cmake/modules/FindGtest.cmake
|
|
+++ /dev/null
|
|
@@ -1,67 +0,0 @@
|
|
-include(ExternalProject)
|
|
-include(FindPackageHandleStandardArgs)
|
|
-
|
|
-#gtest
|
|
-if (EXISTS /usr/src/googletest)
|
|
- set (USING_GOOGLETEST_1_8 TRUE)
|
|
- set (GTEST_INSTALL_DIR /usr/src/googletest/googletest/include)
|
|
-else()
|
|
- set(GTEST_INSTALL_DIR /usr/src/gmock/gtest/include)
|
|
-endif()
|
|
-find_path(GTEST_INCLUDE_DIR gtest/gtest.h
|
|
- HINTS ${GTEST_INSTALL_DIR})
|
|
-
|
|
-#gmock
|
|
-find_path(GMOCK_INSTALL_DIR CMakeLists.txt
|
|
- HINTS /usr/src/googletest /usr/src/gmock)
|
|
-if(${GMOCK_INSTALL_DIR} STREQUAL "GMOCK_INSTALL_DIR-NOTFOUND")
|
|
- message(FATAL_ERROR "google-mock package not found")
|
|
-endif()
|
|
-
|
|
-find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
|
|
-
|
|
-if (USING_GOOGLETEST_1_8)
|
|
- set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs)
|
|
- set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR}/googlemock)
|
|
- set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
|
|
-else()
|
|
- set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs)
|
|
- set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR})
|
|
- set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
|
|
-endif()
|
|
-
|
|
-set(GTEST_CMAKE_ARGS "")
|
|
-if (${MIR_IS_CROSS_COMPILING})
|
|
- set(GTEST_CMAKE_ARGS
|
|
- -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
|
|
-endif()
|
|
-
|
|
-if (USING_GOOGLETEST_1_8)
|
|
- list(APPEND GTEST_CMAKE_ARGS -DBUILD_GTEST=ON)
|
|
-endif()
|
|
-
|
|
-ExternalProject_Add(
|
|
- GMock
|
|
- #where to build in source tree
|
|
- PREFIX ${GMOCK_PREFIX}
|
|
- #where the source is external to the project
|
|
- SOURCE_DIR ${GMOCK_INSTALL_DIR}
|
|
- #forward the compilers to the subproject so cross-arch builds work
|
|
- CMAKE_ARGS ${GTEST_CMAKE_ARGS}
|
|
- BINARY_DIR ${GMOCK_BASE_BINARY_DIR}
|
|
-
|
|
- #we don't need to install, so skip
|
|
- INSTALL_COMMAND ""
|
|
-)
|
|
-
|
|
-set(GMOCK_LIBRARY ${GMOCK_BINARY_DIR}/libgmock.a)
|
|
-set(GMOCK_MAIN_LIBRARY ${GMOCK_BINARY_DIR}/libgmock_main.a)
|
|
-set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY})
|
|
-set(GTEST_LIBRARY ${GTEST_BINARY_DIR}/libgtest.a)
|
|
-set(GTEST_MAIN_LIBRARY ${GTEST_BINARY_DIR}/libgtest_main.a)
|
|
-set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
|
|
-set(GTEST_ALL_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES})
|
|
-
|
|
-find_package_handle_standard_args(GTest DEFAULT_MSG
|
|
- GMOCK_INCLUDE_DIR
|
|
- GTEST_INCLUDE_DIR)
|
|
diff --git a/cmake/modules/FindLcov.cmake b/cmake/modules/FindLcov.cmake
|
|
deleted file mode 100644
|
|
index 70628f4e..00000000
|
|
--- a/cmake/modules/FindLcov.cmake
|
|
+++ /dev/null
|
|
@@ -1,29 +0,0 @@
|
|
-# - Find lcov
|
|
-# Will define:
|
|
-#
|
|
-# LCOV_EXECUTABLE - the lcov binary
|
|
-# GENHTML_EXECUTABLE - the genhtml executable
|
|
-#
|
|
-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
|
|
-#
|
|
-# This program is free software; you can redistribute it
|
|
-# and/or modify it under the terms of the GNU General
|
|
-# Public License as published by the Free Software Foundation;
|
|
-# either version 2, or (at your option)
|
|
-# any later version.
|
|
-#
|
|
-# 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 General Public License for more details.
|
|
-#
|
|
-
|
|
-INCLUDE(FindPackageHandleStandardArgs)
|
|
-
|
|
-FIND_PROGRAM(LCOV_EXECUTABLE lcov)
|
|
-FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
|
|
-
|
|
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
|
|
-
|
|
-# only visible in advanced view
|
|
-MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
|
|
diff --git a/cmake/modules/Findgcovr.cmake b/cmake/modules/Findgcovr.cmake
|
|
deleted file mode 100644
|
|
index e4c43fe1..00000000
|
|
--- a/cmake/modules/Findgcovr.cmake
|
|
+++ /dev/null
|
|
@@ -1,31 +0,0 @@
|
|
-# - Find gcovr scrip
|
|
-# Will define:
|
|
-#
|
|
-# GCOVR_EXECUTABLE - the gcovr script
|
|
-#
|
|
-# Uses:
|
|
-#
|
|
-# GCOVR_ROOT - root to search for the script
|
|
-#
|
|
-# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
|
|
-#
|
|
-# This program is free software; you can redistribute it
|
|
-# and/or modify it under the terms of the GNU General
|
|
-# Public License as published by the Free Software Foundation;
|
|
-# either version 2, or (at your option)
|
|
-# any later version.
|
|
-#
|
|
-# 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 General Public License for more details.
|
|
-#
|
|
-
|
|
-INCLUDE(FindPackageHandleStandardArgs)
|
|
-
|
|
-FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
|
|
-
|
|
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
|
|
-
|
|
-# only visible in advanced view
|
|
-MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
|
|
diff --git a/cmake/modules/ParseArguments.cmake b/cmake/modules/ParseArguments.cmake
|
|
deleted file mode 100644
|
|
index e13f671a..00000000
|
|
--- a/cmake/modules/ParseArguments.cmake
|
|
+++ /dev/null
|
|
@@ -1,52 +0,0 @@
|
|
-# Parse arguments passed to a function into several lists separated by
|
|
-# upper-case identifiers and options that do not have an associated list e.g.:
|
|
-#
|
|
-# SET(arguments
|
|
-# hello OPTION3 world
|
|
-# LIST3 foo bar
|
|
-# OPTION2
|
|
-# LIST1 fuz baz
|
|
-# )
|
|
-# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
|
|
-#
|
|
-# results in 7 distinct variables:
|
|
-# * ARG_DEFAULT_ARGS: hello;world
|
|
-# * ARG_LIST1: fuz;baz
|
|
-# * ARG_LIST2:
|
|
-# * ARG_LIST3: foo;bar
|
|
-# * ARG_OPTION1: FALSE
|
|
-# * ARG_OPTION2: TRUE
|
|
-# * ARG_OPTION3: TRUE
|
|
-#
|
|
-# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
|
|
-
|
|
-MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
|
- SET(DEFAULT_ARGS)
|
|
- FOREACH(arg_name ${arg_names})
|
|
- SET(${prefix}_${arg_name})
|
|
- ENDFOREACH(arg_name)
|
|
- FOREACH(option ${option_names})
|
|
- SET(${prefix}_${option} FALSE)
|
|
- ENDFOREACH(option)
|
|
-
|
|
- SET(current_arg_name DEFAULT_ARGS)
|
|
- SET(current_arg_list)
|
|
- FOREACH(arg ${ARGN})
|
|
- SET(larg_names ${arg_names})
|
|
- LIST(FIND larg_names "${arg}" is_arg_name)
|
|
- IF (is_arg_name GREATER -1)
|
|
- SET(${prefix}_${current_arg_name} ${current_arg_list})
|
|
- SET(current_arg_name ${arg})
|
|
- SET(current_arg_list)
|
|
- ELSE (is_arg_name GREATER -1)
|
|
- SET(loption_names ${option_names})
|
|
- LIST(FIND loption_names "${arg}" is_option)
|
|
- IF (is_option GREATER -1)
|
|
- SET(${prefix}_${arg} TRUE)
|
|
- ELSE (is_option GREATER -1)
|
|
- SET(current_arg_list ${current_arg_list} ${arg})
|
|
- ENDIF (is_option GREATER -1)
|
|
- ENDIF (is_arg_name GREATER -1)
|
|
- ENDFOREACH(arg)
|
|
- SET(${prefix}_${current_arg_name} ${current_arg_list})
|
|
-ENDMACRO(PARSE_ARGUMENTS)
|
|
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
|
index 9ec602cf..ab56cc39 100644
|
|
--- a/tests/CMakeLists.txt
|
|
+++ b/tests/CMakeLists.txt
|
|
@@ -14,7 +14,7 @@
|
|
#
|
|
# Authored by: Manuel de la Peña <manuel.delapena@canonical.com>
|
|
|
|
-find_package(Gtest REQUIRED)
|
|
+find_package(GMock REQUIRED)
|
|
include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR})
|
|
|
|
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|