##// END OF EJS Templates
Configuration update to permit make install on linux
perrinel -
r257:40b3607afb8e
parent child
Show More
@@ -1,152 +1,157
1 1
2 2 ## sciqlop - CMakeLists.txt
3 3 SET(EXECUTABLE_NAME "sciqlop")
4 4 SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME)
5 5 SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
6 6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
7 7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
8 8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
9 9
10 10 # Include gui directory
11 11 include_directories("${INCLUDES_DIR}")
12 12
13 13 #
14 14 # Find Qt modules
15 15 #
16 16 SCIQLOP_FIND_QT(Core Widgets)
17 17
18 18
19 19 #
20 20 # Find dependent libraries
21 21 # ========================
22 22 find_package(sciqlop-gui)
23 23
24 24 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
25 25 SET(EXTERN_SHARED_LIBRARIES)
26 26
27 27 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
28 28
29 29 # Add sqpcore to the list of libraries to use
30 30 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
31 31
32 32 # Include core directory
33 33 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
34 34
35 35 # Add dependent shared libraries
36 36 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
37 37
38 38 # Retrieve the location of the dynamic library to copy it to the output path
39 39 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
40 40 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
41 41
42 42 # Ui files
43 43 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
44 44
45 45 #
46 46 # Compile the application
47 47 #
48 48 FILE (GLOB_RECURSE APPLICATION_SOURCES
49 49 ${INCLUDES_DIR}/*.h
50 50 ${SOURCES_DIR}/*.c
51 51 ${SOURCES_DIR}/*.cpp
52 52 ${SOURCES_DIR}/*.h
53 53 ${PROJECT_FORMS})
54 54
55 55 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
56 56
57 57 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
58 58
59 59 QT5_WRAP_UI(UIS_HDRS
60 60 ${PROJECT_FORMS}
61 61 )
62 62
63 63
64 64 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
65 65 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
66 66 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
67 67 target_link_libraries(${EXECUTABLE_NAME}
68 68 ${LIBRARIES})
69
69
70 INSTALL(TARGETS ${EXECUTABLE_NAME}
71 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
72 LIBRARY DESTINATION ${INSTALL_BINARY_DIR}
73 ARCHIVE DESTINATION ${INSTALL_BINARY_DIR}
74 )
70 75 # Link with Qt5 modules
71 76 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
72 77
73 78
74 79 add_dependencies(${EXECUTABLE_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
75 80
76 81
77 82
78 83 # Add the files to the list of files to be analyzed
79 84 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
80 85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
81 86 # Vera++ exclusion files
82 87 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
83 88 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
84 89
85 90 #
86 91 # Compile the tests
87 92 #
88 93 IF(BUILD_TESTS)
89 94
90 95 INCLUDE_DIRECTORIES(${SOURCES_DIR})
91 96 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
92 97 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
93 98 SET( TEST_LIBRARIES ${LIBRARIES})
94 99
95 100 FOREACH( testFile ${TESTS_SOURCES} )
96 101 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
97 102 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
98 103
99 104 # Add to the list of sources files all the sources in the same
100 105 # directory that aren't another test
101 106 FILE (GLOB currentTestSources
102 107 ${testDirectory}/*.c
103 108 ${testDirectory}/*.cpp
104 109 ${testDirectory}/*.h)
105 110 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
106 111 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
107 112
108 113 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
109 114 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
110 115 qt5_use_modules(${testName} Test)
111 116
112 117 ADD_TEST( NAME ${testName} COMMAND ${testName} )
113 118
114 119 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
115 120 ENDFOREACH( testFile )
116 121
117 122 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
118 123 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
119 124 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
120 125
121 126 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
122 127 ENDIF(BUILD_TESTS)
123 128
124 129 #
125 130 # Set the files that must be formatted by clang-format.
126 131 #
127 132 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
128 133 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
129 134
130 135 #
131 136 # Set the directories that doxygen must browse to generate the
132 137 # documentation.
133 138 #
134 139 # Source directories:
135 140 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
136 141 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
137 142 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
138 143 # Source directories to exclude from the documentation generation
139 144 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
140 145 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
141 146
142 147 #
143 148 # Set the directories with the sources to analyze and propagate the
144 149 # modification to the parent scope
145 150 #
146 151 # Source directories to analyze:
147 152 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
148 153 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
149 154 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
150 155 # Source directories to exclude from the analysis
151 156 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
152 157 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,59 +1,80
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the QLop Software
3 3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "MainWindow.h"
23 23 #include <QProcessEnvironment>
24 24 #include <QThread>
25 25 #include <SqpApplication.h>
26 26 #include <qglobal.h>
27 27
28 28 #include <Plugin/PluginManager.h>
29 29 #include <QDir>
30 30
31 31 namespace {
32 32
33 33 /// Name of the directory containing the plugins
34
35 #if _WIN32 || _WIN64
34 36 const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins");
37 #endif
38
35 39
40 #if __GNUC__
41 #if __x86_64__ || __ppc64__
42 #define ENVIRONMENT64
43 #else
44 #define ENVIRONMENT32
45 #endif
46 #endif
36 47 } // namespace
37 48
38 49 int main(int argc, char *argv[])
39 50 {
40 51 SqpApplication a{argc, argv};
41 52 SqpApplication::setOrganizationName("LPP");
42 53 SqpApplication::setOrganizationDomain("lpp.fr");
43 54 SqpApplication::setApplicationName("SciQLop");
44 55 MainWindow w;
45 56 w.show();
46 57
47 58 // Loads plugins
48 59 auto pluginDir = QDir{sqpApp->applicationDirPath()};
60 #if _WIN32 || _WIN64
49 61 pluginDir.mkdir(PLUGIN_DIRECTORY_NAME);
50 62 pluginDir.cd(PLUGIN_DIRECTORY_NAME);
63 #endif
64
51 65
66 #if __GNUC__
67 #if __x86_64__ || __ppc64__
68 pluginDir.cd("../lib64/SciQlop");
69 #else
70 pluginDir.cd("../lib/SciQlop");
71 #endif
72 #endif
52 73 qCDebug(LOG_PluginManager())
53 74 << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath());
54 75
55 76 PluginManager pluginManager{};
56 77 pluginManager.loadPlugins(pluginDir);
57 78
58 79 return a.exec();
59 80 }
@@ -1,67 +1,53
1 #
2 # Sciqlop_modules.cmake
3 #
4 # Set ouptut directories
5 #
6 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
7 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
8 IF (UNIX)
9 SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject)
10 ELSEIF(WIN32)
11 SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/app/QtProject)
12 ELSE()
13 SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
14 ENDIF()
15 1
16 2 if(BUILD_TESTS)
17 3 INCLUDE ("cmake/sciqlop_code_coverage.cmake")
18 4 APPEND_COVERAGE_COMPILER_FLAGS()
19 5 endif(BUILD_TESTS)
20 6
21 7 #
22 8 # Compile the diffents modules
23 9 #
24 10 set(sciqlop-plugin_DIR "${CMAKE_SOURCE_DIR}/plugin/cmake")
25 11 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-plugin_DIR}")
26 12 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/plugin")
27 13
28 14 set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake")
29 15 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_DIR}")
30 16 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/core")
31 17
32 18 set(sciqlop-gui_DIR "${CMAKE_SOURCE_DIR}/gui/cmake")
33 19 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-gui_DIR}")
34 20 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/gui")
35 21
36 22 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/app")
37 23
38 24 OPTION (BUILD_PLUGINS "Build the plugins" OFF)
39 25 IF(BUILD_PLUGINS)
40 26 set(sciqlop-mockplugin_DIR "${CMAKE_SOURCE_DIR}/plugins/mockplugin/cmake")
41 27 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-mockplugin_DIR}")
42 28 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/plugins/mockplugin")
43 29 ENDIF(BUILD_PLUGINS)
44 30
45 31 # LOGGER
46 32 set(QTLOGGING_INI_FILE "${CMAKE_SOURCE_DIR}/config/QtProject/qtlogging.ini")
47 33 FILE(COPY ${QTLOGGING_INI_FILE} DESTINATION ${CONFIG_OUTPUT_PATH})
48 34
49 35
50 36 #
51 37 # Code formatting
52 38 #
53 39 # Vera++ exclusion files
54 40 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/formatting/vera-exclusions/exclusions.txt)
55 41 #SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
56 42 INCLUDE ("cmake/sciqlop_formatting.cmake")
57 43
58 44 #
59 45 # Documentation generation
60 46 #
61 47 INCLUDE ("cmake/sciqlop_doxygen.cmake")
62 48
63 49 #
64 50 # Source code analysis
65 51 #
66 52 INCLUDE ("cmake/sciqlop_code_analysis.cmake")
67 53 INCLUDE ("cmake/sciqlop_code_cppcheck.cmake")
@@ -1,86 +1,128
1 1 #
2 2 # sciqlop_params : Define compilation parameters
3 3 #
4 4 # Debug or release
5 5 #
6 6 # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice
7 7 #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode")
8 8
9 9 IF(CMAKE_BUILD_TYPE MATCHES "Debug")
10 10 SET (DEBUG_SUFFIX "d")
11 11 ELSE()
12 12 MESSAGE (STATUS "Build in Release")
13 13 SET (DEBUG_SUFFIX "")
14 14 ENDIF()
15 15
16 16 #
17 17 # Need to compile tests?
18 18 #
19 19 OPTION (BUILD_TESTS "Build the tests" OFF)
20 20 ENABLE_TESTING(${BUILD_TESTS})
21 21
22 22 #
23 23 # Path to the folder for sciqlop's extern libraries.
24 24 #
25 25 # When looking for an external library in sciqlop, we look to the following
26 26 # folders:
27 27 # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR
28 28 # - The global Sciqlop extern folder
29 29 # - The system folders.
30 30 #
31 31 # If a dependency is found in the global extern folder or a specific folder for
32 32 # the library, then it is installed with the sciqlop libraries. If it is found
33 33 # in the system folders, it is not. This behavior can be overriden with the
34 34 # <LIBRARY>_COPY_SHARED_LIBRARIES flag.
35 35 #
36 36 set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern"
37 37 CACHE PATH "Path to the folder for sciqlop's extern libraries")
38 38 option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder"
39 39 OFF)
40 40
41 41 if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR)
42 42 set(libRootDirForceValue FORCE)
43 43 else()
44 44 set(libRootDirForceValue)
45 45 endif()
46 46
47 #
48 # Sciqlop_modules.cmake
49 #
50 # Set ouptut directories
51 #
52 IF (UNIX)
53 # 32 or 64 bits compiler
54 IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
55 SET(defaultLib "lib64/sciqlop")
56 ELSE()
57 SET(defaultLib "lib/sciqlop")
58 ENDIF()
59 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
60 SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject)
61 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${defaultLib})
62 ELSEIF(WIN32)
63 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
64 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
65 SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/app/QtProject)
66 ELSE()
67 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
68 SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject)
69 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist)
70 ENDIF()
47 71
48 72
49 73 #
50 74 # Static or shared libraries
51 75 #
52 76 OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON)
53 77
54 78 # Generate position independant code (-fPIC)
55 79 SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
56 80
57 #
58 # Configure installation directories
59 #
81
82
83 # Configuration for make install
84
85 set(PROJECT_PLUGIN_PREFIX "SciQlop")
86
60 87 IF (UNIX)
88 SET(CMAKE_INSTALL_PREFIX "/usr/local/${PROJECT_PLUGIN_PREFIX}")
61 89 SET(defaultBin "bin")
62 90 SET(defaultInc "include/sciqlop")
63 91
64 92 # 32 or 64 bits compiler
65 93 IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
66 SET(defaultLib "lib64/sciqlop")
94 SET(defaultLib "lib64")
95 SET(defaultPluginsLib "lib64/${PROJECT_PLUGIN_PREFIX}")
67 96 ELSE()
68 SET(defaultLib "lib/sciqlop")
97 SET(defaultLib "lib/")
98 SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}")
69 99 ENDIF()
70 100
71 SET(defaultDoc "share/docs/sciqlop")
101 SET(defaultDoc "share/docs/${PROJECT_PLUGIN_PREFIX}")
72 102 ELSE()
73 103 SET(defaultBin "bin")
74 SET(defaultInc "include/sciqlop")
75 SET(defaultLib "lib/sciqlop")
76 SET(defaultDoc "docs/sciqlop")
104 SET(defaultInc "include/${PROJECT_PLUGIN_PREFIX}")
105 SET(defaultLib "lib")
106 SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}")
107 SET(defaultDoc "docs/${PROJECT_PLUGIN_PREFIX}")
77 108 ENDIF()
78 109
79 110 SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING
80 111 "Installation directory for binaries")
81 112 SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING
82 113 "Installation directory for libraries")
114 SET(INSTALL_PLUGINS_LIBRARY_DIR "${defaultPluginsLib}" CACHE STRING
115 "Installation directory for libraries")
83 116 SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING
84 117 "Installation directory for headers")
85 118 SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING
86 119 "Installation directory for documentations")
120
121
122 # Set the rpath when installing
123 SET(CMAKE_SKIP_BUILD_RPATH FALSE)
124 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
125 SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}")
126 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
127
128 message("Install RPATH: ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}")
@@ -1,147 +1,153
1 1
2 2 ## core - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6 6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
7 7
8 8 # Include core directory
9 9 include_directories("${INCLUDES_DIR}")
10 10
11 11 # Set a variable to display a warning in the version files.
12 12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
13 13 # Generate the version file from the cmake version variables. The version
14 14 # variables are defined in the cmake/sciqlop_version.cmake file.
15 15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
16 16 "${INCLUDES_DIR}/Version.h")
17 17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
18 18 "${SOURCES_DIR}/Version.cpp")
19 19
20 20 # Find dependent modules
21 21 find_package(sciqlop-plugin)
22 22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23 23
24 24 #
25 25 # Find Qt modules
26 26 #
27 27 SCIQLOP_FIND_QT(Core)
28 28
29 29 #
30 30 # Compile the library library
31 31 #
32 32 FILE (GLOB_RECURSE MODULE_SOURCES
33 33 ${INCLUDES_DIR}/*.h
34 34 ${SOURCES_DIR}/*.c
35 35 ${SOURCES_DIR}/*.cpp
36 36 ${SOURCES_DIR}/*.h)
37 37
38 38 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
39 39 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
40 40 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
41 41 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
42 42 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
43
43
44 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
45 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
46 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
47 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
48 )
49
44 50 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
45 51 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
46 52 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
47 53 IF(BUILD_SHARED_LIBS)
48 54 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
49 55 ELSE()
50 56 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
51 57 ENDIF()
52 58
53 59 # Set the variable to parent scope so that the other projects can copy the
54 60 # dependent shared libraries
55 61 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
56 62
57 63 # Copy extern shared libraries to the lib folder
58 64 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
59 65
60 66 # Add the files to the list of files to be analyzed
61 67 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
62 68 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
63 69 # Vera++ exclusion files
64 70 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
65 71 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
66 72
67 73 #
68 74 # Compile the tests
69 75 #
70 76 IF(BUILD_TESTS)
71 77 INCLUDE_DIRECTORIES(${SOURCES_DIR})
72 78 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
73 79 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
74 80 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
75 81
76 82 SET(TARGETS_COV)
77 83 FOREACH( testFile ${TESTS_SOURCES} )
78 84 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
79 85 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
80 86
81 87 # Add to the list of sources files all the sources in the same
82 88 # directory that aren't another test
83 89 FILE (GLOB currentTestSources
84 90 ${testDirectory}/*.c
85 91 ${testDirectory}/*.cpp
86 92 ${testDirectory}/*.h)
87 93 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
88 94 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
89 95
90 96 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
91 97 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
92 98 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
93 99 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
94 100 qt5_use_modules(${testName} Test)
95 101
96 102 ADD_TEST( NAME ${testName} COMMAND ${testName} )
97 103
98 104 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
99 105 set(Coverage_NAME ${testName})
100 106 if(UNIX)
101 107 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
102 108 LIST( APPEND TARGETS_COV ${testName}_coverage)
103 109 endif(UNIX)
104 110
105 111 ENDFOREACH( testFile )
106 112
107 113 add_custom_target(coverage)
108 114
109 115 FOREACH( target_cov ${TARGETS_COV} )
110 116 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
111 117 ENDFOREACH( target_cov )
112 118
113 119 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
114 120 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
115 121 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
116 122 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
117 123 ENDIF(BUILD_TESTS)
118 124
119 125 #
120 126 # Set the files that must be formatted by clang-format.
121 127 #
122 128 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
123 129 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
124 130
125 131 #
126 132 # Set the directories that doxygen must browse to generate the
127 133 # documentation.
128 134 #
129 135 # Source directories:
130 136 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
131 137 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
132 138 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
133 139 # Source directories to exclude from the documentation generation
134 140 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
135 141 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
136 142
137 143 #
138 144 # Set the directories with the sources to analyze and propagate the
139 145 # modification to the parent scope
140 146 #
141 147 # Source directories to analyze:
142 148 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
143 149 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
144 150 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
145 151 # Source directories to exclude from the analysis
146 152 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
147 153 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,42 +1,44
1 1 #include <DataSource/DataSourceItemAction.h>
2 2
3 #include <functional>
4
3 5 Q_LOGGING_CATEGORY(LOG_DataSourceItemAction, "DataSourceItemAction")
4 6
5 7 struct DataSourceItemAction::DataSourceItemActionPrivate {
6 8 explicit DataSourceItemActionPrivate(const QString &name,
7 9 DataSourceItemAction::ExecuteFunction fun)
8 10 : m_Name{name}, m_Fun{std::move(fun)}, m_DataSourceItem{nullptr}
9 11 {
10 12 }
11 13
12 14 QString m_Name;
13 15 DataSourceItemAction::ExecuteFunction m_Fun;
14 16 /// Item associated to the action (can be null, in which case the action will not be executed)
15 17 DataSourceItem *m_DataSourceItem;
16 18 };
17 19
18 20 DataSourceItemAction::DataSourceItemAction(const QString &name, ExecuteFunction fun)
19 21 : impl{spimpl::make_unique_impl<DataSourceItemActionPrivate>(name, std::move(fun))}
20 22 {
21 23 }
22 24
23 25 QString DataSourceItemAction::name() const noexcept
24 26 {
25 27 return impl->m_Name;
26 28 }
27 29
28 30 void DataSourceItemAction::setDataSourceItem(DataSourceItem *dataSourceItem) noexcept
29 31 {
30 32 impl->m_DataSourceItem = dataSourceItem;
31 33 }
32 34
33 35 void DataSourceItemAction::execute()
34 36 {
35 37 if (impl->m_DataSourceItem) {
36 38 impl->m_Fun(*impl->m_DataSourceItem);
37 39 }
38 40 else {
39 41 qCDebug(LOG_DataSourceItemAction())
40 42 << tr("Can't execute action : no item has been associated");
41 43 }
42 44 }
@@ -1,163 +1,169
1 1
2 2 ## gui - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
5 5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6 6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
7 7 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
8 8 SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
9 9
10 10 # Include gui directory
11 11 include_directories("${INCLUDES_DIR}")
12 12 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
13 13
14 14 # Set a variable to display a warning in the version files.
15 15 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
16 16
17 17 #
18 18 # Find Qt modules
19 19 #
20 20 SCIQLOP_FIND_QT(Core Widgets PrintSupport)
21 21
22 22 #
23 23 # Find dependent libraries
24 24 # ========================
25 25 find_package(sciqlop-core)
26 26
27 27 SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
28 28
29 29 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
30 30
31 31 # Add sqpcore to the list of libraries to use
32 32 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
33 33
34 34 # Add dependent shared libraries
35 35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
36 36
37 37
38 38 # Ui files
39 39 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
40 40
41 41 # Resources files
42 42 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
43 43
44 44 #
45 45 # Compile the library library
46 46 #
47 47 FILE (GLOB_RECURSE MODULE_SOURCES
48 48 ${INCLUDES_DIR}/*.h
49 49 ${SOURCES_DIR}/*.c
50 50 ${SOURCES_DIR}/*.cpp
51 51 ${SOURCES_DIR}/*.h
52 52 ${PROJECT_FORMS})
53 53
54 54 QT5_ADD_RESOURCES(RCC_HDRS
55 55 ${PROJECT_RESOURCES}
56 56 )
57 57
58 58 QT5_WRAP_UI(UIS_HDRS
59 59 ${PROJECT_FORMS}
60 60 )
61 61
62 62
63 63 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
64 64 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
65 65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
66 66
67 67 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
68 68 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
69 69
70
71 INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
72 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
73 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
74 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
75 )
70 76 add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
71 77
72 78
73 79 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
74 80 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
75 81 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
76 82 IF(BUILD_SHARED_LIBS)
77 83 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
78 84 ELSE()
79 85 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
80 86 ENDIF()
81 87
82 88 # Set the variable to parent scope so that the other projects can copy the
83 89 # dependent shared libraries
84 90 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
85 91
86 92 # Copy extern shared libraries to the lib folder
87 93 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
88 94
89 95 # Add the files to the list of files to be analyzed
90 96 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
91 97 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
92 98 # Vera++ exclusion files
93 99 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
94 100 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
95 101
96 102 #
97 103 # Compile the tests
98 104 #
99 105 IF(BUILD_TESTS)
100 106 INCLUDE_DIRECTORIES(${SOURCES_DIR})
101 107 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
102 108 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
103 109 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
104 110
105 111 FOREACH( testFile ${TESTS_SOURCES} )
106 112 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
107 113 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
108 114
109 115 # Add to the list of sources files all the sources in the same
110 116 # directory that aren't another test
111 117 FILE (GLOB currentTestSources
112 118 ${testDirectory}/*.c
113 119 ${testDirectory}/*.cpp
114 120 ${testDirectory}/*.h)
115 121 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
116 122 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
117 123
118 124 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
119 125 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
120 126 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
121 127 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
122 128 qt5_use_modules(${testName} Test)
123 129
124 130 ADD_TEST( NAME ${testName} COMMAND ${testName} )
125 131
126 132 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
127 133 ENDFOREACH( testFile )
128 134
129 135 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
130 136 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
131 137 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
132 138 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
133 139 ENDIF(BUILD_TESTS)
134 140
135 141 #
136 142 # Set the files that must be formatted by clang-format.
137 143 #
138 144 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
139 145 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
140 146
141 147 #
142 148 # Set the directories that doxygen must browse to generate the
143 149 # documentation.
144 150 #
145 151 # Source directories:
146 152 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
147 153 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
148 154 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
149 155 # Source directories to exclude from the documentation generation
150 156 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
151 157 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
152 158
153 159 #
154 160 # Set the directories with the sources to analyze and propagate the
155 161 # modification to the parent scope
156 162 #
157 163 # Source directories to analyze:
158 164 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
159 165 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
160 166 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
161 167 # Source directories to exclude from the analysis
162 168 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
163 169 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,46 +1,52
1 1 ## plugin - CMakeLists.txt
2 2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 3 SET(SQPPLUGIN_LIBRARY_NAME "${LIBRARY_PREFFIX}_plugin${DEBUG_SUFFIX}")
4 4 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
5 5
6 6 # Include plugin directory
7 7 INCLUDE_DIRECTORIES("${INCLUDES_DIR}")
8 8
9 9 #
10 10 # Find Qt modules
11 11 #
12 12 SCIQLOP_FIND_QT(Core)
13 13
14 14 #
15 15 # Compile the library
16 16 #
17 17 FILE (GLOB_RECURSE MODULE_SOURCES
18 18 ${INCLUDES_DIR}/*.h)
19 19
20 20 ADD_LIBRARY(${SQPPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES})
21 21
22 INSTALL(TARGETS ${SQPPLUGIN_LIBRARY_NAME}
23 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
24 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
25 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
26 )
27
22 28
23 29 # Add the files to the list of files to be analyzed
24 30 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
25 31 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
26 32 # Vera++ exclusion files
27 33 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
28 34 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
29 35
30 36 #
31 37 # Set the files that must be formatted by clang-format.
32 38 #
33 39 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
34 40 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
35 41
36 42 #
37 43 # Set the directories that doxygen must browse to generate the
38 44 # documentation.
39 45 #
40 46 # Source directories:
41 47 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
42 48 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
43 49 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
44 50 # Source directories to exclude from the documentation generation
45 51 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
46 52 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
@@ -1,153 +1,160
1 1 ## mockplugin - CMakeLists.txt
2 2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 3 SET(SQPMOCKPLUGIN_LIBRARY_NAME "${LIBRARY_PREFFIX}_mockplugin${DEBUG_SUFFIX}")
4 4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
5 5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
6 6 SET(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
7 7
8 8 # Include mockplugin directory
9 9 INCLUDE_DIRECTORIES(${INCLUDES_DIR})
10 10 INCLUDE_DIRECTORIES(${RESOURCES_DIR})
11 11
12 12 #
13 13 # Find Qt modules
14 14 #
15 15 SCIQLOP_FIND_QT(Core Widgets)
16 16
17 17 #
18 18 # Find dependent libraries
19 19 # ========================
20 20
21 21 # sciqlop plugin
22 22 find_package(sciqlop-plugin)
23 23 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
24 24
25 25 # sciqlop core
26 26 find_package(sciqlop-core)
27 27 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
28 28 list(APPEND LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
29 29
30 30 # sciqlop gui
31 31 find_package(sciqlop-gui)
32 32 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
33 33 list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
34 34
35 35 # Resources files
36 36 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RESOURCES_DIR}/*.json)
37 37
38 38 #
39 39 # Compile the library
40 40 #
41 41 FILE (GLOB_RECURSE MODULE_SOURCES
42 42 ${INCLUDES_DIR}/*.h
43 43 ${SOURCES_DIR}/*.c
44 44 ${SOURCES_DIR}/*.cpp
45 45 ${SOURCES_DIR}/*.h
46 46 ${PROJECT_RESOURCES})
47 47
48 48 ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES})
49 49 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
50 50 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
51 51
52 INSTALL(TARGETS ${SQPMOCKPLUGIN_LIBRARY_NAME}
53 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
54 LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
55 ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
56 )
57
58
52 59 TARGET_LINK_LIBRARIES(${SQPMOCKPLUGIN_LIBRARY_NAME} ${LIBRARIES})
53 60 qt5_use_modules(${SQPMOCKPLUGIN_LIBRARY_NAME} Core Widgets)
54 61
55 62 add_dependencies(${SQPMOCKPLUGIN_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
56 63
57 64 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
58 65 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
59 66 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
60 67 IF(BUILD_SHARED_LIBS)
61 68 SET_TARGET_PROPERTIES(${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
62 69 ELSE()
63 70 TARGET_COMPILE_DEFINITIONS(${SQPMOCKPLUGIN_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
64 71 ENDIF()
65 72
66 73 # Set the variable to parent scope so that the other projects can copy the
67 74 # dependent shared libraries
68 75 SCIQLOP_SET_TO_PARENT_SCOPE(SQPMOCKPLUGIN_LIBRARY_NAME)
69 76
70 77 # Copy extern shared libraries to the lib folder
71 78 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPMOCKPLUGIN_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
72 79
73 80 # Add the files to the list of files to be analyzed
74 81 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
75 82 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
76 83 # Vera++ exclusion files
77 84 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
78 85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
79 86
80 87 # Temporary target to copy to plugins dir
81 88 find_package(sciqlop-mockplugin)
82 89 ADD_CUSTOM_TARGET(plugins
83 90 COMMAND ${CMAKE_COMMAND} -E copy ${SCIQLOP-MOCKPLUGIN_LIBRARIES} "${LIBRARY_OUTPUT_PATH}/plugins/${SCIQLOP-MOCKPLUGIN_LIBRARIES_NAME}"
84 91 )
85 92
86 93 #
87 94 # Compile the tests
88 95 #
89 96 IF(BUILD_TESTS)
90 97 INCLUDE_DIRECTORIES(${SOURCES_DIR})
91 98 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
92 99 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
93 100 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
94 101
95 102 FOREACH( testFile ${TESTS_SOURCES} )
96 103 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
97 104 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
98 105
99 106 # Add to the list of sources files all the sources in the same
100 107 # directory that aren't another test
101 108 FILE (GLOB currentTestSources
102 109 ${testDirectory}/*.c
103 110 ${testDirectory}/*.cpp
104 111 ${testDirectory}/*.h)
105 112 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
106 113 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
107 114
108 115 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
109 116 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
110 117 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
111 118 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
112 119 qt5_use_modules(${testName} Test)
113 120
114 121 ADD_TEST( NAME ${testName} COMMAND ${testName} )
115 122
116 123 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
117 124 ENDFOREACH( testFile )
118 125
119 126 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
120 127 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
121 128 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
122 129 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
123 130 ENDIF(BUILD_TESTS)
124 131
125 132 #
126 133 # Set the files that must be formatted by clang-format.
127 134 #
128 135 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
129 136 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
130 137
131 138 #
132 139 # Set the directories that doxygen must browse to generate the
133 140 # documentation.
134 141 #
135 142 # Source directories:
136 143 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
137 144 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
138 145 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
139 146 # Source directories to exclude from the documentation generation
140 147 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
141 148 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
142 149
143 150 #
144 151 # Set the directories with the sources to analyze and propagate the
145 152 # modification to the parent scope
146 153 #
147 154 # Source directories to analyze:
148 155 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
149 156 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
150 157 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
151 158 # Source directories to exclude from the analysis
152 159 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
153 160 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now