summaryrefslogtreecommitdiff
path: root/src/agent/CMakeLists.txt
blob: 64fb834da58a71c57bf0e894cd3c9a2c64a84fc0 (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

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

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

# set variables
SET(EXENAME "${PROJECT_NAME}-agent")
SET(BINDIR "${PREFIX}/bin")
SET(OMADS_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent")
SET(OMADS_COMPONETS "main;common;framework/san-parser;framework/event;framework/task;service-adapter;service-adapter/network-binder;service-adapter/protocol-binder;service-engine")

# 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
					libwbxml2
					dlog
					aul
					dbus-glib-1
					)

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

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

# find all source files in a directory.
FOREACH(OMADS_COMPONET ${OMADS_COMPONETS})
	AUX_SOURCE_DIRECTORY(${OMADS_SRC_DIR}/${OMADS_COMPONET} SRCS)
ENDFOREACH(OMADS_COMPONET)

# add internal include directories to the build.
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/san-parser)

# 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 oma ds configuration files
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-ds-cfg DESTINATION /usr/share)

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

# install booting script file
INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/${PROJECT_NAME} DESTINATION /etc/init.d/)