| 1 |
cmake_minimum_required(VERSION 3.5) |
| 2 |
project(lomiri-mediaplayer-app VERSION 1.1.1 LANGUAGES CXX) |
| 3 |
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
| 4 |
|
| 5 |
# Find includes in corresponding build directories |
| 6 |
set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 7 |
set(DESKTOP_FILE lomiri-mediaplayer-app.desktop) |
| 8 |
|
| 9 |
# Instruct CMake to run moc automatically when needed. |
| 10 |
set(CMAKE_AUTOMOC ON) |
| 11 |
|
| 12 |
find_package(Gettext REQUIRED) |
| 13 |
|
| 14 |
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) |
| 15 |
|
| 16 |
include(EnableCoverageReport) |
| 17 |
##################################################################### |
| 18 |
# Enable code coverage calculation with gcov/gcovr/lcov |
| 19 |
# Usage: |
| 20 |
# * Switch build type to coverage (use ccmake or cmake-gui) |
| 21 |
# * Invoke make, make test, make coverage (or ninja if you use that backend) |
| 22 |
# * Find html report in subdir coveragereport |
| 23 |
# * Find xml report feasible for jenkins in coverage.xml |
| 24 |
##################################################################### |
| 25 |
if(cmake_build_type_lower MATCHES coverage) |
| 26 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" ) |
| 27 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" ) |
| 28 |
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" ) |
| 29 |
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" ) |
| 30 |
ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP}) |
| 31 |
endif() |
| 32 |
find_package(Qt5 COMPONENTS Gui Widgets Core Qml Quick Multimedia REQUIRED) |
| 33 |
|
| 34 |
# Standard install paths |
| 35 |
include(GNUInstallDirs) |
| 36 |
|
| 37 |
set(MEDIAPLAYER_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lomiri-mediaplayer-app) |
| 38 |
|
| 39 |
# for dh_translations to extract the domain |
| 40 |
# (regarding syntax consistency, see http://pad.lv/1181187) |
| 41 |
set (GETTEXT_PACKAGE "lomiri-mediaplayer-app") |
| 42 |
|
| 43 |
# Tests |
| 44 |
option(USE_XVFB "Use XVFB to run qml tests" on) |
| 45 |
option(ENABLE_AUTOPILOT "Build autopilot tests" off) |
| 46 |
|
| 47 |
include(CTest) |
| 48 |
|
| 49 |
add_subdirectory(data) |
| 50 |
add_subdirectory(src) |
| 51 |
if(BUILD_TESTING) |
| 52 |
add_subdirectory(tests) |
| 53 |
endif() |
| 54 |
add_subdirectory(po) |
| 55 |
|
| 56 |
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) |
| 57 |
|