1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
7 bt-service-event-sender.c
8 bt-service-event-receiver.c
17 bt-service-obex-agent.c
18 bt-service-opp-client.c
19 bt-service-obex-server.c
20 bt-service-rfcomm-client.c
21 bt-service-rfcomm-server.c
25 bt-service-gap-agent.c
32 ENDIF(LIBNOTIFY_SUPPORT)
34 IF(LIBNOTIFICATION_SUPPORT)
36 bt-service-agent-notification.c
38 ENDIF(LIBNOTIFICATION_SUPPORT)
40 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
41 SET(CMAKE_BUILD_TYPE "Release")
42 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
43 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
45 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
46 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
48 INCLUDE(FindPkgConfig)
51 pkg_check_modules(service_pkgs REQUIRED vconf aul vconf dbus-glib-1 capi-network-tethering libprivilege-control status alarm-service notification security-server libnotify gdk-pixbuf-2.0 gtk+-3.0)
52 ELSEIF(LIBNOTIFICATION_SUPPORT)
53 pkg_check_modules(service_pkgs REQUIRED vconf aul dbus-glib-1 capi-network-tethering libprivilege-control status alarm-service notification security-server)
55 pkg_check_modules(service_pkgs REQUIRED vconf aul vconf syspopup-caller dbus-glib-1 capi-network-tethering libprivilege-control status alarm-service notification security-server)
56 ENDIF(LIBNOTIFY_SUPPORT)
58 FOREACH(flag ${service_pkgs_CFLAGS})
59 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall")
62 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
63 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
64 SET(CMAKE_C_FLAGS_RELEASE "-O2")
65 SET(APP_SYSCONFDIR /opt/var/lib/bluetooth)
67 FIND_PROGRAM(UNAME NAMES uname)
68 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
69 IF("${ARCH}" STREQUAL "arm")
70 ADD_DEFINITIONS("-DTARGET")
71 MESSAGE("add -DTARGET")
72 ENDIF("${ARCH}" STREQUAL "arm")
74 FIND_PROGRAM(MARSHALTOOL NAMES glib-genmarshal)
75 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --header > ${CMAKE_CURRENT_SOURCE_DIR}/include/marshal.h")
76 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --body > ${CMAKE_CURRENT_SOURCE_DIR}/marshal.c")
78 FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
79 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt ${CMAKE_CURRENT_SOURCE_DIR}/bt-request-service.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-service-method.h")
80 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt_obex_agent ${CMAKE_CURRENT_SOURCE_DIR}/bt-service-obex-agent.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-obex-agent-method.h")
81 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=gap_agent ${CMAKE_CURRENT_SOURCE_DIR}/bt-service-gap-agent.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-gap-agent-method.h")
82 EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt_media_agent ${CMAKE_CURRENT_SOURCE_DIR}/bt-service-media-agent.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-media-agent-method.h")
84 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
85 ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"")
86 ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"")
87 ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"")
88 ADD_DEFINITIONS("-DAPP_LOCALEDIR=\"${APP_LOCALEDIR}\"")
89 ADD_DEFINITIONS("-DAPP_SYSCONFDIR=\"${APP_SYSCONFDIR}\"")
91 IF(LIBNOTIFY_SUPPORT OR LIBNOTIFICATION_SUPPORT)
92 ADD_DEFINITIONS("-DDATA_DIR_ICON=\"${SHARE_INSTALL_PREFIX}\"")
93 MESSAGE("Icon used for notification is : ${SHARE_INSTALL_PREFIX}/icons/default/bt-icon.png")
94 ENDIF(LIBNOTIFY_SUPPORT OR LIBNOTIFICATION_SUPPORT)
96 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
98 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
100 # to permit usage of bluetooth_cancel_bonding in bt-popup.c. This build bluetooth-api first.
101 IF(LIBNOTIFY_SUPPORT)
102 ADD_DEPENDENCIES(${PROJECT_NAME} bluetooth-api)
103 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS} bluetooth-api)
104 ELSE(LIBNOTIFY_SUPPORT)
105 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS})
106 ENDIF(LIBNOTIFY_SUPPORT)
109 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service.in ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service)
110 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services)
111 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
113 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/auto-pair-blacklist DESTINATION /opt/var/lib/bluetooth)
115 # install booting script
116 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf)
117 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service DESTINATION /etc/rc.d/init.d)
118 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d)
120 SET(PREFIX ${CMAKE_INSTALL_PREFIX})