1991f5b791d2ac110c61ed45de3161113249b703
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(bt-service-api C)
3
4 SET(SRCS
5 bt-common.c
6 bt-adapter.c
7 bt-adapter-le.c
8 bt-device.c
9 bt-hid.c
10 bt-network.c
11 bt-audio.c
12 bt-oob.c
13 bt-hdp.c
14 bt-avrcp.c
15 bt-telephony.c
16 bt-opp-client.c
17 bt-obex-server.c
18 bt-rfcomm-client.c
19 bt-rfcomm-server.c
20 bt-request-sender.c
21 bt-event-handler.c
22 bt-scmst.c
23 bt-gatt-service.c
24 bt-pbap.c
25 bt-gatt-client.c)
26
27 SET(HEADERS
28 bluetooth-api.h
29 bluetooth-hid-api.h
30 bluetooth-audio-api.h
31 bluetooth-telephony-api.h
32 bluetooth-media-control.h
33 bluetooth-scmst-api.h)
34
35 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
36 SET(EXEC_PREFIX "\${prefix}")
37 IF("${ARCH}" STREQUAL "aarch64")
38 SET(LIBDIR "\${prefix}/lib64")
39 ELSE()
40 SET(LIBDIR "\${prefix}/lib")
41 ENDIF("${ARCH}" STREQUAL "aarch64")
42 SET(INCLUDEDIR "\${prefix}/include")
43 SET(VERSION_MAJOR 1)
44 SET(VERSION ${VERSION_MAJOR}.0.0)
45
46 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
47 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
48 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
49
50 INCLUDE(FindPkgConfig)
51
52 SET(PKG_MODULES
53         dlog
54         dbus-glib-1
55         gobject-2.0
56         gmodule-2.0
57         vconf
58         libxml-2.0
59         glib-2.0
60         gio-2.0
61         gio-unix-2.0
62         syspopup-caller
63 )
64
65 INCLUDE(FindPkgConfig)
66 pkg_check_modules(packages REQUIRED ${PKG_MODULES})
67
68 FOREACH(flag ${packages_CFLAGS})
69         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
70 ENDFOREACH(flag)
71
72 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
73 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g ")
74
75 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
76
77 FIND_PROGRAM(UNAME NAMES uname)
78 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
79 IF("${ARCH}" STREQUAL "arm")
80         ADD_DEFINITIONS("-DTARGET")
81         MESSAGE("add -DTARGET")
82 ENDIF("${ARCH}" STREQUAL "arm")
83
84 FIND_PROGRAM(MARSHALTOOL NAMES glib-genmarshal)
85 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --header > ${CMAKE_CURRENT_SOURCE_DIR}/include/marshal.h")
86 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --body > ${CMAKE_CURRENT_SOURCE_DIR}/marshal.c")
87
88 FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
89 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt ${CMAKE_CURRENT_SOURCE_DIR}/bt-request-service.xml --mode=glib-client --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-request-service.h")
90 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bluetooth_gatt ${CMAKE_CURRENT_SOURCE_DIR}/bt-gatt.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-gatt-glue.h")
91 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bluetooth_telephony_method ${CMAKE_CURRENT_SOURCE_DIR}/bt-telephony.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-telephony-glue.h")
92
93 ADD_LIBRARY(bluetooth-api SHARED ${SRCS})
94 SET_TARGET_PROPERTIES(bluetooth-api PROPERTIES SOVERSION ${VERSION_MAJOR})
95 SET_TARGET_PROPERTIES(bluetooth-api PROPERTIES VERSION ${VERSION})
96 TARGET_LINK_LIBRARIES(bluetooth-api ${packages_LDFLAGS})
97 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-api.pc.in ${CMAKE_CURRENT_BINARY_DIR}/bluetooth-api.pc @ONLY)
98 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/bluetooth-api.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
99 INSTALL(TARGETS bluetooth-api DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
100
101 FOREACH(hfile ${HEADERS})
102         INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/${hfile} DESTINATION include/bt-service)
103 ENDFOREACH(hfile)