fix missing encoded_id related change & code clearing.
[platform/core/appfw/app2sd.git] / plugin / app2sd / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(app2sd C)
3
4 ### Required packages
5 INCLUDE(FindPkgConfig)
6 pkg_check_modules(pkgs REQUIRED libssl dlog openssl pkgmgr-info libtzplatform-config gio-2.0 glib-2.0 minizip)
7
8 FOREACH(flag ${pkgs_CFLAGS})
9         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
10 ENDFOREACH(flag)
11
12 pkg_check_modules(libpkgs REQUIRED libssl dlog openssl pkgmgr-info db-util gio-2.0 glib-2.0 minizip)
13
14 FOREACH(flag ${libpkgs_CFLAGS})
15         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
16 ENDFOREACH(flag)
17
18 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wno-unused-result")
19 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
20
21 ### Local include directories
22 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
23         ${CMAKE_SOURCE_DIR}/common/inc
24         ${CMAKE_SOURCE_DIR}/plugin/app2sd/inc)
25
26 SET(app2sd_dir "${CMAKE_SOURCE_DIR}/plugin/app2sd")
27 SET(app2sd_src_dir "${app2sd_dir}/src")
28
29 ## build app2sd library
30 SET(APP2SD "app2sd")
31 SET(libapp2sd_SOURCES
32         ${app2sd_src_dir}/app2sd_client_interface.c)
33 SET(libapp2sd_LDFLAGS " -L${LIB_INSTALL_DIR} -lcrypto -module -avoid-version ")
34 SET(libapp2sd_CFLAGS  " ${CFLAGS} -fPIC ")
35
36 ADD_LIBRARY(${APP2SD} SHARED ${libapp2sd_SOURCES})
37 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES SOVERSION ${VERSION_MAJOR})
38 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES VERSION ${VERSION})
39 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES COMPILE_FLAGS "${libapp2sd_CFLAGS}")
40 TARGET_LINK_LIBRARIES(${APP2SD} ${libpkgs_LDFLAGS} "-lm")
41
42 ## devel package
43
44 SET(CMAKE_INSTALL_PREFIX "/usr")
45 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
46
47 INSTALL(TARGETS ${APP2SD} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
48
49 ## build app2sd-server binary
50 SET(APP2SD_SERVER "app2sd-server")
51 SET(app2sd_server_SOURCES
52         ${app2sd_src_dir}/app2sd_internals.c
53         ${app2sd_src_dir}/app2sd_interface.c
54         ${app2sd_src_dir}/app2sd_internals_registry.c
55         ${app2sd_src_dir}/app2sd_internals_utils.c
56         ${app2sd_src_dir}/app2sd_server.c
57         ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
58 ADD_EXECUTABLE(${APP2SD_SERVER} ${app2sd_server_SOURCES})
59 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE ")
60 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES LINK_FLAGS "-pie")
61 TARGET_LINK_LIBRARIES(${APP2SD_SERVER} app2sd ${pkgs_LDFLAGS})
62
63 CONFIGURE_FILE(org.tizen.app2sd.service.in org.tizen.app2sd.service @ONLY)
64 CONFIGURE_FILE(org.tizen.app2sd.conf.in org.tizen.app2sd.conf @ONLY)
65
66 INSTALL(TARGETS ${APP2SD_SERVER} DESTINATION bin)
67 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.service DESTINATION
68         ${PREFIX}/share/dbus-1/system-services/)
69 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.conf DESTINATION
70         ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)