diff --git a/CMakeLists.txt b/CMakeLists.txt index 81ef667787cfa4678ac7acdb0f8193f5e554251c..92efe9794cfcd22f70dd4bbd7771169c51ebd37d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,11 @@ IF(NOT CLIENT_ONLY) PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME}) + INSTALL(FILES cmake-modules/gepetto-viewer-corba-plugin.cmake + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake/ + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE) + SET(PKG_CONFIG_EXTRA "${PKG_CONFIG_EXTRA}\ncmake_plugin=${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake/gepetto-viewer-corba-plugin.cmake") + INCLUDE_DIRECTORIES(SYSTEM ${EIGEN3_INCLUDE_DIRS} ${QT_INCLUDE_DIRS}) SET (${PROJECT_NAME}_HEADERS_MOC diff --git a/cmake-modules/gepetto-viewer-corba-plugin.cmake b/cmake-modules/gepetto-viewer-corba-plugin.cmake new file mode 100644 index 0000000000000000000000000000000000000000..869a96fc86fa9fa87fb87435d315338e6d86d520 --- /dev/null +++ b/cmake-modules/gepetto-viewer-corba-plugin.cmake @@ -0,0 +1,80 @@ +# Copyright (c) 2018 CNRS +# Authors: Joseph Mirabel +# +# +# This file is part of gepetto-viewer-corba +# gepetto-viewer-corba is free software: you can redistribute it +# and/or modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, either version +# 3 of the License, or (at your option) any later version. +# +# gepetto-viewer-corba is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Lesser Public License for more details. You should have +# received a copy of the GNU Lesser General Public License along with +# gepetto-viewer-corba If not, see +# <http://www.gnu.org/licenses/>. + +MACRO(GEPETTO_GUI_PLUGIN PLUGIN_NAME) + + SET(options QT4 INSIDE_GEPETTO_VIEWER_CORBA) + SET(oneValueArgs ) + SET(multiValueArgs + HEADERS + HEADERS_NO_MOC + FORMS + RESOURCES + SOURCES + LINK_DEPENDENCIES + PKG_CONFIG_DEPENDENCIES) + CMAKE_PARSE_ARGUMENTS(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + IF(PLUGIN_QT4) + IF(PLUGIN_INSIDE_GEPETTO_VIEWER_CORBA) + QT4_WRAP_CPP(PLUGIN_HEADERS_MOC ${PLUGIN_HEADERS}) + ELSE() + QT4_WRAP_CPP(PLUGIN_HEADERS_MOC ${PLUGIN_HEADERS} OPTIONS -I${GEPETTO_VIEWER_CORBA_INCLUDEDIR}) + ENDIF() + QT4_WRAP_UI(PLUGIN_FORMS_HEADERS ${PLUGIN_FORMS}) + QT4_ADD_RESOURCES(PLUGIN_RESOURCES_RCC ${PLUGIN_RESOURCES}) + INCLUDE(${QT_USE_FILE}) + ELSE() + IF(PLUGIN_INSIDE_GEPETTO_VIEWER_CORBA) + QT5_WRAP_CPP(PLUGIN_HEADERS_MOC ${PLUGIN_HEADERS}) + ELSE() + QT5_WRAP_CPP(PLUGIN_HEADERS_MOC ${PLUGIN_HEADERS} OPTIONS -I${GEPETTO_VIEWER_CORBA_INCLUDEDIR}) + ENDIF() + QT5_WRAP_UI(PLUGIN_FORMS_HEADERS ${PLUGIN_FORMS}) + QT5_ADD_RESOURCES(PLUGIN_RESOURCES_RCC ${PLUGIN_RESOURCES}) + ENDIF() + + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + INCLUDE(${QT_USE_FILE}) + ADD_DEFINITIONS(${QT_DEFINITIONS} + -DQT_PLUGIN + -DQT_NO_DEBUG + -DQT_SHARED) + + IF(APPLE) + SET(CMAKE_MACOSX_RPATH TRUE) + ENDIF(APPLE) + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/gepetto-gui-plugins") + + ADD_LIBRARY(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES} + ${PLUGIN_HEADERS_NO_MOC} + ${PLUGIN_HEADERS_MOC} + ${PLUGIN_FORMS_HEADERS} + ${PLUGIN_RESOURCES_RCC} + ) + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") + + TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${QT_LIBRARIES} ${PLUGIN_LINK_DEPENDENCIES}) + FOREACH(DEP ${PLUGIN_PKG_CONFIG_DEPENDENCIES}) + PKG_CONFIG_USE_DEPENDENCY(${PLUGIN_NAME} ${DEP}) + ENDFOREACH() + + # Uncomment to install + INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION lib/gepetto-gui-plugins) +ENDMACRO() diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index d8ced0d8cebf97fa129a970e979d181dcfe11102..ee7f0d2488e026d98115b405f2c8ee3c9c3e8f81 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -17,6 +17,8 @@ # gepetto-viewer-corba If not, see # <http://www.gnu.org/licenses/>. +INCLUDE(gepetto-viewer-corba-plugin) + #ADD_SUBDIRECTORY(plugin-skeleton) IF(PYTHONQT_FOUND)