-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
116 lines (96 loc) · 3.6 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
project(com.ubuntu.shorts)
cmake_minimum_required(VERSION 2.8.9)
find_program(INTLTOOL_MERGE intltool-merge)
find_program(INTLTOOL_EXTRACT intltool-extract)
# Standard install paths
include(GNUInstallDirs)
option(INSTALL_TESTS "Install the tests on make install" on)
option(CLICK_MODE "Installs to a contained location" on)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
find_package(Qt5Core)
find_package(Qt5Gui)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5Network)
# Find_package(ubuntu-sdk-libs)
#automatically create moc files
set(CMAKE_AUTOMOC ON)
#automatically add qrc files
set(CMAKE_AUTORCC ON)
# Figure out the component install path
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
#set(CLICK_ARCH "all")
# If you want to add native code to your project, replace the set CLICK_ARCH command
# with the following part.
# This command figures out the target architecture for use in the manifest file
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
set(BIN_DIR /lib/${ARCH_TRIPLET}/bin)
set(APP_NAME shorts)
set(DESKTOP_FILE "${APP_NAME}.desktop")
set(APP_HARDCODE shorts-app)
set(MAIN_QML shorts-app.qml)
set(ICON_FILE shorts.png)
set(SHORTS_DIR "share/qml")
set(AUTOPILOT_DIR shorts_app)
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
if(CLICK_MODE)
if(NOT DEFINED BZR_SOURCE)
set(BZR_SOURCE "lp:ubuntu-rssreader-app")
message("-- Setting BZR_SOURCE to ${BZR_SOURCE}")
endif(NOT DEFINED BZR_SOURCE)
set(CMAKE_INSTALL_PREFIX /)
set(CMAKE_INSTALL_BINDIR /)
set(DATA_DIR /)
set(ICON ${ICON_FILE})
# set(EXEC "qmlscene ${MAIN_QML}")
set(EXEC ${APP_HARDCODE})
set(DESKTOP_DIR ${DATA_DIR})
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json shorts.apparmor
DESTINATION ${CMAKE_INSTALL_PREFIX})
file(GLOB CLICK_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.json *.json.in *.apparmor)
add_custom_target(com_ubuntu_shorts_CLICKFiles ALL SOURCES ${CLICK_FILES})
else(CLICK_MODE)
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})
set(EXEC ${APP_HARDCODE})
set(ICON ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON_FILE})
configure_file(${APP_HARDCODE}.in
${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE}
DESTINATION ${CMAKE_INSTALL_BINDIR})
set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications)
endif(CLICK_MODE)
file(GLOB_RECURSE I18N_SRC_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/shorts/po
*.js *.qml)
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE}.in.in.h)
list(SORT I18N_SRC_FILES)
# for icon
file(GLOB DESKTOP_ICON *.png)
add_custom_target(ubuntu-rssreader-app_icons ALL SOURCES ${DESKTOP_ICON})
install(FILES ${DESKTOP_ICON} DESTINATION ${DESKTOP_DIR})
configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in)
add_custom_target(${DESKTOP_FILE} ALL
COMMENT "Merging translations into ${DESKTOP_FILE}..."
COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/shorts/po ${DESKTOP_FILE}.in ${DESKTOP_FILE}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
DESTINATION ${DESKTOP_DIR})
# Tests
# enable_testing()
# add_subdirectory(click)
# add_subdirectory(po)
# add_subdirectory(tests)
# add_subdirectory(feeds)
add_subdirectory(shorts)