~verzegnassi-stefano/ubuntu-docviewer-app/reboot-document-last-position

31.1.7 by David Planella
Finished integration of the file plugin into the source tree
1
project(com.ubuntu.docviewer C CXX)
26.2.3 by Fabio Colella
Added CMakeLists.txt
2
cmake_minimum_required(VERSION 2.8.9)
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
3
26.2.3 by Fabio Colella
Added CMakeLists.txt
4
find_program(INTLTOOL_MERGE intltool-merge)
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
5
if(NOT INTLTOOL_MERGE)
6
  message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
7
endif(NOT INTLTOOL_MERGE)
8
26.2.3 by Fabio Colella
Added CMakeLists.txt
9
find_program(INTLTOOL_EXTRACT intltool-extract)
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
10
if(NOT INTLTOOL_EXTRACT)
11
  message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
12
endif(NOT INTLTOOL_EXTRACT)
26.2.3 by Fabio Colella
Added CMakeLists.txt
13
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
14
set(CMAKE_AUTOMOC ON)
15
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
16
56.2.1 by Stefano Verzegnassi
Just some reordering of CMakeLists files
17
include(FindPkgConfig)
26.2.3 by Fabio Colella
Added CMakeLists.txt
18
# Standard install paths
19
include(GNUInstallDirs)
20
21
option(INSTALL_TESTS "Install the tests on make install" on)
22
option(CLICK_MODE "Installs to a contained location" on)
23
31.3.4 by Daniel Holbach
install bits into the right place, rename docviewer and docviewer-app to ubuntu-docviewer-app
24
set(APP_NAME ubuntu-docviewer-app)
29.1.1 by David Planella
Some cmake improvements
25
set(DESKTOP_FILE "${PROJECT_NAME}.desktop")
77.1.3 by Stefano Verzegnassi
Basically:
26
set(URLS_FILE "${PROJECT_NAME}.url-dispatcher")
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
27
set(LP_PROJECT ubuntu-docviewer-app)
26.2.10 by Fabio Colella
Merged to trunk, updated CMakeLists to use the new icon and added needed dependancies to debian/control
28
set(ICON_FILE docviewer@30.png)
26.2.14 by Fabio Colella
Edited test folder name in root CMakeLists
29
set(AUTOPILOT_DIR ubuntu_docviewer_app)
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
30
set(EXEC "${APP_NAME}")
29.1.1 by David Planella
Some cmake improvements
31
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
26.2.3 by Fabio Colella
Added CMakeLists.txt
32
31.1.6 by David Planella
Project can now be opened in Qt Creator, only qt5_use_modules macro needs to be sorted
33
# Sets BZR_REVNO
34
execute_process(
35
    COMMAND bzr revno ${CMAKE_SOURCE_DIR}
36
    OUTPUT_VARIABLE BZR_REVNO
37
    OUTPUT_STRIP_TRAILING_WHITESPACE
38
)
39
26.2.3 by Fabio Colella
Added CMakeLists.txt
40
if(CLICK_MODE)
41
    if(NOT DEFINED BZR_SOURCE)
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
42
        set(BZR_SOURCE "lp:${LP_PROJECT}")
29.1.1 by David Planella
Some cmake improvements
43
        message("-- Setting BZR_SOURCE to ${BZR_SOURCE}")
26.2.3 by Fabio Colella
Added CMakeLists.txt
44
    endif(NOT DEFINED BZR_SOURCE)
31.1.6 by David Planella
Project can now be opened in Qt Creator, only qt5_use_modules macro needs to be sorted
45
29.1.3 by David Planella
Added revno for Qt Creator builds. For some reason, the cmake execute_process command does not work to execute 'bzr revno'
46
    if(NOT BZR_REVNO)
47
        set(BZR_REVNO "latest")
48
    endif(NOT BZR_REVNO)
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
49
50
    # Find out the architecture for package building
51
    # to determine the plugin's installation path
31.1.6 by David Planella
Project can now be opened in Qt Creator, only qt5_use_modules macro needs to be sorted
52
    execute_process(
53
        COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
54
            OUTPUT_VARIABLE ARCH_TRIPLET
55
            OUTPUT_STRIP_TRAILING_WHITESPACE
56
    )
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
57
    execute_process(
58
      COMMAND dpkg-architecture -qDEB_HOST_ARCH
59
      OUTPUT_VARIABLE CLICK_ARCH
60
      OUTPUT_STRIP_TRAILING_WHITESPACE
61
    )
