From b21e8bfbb401806cfe38f30d9ff251dc5b518a53 2017-06-28 13:34:34 From: perrinel Date: 2017-06-28 13:34:34 Subject: [PATCH] Merge pull request #163 from SCIQLOP-Initialisation develop Develop --- diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index ad0effb..251e0a7 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -66,7 +66,12 @@ set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) target_link_libraries(${EXECUTABLE_NAME} ${LIBRARIES}) - + +INSTALL(TARGETS ${EXECUTABLE_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_BINARY_DIR} + ARCHIVE DESTINATION ${INSTALL_BINARY_DIR} +) # Link with Qt5 modules qt5_use_modules(${EXECUTABLE_NAME} Core Widgets) diff --git a/app/src/Main.cpp b/app/src/Main.cpp index 1533e01..9a79cbc 100644 --- a/app/src/Main.cpp +++ b/app/src/Main.cpp @@ -31,8 +31,19 @@ namespace { /// Name of the directory containing the plugins + +#if _WIN32 || _WIN64 const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); +#endif + +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENVIRONMENT64 +#else +#define ENVIRONMENT32 +#endif +#endif } // namespace int main(int argc, char *argv[]) @@ -46,9 +57,19 @@ int main(int argc, char *argv[]) // Loads plugins auto pluginDir = QDir{sqpApp->applicationDirPath()}; +#if _WIN32 || _WIN64 pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); pluginDir.cd(PLUGIN_DIRECTORY_NAME); +#endif + +#if __GNUC__ +#if __x86_64__ || __ppc64__ + pluginDir.cd("../lib64/SciQlop"); +#else + pluginDir.cd("../lib/SciQlop"); +#endif +#endif qCDebug(LOG_PluginManager()) << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath()); diff --git a/cmake/sciqlop_applications.cmake b/cmake/sciqlop_applications.cmake index 1c47446..9c5ecde 100644 --- a/cmake/sciqlop_applications.cmake +++ b/cmake/sciqlop_applications.cmake @@ -1,17 +1,3 @@ -# -# Sciqlop_modules.cmake -# -# Set ouptut directories -# -SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) -SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) -IF (UNIX) - SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) -ELSEIF(WIN32) - SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/app/QtProject) -ELSE() - SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) -ENDIF() if(BUILD_TESTS) INCLUDE ("cmake/sciqlop_code_coverage.cmake") diff --git a/cmake/sciqlop_params.cmake b/cmake/sciqlop_params.cmake index 237ae58..82ec488 100644 --- a/cmake/sciqlop_params.cmake +++ b/cmake/sciqlop_params.cmake @@ -44,6 +44,30 @@ else() set(libRootDirForceValue) endif() +# +# Sciqlop_modules.cmake +# +# Set ouptut directories +# +IF (UNIX) + # 32 or 64 bits compiler + IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + SET(defaultLib "lib64/sciqlop") + ELSE() + SET(defaultLib "lib/sciqlop") + ENDIF() + SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) + SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) + SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${defaultLib}) +ELSEIF(WIN32) + SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) + SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) + SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/app/QtProject) +ELSE() + SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) + SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) + SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) +ENDIF() # @@ -54,33 +78,51 @@ OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON) # Generate position independant code (-fPIC) SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) -# -# Configure installation directories -# + + +# Configuration for make install + +set(PROJECT_PLUGIN_PREFIX "SciQlop") + IF (UNIX) + SET(CMAKE_INSTALL_PREFIX "/usr/local/${PROJECT_PLUGIN_PREFIX}") SET(defaultBin "bin") SET(defaultInc "include/sciqlop") # 32 or 64 bits compiler IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - SET(defaultLib "lib64/sciqlop") + SET(defaultLib "lib64") + SET(defaultPluginsLib "lib64/${PROJECT_PLUGIN_PREFIX}") ELSE() - SET(defaultLib "lib/sciqlop") + SET(defaultLib "lib/") + SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}") ENDIF() - SET(defaultDoc "share/docs/sciqlop") + SET(defaultDoc "share/docs/${PROJECT_PLUGIN_PREFIX}") ELSE() SET(defaultBin "bin") - SET(defaultInc "include/sciqlop") - SET(defaultLib "lib/sciqlop") - SET(defaultDoc "docs/sciqlop") + SET(defaultInc "include/${PROJECT_PLUGIN_PREFIX}") + SET(defaultLib "lib") + SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}") + SET(defaultDoc "docs/${PROJECT_PLUGIN_PREFIX}") ENDIF() SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING "Installation directory for binaries") SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING "Installation directory for libraries") +SET(INSTALL_PLUGINS_LIBRARY_DIR "${defaultPluginsLib}" CACHE STRING + "Installation directory for libraries") SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING "Installation directory for headers") SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING "Installation directory for documentations") + + +# Set the rpath when installing +SET(CMAKE_SKIP_BUILD_RPATH FALSE) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}") +SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +message("Install RPATH: ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 0263499..90fcc84 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -40,7 +40,13 @@ set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) - + +INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} +) + # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets diff --git a/core/src/DataSource/DataSourceItemAction.cpp b/core/src/DataSource/DataSourceItemAction.cpp index e791e8f..1677091 100644 --- a/core/src/DataSource/DataSourceItemAction.cpp +++ b/core/src/DataSource/DataSourceItemAction.cpp @@ -1,5 +1,7 @@ #include +#include + Q_LOGGING_CATEGORY(LOG_DataSourceItemAction, "DataSourceItemAction") struct DataSourceItemAction::DataSourceItemActionPrivate { diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index a65ba0b..dab081d 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -67,6 +67,12 @@ set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES}) qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport) + +INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} +) add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt index cbb3d24..a33496c 100644 --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -19,6 +19,12 @@ FILE (GLOB_RECURSE MODULE_SOURCES ADD_LIBRARY(${SQPPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES}) +INSTALL(TARGETS ${SQPPLUGIN_LIBRARY_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} +) + # Add the files to the list of files to be analyzed LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) diff --git a/plugins/mockplugin/CMakeLists.txt b/plugins/mockplugin/CMakeLists.txt index 916ee86..a918c67 100644 --- a/plugins/mockplugin/CMakeLists.txt +++ b/plugins/mockplugin/CMakeLists.txt @@ -49,6 +49,13 @@ ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES}) set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +INSTALL(TARGETS ${SQPMOCKPLUGIN_LIBRARY_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} + ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} +) + + TARGET_LINK_LIBRARIES(${SQPMOCKPLUGIN_LIBRARY_NAME} ${LIBRARIES}) qt5_use_modules(${SQPMOCKPLUGIN_LIBRARY_NAME} Core Widgets)