##// END OF EJS Templates
Adds Q_DECL_EXPORT for Mock plugin
Alexandre Leroux -
r351:057ef7ee6e0d
parent child
Show More
@@ -0,0 +1,12
1 #ifndef SCIQLOP_MOCKPLUGINGLOBAL_H
2 #define SCIQLOP_MOCKPLUGINGLOBAL_H
3
4 #include <QtCore/QtGlobal>
5
6 #if defined(MOCKPLUGIN_LIB)
7 #define SCIQLOP_MOCKPLUGIN_EXPORT Q_DECL_EXPORT
8 #else
9 #define SCIQLOP_MOCKPLUGIN_EXPORT Q_DECL_IMPORT
10 #endif
11
12 #endif // SCIQLOP_MOCKPLUGINGLOBAL_H
@@ -1,154 +1,157
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 # Description file
36 36 FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/mockplugin.json)
37 37
38 38 #
39 39 # Compile the library
40 40 #
41
42 ADD_DEFINITIONS(-DMOCKPLUGIN_LIB)
43
41 44 FILE (GLOB_RECURSE MODULE_SOURCES
42 45 ${INCLUDES_DIR}/*.h
43 46 ${SOURCES_DIR}/*.c
44 47 ${SOURCES_DIR}/*.cpp
45 48 ${SOURCES_DIR}/*.h
46 49 ${PLUGIN_FILE})
47 50
48 51 ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES})
49 52 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
50 53 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
51 54
52 55 INSTALL(TARGETS ${SQPMOCKPLUGIN_LIBRARY_NAME}
53 56 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
54 57 LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
55 58 ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
56 59 )
57 60
58 61
59 62 TARGET_LINK_LIBRARIES(${SQPMOCKPLUGIN_LIBRARY_NAME} ${LIBRARIES})
60 63 qt5_use_modules(${SQPMOCKPLUGIN_LIBRARY_NAME} Core Widgets)
61 64
62 65 add_dependencies(${SQPMOCKPLUGIN_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
63 66
64 67 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
65 68 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
66 69 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
67 70 IF(BUILD_SHARED_LIBS)
68 71 SET_TARGET_PROPERTIES(${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
69 72 ELSE()
70 73 TARGET_COMPILE_DEFINITIONS(${SQPMOCKPLUGIN_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
71 74 ENDIF()
72 75
73 76 # Set the variable to parent scope so that the other projects can copy the
74 77 # dependent shared libraries
75 78 SCIQLOP_SET_TO_PARENT_SCOPE(SQPMOCKPLUGIN_LIBRARY_NAME)
76 79
77 80 # Copy extern shared libraries to the lib folder
78 81 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPMOCKPLUGIN_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
79 82
80 83 # Add the files to the list of files to be analyzed
81 84 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
82 85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
83 86 # Vera++ exclusion files
84 87 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
85 88 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
86 89
87 90 #
88 91 # Compile the tests
89 92 #
90 93 IF(BUILD_TESTS)
91 94 INCLUDE_DIRECTORIES(${SOURCES_DIR})
92 95 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
93 96 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
94 97 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
95 98
96 99 FOREACH( testFile ${TESTS_SOURCES} )
97 100 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
98 101 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
99 102
100 103 # Add to the list of sources files all the sources in the same
101 104 # directory that aren't another test
102 105 FILE (GLOB currentTestSources
103 106 ${testDirectory}/*.c
104 107 ${testDirectory}/*.cpp
105 108 ${testDirectory}/*.h)
106 109 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
107 110 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
108 111
109 112 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
110 113 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
111 114 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
112 115 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
113 116 qt5_use_modules(${testName} Test)
114 117
115 118 ADD_TEST( NAME ${testName} COMMAND ${testName} )
116 119
117 120 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
118 121 ENDFOREACH( testFile )
119 122
120 123 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
121 124 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
122 125 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
123 126 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
124 127 ENDIF(BUILD_TESTS)
125 128
126 129 #
127 130 # Set the files that must be formatted by clang-format.
128 131 #
129 132 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
130 133 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
131 134
132 135 #
133 136 # Set the directories that doxygen must browse to generate the
134 137 # documentation.
135 138 #
136 139 # Source directories:
137 140 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
138 141 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
139 142 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
140 143 # Source directories to exclude from the documentation generation
141 144 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
142 145 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
143 146
144 147 #
145 148 # Set the directories with the sources to analyze and propagate the
146 149 # modification to the parent scope
147 150 #
148 151 # Source directories to analyze:
149 152 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
150 153 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
151 154 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
152 155 # Source directories to exclude from the analysis
153 156 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
154 157 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,26 +1,28
1 1 #ifndef SCIQLOP_COSINUSPROVIDER_H
2 2 #define SCIQLOP_COSINUSPROVIDER_H
3 3
4 #include "MockPluginGlobal.h"
5
4 6 #include <Data/IDataProvider.h>
5 7
6 8 #include <QLoggingCategory>
7 9
8 10 Q_DECLARE_LOGGING_CATEGORY(LOG_CosinusProvider)
9 11
10 12 /**
11 13 * @brief The CosinusProvider class is an example of how a data provider can generate data
12 14 */
13 class CosinusProvider : public IDataProvider {
15 class SCIQLOP_MOCKPLUGIN_EXPORT CosinusProvider : public IDataProvider {
14 16 public:
15 17 /// @sa IDataProvider::retrieveData()
16 18 std::shared_ptr<IDataSeries>
17 19 retrieveData(const DataProviderParameters &parameters) const override;
18 20
19 21 void requestDataLoading(const QVector<SqpDateTime> &dateTimeList) override;
20 22
21 23
22 24 private:
23 25 std::shared_ptr<IDataSeries> retrieveDataSeries(const SqpDateTime &dateTime);
24 26 };
25 27
26 28 #endif // SCIQLOP_COSINUSPROVIDER_H
@@ -1,23 +1,25
1 1 #ifndef SCIQLOP_MOCKPLUGIN_H
2 2 #define SCIQLOP_MOCKPLUGIN_H
3 3
4 #include "MockPluginGlobal.h"
5
4 6 #include <Plugin/IPlugin.h>
5 7
6 8 #include <QLoggingCategory>
7 9
8 10 #include <memory>
9 11
10 12 Q_DECLARE_LOGGING_CATEGORY(LOG_MockPlugin)
11 13
12 14 class DataSourceItem;
13 15
14 class MockPlugin : public QObject, public IPlugin {
16 class SCIQLOP_MOCKPLUGIN_EXPORT MockPlugin : public QObject, public IPlugin {
15 17 Q_OBJECT
16 18 Q_INTERFACES(IPlugin)
17 19 Q_PLUGIN_METADATA(IID "sciqlop.plugin.IPlugin" FILE "mockplugin.json")
18 20 public:
19 21 /// @sa IPlugin::initialize()
20 22 void initialize() override;
21 23 };
22 24
23 25 #endif // SCIQLOP_MOCKPLUGIN_H
General Comments 0
You need to be logged in to leave comments. Login now