##// 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 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 # Find dependent modules
21 find_package(sciqlop-plugin)
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23
20 24 #
21 25 # Find Qt modules
22 26 #
23 27 SCIQLOP_FIND_QT(Core)
24 28
25 29 #
26 30 # Compile the library library
27 31 #
28 32 FILE (GLOB_RECURSE MODULE_SOURCES
29 33 ${INCLUDES_DIR}/*.h
30 34 ${SOURCES_DIR}/*.c
31 35 ${SOURCES_DIR}/*.cpp
32 36 ${SOURCES_DIR}/*.h)
33 37
34 38 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
35 39 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
36 40 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
37 41 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
38 42 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
39 43
40 44 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
41 45 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
42 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 47 IF(BUILD_SHARED_LIBS)
44 48 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
45 49 ELSE()
46 50 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
47 51 ENDIF()
48 52
49 53 # Set the variable to parent scope so that the other projects can copy the
50 54 # dependent shared libraries
51 55 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
52 56
53 57 # Copy extern shared libraries to the lib folder
54 58 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
55 59
56 60 # Add the files to the list of files to be analyzed
57 61 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
58 62 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
59 63 # Vera++ exclusion files
60 64 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
61 65 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
62 66
63 67 #
64 68 # Compile the tests
65 69 #
66 70 IF(BUILD_TESTS)
67 71 INCLUDE_DIRECTORIES(${SOURCES_DIR})
68 72 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
69 73 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
70 74 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
71 75
72 76 SET(TARGETS_COV)
73 77 FOREACH( testFile ${TESTS_SOURCES} )
74 78 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
75 79 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
76 80
77 81 # Add to the list of sources files all the sources in the same
78 82 # directory that aren't another test
79 83 FILE (GLOB currentTestSources
80 84 ${testDirectory}/*.c
81 85 ${testDirectory}/*.cpp
82 86 ${testDirectory}/*.h)
83 87 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
84 88 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
85 89
86 90 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
87 91 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
88 92 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
89 93 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
90 94 qt5_use_modules(${testName} Test)
91 95
92 96 ADD_TEST( NAME ${testName} COMMAND ${testName} )
93 97
94 98 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
95 99 set(Coverage_NAME ${testName})
96 100 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
97 101 LIST( APPEND TARGETS_COV ${testName}_coverage)
98 102
99 103 ENDFOREACH( testFile )
100 104
101 105 add_custom_target(coverage)
102 106
103 107 FOREACH( target_cov ${TARGETS_COV} )
104 108 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
105 109 ENDFOREACH( target_cov )
106 110
107 111 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
108 112 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
109 113 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
110 114 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
111 115 ENDIF(BUILD_TESTS)
112 116
113 117 #
114 118 # Set the files that must be formatted by clang-format.
115 119 #
116 120 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
117 121 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
118 122
119 123 #
120 124 # Set the directories that doxygen must browse to generate the
121 125 # documentation.
122 126 #
123 127 # Source directories:
124 128 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
125 129 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
126 130 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
127 131 # Source directories to exclude from the documentation generation
128 132 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
129 133 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
130 134
131 135 #
132 136 # Set the directories with the sources to analyze and propagate the
133 137 # modification to the parent scope
134 138 #
135 139 # Source directories to analyze:
136 140 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
137 141 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
138 142 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
139 143 # Source directories to exclude from the analysis
140 144 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
141 145 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now