Merge "Mesh: SVACE defect fixes" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(bt-service C)
3
4 #Include Source files for bluetooth service common files only
5 SET(SRCS
6 ../include/bt-internal-types.c
7 ./services/bt-service-main.c
8 ./services/bt-service-common.c
9 ./services/bt-service-event-sender.c
10 ./services/bt-service-battery-monitor.c
11 ./services/bt-service-util.c
12 ./services/bt-request-handler.c
13 ./services/adapter/bt-service-core-adapter.c
14 ./services/adapter/bt-service-core-adapter-le.c
15 ./services/device/bt-service-core-device.c
16 ./services/device/bt-service-bonded-device.c
17 ./services/bt-service-event-receiver.c
18 ./services/bt-service-dpm.c
19 ./services/bt-service-agent-util.c
20 ./services/hid/bt-service-hidhost.c
21 ./services/hid/bt-service-hiddevice.c
22 ./services/socket/bt-service-socket.c
23 ./services/rfcomm/bt-service-rfcomm.c
24 ./services/audio/bt-service-audio.c
25 ./services/audio/bt-service-headset-connection.c
26 ./services/audio/hf/bt-service-hf.c
27 ./services/audio/a2dp_src/bt-service-a2dp-src.c
28 ./services/audio/a2dp_sink/bt-service-a2dp-sink.c
29 ./services/health/bt-service-hdp.c
30 ./services/audio/avrcp/bt-service-avrcp-tg.c
31 ./services/audio/avrcp/bt-service-avrcp-ctrl.c
32 ./services/gatt/bt-service-gatt.c
33 ./services/audio/hf/bt-service-hf-client.c
34 ./services/mesh/bt-service-mesh-util.c
35 ./services/mesh/bt-service-mesh-keys.c
36 ./services/mesh/bt-service-mesh-cdb.c
37 ./services/mesh/bt-service-mesh-nodes.c
38 ./services/mesh/bt-service-mesh-network.c
39 ./services/mesh/bt-service-mesh-main.c
40 ./services/mesh/bt-service-mesh-config-client.c
41 )
42
43 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_OBEX")
44 LIST(APPEND SRCS ./services/obex/bt-service-obex-agent.c)
45 LIST(APPEND SRCS ./services/obex/bt-service-obex-server.c)
46 LIST(APPEND SRCS ./services/obex/bt-service-map-client.c)
47 LIST(APPEND SRCS ./services/obex/bt-service-opp-client.c)
48 LIST(APPEND SRCS ./services/obex/bt-service-pbap.c)
49 LIST(APPEND SRCS ./services/obex/bt-service-obex-event-receiver.c)
50 LIST(APPEND SRCS ./services/obex/bt-service-oob.c)
51 ENDIF()
52
53 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_PAN_NAP")
54 LIST(APPEND SRCS ./services/pan_nap/bt-service-pan-nap-event-receiver.c)
55 LIST(APPEND SRCS ./services/pan_nap/bt-service-network.c)
56 ENDIF()
57
58 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_IPSP")
59 LIST(APPEND SRCS ./services/ipsp/bt-service-ipsp.c)
60 LIST(APPEND SRCS ./services/ipsp/bt-service-ipsp-event-receiver.c)
61 ENDIF()
62
63 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_AVC_TARGET")
64 LIST(APPEND SRCS ./services/audio/bt-service-absolute-volume.c)
65 ENDIF()
66
67 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
68         SET(CMAKE_BUILD_TYPE "Release")
69 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
70 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
71
72 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
73 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/services/include)
74 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_OBEX")
75 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/services/obex/include)
76 ENDIF()
77 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_PAN_NAP")
78 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/services/pan_nap/include)
79 ENDIF()
80 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_IPSP")
81 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/services/ipsp/include)
82 ENDIF()
83
84 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../bt-oal/include)
85 LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../bt-oal)
86
87 IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_FACTORY_MODE")
88 SET(PKG_MODULES
89         vconf
90         dbus-1
91         gio-2.0
92         gio-unix-2.0
93         alarm-service
94         capi-network-connection
95         cynara-client
96         cynara-creds-gdbus
97         aul
98         json-c
99         ell
100         eventsystem
101         storage
102         capi-system-info
103         libsystemd-daemon
104         bincfg
105         libactd
106 )
107 ELSE()
108 SET(PKG_MODULES
109         vconf
110         dbus-1
111         gio-2.0
112         gio-unix-2.0
113         alarm-service
114         capi-network-connection
115         cynara-client
116         cynara-creds-gdbus
117         aul
118         json-c
119         ell
120         eventsystem
121         storage
122         capi-system-info
123         libsystemd-daemon
124         libactd
125 )
126 ENDIF()
127
128 INCLUDE(FindPkgConfig)
129 pkg_check_modules(service_pkgs REQUIRED ${PKG_MODULES})
130
131 FOREACH(flag ${service_pkgs_CFLAGS})
132         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall")
133 ENDFOREACH(flag)
134
135 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
136 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
137 SET(CMAKE_C_FLAGS_RELEASE "-O2")
138 SET(APP_SYSCONFDIR /opt/var/lib/bluetooth)
139
140 FIND_PROGRAM(UNAME NAMES uname)
141 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
142 IF("${ARCH}" STREQUAL "arm")
143         ADD_DEFINITIONS("-DTARGET")
144         MESSAGE("add -DTARGET")
145 ENDIF("${ARCH}" STREQUAL "arm")
146
147 FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
148
149 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
150 ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"")
151 ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"")
152 ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"")
153 ADD_DEFINITIONS("-DAPP_LOCALEDIR=\"${APP_LOCALEDIR}\"")
154 ADD_DEFINITIONS("-DAPP_SYSCONFDIR=\"${APP_SYSCONFDIR}\"")
155 ADD_DEFINITIONS("-DHPS_FEATURE")
156 ADD_DEFINITIONS("-DTIZEN_FEATURE_BT_DPM")
157
158 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
159
160 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
161 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS} bt-oal -ldl)
162
163 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services)
164 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
165
166 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/auto-pair-blacklist DESTINATION /opt/var/lib/bluetooth/)
167
168 # install booting script
169 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf)
170
171 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wearable/stack_info DESTINATION /usr/etc/bluetooth/)
172 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobile/stack_info DESTINATION /usr/etc/bluetooth/)
173
174 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d)
175
176 TARGET_LINK_LIBRARIES(${PROJECT_NAME} -ldl)
177
178 SET(PREFIX ${CMAKE_INSTALL_PREFIX})