Add multi-user support
[platform/core/system/oma-ds-agent.git] / src / agent / CMakeLists.txt
1
2 #############################################
3 #
4 # Step 1. Set Variable and Build Dependency
5 #
6
7 # set a name for the entire project
8 PROJECT(oma-ds)
9
10 # set variables
11 SET(EXENAME "${PROJECT_NAME}-agent")
12 SET(BINDIR "${PREFIX}/bin")
13 SET(OMADS_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent")
14 SET(OMADS_COMPONETS "main;common;framework/san-parser;framework/event;framework/task;service-adapter;service-adapter/network-binder;service-adapter/protocol-binder;service-engine")
15
16 # checks for build dependency modules : a pkg-config module for CMake
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(LPKGS REQUIRED
19                                         glib-2.0
20                                         libsoup-2.4
21                                         sqlite3
22                                         sync-agent
23                                         vconf
24                                         dlog
25                                         aul
26                                         dbus-glib-1
27                                         libtzplatform-config
28                                         )
29
30 #############################################
31 #
32 # Step 2. Set Compile Environment
33 #
34
35 # set extra cflags from build dependency
36 STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
37
38 # find all source files in a directory.
39 FOREACH(OMADS_COMPONET ${OMADS_COMPONETS})
40         AUX_SOURCE_DIRECTORY(${OMADS_SRC_DIR}/${OMADS_COMPONET} SRCS)
41 ENDFOREACH(OMADS_COMPONET)
42
43 # add internal include directories to the build.
44 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
45 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/san-parser)
46
47 # add define macros
48 ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")
49
50 #############################################
51 #
52 # Step 3. Set Link Environment
53 #
54
55 # add an executable to the project using the specified source files.
56 ADD_EXECUTABLE(${EXENAME} ${SRCS})
57
58 # link a target to given libraries.
59 TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES})
60
61 # sets additional compiler flags used to build sources within the target.
62 SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
63
64 #############################################
65 #
66 # Step 4. Install packages
67 #
68
69 # install executable file
70 INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR})
71
72 # install oma ds configuration files
73 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-ds-cfg DESTINATION /usr/share)
74
75 # install oma ds dbus file
76 INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadsagent.service DESTINATION /usr/share/dbus-1/system-services)
77 INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadsagent.conf DESTINATION /etc/dbus-1/system.d)
78
79 # install systemd unit
80 INSTALL(FILES ${CMAKE_SOURCE_DIR}/oma-ds-agent.service DESTINATION /usr/lib/systemd/system)
81 INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/usr/lib/systemd/system/graphical.target.wants)")
82 INSTALL(CODE "EXECUTE_PROCESS(COMMAND ln -sf ../oma-ds-agent.service . WORKING_DIRECTORY \$ENV{DESTDIR}/usr/lib/systemd/system/graphical.target.wants)")