Code sync from tizen_2.4
[platform/core/telephony/tel-plugin-packetservice.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(ps-plugin C)
3
4 #INCLUDE(FindPkgConfig)
5
6 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
7 SET(EXEC_PREFIX "\${prefix}")
8 SET(LIBDIR ${LIB_INSTALL_DIR})
9 SET(INCLUDEDIR "\${prefix}/include")
10 SET(DATAROOTDIR "\${prefix}/share")
11 if(NOT DEFINED SYSCONFDIR)
12         SET(SYSCONFDIR "/etc")
13 endif()
14
15 # Set required packages
16 INCLUDE(FindPkgConfig)
17 pkg_check_modules(pkgs REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 tcore iniparser libxml-2.0 vconf alarm-service cynara-client cynara-creds-gdbus cynara-session)
18
19 FOREACH(flag ${pkgs_CFLAGS})
20         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
21 ENDFOREACH(flag)
22
23 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/cmake_tmp )
24
25 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wcast-align -Wall -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
26
27 ### Purge unused code ###
28 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections")
29
30 # model definitions #
31 IF (CONNECT_DEFAULT_CONNECTION_WITHOUT_TIMER)
32   ADD_DEFINITIONS("-DCONNECT_DEFAULT_CONNECTION_WITHOUT_TIMER")
33 ENDIF (CONNECT_DEFAULT_CONNECTION_WITHOUT_TIMER)
34
35 ADD_DEFINITIONS("-DFEATURE_TLOG_DEBUG")
36 ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"PS\"")
37 ADD_DEFINITIONS("-DPLUGIN_VERSION=${VERSION}")
38 ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
39 #ADD_DEFINITIONS("-DTIZEN_UPS_ENABLED")
40 IF(PREPAID_SIM_APN_SUPPORT)
41         ADD_DEFINITIONS("-DPREPAID_SIM_APN_SUPPORT")
42 ENDIF(PREPAID_SIM_APN_SUPPORT)
43
44 #ADD_DEFINITIONS("-DPOWER_SAVING_FEATURE_WEARABLE")
45 MESSAGE(${CMAKE_C_FLAGS})
46 MESSAGE(${pkgs_LDFLAGS})
47
48 SET(SRCS
49         src/desc.c
50         src/main.c
51         src/master.c
52         src/modem.c
53         src/service.c
54         src/context.c
55         src/tcore-interface.c
56         src/ps_log.c
57         src/util.c
58         ${CMAKE_BINARY_DIR}/generated-code.c
59 )
60
61 ADD_CUSTOM_COMMAND(
62         OUTPUT ${CMAKE_BINARY_DIR}/generated-code.c
63         COMMAND gdbus-codegen --interface-prefix com.tcore.ps. --generate-c-code generated-code --c-namespace PacketService --c-generate-object-manager --generate-docbook generated-docs ${CMAKE_SOURCE_DIR}/introspection/master.xml ${CMAKE_SOURCE_DIR}/introspection/modem.xml ${CMAKE_SOURCE_DIR}/introspection/service.xml ${CMAKE_SOURCE_DIR}/introspection/context.xml
64         COMMENT "Generating GDBus .c/.h")
65
66 # library build
67 ADD_LIBRARY(ps-plugin SHARED ${SRCS})
68 TARGET_LINK_LIBRARIES(ps-plugin ${pkgs_LDFLAGS})
69 SET_TARGET_PROPERTIES(ps-plugin PROPERTIES PREFIX "" OUTPUT_NAME ps-plugin)
70
71 # install
72 INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/dnet_db.sql DESTINATION ${DATAROOTDIR}/ps-plugin)
73 INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/dnet_db_init.sql DESTINATION ${DATAROOTDIR}/ps-plugin)
74 INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/apns-conf.xml DESTINATION ${DATAROOTDIR}/ps-plugin)
75 INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/520.tel-plugin-packetservice.patch.sh DESTINATION ${SYSCONFDIR}/opt/upgrade)
76 INSTALL(TARGETS ps-plugin LIBRARY DESTINATION ${LIBDIR}/telephony/plugins)
77 INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME tel-plugin-packetservice)
78 INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/dump_packetservice.sh DESTINATION /opt/etc/dump.d/module.d)
79 IF (TIZEN_ENGINEER_MODE)
80         ADD_SUBDIRECTORY(test_src)
81 ENDIF (TIZEN_ENGINEER_MODE)
82