##// END OF EJS Templates
Initializes plugin manager...
Alexandre Leroux -
r66:5cbeec46f38d
parent child
Show More
@@ -0,0 +1,34
1 #ifndef SCIQLOP_PLUGINMANAGER_H
2 #define SCIQLOP_PLUGINMANAGER_H
3
4 #include <Common/spimpl.h>
5
6 #include <QLoggingCategory>
7
8 class QDir;
9
10 Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager)
11
12 /**
13 * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop.
14 */
15 class PluginManager {
16 public:
17 explicit PluginManager();
18
19 /**
20 * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in
21 * parameter
22 * @param pluginDir the directory containing the plugins
23 */
24 void loadPlugins(const QDir &pluginDir);
25
26 /// @returns the number of plugins loaded
27 int nbPluginsLoaded() const noexcept;
28
29 private:
30 class PluginManagerPrivate;
31 spimpl::unique_impl_ptr<PluginManagerPrivate> impl;
32 };
33
34 #endif // SCIQLOP_PLUGINMANAGER_H
@@ -0,0 +1,29
1 #include <Plugin/PluginManager.h>
2
3 #include <Plugin/IPlugin.h>
4
5 #include <QDir>
6
7 Q_LOGGING_CATEGORY(LOG_PluginManager, "PluginManager")
8
9 struct PluginManager::PluginManagerPrivate {
10 };
11
12 PluginManager::PluginManager() : impl{spimpl::make_unique_impl<PluginManagerPrivate>()}
13 {
14 }
15
16 void PluginManager::loadPlugins(const QDir &pluginDir)
17 {
18 // Load plugins
19 auto pluginInfoList = pluginDir.entryInfoList(QDir::Files, QDir::Name);
20 for (auto pluginInfo : qAsConst(pluginInfoList)) {
21 /// @todo ALX
22 }
23 }
24
25 int PluginManager::nbPluginsLoaded() const noexcept
26 {
27 /// @todo ALX
28 return 0;
29 }
@@ -1,141 +1,145
1
1
2 ## core - CMakeLists.txt
2 ## core - CMakeLists.txt
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
7
7
8 # Include core directory
8 # Include core directory
9 include_directories("${INCLUDES_DIR}")
9 include_directories("${INCLUDES_DIR}")
10
10
11 # Set a variable to display a warning in the version files.
11 # Set a variable to display a warning in the version files.
12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
13 # Generate the version file from the cmake version variables. The version
13 # Generate the version file from the cmake version variables. The version
14 # variables are defined in the cmake/sciqlop_version.cmake file.
14 # variables are defined in the cmake/sciqlop_version.cmake file.
15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
16 "${INCLUDES_DIR}/Version.h")
16 "${INCLUDES_DIR}/Version.h")
17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
18 "${SOURCES_DIR}/Version.cpp")
18 "${SOURCES_DIR}/Version.cpp")
19
19
20 # Find dependent modules
21 find_package(sciqlop-plugin)
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23
20 #
24 #
21 # Find Qt modules
25 # Find Qt modules
22 #
26 #
23 SCIQLOP_FIND_QT(Core)
27 SCIQLOP_FIND_QT(Core)
24
28
25 #
29 #
26 # Compile the library library
30 # Compile the library library
27 #
31 #
28 FILE (GLOB_RECURSE MODULE_SOURCES
32 FILE (GLOB_RECURSE MODULE_SOURCES
29 ${INCLUDES_DIR}/*.h
33 ${INCLUDES_DIR}/*.h
30 ${SOURCES_DIR}/*.c
34 ${SOURCES_DIR}/*.c
31 ${SOURCES_DIR}/*.cpp
35 ${SOURCES_DIR}/*.cpp
32 ${SOURCES_DIR}/*.h)
36 ${SOURCES_DIR}/*.h)
33
37
34 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
38 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
35 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
39 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
36 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
40 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
37 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
41 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
38 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
42 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
39
43
40 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
44 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
41 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
45 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
42 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
46 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
43 IF(BUILD_SHARED_LIBS)
47 IF(BUILD_SHARED_LIBS)
44 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
48 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
45 ELSE()
49 ELSE()
46 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
50 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
47 ENDIF()
51 ENDIF()
48
52
49 # Set the variable to parent scope so that the other projects can copy the
53 # Set the variable to parent scope so that the other projects can copy the
50 # dependent shared libraries
54 # dependent shared libraries
51 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
55 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
52
56
53 # Copy extern shared libraries to the lib folder
57 # Copy extern shared libraries to the lib folder
54 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
58 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
55
59
56 # Add the files to the list of files to be analyzed
60 # Add the files to the list of files to be analyzed
57 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
61 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
58 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
62 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
59 # Vera++ exclusion files
63 # Vera++ exclusion files
60 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
64 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
61 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
65 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
62
66
63 #
67 #
64 # Compile the tests
68 # Compile the tests
65 #
69 #
66 IF(BUILD_TESTS)
70 IF(BUILD_TESTS)
67 INCLUDE_DIRECTORIES(${SOURCES_DIR})
71 INCLUDE_DIRECTORIES(${SOURCES_DIR})
68 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
72 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
69 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
73 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
70 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
74 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
71
75
72 SET(TARGETS_COV)
76 SET(TARGETS_COV)
73 FOREACH( testFile ${TESTS_SOURCES} )
77 FOREACH( testFile ${TESTS_SOURCES} )
74 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
78 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
75 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
79 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
76
80
77 # Add to the list of sources files all the sources in the same
81 # Add to the list of sources files all the sources in the same
78 # directory that aren't another test
82 # directory that aren't another test
79 FILE (GLOB currentTestSources
83 FILE (GLOB currentTestSources
80 ${testDirectory}/*.c
84 ${testDirectory}/*.c
81 ${testDirectory}/*.cpp
85 ${testDirectory}/*.cpp
82 ${testDirectory}/*.h)
86 ${testDirectory}/*.h)
83 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
87 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
84 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
88 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
85
89
86 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
90 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
87 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
91 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
88 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
92 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
89 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
93 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
90 qt5_use_modules(${testName} Test)
94 qt5_use_modules(${testName} Test)
91
95
92 ADD_TEST( NAME ${testName} COMMAND ${testName} )
96 ADD_TEST( NAME ${testName} COMMAND ${testName} )
93
97
94 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
98 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
95 set(Coverage_NAME ${testName})
99 set(Coverage_NAME ${testName})
96 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
100 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
97 LIST( APPEND TARGETS_COV ${testName}_coverage)
101 LIST( APPEND TARGETS_COV ${testName}_coverage)
98
102
99 ENDFOREACH( testFile )
103 ENDFOREACH( testFile )
100
104
101 add_custom_target(coverage)
105 add_custom_target(coverage)
102
106
103 FOREACH( target_cov ${TARGETS_COV} )
107 FOREACH( target_cov ${TARGETS_COV} )
104 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
108 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
105 ENDFOREACH( target_cov )
109 ENDFOREACH( target_cov )
106
110
107 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
111 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
108 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
112 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
109 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
113 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
110 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
114 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
111 ENDIF(BUILD_TESTS)
115 ENDIF(BUILD_TESTS)
112
116
113 #
117 #
114 # Set the files that must be formatted by clang-format.
118 # Set the files that must be formatted by clang-format.
115 #
119 #
116 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
120 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
117 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
121 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
118
122
119 #
123 #
120 # Set the directories that doxygen must browse to generate the
124 # Set the directories that doxygen must browse to generate the
121 # documentation.
125 # documentation.
122 #
126 #
123 # Source directories:
127 # Source directories:
124 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
128 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
125 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
129 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
126 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
130 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
127 # Source directories to exclude from the documentation generation
131 # Source directories to exclude from the documentation generation
128 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
132 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
129 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
133 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
130
134
131 #
135 #
132 # Set the directories with the sources to analyze and propagate the
136 # Set the directories with the sources to analyze and propagate the
133 # modification to the parent scope
137 # modification to the parent scope
134 #
138 #
135 # Source directories to analyze:
139 # Source directories to analyze:
136 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
140 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
137 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
141 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
138 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
142 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
139 # Source directories to exclude from the analysis
143 # Source directories to exclude from the analysis
140 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
144 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
141 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
145 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now