From e90cf53c6f760aadb65f583aa8eb84f6b9cb7344 Mon Sep 17 00:00:00 2001 From: Stefan Persson Date: Tue, 8 Mar 2011 09:33:33 +0000 Subject: [PATCH] CMake-files updated for installation of Telldus Center on Linux --- telldus-gui/CMakeLists.txt | 3 +++ telldus-gui/Plugins/TelldusCenterPlugin.cmake | 13 +++++++++---- telldus-gui/TelldusCenter/CMakeLists.txt | 7 ++++++- .../TelldusCenter/tellduscenterapplication.cpp | 14 +++++++++++--- telldus-gui/TelldusGui/CMakeLists.txt | 10 +++++----- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/telldus-gui/CMakeLists.txt b/telldus-gui/CMakeLists.txt index c3b2e01b..b36a4be5 100644 --- a/telldus-gui/CMakeLists.txt +++ b/telldus-gui/CMakeLists.txt @@ -25,6 +25,9 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") IF (WIN32) SET(TELLDUSCORE_INCLUDE_DIR "" CACHE PATH "Path to the directory which contains telldus-core.h") +ELSEIF(UNIX) + SET(PLUGIN_LIB_PATH "lib" CACHE STRING "Relative path to the directory to install TelldusCenter plugin libraries into") + SET(PLUGIN_LIB_FULL_PATH "${PLUGIN_LIB_PATH}/telldus/tellduscenter/plugins") ENDIF (WIN32) if(BUILD_LIBTELLDUS-GUI) diff --git a/telldus-gui/Plugins/TelldusCenterPlugin.cmake b/telldus-gui/Plugins/TelldusCenterPlugin.cmake index ebbc6b75..7647675c 100644 --- a/telldus-gui/Plugins/TelldusCenterPlugin.cmake +++ b/telldus-gui/Plugins/TelldusCenterPlugin.cmake @@ -35,14 +35,14 @@ SET(translation_sources ${Plugin_SRCS}) IF(Plugin_PATH) STRING(REPLACE "." "/" - path ${Plugin_PATH} + Plugin_PATH_relative ${Plugin_PATH} ) IF (APPLE) - SET(Plugin_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/TelldusCenter.app/Contents/Plugins/script/${path}") + SET(Plugin_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/TelldusCenter.app/Contents/Plugins/script/${Plugin_PATH_relative}") ELSEIF (WIN32) - SET(Plugin_PATH "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Plugins/script/${path}") + SET(Plugin_PATH "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Plugins/script/${Plugin_PATH_relative}") ELSE (APPLE) - SET(Plugin_PATH "${CMAKE_BINARY_DIR}/TelldusCenter/Plugins/script/${path}") + SET(Plugin_PATH "${CMAKE_BINARY_DIR}/TelldusCenter/Plugins/script/${Plugin_PATH_relative}") ENDIF (APPLE) LIST(APPEND translation_sources @@ -89,6 +89,9 @@ IF(Plugin_SRCS) SET_TARGET_PROPERTIES(${Plugin_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TelldusCenter/Plugins/script ) + INSTALL(TARGETS ${Plugin_NAME} + LIBRARY DESTINATION "${PLUGIN_LIB_FULL_PATH}/script" + ) ENDIF (APPLE) ELSE(Plugin_SRCS) ADD_CUSTOM_TARGET(${Plugin_NAME} ALL @@ -109,6 +112,8 @@ IF(Plugin_PATH) COMMAND ${CMAKE_COMMAND} -E copy ${_FILE} ${Plugin_PATH} COMMENT "Copy ${_FILENAME} for plugin ${Plugin_NAME}" ) + INSTALL(FILES ${_FILE} DESTINATION "${PLUGIN_LIB_FULL_PATH}/script/${Plugin_PATH_relative}") ENDFOREACH(_FILE) ENDIF(Plugin_PATH) + diff --git a/telldus-gui/TelldusCenter/CMakeLists.txt b/telldus-gui/TelldusCenter/CMakeLists.txt index 17e786c9..7e20732b 100644 --- a/telldus-gui/TelldusCenter/CMakeLists.txt +++ b/telldus-gui/TelldusCenter/CMakeLists.txt @@ -6,6 +6,7 @@ INCLUDE( ${QT_USE_FILE} ) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) + cmake_policy(SET CMP0005 NEW) endif(COMMAND cmake_policy) ######## Non configurable options ######## @@ -99,7 +100,7 @@ ELSEIF (WIN32) #### Windows #### ${CMAKE_CURRENT_BINARY_DIR}/TelldusCenter.rc ) ELSE (APPLE) #### Linux #### - + ADD_DEFINITIONS( -DPLUGIN_LIB_PATH=${CMAKE_INSTALL_PREFIX}/${PLUGIN_LIB_FULL_PATH} ) ENDIF (APPLE) ######## QtSingleApplication ######## @@ -158,3 +159,7 @@ IF (APPLE) ) ENDIF (APPLE) +INSTALL(TARGETS ${telldus-center_TARGET} + RUNTIME DESTINATION bin +) + diff --git a/telldus-gui/TelldusCenter/tellduscenterapplication.cpp b/telldus-gui/TelldusCenter/tellduscenterapplication.cpp index 79e412ce..270ac015 100644 --- a/telldus-gui/TelldusCenter/tellduscenterapplication.cpp +++ b/telldus-gui/TelldusCenter/tellduscenterapplication.cpp @@ -11,6 +11,9 @@ #include "plugintree.h" #include "scriptenvironment.h" +#define DEFINE_STRING_HELPER(X) #X +#define DEFINE_STRING(X) DEFINE_STRING_HELPER(X) + class TelldusCenterPlugin; typedef QList PluginList; @@ -95,12 +98,17 @@ void TelldusCenterApplication::loadPlugins() { pluginsDir.cdUp(); } #endif - if (!pluginsDir.cd("Plugins")) { - return; + + if (pluginsDir.cd("Plugins")) { + this->setLibraryPaths( QStringList(pluginsDir.absolutePath()) ); } - this->setLibraryPaths( QStringList(pluginsDir.absolutePath()) ); +#if defined(Q_OS_UNIX) + QStringList paths = QStringList() << DEFINE_STRING(PLUGIN_LIB_PATH); + this->setLibraryPaths( paths ); +#endif + QScriptValue mainWindowObject = d->scriptEnvironment->engine()->newQObject(d->mainWindow); d->scriptEnvironment->engine()->globalObject().property("application").setProperty("mainwindow", mainWindowObject); diff --git a/telldus-gui/TelldusGui/CMakeLists.txt b/telldus-gui/TelldusGui/CMakeLists.txt index 1878f679..f1fba39d 100644 --- a/telldus-gui/TelldusGui/CMakeLists.txt +++ b/telldus-gui/TelldusGui/CMakeLists.txt @@ -142,9 +142,9 @@ TARGET_LINK_LIBRARIES( ${telldus-gui_TARGET} ${telldus-gui_LIBRARIES} ) SET_PROPERTY(TARGET ${telldus-gui_TARGET} PROPERTY FRAMEWORK TRUE ) -SET_PROPERTY(TARGET ${telldus-gui_TARGET} - PROPERTY PUBLIC_HEADER ${telldus-gui_HDRS} -) +#SET_PROPERTY(TARGET ${telldus-gui_TARGET} +# PROPERTY PUBLIC_HEADER ${telldus-gui_HDRS} +#) SET_PROPERTY(TARGET ${telldus-gui_TARGET} PROPERTY VERSION ${PACKAGE_VERSION} @@ -154,6 +154,6 @@ SET_PROPERTY(TARGET ${telldus-gui_TARGET} ) INSTALL(TARGETS ${telldus-gui_TARGET} - DESTINATION lib + LIBRARY DESTINATION lib # PUBLIC_HEADER DESTINATION ${HEADER_DIR} - ) +)