1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
6 pkg_check_modules(pkgs REQUIRED libssl dlog openssl pkgmgr-info libtzplatform-config gio-2.0 glib-2.0 minizip)
8 FOREACH(flag ${pkgs_CFLAGS})
9 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
12 pkg_check_modules(libpkgs REQUIRED libssl dlog openssl pkgmgr-info db-util gio-2.0 glib-2.0 minizip)
14 FOREACH(flag ${libpkgs_CFLAGS})
15 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
18 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wno-unused-result")
19 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
21 ### Local include directories
22 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
23 ${CMAKE_SOURCE_DIR}/src)
25 SET(app2sd_dir "${CMAKE_SOURCE_DIR}/plugin/app2sd")
26 SET(app2sd_inc_dir "${app2sd_dir}/inc")
27 SET(app2sd_src_dir "${app2sd_dir}/src")
29 ## build app2sd library
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 -I${app2sd_inc_dir} ")
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")
44 SET(CMAKE_INSTALL_PREFIX "/usr")
45 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
47 INSTALL(TARGETS ${APP2SD} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
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 ADD_EXECUTABLE(${APP2SD_SERVER} ${app2sd_server_SOURCES})
58 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE -I${app2sd_inc_dir} ")
59 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES LINK_FLAGS "-pie")
60 TARGET_LINK_LIBRARIES(${APP2SD_SERVER} app2sd ${pkgs_LDFLAGS})
62 CONFIGURE_FILE(org.tizen.app2sd.service.in org.tizen.app2sd.service @ONLY)
63 CONFIGURE_FILE(org.tizen.app2sd.conf.in org.tizen.app2sd.conf @ONLY)
65 INSTALL(TARGETS ${APP2SD_SERVER} DESTINATION bin)
66 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.service DESTINATION
67 ${PREFIX}/share/dbus-1/system-services/)
68 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.app2sd.conf DESTINATION
69 ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)