summaryrefslogtreecommitdiff
path: root/PluginRoutingInterfaceDbus/CMakeLists.txt
blob: ed1503184335feb505855ad5a4c6d3ec762f2601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 2.6)

PROJECT(AudioManagerDeamon)

set(CMAKE_CXX_FLAGS "-g -pipe -fPIC -Wall -W -D_REENTRANT")

set(STD_INCLUDE_DIRS "/usr/include")
set(EXECUTABLE_OUTPUT_PATH ../../bin/)
set(LIBRARY_OUTPUT_PATH ../plugins)
set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../dbusInterfaces)
set(DOC_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../doc/DBusPlugin)

cmake_policy(SET CMP0015 NEW)

file(MAKE_DIRECTORY ${DOC_OUTPUT_PATH})

FIND_PACKAGE(Qt4 REQUIRED)

INCLUDE_DIRECTORIES(
	${CMAKE_SOURCE_DIR} 
	${STD_INCLUDE_DIRS}
 	${CMAKE_CURRENT_BINARY_DIR}
	${DBUS_FOLDER}
	../AudioManagerDaemon
)

# add Qt modules here, the include will setup QT_LIBRARIES

# defines for QL Plugins
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_STATICPLUGIN)
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_SHARED)


INCLUDE(${QT_USE_FILE})

# all source files go here
SET(PLUGINDBUS_SRCS_CXX
    DBusInterface.cpp 
    RoutingSend.cpp 
    ${CMAKE_CURRENT_BINARY_DIR}/DBusSend.cpp 
    ${CMAKE_CURRENT_BINARY_DIR}/DBusInterfaceAdaptor.cpp 
)

# every header that contains QT stuff like Q_OBJECT .... and must be mocced
SET(PLUGINDBUS_MOC_SRCS
    DBusInterface.h 
    RoutingSend.h 
    ${CMAKE_CURRENT_BINARY_DIR}/DBusSend.h
    ${CMAKE_CURRENT_BINARY_DIR}/DBusInterfaceAdaptor.h 
)

#now take the headers, moc them and append the resulting moc files to the sources
QT4_WRAP_CPP(PLUGINDBUS_SRCS_CXX ${PLUGINDBUS_MOC_SRCS})

add_library(RoutingPlugin ${PLUGINDBUS_SRCS_CXX})

TARGET_LINK_LIBRARIES(RoutingPlugin
	${QT_LIBRARIES}
)

add_custom_command(
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DBusInterfaceAdaptor.h ${CMAKE_CURRENT_BINARY_DIR}/DBusInterfaceAdaptor.cpp
	COMMAND qdbusxml2cpp ARGS -c DBusInterfaceAdaptor -a DBusInterfaceAdaptor.h:DBusInterfaceAdaptor.cpp ${DBUS_FOLDER}/DBusReceive.xml 
	MAIN_DEPENDENCY ${DBUS_FOLDER}/DBusReceive.xml
)

add_custom_command(
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DBusSend.h ${CMAKE_CURRENT_BINARY_DIR}/DBusSend.cpp
	COMMAND qdbusxml2cpp ARGS -v -c DBusSend -p DBusSend.h:DBusSend.cpp ${DBUS_FOLDER}/DBusSend.xml
	MAIN_DEPENDENCY ${DBUS_FOLDER}/DBusSend.xml
)

#add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
  	configure_file(Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile  @ONLY IMMEDIATE)
  	add_custom_target (Docs ALL 
  	COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${DOC_OUTPUT_PATH}
  	SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
endif(DOXYGEN_FOUND)