Este é o meu exemplo do arquivo de projeto para um aplicativo C ++ simples (também mostra como adicionar bibliotecas Qt). O Ubuntu-Click é gerado.
Era compatível com o Ubuntu SDK quando o compus (então, basta abri-lo no Ubuntu SDK, é um projeto normal).
Substitua sem título em qualquer lugar pelo nome do seu programa.
CMakeLists.txt (existem bibliotecas do Qt que você não precisa ou precisa de mais deles):
project(com.ubuntu.untitled C CXX)
cmake_minimum_required(VERSION 2.8.9)
find_program(INTLTOOL_MERGE intltool-merge)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
# Standard install paths
include(GNUInstallDirs)
option(CLICK_MODE "Installs to a contained location" on)
set(APP_NAME untitled)
set(DESKTOP_FILE "${PROJECT_NAME}.desktop")
set(APP_HARDCODE untitled)
set(ICON_FILE untitled256.png)
set(EXEC "${APP_NAME}")
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
if(CLICK_MODE)
# Find out the architecture for package building
# to determine the plugin's installation path
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_INSTALL_PREFIX /)
set(CMAKE_INSTALL_BINDIR /)
set(DATA_DIR /)
set(DESKTOP_DIR ${DATA_DIR})
set(ICON ${ICON_FILE})
set(BIN_DIR /lib/${ARCH_TRIPLET}/bin)
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 ${APP_NAME}.apparmor DESTINATION ${CMAKE_INSTALL_PREFIX})
# make the click files visible in qtcreator
file(GLOB CLICK_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.json *.json.in *.apparmor)
add_custom_target(com_ubuntu_untitled_CLICKFiles ALL SOURCES ${CLICK_FILES})
else(CLICK_MODE)
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_NAME})
set(ICON ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON_FILE})
set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications)
endif(CLICK_MODE)
file(GLOB SRC_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.png)
install(FILES ${SRC_FILES}
DESTINATION ${DATA_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}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
DESTINATION ${DESKTOP_DIR})
include(FindPkgConfig)
find_package(Qt5Core)
find_package(Qt5Widgets)
aux_source_directory(. SRC_LIST)
add_executable(${APP_NAME} ${SRC_LIST})
if(CLICK_MODE)
install(TARGETS ${APP_NAME} DESTINATION ${BIN_DIR})
else()
install(TARGETS ${APP_NAME} RUNTIME DESTINATION bin)
endif()
qt5_use_modules(${APP_NAME} Widgets)
com.ubuntu.untitled.desktop.in.in :
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=@EXEC@
Icon=@ICON@
_Name=Untitled
X-Ubuntu-Touch=true
X-Ubuntu-Default-Department-ID=accessories
manifest.json.in :
{
"description": "Untitled application",
"framework": "ubuntu-sdk-14.10",
"architecture": "@CLICK_ARCH@",
"hooks": {
"untitled": {
"apparmor": "untitled.apparmor",
"desktop": "com.ubuntu.untitled.desktop"
}
},
"icon": "untitled256.png",
"maintainer": "None <[email protected]>",
"name": "com.ubuntu.untitled",
"title": "Untitled",
"version": "0.0.0"
}
untitled.apparmor (rasgado isso do aplicativo padrão da câmera, eu acho):
{
"policy_groups": [
"picture_files",
"video_files",
"camera",
"audio",
"video",
"usermetrics",
"content_exchange",
"content_exchange_source",
"location"
],
"policy_version": 1.2,
"read_path": [
"@{PROC}/*/mounts",
"/dev/disk/by-label/"
]
}
E um ícone untitled256.png .
Tudo composto do ubuntu-terminal-app e do camera-app (as fontes estão na barra de ativação).