182.1.1
by nskaggs
migrate to cmake build |
1 |
project(com.ubuntu.weather) |
2 |
cmake_minimum_required(VERSION 2.8.9) |
|
267.1.1
by David Planella
Added inline desktop translations support |
3 |
find_program(INTLTOOL_MERGE intltool-merge) |
4 |
find_program(INTLTOOL_EXTRACT intltool-extract) |
|
182.1.1
by nskaggs
migrate to cmake build |
5 |
|
6 |
# Standard install paths
|
|
7 |
include(GNUInstallDirs) |
|
8 |
||
9 |
option(INSTALL_TESTS "Install the tests on make install" on) |
|
10 |
option(CLICK_MODE "Installs to a contained location" off) |
|
11 |
||
12 |
set(APP_NAME weather) |
|
193.1.3
by David Planella
Fixed rules to generate translation template |
13 |
set(DESKTOP_FILE "${PROJECT_NAME}_${APP_NAME}.desktop") |
182.1.5
by nskaggs
tweak cmake |
14 |
set(APP_HARDCODE ubuntu-weather-app) |
182.1.6
by nskaggs
fix main qml in cmake |
15 |
set(MAIN_QML ubuntu-weather-app.qml) |
162.6.1
by David Planella
Fixed icon in click and debian packages |
16 |
set(ICON_FILE weather-app@30.png) |
182.1.4
by Nicholas Skaggs
tweak cmake app name |
17 |
set(AUTOPILOT_DIR ubuntu_weather_app) |
182.1.1
by nskaggs
migrate to cmake build |
18 |
|
19 |
if(CLICK_MODE) |
|
20 |
if(NOT DEFINED BZR_SOURCE) |
|
182.1.5
by nskaggs
tweak cmake |
21 |
set(BZR_SOURCE "lp:${APP_HARDCODE}") |
182.1.1
by nskaggs
migrate to cmake build |
22 |
message("-- Setting BZR_SOURCE to ${BZR_SOURCE}") |
23 |
endif(NOT DEFINED BZR_SOURCE) |
|
24 |
set(CMAKE_INSTALL_PREFIX /) |
|
25 |
set(CMAKE_INSTALL_BINDIR /) |
|
26 |
set(DATA_DIR /) |
|
162.6.1
by David Planella
Fixed icon in click and debian packages |
27 |
set(ICON ${ICON_FILE}) |
182.1.5
by nskaggs
tweak cmake |
28 |
set(EXEC "qmlscene ${MAIN_QML}") |
182.1.1
by nskaggs
migrate to cmake build |
29 |
set(DESKTOP_DIR ${DATA_DIR}) |
30 |
else(CLICK_MODE) |
|
31 |
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE}) |
|
32 |
set(EXEC ${APP_HARDCODE}) |
|
162.6.1
by David Planella
Fixed icon in click and debian packages |
33 |
set(ICON ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON_FILE}) |
182.1.1
by nskaggs
migrate to cmake build |
34 |
configure_file(${APP_HARDCODE}.in |
35 |
${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE}) |
|
36 |
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE} |
|
37 |
DESTINATION ${CMAKE_INSTALL_BINDIR}) |
|
38 |
set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications) |
|
39 |
endif(CLICK_MODE) |
|
40 |
||
41 |
file(GLOB_RECURSE I18N_SRC_FILES |
|
267.1.1
by David Planella
Added inline desktop translations support |
42 |
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po |
43 |
components/*.qml components/*.js *.qml) |
|
44 |
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE}.in.in.h) |
|
182.1.1
by nskaggs
migrate to cmake build |
45 |
list(SORT I18N_SRC_FILES) |
267.1.1
by David Planella
Added inline desktop translations support |
46 |
message("Found ${I18N_SRC_FILES}") |
182.1.1
by nskaggs
migrate to cmake build |
47 |
|
48 |
file(GLOB SRC_FILES |
|
49 |
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} |
|
50 |
*.qml *.js *.png *.js) |
|
182.1.7
by nskaggs
add install dirs, clean deb control |
51 |
install(DIRECTORY components resources DESTINATION ${DATA_DIR}) |
162.2.30
by Martin Borho
added fix from francis for keys.js to CMakeLists.txt |
52 |
install(FILES key.js DESTINATION ${DATA_DIR}) |
162.6.1
by David Planella
Fixed icon in click and debian packages |
53 |
install(FILES ${MAIN_QML} ${ICON_FILE} DESTINATION ${DATA_DIR}) |
182.1.1
by nskaggs
migrate to cmake build |
54 |
|
267.1.1
by David Planella
Added inline desktop translations support |
55 |
configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in) |
56 |
||
57 |
add_custom_target(${DESKTOP_FILE} ALL |
|
58 |
COMMENT "Merging translations into ${DESKTOP_FILE}" |
|
59 |
COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE} >/dev/null |
|
60 |
)
|
|
193.1.2
by David Planella
Replace the .desktop file string marked for translation, added ignores related to cmake |
61 |
|
182.1.5
by nskaggs
tweak cmake |
62 |
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} |
63 |
DESTINATION ${DESKTOP_DIR}) |
|
182.1.1
by nskaggs
migrate to cmake build |
64 |
|
65 |
# Tests
|
|
66 |
enable_testing() |
|
67 |
||
68 |
add_subdirectory(click) |
|
69 |
add_subdirectory(po) |
|
70 |
add_subdirectory(tests) |