499d38a3b9c00c427f7fc35630f19dd89609bee0
[src/app-framework-main.git] / src / CMakeLists.txt
1 ###########################################################################
2 # Copyright 2015 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 2.8)
20
21 include(FindPkgConfig)
22
23 pkg_check_modules(EXTRAS REQUIRED
24         libzip>=0.11
25         libxml-2.0
26         openssl
27         xmlsec1 xmlsec1-openssl
28         json-c
29         dbus-1
30         )
31
32 add_compile_options(${EXTRAS_CFLAGS})
33 include_directories(${EXTRAS_INCLUDE_DIRS})
34 link_libraries(${EXTRAS_LIBRARIES})
35
36 ###########################################################################
37
38 include_directories(simulation)
39
40 ###########################################################################
41
42 add_compile_options(-Wall -Wno-pointer-sign)
43 add_compile_options(-ffunction-sections -fdata-sections)
44 add_compile_options(-fPIC)
45 add_compile_options(-Wl,--gc-sections)
46
47 set(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
48 set(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
49 set(CMAKE_C_FLAGS_RELEASE      "-g -O2")
50 set(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
51
52 ###########################################################################
53
54 add_library(wgtpkg
55         wgtpkg-base64.c
56         wgtpkg-certs.c
57         wgtpkg-digsig.c
58         wgtpkg-files.c
59         wgtpkg-install.c
60         wgtpkg-permissions.c
61         wgtpkg-workdir.c
62         wgtpkg-xmlsec.c
63         wgtpkg-zip.c
64         )
65
66 add_library(utils
67         utils-dir.c
68         utils-jbus.c
69         verbose.c
70         )
71
72 add_library(wgt
73         wgt-config.c
74         wgt-info.c
75         wgt.c
76         )
77
78 add_library(secwrp
79         secmgr-wrap.c
80         )
81
82 add_library(afm
83         afm-db.c
84         afm-launch.c
85         afm-run.c
86         )
87
88 add_executable(wgtpkg-sign wgtpkg-sign.c)
89 target_link_libraries(wgtpkg-sign wgtpkg utils)
90
91 add_executable(wgtpkg-pack wgtpkg-pack.c)
92 target_link_libraries(wgtpkg-pack wgtpkg utils)
93
94 add_executable(wgtpkg-info wgtpkg-info.c)
95 target_link_libraries(wgtpkg-info wgtpkg wgt utils)
96
97 add_executable(wgtpkg-installer wgtpkg-installer.c)
98 target_link_libraries(wgtpkg-installer wgtpkg wgt secwrp utils)
99
100 add_executable(afm-user-daemon afm-user-daemon.c)
101 target_link_libraries(afm-user-daemon afm secwrp wgt utils)
102
103 add_executable(afm-system-daemon afm-system-daemon.c)
104 target_link_libraries(afm-system-daemon wgtpkg afm secwrp wgt utils)
105
106 install(TARGETS wgtpkg-sign wgtpkg-pack wgtpkg-info wgtpkg-installer DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
107 install(TARGETS afm-user-daemon DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
108 install(TARGETS afm-system-daemon DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
109