~artmello/gallery-app/badcontext_crash

651.1.1 by Guenter Schwann
Use cmake instead of qmake
1
project(gallery-app)
2
cmake_minimum_required(VERSION 2.8.9)
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
8
# Instruct CMake to run moc automatically when needed.
9
set(CMAKE_AUTOMOC ON)
10
651.1.4 by Guenter Schwann
Add support for coverage report
11
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
12
13
include(EnableCoverageReport)
14
#####################################################################
15
# Enable code coverage calculation with gcov/gcovr/lcov
16
# Usage:
17
#  * Switch build type to coverage (use ccmake or cmake-gui)
18
#  * Invoke make, make test, make coverage (or ninja if you use that backend)
19
#  * Find html report in subdir coveragereport
20
#  * Find xml report feasible for jenkins in coverage.xml
21
#####################################################################
22
if(cmake_build_type_lower MATCHES coverage)
23
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
24
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" )
25
    set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" )
26
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
27
    ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP})
28
endif()
29
890.1.1 by Olivier Tilloy
Use QT5_WRAP_CPP instead of QT_WRAP_CPP.
30
find_package(Qt5Core)
651.1.4 by Guenter Schwann
Add support for coverage report
31
find_package(Qt5Gui)
651.1.1 by Guenter Schwann
Use cmake instead of qmake
32
find_package(Qt5Qml)
33
find_package(Qt5Quick)
651.1.4 by Guenter Schwann
Add support for coverage report
34
find_package(Qt5Sql)
659.3.6 by Guenter Schwann
Use OpenGL on the desktop, and OpenGL ESv2 on the device
35
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
36
    find_package(GLESv2)
37
else()
38
    find_package(OpenGL)
39
endif()
651.1.1 by Guenter Schwann
Use cmake instead of qmake
40
651.1.7 by Guenter Schwann
Use pkgconfig to include exiv2
41
find_package(PkgConfig REQUIRED)
852.2.1 by Ken VanDine
use pkgconfig provided in content-hub >= 0.0+13.10.20130930.1
42
pkg_check_modules(CONTENTHUB REQUIRED libcontent-hub)
651.1.7 by Guenter Schwann
Use pkgconfig to include exiv2
43
pkg_check_modules(EXIV2 REQUIRED exiv2)
807.3.1 by Guenter Schwann
* read video metadata from video file
44
pkg_check_modules(MEDIAINFO REQUIRED libmediainfo)
651.1.1 by Guenter Schwann
Use cmake instead of qmake
45
814.1.1 by Guenter Schwann
* be more strict about compiler warnings and errors
46
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
813.1.1 by Guenter Schwann
Use content hub for content picking
47
651.1.1 by Guenter Schwann
Use cmake instead of qmake
48
# Standard install paths
49
include(GNUInstallDirs)
50
837.3.1 by Sergio Schvezov
click building support
51
option(INSTALL_TESTS "Install the tests on make install" on)
52
option(CLICK_MODE "Installs to a contained location" off)
53
54
set(GALLERY gallery-app)
55
set(DESKTOP_FILE ${GALLERY}.desktop)
965.1.1 by Dimitri John Ledkov
Correct click manifest for python3.
56
set(AUTOPILOT_DIR gallery_app)
837.3.1 by Sergio Schvezov
click building support
57
58
if(CLICK_MODE)
904.2.1 by Sergio Schvezov
Using svg icon for click
59
    if(NOT DEFINED BZR_SOURCE)
60
        set(BZR_SOURCE "lp:gallery-app")
61
    endif(NOT DEFINED BZR_SOURCE)
837.3.1 by Sergio Schvezov
click building support
62
    set(APP_PACKAGE_NAME "com.ubuntu.gallery")
63
    set(CMAKE_INSTALL_PREFIX /)
64
    set(CMAKE_INSTALL_BINDIR /)
837.3.8 by Sergio Schvezov
gallery_dir woes
65
    set(GALLERY_DIR "")
925.1.2 by Sergio Schvezov
Remove tabs from CMakeLists.txt
66
    set(GETTEXT_PACKAGE "${APP_PACKAGE_NAME}")
67
    add_definitions("-DCLICK_MODE=1")
837.3.8 by Sergio Schvezov
gallery_dir woes
68
else(CLICK_MODE)
69
    set(GALLERY_DIR ${CMAKE_INSTALL_DATADIR}/${GALLERY})
904.3.1 by Sergio Schvezov
Making GETTEXT dependant on click building
70
	# for dh_translations to extract the domain
71
	# (regarding syntax consistency, see http://pad.lv/1181187)
72
	set (GETTEXT_PACKAGE "${GALLERY}")
837.3.1 by Sergio Schvezov
click building support
73
endif(CLICK_MODE)
651.1.1 by Guenter Schwann
Use cmake instead of qmake
74
703.1.1 by Guenter Schwann
Support to translate the .desktop file
75
file(GLOB_RECURSE I18N_SRC_FILES
76
     RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
77
     rc/**.qml desktop/**.desktop.in)
703.1.6 by Guenter Schwann
Sort the files for translation
78
list(SORT I18N_SRC_FILES)
703.1.1 by Guenter Schwann
Support to translate the .desktop file
79
651.1.1 by Guenter Schwann
Use cmake instead of qmake
80
# Tests
81
enable_testing()
82
837.3.1 by Sergio Schvezov
click building support
83
add_subdirectory(click)
651.1.1 by Guenter Schwann
Use cmake instead of qmake
84
add_subdirectory(desktop)
669.2.1 by Guenter Schwann
First german translation
85
add_subdirectory(po)
651.1.1 by Guenter Schwann
Use cmake instead of qmake
86
add_subdirectory(rc)
87
add_subdirectory(src)
88
add_subdirectory(tests)