1e289fa4c1c07ea4634f69685174c390673ed273
[src/app-framework-main.git] / CMakeLists.txt
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 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(PROJECT_VERSION "5.99-FF-draft")
30 set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-main.git;a=summary")
31
32 set(USE_LIBZIP     ON  CACHE BOOL "should try to use libzip?")
33 set(USE_SIMULATION OFF CACHE BOOL "if set simulates security manager and smack")
34 set(USE_SDK        OFF CACHE BOOL "if set, avoids installating system runtime files")
35
36 set(SIMULATE_SECMGR OFF CACHE BOOL "if set, the security manager is simulated")
37 set(SIMULATE_SMACK  OFF CACHE BOOL "if set, the smack environment is simulated")
38
39 set(afm_name                "afm" CACHE STRING "Name for application framework user")
40 set(afm_confdir             "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${afm_name}" CACHE STRING "Directory for configuration files")
41 set(afm_datadir             "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}" CACHE STRING "Root directory for installions")
42 set(afm_appdir              "${afm_datadir}/applications" CACHE STRING "Directory for installing applications")
43 set(afm_icondir             "${afm_datadir}/icons" CACHE STRING "Directory for installing icons")
44 set(afm_prefix              "urn:AGL:" CACHE STRING "Prefix for uniform resource name")
45 set(afm_prefix_binding      "${afm_prefix}binding:" CACHE STRING "URN for bindings")
46 set(afm_user_appdir         "app-data" CACHE STRING "User subdirectory for applications")
47 set(afm_user_appdir_label   "User::App-Shared" CACHE STRING "Smack label of the user subdirectory for applications")
48 set(systemd_units_root      "${CMAKE_INSTALL_FULL_LIBDIR}/systemd" CACHE STRING "Place where unit files are to be set")
49 set(wgtpkg_trusted_cert_dir "${afm_confdir}/certs" CACHE STRING "Path to internal certificates")
50 set(afm_platform_rundir     "/run/platform" CACHE STRING "Path to location of platform runtime sockets")
51 set(afm_users_rundir        "/run/user" CACHE STRING "Path to location of users runtime sockets")
52
53 if(USE_SIMULATION)
54     set(SIMULATE_SECMGR ON)
55     set(SIMULATE_SMACK  ON)
56 endif(USE_SIMULATION)
57
58 add_definitions(
59         -DFWK_CONFIG_DIR="${afm_confdir}"
60         -DFWK_PREFIX="${afm_prefix}"
61         -DFWK_PREFIX_BINDING="${afm_prefix_binding}"
62         -DFWK_ICON_DIR="${afm_icondir}"
63         -DFWK_APP_DIR="${afm_appdir}"
64         -DFWK_USER_APP_DIR="${afm_user_appdir}"
65         -DWGTPKG_TRUSTED_CERT_DIR="${wgtpkg_trusted_cert_dir}"
66         -DFWK_LAUNCH_CONF="${afm_confdir}/afm-launch.conf"
67         -DFWK_UNIT_CONF="${afm_confdir}/afm-unit.conf"
68         -DFWK_USER_APP_DIR_LABEL="${afm_user_appdir_label}"
69         -DSYSTEMD_UNITS_ROOT="${systemd_units_root}"
70         -DAFM_VERSION="${PROJECT_VERSION}"
71 )
72
73 add_subdirectory(src)
74 add_subdirectory(conf)
75 add_subdirectory(scripts)
76 add_subdirectory(certs)
77
78 ############################################################
79 # installs the pkgconfig files
80
81 CONFIGURE_FILE(afm-main.pc.in afm-main.pc @ONLY)
82 INSTALL(FILES
83     ${CMAKE_CURRENT_BINARY_DIR}/afm-main.pc
84     DESTINATION
85     ${CMAKE_INSTALL_LIBDIR}/pkgconfig
86     )
87
88