-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
114 lines (99 loc) · 3.13 KB
/
CMakeLists.txt
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
104
105
106
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 3.0.2)
project(mediascanner2 CXX C)
set(MEDIASCANNER_VERSION "0.112")
execute_process(
COMMAND /bin/sh ${CMAKE_CURRENT_SOURCE_DIR}/get-soversion.sh
OUTPUT_VARIABLE MEDIASCANNER_SOVERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE result)
if(NOT result EQUAL 0)
message(FATAL_ERROR "Error running get-soversion.sh script")
endif()
set(MEDIASCANNER_LIBVERSION "${MEDIASCANNER_SOVERSION}.${MEDIASCANNER_VERSION}")
if(PROJECT_BINARY_DIR STREQUAL PROJECT_SOURCE_DIR)
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.")
endif()
option(full_warnings "All possible compiler warnings." OFF)
include(FindPkgConfig)
pkg_check_modules(MEDIASCANNER_DEPS REQUIRED
gio-2.0
gio-unix-2.0
sqlite3>=3.8.5
)
pkg_check_modules(GST gstreamer-1.0 gstreamer-pbutils-1.0 REQUIRED)
pkg_check_modules(GLIB glib-2.0 REQUIRED)
pkg_check_modules(PIXBUF gdk-pixbuf-2.0 REQUIRED)
pkg_check_modules(EXIF libexif REQUIRED)
pkg_check_modules(TAGLIB taglib REQUIRED)
pkg_check_modules(DBUSCPP dbus-cpp REQUIRED)
pkg_check_modules(APPARMOR libapparmor REQUIRED)
pkg_check_modules(UDISKS udisks2 REQUIRED)
find_package(Threads REQUIRED)
find_package(Qt5Core REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -std=c++11")
if(${full_warnings})
# C does not have any more warning flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
endif()
find_package(CoverageReport)
include(GNUInstallDirs)
set(LIBDIR $CMAKE_INSTALL_LIBDIR)
enable_testing()
add_subdirectory(src/mediascanner)
add_subdirectory(src/extractor)
add_subdirectory(src/daemon)
add_subdirectory(src/ms-dbus)
add_subdirectory(src/qml/Ubuntu/MediaScanner.0.1)
add_subdirectory(src/utils)
add_subdirectory(test)
# Install pkg-config file
configure_file(mediascanner-2.0.pc.in mediascanner-2.0.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mediascanner-2.0.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# Install Upstart user session job
configure_file(mediascanner-2.0.conf.in mediascanner-2.0.conf)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/mediascanner-2.0.conf
DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions
)
# Install SystemD user unit
configure_file(mediascanner-2.0.service.in mediascanner-2.0.service)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/mediascanner-2.0.service
DESTINATION lib/systemd/user
)
# Install upstart-systemd override
install(
FILES mediascanner-2.0.override
DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/systemd-session/upstart
)
enable_coverage_report(
TARGETS
mediascanner
extractor-client
extractor-backend
mediascanner-extractor
scannerstuff
scannerdaemon
ms-dbus
mediascanner-dbus
mediascanner-qml
query
mountwatcher
FILTER
${CMAKE_SOURCE_DIR}/tests/*
${CMAKE_BINARY_DIR}/*
TESTS
basic
test_mediastore
test_metadataextractor
test_extractorbackend
test_sqliteutils
test_mfbuilder
test_subtreewatcher
test_volumemanager
test_dbus
test_qml
test_util
)