~mterry/ubuntu-calculator-app/confined

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Riccardo Padovani
  • Date: 2014-12-11 17:51:56 UTC
  • Revision ID: rpadovani@ubuntu.com-20141211175156-yp6q17493l5yb2lz
Reverted unwanted push

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
project(com.ubuntu.calculator)
 
1
project(ubuntu-calculator-app C CXX)
2
2
cmake_minimum_required(VERSION 2.8.9)
3
3
 
4
 
find_program(INTLTOOL_MERGE intltool-merge)
5
 
if(NOT INTLTOOL_MERGE)
6
 
    message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
7
 
endif()
8
 
 
9
 
find_program(INTLTOOL_EXTRACT intltool-extract)
10
 
if(NOT INTLTOOL_EXTRACT)
11
 
    message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
12
 
endif()
13
 
 
 
4
# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
14
5
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
15
6
 
16
7
find_package(Qt5Core)
21
12
#automatically create moc files
22
13
set(CMAKE_AUTOMOC ON)
23
14
 
24
 
# option(INSTALL_TESTS "Install the tests on make install" on)
25
 
option(CLICK_MODE "Installs to a contained location" on)
26
 
 
27
 
include(GNUInstallDirs)
28
 
 
29
 
set(APP_NAME                        ubuntu-calculator-app)
30
 
set(APP_HARDCODE                    ubuntu-calculator-app)
31
 
set(MAIN_QML                        ${APP_HARDCODE}.qml)
32
 
set(ICON                            "graphics/${APP_HARDCODE}.png")
33
 
set(DESKTOP_FILE                    "${APP_HARDCODE}.desktop")
34
 
 
35
 
if(CLICK_MODE)
36
 
  set(CMAKE_INSTALL_PREFIX "/")
37
 
  set(UBUNTU-CALCULATOR-APP_DIR    "${CMAKE_INSTALL_DATADIR}/qml")
38
 
 
39
 
  set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}")
40
 
  set(EXEC "qmlscene $@ ${UBUNTU-CALCULATOR-APP_DIR}/${MAIN_QML}")
41
 
  set(MODULE_PATH ${QT_IMPORTS_DIR})
42
 
  if(NOT BZR_REVNO)
43
 
    execute_process(
44
 
      COMMAND bzr revno
45
 
              OUTPUT_VARIABLE BZR_REVNO
46
 
              WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
47
 
              OUTPUT_STRIP_TRAILING_WHITESPACE
48
 
      )
49
 
  endif(NOT BZR_REVNO)
50
 
  if(NOT BZR_SOURCE)
51
 
    set(BZR_SOURCE lp:${APP_HARDCODE})
52
 
    message("-- Setting BZR_SOURCE to ${BZR_SOURCE}")
53
 
  endif(NOT BZR_SOURCE)
54
 
else(CLICK_MODE)
55
 
  set(UBUNTU-CALCULATOR-APP_DIR "${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE}")
56
 
  execute_process(
57
 
    COMMAND qmake -query QT_INSTALL_QML
58
 
            OUTPUT_VARIABLE QT_IMPORTS_DIR
59
 
            OUTPUT_STRIP_TRAILING_WHITESPACE
60
 
    )
61
 
endif(CLICK_MODE)
62
 
 
63
 
if(${CLICK_MODE})
64
 
  message("-- Configuring manifest.json")
