Merge "Add wait for start jobs"
[src/app-framework-main.git] / CMakeLists.txt
1 ###########################################################################
2 # Copyright (C) 2015-2020 IoT.bzh
3 #
4 # author: José Bollo <jose.bollo@iot.bzh>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
18
19 cmake_minimum_required(VERSION 3.4.3)
20
21 project(afm-main C)
22
23 include(GNUInstallDirs)
24 include(CTest)
25
26 set(PROJECT_NAME "AFM Main")
27 set(PROJECT_PRETTY_NAME "Application Framework Main")
28 set(PROJECT_DESCRIPTION "Secured Application framework for Automotive Grade Linux")
29 set(AGLVERSION "8.0.0" CACHE STRING "Version of AGL")
30 set(PROJECT_VERSION ${AGLVERSION} CACHE STRING "Version of the project can override AGLVERSION")
31 set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-main.git;a=summary")
32
33 option(DISTINCT_VERSIONS  "Should the version of application be distinguished" OFF)
34 option(USE_LIBZIP         "Should try to use libzip?" ON)
35 option(USE_SIMULATION     "If set simulates security manager and smack" OFF)
36 option(USE_SDK            "If set, avoids installating system runtime files" OFF)
37 option(ALLOW_NO_SIGNATURE "If set, widgets without signature are accepted" OFF)
38 option(INSTALL_SAMPLE_KEYS "install the sample keys and certificates" OFF)
39
40 option(SIMULATE_SECMGR    "If set, the security manager is simulated" OFF)
41 option(SIMULATE_SMACK     "If set, the smack environment is simulated"  OFF)
42
43 option(LEGACY_USER_DAEMON "compile and install the legacy afm-user-daemon" OFF)
44
45 set(afm_name                "afm" CACHE STRING "Name for application framework user")
46 set(afm_confdir             "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${afm_name}" CACHE STRING "Directory for configuration files")
47 set(afm_datadir             "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}" CACHE STRING "Root directory for installions")
48 set(afm_libexecdir          "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${afm_name}" CACHE STRING "Directory for installing internal binaries")
49 set(afm_appdir              "${afm_datadir}/applications" CACHE STRING "Directory for installing applications")
50 set(afm_icondir             "${afm_datadir}/icons" CACHE STRING "Directory for installing icons")
51 set(afm_prefix              "urn:AGL:" CACHE STRING "Prefix for uniform resource name")
52 set(afm_user_appdir         "app-data" CACHE STRING "User subdirectory for applications")
53 set(afm_user_appdir_label   "User::App-Shared" CACHE STRING "Smack label of the user subdirectory for applications")
54 set(systemd_units_root      "${CMAKE_INSTALL_FULL_LIBDIR}/systemd" CACHE STRING "Place where unit files are to be set")
55 set(wgtpkg_trusted_certs_dir "${afm_confdir}/certs" CACHE STRING "Path to internal certificates")
56 set(wgtpkg_sample_keys_dir  "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}/keys" CACHE STRING "Path to internal keys")
57 set(wgtpkg_sample_certs_dir "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}/certs" CACHE STRING "Path to internal certs")
58 set(afm_platform_rundir     "/run/platform" CACHE STRING "Path to location of platform runtime sockets")
59 set(afm_users_rundir        "/run/user" CACHE STRING "Path to location of users runtime sockets")
60 set(afm_scope_platform_dir  "/var/scope-platform" CACHE STRING "Path to home of scope-platform apps")
61
62 if(USE_SIMULATION)
63     set(SIMULATE_SECMGR ON)
64     set(SIMULATE_SMACK  ON)
65 endif(USE_SIMULATION)
66
67 add_definitions(
68         -DFWK_CONFIG_DIR="${afm_confdir}"
69         -DFWK_PREFIX="${afm_prefix}"
70         -DFWK_ICON_DIR="${afm_icondir}"
71         -DFWK_APP_DIR="${afm_appdir}"
72         -DFWK_USER_APP_DIR="${afm_user_appdir}"
73         -DWGTPKG_TRUSTED_CERT_DIR="${wgtpkg_trusted_certs_dir}"
74         -DFWK_LAUNCH_CONF="${afm_confdir}/afm-launch.conf"
75         -DFWK_UNIT_CONF="${afm_confdir}/afm-unit.conf"
76         -DFWK_USER_APP_DIR_LABEL="${afm_user_appdir_label}"
77         -DSYSTEMD_UNITS_ROOT="${systemd_units_root}"
78         -DAFM_VERSION="${PROJECT_VERSION}"
79 )
80 if(ALLOW_NO_SIGNATURE)
81         add_definitions(-DALLOW_NO_SIGNATURE=1)
82 endif(ALLOW_NO_SIGNATURE)
83 if(DISTINCT_VERSIONS)
84         add_definitions(-DDISTINCT_VERSIONS=1)
85 else(DISTINCT_VERSIONS)
86         add_definitions(-DDISTINCT_VERSIONS=0)
87 endif(DISTINCT_VERSIONS)
88 if(INSTALL_SAMPLE_KEYS)
89         add_definitions(-DWITH_SAMPLE_KEYS=1)
90 endif(INSTALL_SAMPLE_KEYS)
91
92 add_subdirectory(src)
93 add_subdirectory(conf)
94 add_subdirectory(scripts)
95 add_subdirectory(certs)
96
97 ############################################################
98 # installs the pkgconfig files
99
100 CONFIGURE_FILE(afm-main.pc.in afm-main.pc @ONLY)
101 INSTALL(FILES
102     ${CMAKE_CURRENT_BINARY_DIR}/afm-main.pc
103     DESTINATION
104     ${CMAKE_INSTALL_LIBDIR}/pkgconfig
105 )
106
107