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
28 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
29 SET(CMAKE_BUILD_TYPE "Release")
30 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
31 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
33 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
34 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
36 INCLUDE(FindPkgConfig)
37 pkg_check_modules(service_pkgs REQUIRED vconf aul vconf syspopup-caller dbus-glib-1 capi-network-tethering
38 libprivilege-control status alarm-service notification security-server)
40 FOREACH(flag ${service_pkgs_CFLAGS})
41 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall")
44 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
45 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
46 SET(CMAKE_C_FLAGS_RELEASE "-O2")
47 SET(APP_SYSCONFDIR /opt/var/lib/bluetooth)
49 FIND_PROGRAM(UNAME NAMES uname)
50 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
51 IF("${ARCH}" STREQUAL "arm")
52 ADD_DEFINITIONS("-DTARGET")
53 MESSAGE("add -DTARGET")
54 ENDIF("${ARCH}" STREQUAL "arm")
56 FIND_PROGRAM(MARSHALTOOL NAMES glib-genmarshal)
57 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --header > ${CMAKE_CURRENT_SOURCE_DIR}/include/marshal.h")
58 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --body > ${CMAKE_CURRENT_SOURCE_DIR}/marshal.c")
60 FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
61 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")
62 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")
63 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")
64 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")
66 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
67 ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"")
68 ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"")
69 ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"")
70 ADD_DEFINITIONS("-DAPP_LOCALEDIR=\"${APP_LOCALEDIR}\"")
71 ADD_DEFINITIONS("-DAPP_SYSCONFDIR=\"${APP_SYSCONFDIR}\"")
73 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
75 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
76 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS})
78 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services)
79 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
81 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/auto-pair-blacklist DESTINATION /opt/var/lib/bluetooth)
83 # install booting script
84 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service DESTINATION /etc/rc.d/init.d)
86 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d)
88 SET(PREFIX ${CMAKE_INSTALL_PREFIX})