65
 
 
66
 
  execute_process(
67
 
    COMMAND dpkg-architecture -qDEB_HOST_ARCH
68
 
    OUTPUT_VARIABLE CLICK_ARCH
 
15
# Figure out the component install path
 
16
execute_process(
 
17
    COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
 
18
    OUTPUT_VARIABLE ARCH_TRIPLET
69
19
    OUTPUT_STRIP_TRAILING_WHITESPACE
70
 
  )
71
 
 
72
 
  configure_file(${UBUNTU_MANIFEST_PATH} ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
73
 
  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
74
 
  install(FILES "${APP_HARDCODE}.json" DESTINATION ${CMAKE_INSTALL_PREFIX})
75
 
else(CLICK_MODE)
76
 
  set(EXEC "qmlscene $@ -I ${MODULE_PATH}  ${CMAKE_INSTALL_PREFIX}/${UBUNTU-CALCULATOR-APP_DIR}/${MAIN_QML}")
77
 
endif()
78
 
 
79
 
#file(GLOB_RECURSE I18N_SRC_FILES
80
 
#    RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po
81
 
#    *.qml *.js)
82
 
#list(APPEND I18N_SRC_FILES ${DESKTOP_FILE})
83
 
#list(SORT I18N_SRC_FILES)
84
 
 
85
 
configure_file(${DESKTOP_FILE} ${DESKTOP_FILE})
86
 
 
87
 
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
88
 
        DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
 
20
)
 
21
 
 
22
set(CLICK_ARCH "all")
 
23
# If you want to add native code to your project, replace the set CLICK_ARCH command
 
24
# with the following part.
 
25
# This command figures out the target architecture for use in the manifest file
 
26
# execute_process(
 
27
#   COMMAND dpkg-architecture -qDEB_HOST_ARCH
 
28
#   OUTPUT_VARIABLE CLICK_ARCH
 
29
#   OUTPUT_STRIP_TRAILING_WHITESPACE
 
30
# )
 
31
 
 
32
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
 
33
 
 
34
option(INSTALL_TESTS "Install the tests on make install" on)
 
35
 
 
36
set(APP_NAME          ubuntu-calculator-app)
 
37
set(UBUNTU-CALCULATOR-APP_DIR "share/qml/ubuntu-calculator-app")
 
38
set(MAIN_QML          "ubuntu-calculator-app.qml")
 
39
set(ICON              "graphics/ubuntu-calculator-app.png")
 
40
 
 
41
# Set install paths
 
42
set(CMAKE_INSTALL_PREFIX /)
 
43
set(DATA_DIR /)
 
44
set(DESKTOP_DIR ${DATA_DIR})
 
45
set(DESKTOP_FILE_NAME "ubuntu-calculator-app.desktop")
 
46
 
 
47
# This sets the commandline that is executed on the device
 
48
set(EXEC "qmlscene $@ ${UBUNTU-CALCULATOR-APP_DIR}/${MAIN_QML}")
 
49
 
 
50
# Configures the manifest file. The manifest file describes the click package
 
51
# to the target system. All cmake variables that are defined at this point
 
52
# can be used in the manifest file and will be automatically replaced by cmake
 
53
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
 
54
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
 
55
        DESTINATION ${CMAKE_INSTALL_PREFIX})
 
56
 
 
57
install(DIRECTORY "app/graphics" DESTINATION ${DATA_DIR})
 
58
install(FILES "ubuntu-calculator-app.apparmor" DESTINATION ${DATA_DIR})
89
59
 
90
60
add_subdirectory(app)
91
 
#add_subdirectory(po)
 
61
add_subdirectory(po)
 
62
 
 
63
add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
 
64
                    COMMAND ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
 
65
                    WORKING_DIRECTORY ./app)
 
66
 
 
67
add_custom_target("check" /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend
 
68
                    WORKING_DIRECTORY ./app)
 
69
 
 
70
add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend  ${CMAKE_SOURCE_DIR}/app/ubuntu-calculator-app.qml
 
71
                    WORKING_DIRECTORY ./app)
 
72
 
 
73
# Normally QtCreator would only show files that are part of a target, but we need it to show also files 
 
74
# that are not compiled. Therefore we add a custom target that just does nothing but list the files 
 
75
add_custom_target("ubuntu-calculator-app_ClickFiles" ALL SOURCES "ubuntu-calculator-app.apparmor" "manifest.json.in")
 
76