From f9de38ac41d5da1d5cc52e8797dd47bdac4b3116 Mon Sep 17 00:00:00 2001 From: christian linke Date: Thu, 25 Oct 2012 16:21:04 +0200 Subject: * changes to make the package and documentation easier Signed-off-by: christian linke --- PluginCommandInterfaceDbus/CMakeLists.txt | 25 +++++++++++++++++++--- PluginCommandInterfaceDbus/cmake/config.cmake | 6 ++++++ .../include/configCommandDbus.h | 6 ++++++ .../src/IAmCommandReceiverShadow.cpp | 4 ++-- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 PluginCommandInterfaceDbus/cmake/config.cmake create mode 100644 PluginCommandInterfaceDbus/include/configCommandDbus.h (limited to 'PluginCommandInterfaceDbus') diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt index e4face2..06e3c30 100644 --- a/PluginCommandInterfaceDbus/CMakeLists.txt +++ b/PluginCommandInterfaceDbus/CMakeLists.txt @@ -21,12 +21,24 @@ PROJECT(PluginCommandInterfaceDbus) set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/command) set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/CommandDBusPlugin) set(INCLUDE_FOLDER "include") +message(STATUS "prefix ${CMAKE_INSTALL_PREFIX}") +SET(SHARED_FOLDER "${CMAKE_INSTALL_PREFIX}/share") FILE(READ "${AUDIO_INCLUDE_FOLDER}/command/IAmCommandSend.h" VERSION_BUFFER LIMIT 6000) STRING(REGEX MATCH "CommandSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER}) STRING(REGEX REPLACE "CommandSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING}) MESSAGE(STATUS "Building against command interface version ${LIB_INTERFACE_VERSION}") +IF(USE_BUILD_LIBS) + SET(COMMAND_DBUS_INTROSPECTION_FOLDER ${EXECUTABLE_OUTPUT_PATH}) + SET(COMMAND_DBUS_INTROSPECTION_FILE ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml) +ELSE(USE_BUILD_LIBS) + SET(COMMAND_DBUS_INTROSPECTION_FOLDER ${SHARED_FOLDER}/audiomanager) + SET(COMMAND_DBUS_INTROSPECTION_FILE ${SHARED_FOLDER}/audiomanager/CommandInterface.xml) +ENDIF(USE_BUILD_LIBS) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake ${CMAKE_CURRENT_SOURCE_DIR}/include/configCommandDbus.h ) + FIND_PACKAGE(DBUS REQUIRED) INCLUDE_DIRECTORIES( @@ -73,9 +85,16 @@ INSTALL(TARGETS PluginCommandInterfaceDbus COMPONENT sampleplugins ) -execute_process( - COMMAND mkdir -p "${CMAKE_SOURCE_DIR}/bin" - COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${INCLUDE_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/CommandInterface.xml + DESTINATION "${COMMAND_DBUS_INTROSPECTION_FOLDER}" + COMPONENT sampleplugins +) + +IF(USE_BUILD_LIBS) + execute_process( + COMMAND mkdir -p "${CMAKE_SOURCE_DIR}/bin" + COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${INCLUDE_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml) +ENDIF(USE_BUILD_LIBS) SET(ADD_DEPEND "audiomanager-bin" "dlt" "libdbus-1-3(>=1.2.16)") set_property(GLOBAL APPEND PROPERTY sampleplugins_prop "${ADD_DEPEND}") diff --git a/PluginCommandInterfaceDbus/cmake/config.cmake b/PluginCommandInterfaceDbus/cmake/config.cmake new file mode 100644 index 0000000..35c9aeb --- /dev/null +++ b/PluginCommandInterfaceDbus/cmake/config.cmake @@ -0,0 +1,6 @@ +#ifndef _COMMANDDBUS_CONFIG_H +#define _COMMANDDBUS_CONFIG_H + +#cmakedefine COMMAND_DBUS_INTROSPECTION_FILE "@COMMAND_DBUS_INTROSPECTION_FILE@" + +#endif /* _COMMANDDBUS_CONFIG_H */ diff --git a/PluginCommandInterfaceDbus/include/configCommandDbus.h b/PluginCommandInterfaceDbus/include/configCommandDbus.h new file mode 100644 index 0000000..685d911 --- /dev/null +++ b/PluginCommandInterfaceDbus/include/configCommandDbus.h @@ -0,0 +1,6 @@ +#ifndef _COMMANDDBUS_CONFIG_H +#define _COMMANDDBUS_CONFIG_H + +#define COMMAND_DBUS_INTROSPECTION_FILE "/usr/share/audiomanager/CommandInterface.xml" + +#endif /* _COMMANDDBUS_CONFIG_H */ diff --git a/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp b/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp index 2b411b3..7322b99 100644 --- a/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp +++ b/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp @@ -23,6 +23,7 @@ #include "audiomanagertypes.h" #include "CAmCommandSenderDbus.h" #include "shared/CAmDltWrapper.h" +#include "configCommandDbus.h" using namespace am; @@ -344,8 +345,7 @@ void IAmCommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessa // create a reply from the message reply = dbus_message_new_method_return(msg); - std::string fullpath(EXECUTABLE_OUTPUT_PATH); - fullpath.append("/CommandInterface.xml"); + std::string fullpath(COMMAND_DBUS_INTROSPECTION_FILE); std::ifstream in(fullpath.c_str(), std::ifstream::in); if (!in) { -- cgit v1.2.1