26.2.3 by Fabio Colella
Added CMakeLists.txt
62
    set(CMAKE_INSTALL_PREFIX /)
31.1.6 by David Planella
Project can now be opened in Qt Creator, only qt5_use_modules macro needs to be sorted
63
    set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")
64
    set(BIN_DIR /lib/${ARCH_TRIPLET}/bin)
29.1.1 by David Planella
Some cmake improvements
65
    set(DATA_DIR /)
36.3.1 by Stefano Verzegnassi
Added support for ContentHub
66
    set(ICON ${ICON_FILE})
29.1.1 by David Planella
Some cmake improvements
67
    set(DESKTOP_DIR ${DATA_DIR})
68
    set(URLS_DIR ${DATA_DIR})
29.1.2 by David Planella
More cmake fixes
69
    configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
77.1.3 by Stefano Verzegnassi
Basically:
70
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json docviewer.apparmor docviewer-content.json ${URLS_FILE}
29.1.2 by David Planella
More cmake fixes
71
            DESTINATION ${CMAKE_INSTALL_PREFIX})
29.1.1 by David Planella
Some cmake improvements
72
    # Make the click files visible in Qt Creator
73
    file(GLOB CLICK_FILES
74
         RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
75
         *.json *.json.in *.apparmor)
76
31.1.6 by David Planella
Project can now be opened in Qt Creator, only qt5_use_modules macro needs to be sorted
77
    add_custom_target(com_ubuntu_docviewer_CLICKFiles ALL SOURCES ${CLICK_FILES})
26.2.3 by Fabio Colella
Added CMakeLists.txt
78
else(CLICK_MODE)
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
79
    # components PATH
80
    execute_process(
81
        COMMAND qmake -query QT_INSTALL_QML
82
            OUTPUT_VARIABLE QT_IMPORTS_DIR
83
            OUTPUT_STRIP_TRAILING_WHITESPACE
84
    )
85
    set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_NAME})
151.2.1 by Bartosz Kosiorek
Fix missing icon for desktop.
86
    set(ICON "${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON_FILE}")
29.1.1 by David Planella
Some cmake improvements
87
    set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications)
31.1.7 by David Planella
Finished integration of the file plugin into the source tree
88
    set(APPLICATION_DIR ${CMAKE_INSTALL_DATADIR}/accounts/applications)
26.2.3 by Fabio Colella
Added CMakeLists.txt
89
endif(CLICK_MODE)
90
91
file(GLOB_RECURSE I18N_SRC_FILES
92
     RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po
128.1.2 by Stefano Verzegnassi
- Don't add a second suffix to the file name if there's already one
93
     *.qml *.js *.cpp)
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
94
list(APPEND I18N_SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/po/${DESKTOP_FILE}.in.in.h)
26.2.3 by Fabio Colella
Added CMakeLists.txt
95
list(SORT I18N_SRC_FILES)
96
message("Found ${I18N_SRC_FILES}")
97
98
file(GLOB SRC_FILES
99
     RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
100
     *.qml *.js)
101
add_custom_target(ubuntu-docviewer-app_QMlFiles ALL SOURCES ${SRC_FILES})
102
103
file(GLOB RESOURCE_FILES
104
     RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
105
     *.png *.svg)
106
install(FILES ${SRC_FILES} ${RESOURCE_FILES} ${ICON_FILE} DESTINATION ${DATA_DIR})
107
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
108
configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in)
26.2.3 by Fabio Colella
Added CMakeLists.txt
109
110
add_custom_target(${DESKTOP_FILE} ALL
111
  COMMENT "Merging translations into ${DESKTOP_FILE}"
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
112
  COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE}
26.2.3 by Fabio Colella
Added CMakeLists.txt
113
)
114
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
115
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} 
116
        DESTINATION ${DESKTOP_DIR})
26.2.3 by Fabio Colella
Added CMakeLists.txt
117
 
118
# Tests
119
enable_testing()
120
31.1.5 by David Planella
Fixed all cmake files, reorg of QML files
121
add_subdirectory(src)
26.2.3 by Fabio Colella
Added CMakeLists.txt
122
add_subdirectory(tests)
51.1.1 by Bartosz Kosiorek
Introduce translation support for DocViewer
123
add_subdirectory(po)