Add the app2ext_utils.c to the app2sd library
[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 aul)
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         ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
34 SET(libapp2sd_LDFLAGS " -L${LIB_INSTALL_DIR} -lcrypto -module -avoid-version ")
35 SET(libapp2sd_CFLAGS  " ${CFLAGS} -fPIC ")
36
37 ADD_LIBRARY(${APP2SD} SHARED ${libapp2sd_SOURCES})
38 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES SOVERSION ${VERSION_MAJOR})
39 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES VERSION ${VERSION})
40 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES COMPILE_FLAGS "${libapp2sd_CFLAGS}")
41 TARGET_LINK_LIBRARIES(${APP2SD} ${libpkgs_LDFLAGS} "-lm")
42
43 ## devel package
44
45 SET(CMAKE_INSTALL_PREFIX "/usr")
46 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
47
48 INSTALL(TARGETS ${APP2SD} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
49
50 ## build app2sd-server binary
51 SET(APP2SD_SERVER "app2sd-server")
52 SET(app2sd_server_SOURCES
53         ${app2sd_src_dir}/app2sd_internals.c
54         ${app2sd_src_dir}/app2sd_interface.c
55         ${app2sd_src_dir}/app2sd_internals_registry.c
56         ${app2sd_src_dir}/app2sd_internals_utils.c
57         ${app2sd_src_dir}/app2sd_server.c
58         ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
59 ADD_EXECUTABLE(${APP2SD_SERVER} ${app2sd_server_SOURCES})
60 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE ")
61 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES LINK_FLAGS "-pie")
62 TARGET_LINK_LIBRARIES(${APP2SD_SERVER} app2sd ${pkgs_LDFLAGS})
63
64 CONFIGURE_FILE(org.tizen.app2sd.service.in org.tizen.app2sd.service @ONLY)
65 CONFIGURE_FILE(org.tizen.app2sd.conf.in org.tizen.app2sd.conf @ONLY)
66 CONFIGURE_FILE(app2sd-server.service.in app2sd-server.service @ONLY)
67
68 INSTALL(TARGETS ${APP2SD_SERVER} DESTINATION bin)
69 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.service DESTINATION
70         ${PREFIX}/share/dbus-1/system-services/)
71 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.conf DESTINATION
72         ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
73 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd-server.service DESTINATION ${UNITDIR})