This repository has been archived by the owner on Jan 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
174 lines (136 loc) · 4.94 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
project(camera-app)
cmake_minimum_required(VERSION 3.1.0)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Standard install paths. Needs to be set before finding packages.
include(GNUInstallDirs)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5Multimedia)
find_package(Qt5Gui)
find_program(INTLTOOL_MERGE intltool-merge)
find_program(INTLTOOL_EXTRACT intltool-extract)
option(INSTALL_TESTS "Install the tests on make install" off)
option(CLICK_MODE "Installs to a contained location" on)
set(CAMERA_APP camera-app)
set(AUTOPILOT_DIR camera_app)
set(DESKTOP_FILE camera-app.desktop)
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
if(CLICK_MODE)
set(CMAKE_INSTALL_PREFIX /)
set(CAMERA_APP_DIR /)
set(CMAKE_INSTALL_BINDIR /)
set(PLUGIN_BASE lib/${CMAKE_LIBRARY_ARCHITECTURE})
set(PLUGIN_DIR ${PLUGIN_BASE}/CameraApp)
set(DESKTOP_EXEC "./${CAMERA_APP}")
set(CAMERA_ICON "${CMAKE_INSTALL_DATADIR}/icons/camera-app.png")
install(FILES camera-app.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons)
add_definitions("-DCLICK_MODE=1")
if(NOT SOURCE)
execute_process(
COMMAND git remote -v
COMMAND grep origin
COMMAND grep push
COMMAND awk "{print $2}"
OUTPUT_VARIABLE SOURCE
RESULT_VARIABLE res
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("-- Setting SOURCE to ${SOURCE} with result of : ${res}")
endif(NOT SOURCE)
if(NOT SOURCE)
set(SOURCE lp:${APP_HARDCODE})
message("-- Setting SOURCE to ${SOURCE}")
endif(NOT SOURCE)
else(CLICK_MODE)
set(CAMERA_APP_DIR ${CMAKE_INSTALL_DATADIR}/${CAMERA_APP})
set(CAMERA_ICON ${CMAKE_INSTALL_PREFIX}/${CAMERA_APP_DIR}/camera-app.png)
set(PLUGIN_BASE ${CMAKE_INSTALL_LIBDIR}/${CAMERA_APP})
set(PLUGIN_DIR ${PLUGIN_BASE}/CameraApp)
set(DESKTOP_EXEC ${CAMERA_APP})
endif(CLICK_MODE)
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${Qt5Core_INCLUDE_DIRS}
${Qt5Quick_INCLUDE_DIRS}
${Qt5Multimedia_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
)
set(camera_app_HDRS
cameraapplication.h)
set(camera_app_SRCS
cameraapplication.cpp
main.cpp)
add_executable(${CAMERA_APP}
${cameraapplication_MOC_SRCS}
${camera_app_SRCS}
)
target_link_libraries(${CAMERA_APP}
${Qt5Core_LIBRARIES}
${Qt5Quick_LIBRARIES}
${Qt5Multimedia_LIBRARIES}
${Qt5Gui_LIBRARIES}
stdc++
)
install(TARGETS ${CAMERA_APP}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
file(GLOB QML_JS_FILES *.qml *.js *.png)
install(FILES ${QML_JS_FILES}
DESTINATION ${CAMERA_APP_DIR}
)
set(ASSETS_DIR assets)
install(DIRECTORY ${ASSETS_DIR}
DESTINATION ${CAMERA_APP_DIR}
)
install(DIRECTORY ${THEME_DIR}
DESTINATION ${CAMERA_APP_DIR}
)
configure_file(${DESKTOP_FILE}.in.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}.in)
add_custom_target(${DESKTOP_FILE} ALL
COMMENT "Merging translations into ${DESKTOP_FILE}"
COMMAND ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE}
)
# make non compiled files visible in qtcreator
file(GLOB_RECURSE NON_COMPILED_FILES *.qml *.js *.py *.svg *.png *.in *.json *.desktop *.pot *.apparmor qmldir)
add_custom_target(NON_COMPILED_TARGET ALL SOURCES ${NON_COMPILED_FILES})
if(CLICK_MODE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX})
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES camera.apparmor
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES camera-contenthub.json
DESTINATION ${CMAKE_INSTALL_PREFIX})
else(CLICK_MODE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
endif(CLICK_MODE)
add_subdirectory(CameraApp)
add_subdirectory(desktop)
file(GLOB_RECURSE I18N_SRC_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po
**.qml)
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE}.in.in.h)
list(SORT I18N_SRC_FILES)
# for dh_translations to extract the domain
# (regarding syntax consistency, see http://pad.lv/1181187)
set (GETTEXT_PACKAGE "camera-app")
add_subdirectory(po)
enable_testing()
add_subdirectory(tests)