summaryrefslogtreecommitdiff
path: root/src/agent/CMakeLists.txt
blob: 5219bf7dcd65d268298d59a912ed7dfaaa11c81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

#############################################
#
# Step 1. Set Variable and Build Dependency
#

# set a name for the entire project
PROJECT(oma-dm)

# set variables
SET(EXENAME "${PROJECT_NAME}-agent")
SET(BINDIR "${PREFIX}/bin")
SET(OMADM_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent")
SET(OMADM_COMPONETS "common;common/dm-status;common/util;framework;framework/task;framework/ui-event-handler;framework/ui-event-handler/user-interaction;framework/platform-event-handler;framework/san-parser;dm-engine;dm-engine/fumo;dm-engine/lawmo;dm-engine/bootstrap;dm-engine/cp;dm-engine/dl-manager;mo-handler;serviceadapter;serviceadapter/dm-phase-handler;serviceadapter/protocolbinder;serviceadapter/networkbinder")

# checks for build dependency modules : a pkg-config module for CMake
INCLUDE(FindPkgConfig)
pkg_check_modules(LPKGS REQUIRED
					glib-2.0
					libsoup-2.4
					sqlite3
					sync-agent
					vconf
					libxml-2.0
					aul
					libwbxml2
#					oauth
					appsvc
					dlog
					dbus-glib-1
#					appcore-efl
					)

#############################################
#
# Step 2. Set Compile Environment
#

# set extra cflags from build dependency
STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")

# find all source files in a directory.
AUX_SOURCE_DIRECTORY(${OMADM_SRC_DIR} SRCS)
FOREACH(OMADM_COMPONET ${OMADM_COMPONETS})
	AUX_SOURCE_DIRECTORY(${OMADM_SRC_DIR}/${OMADM_COMPONET} SRCS)
ENDFOREACH(OMADM_COMPONET)

# add internal include directories to the build.
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/framework/ui-event-handler)

# add define macros
ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")

#############################################
#
# Step 3. Set Link Environment
#

# add an executable to the project using the specified source files.
ADD_EXECUTABLE(${EXENAME} ${SRCS})

# link a target to given libraries.
TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES})

# sets additional compiler flags used to build sources within the target.
SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})

#############################################
#
# Step 4. Install packages
#

# install executable file
INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR})

# install dm configuration files
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-dm-cfg DESTINATION /usr/share)

# install oma ds dbus file
INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadmagent.service DESTINATION /usr/share/dbus-1/services)

# install smack rule file
Install(FILES ${CMAKE_SOURCE_DIR}/oma-dm-agent.rule DESTINATION /etc/smack/accesses2.d)