@@ -0,0 +1,29 | |||
|
1 | # - Try to find CatalogueAPI Module | |
|
2 | # Once done this will define | |
|
3 | # CATALOGUEAPI_FOUND - System has CatalogueAPI | |
|
4 | # CATALOGUEAPI_INCLUDE_DIRS - The CatalogueAPI include directories | |
|
5 | # CATALOGUEAPI_LIBRARIES - The libraries needed to use CatalogueAPI | |
|
6 | # CATALOGUEAPI_SHARED_LIBRARIES - The shared libraries for CatalogueAPI | |
|
7 | ||
|
8 | set(CATALOGUEAPI_ROOT_DIR "${CATALOGUEAPI_EXTERN_FOLDER}" | |
|
9 | CACHE PATHS | |
|
10 | "Path to the installation of CatalogueAPI" | |
|
11 | ${libRootDirForceValue}) | |
|
12 | ||
|
13 | find_path(CATALOGUEAPI_INCLUDE_DIR CatalogueDao.h | |
|
14 | HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER} | |
|
15 | PATH_SUFFIXES src ) | |
|
16 | ||
|
17 | find_library(CATALOGUEAPI_LIBRARY NAMES CatalogueAPI | |
|
18 | HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER} | |
|
19 | PATH_SUFFIXES lib) | |
|
20 | ||
|
21 | set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_LIBRARY} ) | |
|
22 | set(CATALOGUEAPI_INCLUDE_DIRS ${CATALOGUEAPI_INCLUDE_DIR} ) | |
|
23 | ||
|
24 | include(FindPackageHandleStandardArgs) | |
|
25 | # handle the QUIETLY and REQUIRED arguments and set CATALOGUEAPI_FOUND to TRUE | |
|
26 | # if all listed variables are TRUE | |
|
27 | find_package_handle_standard_args(CatalogueAPI FOUND_VAR CATALOGUEAPI_FOUND | |
|
28 | REQUIRED_VARS CATALOGUEAPI_LIBRARY CATALOGUEAPI_INCLUDE_DIR) | |
|
29 | mark_as_advanced(CATALOGUEAPI_INCLUDE_DIR CATALOGUEAPI_LIBRARY ) |
@@ -0,0 +1,51 | |||
|
1 | #ifndef SCIQLOP_CATALOGUECONTROLLER_H | |
|
2 | #define SCIQLOP_CATALOGUECONTROLLER_H | |
|
3 | ||
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
6 | #include <Data/SqpRange.h> | |
|
7 | ||
|
8 | #include <QLoggingCategory> | |
|
9 | #include <QObject> | |
|
10 | #include <QUuid> | |
|
11 | ||
|
12 | #include <Common/spimpl.h> | |
|
13 | ||
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) | |
|
15 | ||
|
16 | class DataSourceItem; | |
|
17 | class Variable; | |
|
18 | ||
|
19 | /** | |
|
20 | * @brief The CatalogueController class aims to make the link between SciQlop and its plugins. | |
|
21 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |
|
22 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |
|
23 | * plugin source) then others specifics method will be able to access it. You can load a data source | |
|
24 | * driver plugin then create a data source. | |
|
25 | */ | |
|
26 | class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { | |
|
27 | Q_OBJECT | |
|
28 | public: | |
|
29 | explicit CatalogueController(QObject *parent = 0); | |
|
30 | virtual ~CatalogueController(); | |
|
31 | ||
|
32 | signals: | |
|
33 | /// Signal emitted when a variable is about to be deleted from SciQlop | |
|
34 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
|
35 | ||
|
36 | /// Signal emitted when a data acquisition is requested on a range for a variable | |
|
37 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range); | |
|
38 | ||
|
39 | public slots: | |
|
40 | /// Manage init/end of the controller | |
|
41 | void initialize(); | |
|
42 | void finalize(); | |
|
43 | ||
|
44 | private: | |
|
45 | void waitForFinish(); | |
|
46 | ||
|
47 | class CatalogueControllerPrivate; | |
|
48 | spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | |
|
49 | }; | |
|
50 | ||
|
51 | #endif // SCIQLOP_CATALOGUECONTROLLER_H |
@@ -0,0 +1,52 | |||
|
1 | #include <Catalogue/CatalogueController.h> | |
|
2 | ||
|
3 | #include <Variable/Variable.h> | |
|
4 | ||
|
5 | #include <CatalogueDao.h> | |
|
6 | ||
|
7 | #include <QMutex> | |
|
8 | #include <QThread> | |
|
9 | ||
|
10 | #include <QDir> | |
|
11 | #include <QStandardPaths> | |
|
12 | ||
|
13 | Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController") | |
|
14 | ||
|
15 | class CatalogueController::CatalogueControllerPrivate { | |
|
16 | public: | |
|
17 | QMutex m_WorkingMutex; | |
|
18 | CatalogueDao m_CatalogueDao; | |
|
19 | }; | |
|
20 | ||
|
21 | CatalogueController::CatalogueController(QObject *parent) | |
|
22 | : impl{spimpl::make_unique_impl<CatalogueControllerPrivate>()} | |
|
23 | { | |
|
24 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController construction") | |
|
25 | << QThread::currentThread(); | |
|
26 | } | |
|
27 | ||
|
28 | CatalogueController::~CatalogueController() | |
|
29 | { | |
|
30 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController destruction") | |
|
31 | << QThread::currentThread(); | |
|
32 | this->waitForFinish(); | |
|
33 | } | |
|
34 | ||
|
35 | void CatalogueController::initialize() | |
|
36 | { | |
|
37 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init") | |
|
38 | << QThread::currentThread(); | |
|
39 | impl->m_WorkingMutex.lock(); | |
|
40 | impl->m_CatalogueDao.initialize(); | |
|
41 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END"); | |
|
42 | } | |
|
43 | ||
|
44 | void CatalogueController::finalize() | |
|
45 | { | |
|
46 | impl->m_WorkingMutex.unlock(); | |
|
47 | } | |
|
48 | ||
|
49 | void CatalogueController::waitForFinish() | |
|
50 | { | |
|
51 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
|
52 | } |
@@ -0,0 +1,73 | |||
|
1 | # - Clone and build CatalogueAPI Module | |
|
2 | include(ExternalProject) | |
|
3 | ||
|
4 | find_package(Git REQUIRED) | |
|
5 | ||
|
6 | if(WIN32) | |
|
7 | find_program(MesonExec meson PATHS C:/Appli/Meson) | |
|
8 | if(NOT MesonExec) | |
|
9 | Message("Error: Meson not found") | |
|
10 | else() | |
|
11 | message("Meson found: ${MesonExec}" ) | |
|
12 | endif() | |
|
13 | find_program(NinjaExec ninja PATHS C:/Appli/Meson) | |
|
14 | if(NOT NinjaExec) | |
|
15 | Message("Error: Ninja not found") | |
|
16 | else() | |
|
17 | message("Ninja found: ${NinjaExec}" ) | |
|
18 | endif() | |
|
19 | endif() | |
|
20 | if(NOT MesonExec) | |
|
21 | set (MesonExec meson) | |
|
22 | endif() | |
|
23 | if(NOT NinjaExec) | |
|
24 | set (NinjaExec ninja) | |
|
25 | endif() | |
|
26 | ||
|
27 | SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI) | |
|
28 | SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build) | |
|
29 | SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm) | |
|
30 | SET(CatalogueAPI_build_type plain) | |
|
31 | ||
|
32 | if(CMAKE_BUILD_TYPE STREQUAL "") | |
|
33 | set(CMAKE_BUILD_TYPE Release) | |
|
34 | endif() | |
|
35 | string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) | |
|
36 | ||
|
37 | ExternalProject_Add( | |
|
38 | CatalogueAPI | |
|
39 | ||
|
40 | GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI | |
|
41 | GIT_TAG develop | |
|
42 | ||
|
43 | UPDATE_COMMAND ${GIT_EXECUTABLE} pull | |
|
44 | PATCH_COMMAND "" | |
|
45 | ||
|
46 | SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}" | |
|
47 | CONFIGURE_COMMAND ${MesonExec} --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}" | |
|
48 | ||
|
49 | BUILD_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" | |
|
50 | INSTALL_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" install | |
|
51 | LOG_DOWNLOAD 1 | |
|
52 | LOG_UPDATE 1 | |
|
53 | ) | |
|
54 | ||
|
55 | set(CATALOG_LIB_PATH lib) | |
|
56 | if(WIN32) | |
|
57 | set(CATALOG_LIB_PATH bin) | |
|
58 | endif() | |
|
59 | ||
|
60 | ExternalProject_Add_Step( | |
|
61 | CatalogueAPI CopyToBin | |
|
62 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} | |
|
63 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} | |
|
64 | DEPENDEES install | |
|
65 | ) | |
|
66 | ||
|
67 | ||
|
68 | set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src) | |
|
69 | set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX}) | |
|
70 | list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX}) | |
|
71 | ||
|
72 | mark_as_advanced(CATALOGUEAPI_INCLUDE) | |
|
73 | mark_as_advanced(CATALOGUEAPI_LIBRARIES) |
@@ -0,0 +1,4 | |||
|
1 | [wrap-git] | |
|
2 | directory=CatalogueAPI | |
|
3 | url=https://hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI.git | |
|
4 | revision=head |
@@ -0,0 +1,5 | |||
|
1 | [wrap-git] | |
|
2 | directory=QxOrm | |
|
3 | url=https://github.com/jeandet/qxorm.git | |
|
4 | revision=head | |
|
5 |
@@ -1,12 +1,18 | |||
|
1 | 1 | ο»Ώ |
|
2 | 2 | |
|
3 | 3 | ## Main CMakeLists for SCIQLOP |
|
4 | 4 | CMAKE_MINIMUM_REQUIRED (VERSION 3.6.1) |
|
5 | 5 | cmake_policy(VERSION 3.6) |
|
6 | 6 | |
|
7 | 7 | PROJECT(SCIQLOP) |
|
8 | 8 | |
|
9 | ||
|
10 | # | |
|
11 | # build the CatalogueAPI dependencu | |
|
12 | # | |
|
13 | INCLUDE("extern/CatalogueAPI.cmake") | |
|
14 | ||
|
9 | 15 | # |
|
10 | 16 | # build the project |
|
11 | 17 | # |
|
12 | INCLUDE("cmake/sciqlop.cmake") No newline at end of file | |
|
18 | INCLUDE("cmake/sciqlop.cmake") |
@@ -1,36 +1,36 | |||
|
1 | 1 | STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TO_LOWER) |
|
2 | SET(WINDEPLOYQT_ARGS --${CMAKE_BUILD_TYPE_TO_LOWER} --list mapping --no-system-d3d-compiler --compiler-runtime --dry-run) | |
|
2 | SET(WINDEPLOYQT_ARGS --${CMAKE_BUILD_TYPE_TO_LOWER} --list mapping -network -sql --no-system-d3d-compiler --compiler-runtime --dry-run) | |
|
3 | 3 | |
|
4 | 4 | #FOREACH(qtModule @_qt5_modules@) |
|
5 | 5 | # STRING(TOLOWER ${qtModule} qtLowerModule) |
|
6 | 6 | # SET(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} -${qtLowerModule}) |
|
7 | 7 | #ENDFOREACH() |
|
8 | 8 | |
|
9 | 9 | EXECUTE_PROCESS( |
|
10 | 10 | COMMAND windeployqt ${WINDEPLOYQT_ARGS} -printsupport ${SCIQLOP_EXE_LOCATION} |
|
11 | 11 | OUTPUT_VARIABLE QT_FILES |
|
12 | 12 | ) |
|
13 | 13 | |
|
14 | 14 | IF( QT_FILES ) |
|
15 | 15 | |
|
16 | 16 | STRING(REPLACE "\n" ";" QT_FILES ${QT_FILES}) |
|
17 | 17 | LIST(APPEND QT_FILES_LIST ${QT_FILES}) |
|
18 | 18 | FOREACH(QtFile ${QT_FILES_LIST}) |
|
19 | 19 | STRING(REPLACE "\"" "" QtFile ${QtFile}) |
|
20 | 20 | STRING(REPLACE "\\" "/" QtFile ${QtFile}) |
|
21 | 21 | STRING(REGEX MATCH "^(.*) " QtFileSource ${QtFile}) |
|
22 | 22 | STRING(REGEX MATCH " (.*)$" QtFileTarget ${QtFile}) |
|
23 | 23 | |
|
24 | 24 | STRING(STRIP ${QtFileSource} QtFileSource) |
|
25 | 25 | STRING(STRIP ${QtFileTarget} QtFileTarget) |
|
26 | 26 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) |
|
27 | 27 | |
|
28 | 28 | IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${EXECUTABLE_OUTPUT_PATH}/${QtFileTarget}") |
|
29 | 29 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) |
|
30 | 30 | FILE(INSTALL DESTINATION "${EXECUTABLE_OUTPUT_PATH}/${QtFileTargetDir}" FILES "${QtFileSource}") |
|
31 | 31 | ENDIF() |
|
32 | 32 | ENDFOREACH() |
|
33 | 33 | |
|
34 | 34 | ENDIF() |
|
35 | 35 | |
|
36 | 36 | MESSAGE( "Exec windeployqt done" ) |
@@ -1,159 +1,174 | |||
|
1 | ||
|
2 | 1 | ## core - CMakeLists.txt |
|
3 | 2 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
4 | 3 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
5 | 4 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
6 | 5 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
7 | 6 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") |
|
8 | 7 | |
|
9 | 8 | # Include core directory |
|
10 | 9 | include_directories("${INCLUDES_DIR}") |
|
11 | 10 | |
|
12 | 11 | # Set a variable to display a warning in the version files. |
|
13 | 12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
14 | 13 | # Generate the version file from the cmake version variables. The version |
|
15 | 14 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
16 | 15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
17 | 16 | "${INCLUDES_DIR}/Version.h") |
|
18 | 17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
19 | 18 | "${SOURCES_DIR}/Version.cpp") |
|
20 | 19 | |
|
21 | 20 | # Find dependent modules |
|
22 | 21 | find_package(sciqlop-plugin) |
|
23 | 22 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
24 | 23 | |
|
25 | 24 | # |
|
26 | 25 | # Find Qt modules |
|
27 | 26 | # |
|
28 | 27 | SCIQLOP_FIND_QT(Core Network) |
|
29 | 28 | |
|
30 | 29 | # |
|
31 | 30 | # Compile the library library |
|
32 | 31 | # |
|
33 | 32 | |
|
34 | 33 | ADD_DEFINITIONS(-DCORE_LIB) |
|
35 | 34 | |
|
36 | 35 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
37 | 36 | ${INCLUDES_DIR}/*.h |
|
38 | 37 | ${SOURCES_DIR}/*.c |
|
39 | 38 | ${SOURCES_DIR}/*.cpp |
|
40 | 39 | ${SOURCES_DIR}/*.h) |
|
41 | 40 | |
|
42 | 41 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
43 | 42 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
44 | 43 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
45 | 44 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
46 | 45 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) |
|
47 | 46 | |
|
47 | # Find CATALOGUE_API | |
|
48 | include_directories("${CATALOGUEAPI_INCLUDE}") | |
|
49 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) | |
|
48 | 50 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} |
|
49 | 51 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
50 | 52 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
51 | 53 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
52 | 54 | ) |
|
53 | 55 | |
|
56 | add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI) | |
|
57 | ||
|
54 | 58 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
55 | 59 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
56 | 60 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
57 | 61 | IF(BUILD_SHARED_LIBS) |
|
58 | 62 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
59 | 63 | ELSE() |
|
60 | 64 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
61 | 65 | ENDIF() |
|
62 | 66 | |
|
63 | 67 | # Set the variable to parent scope so that the other projects can copy the |
|
64 | 68 | # dependent shared libraries |
|
65 | 69 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
66 | 70 | |
|
67 | # Copy extern shared libraries to the lib folder | |
|
68 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) | |
|
69 | ||
|
71 | ## Copy extern shared libraries to the lib folder | |
|
72 | LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES}) | |
|
73 | ||
|
74 | ||
|
75 | SET (COPY_LIBS_DESTINATION LIBRARY) | |
|
76 | if(APPLE) | |
|
77 | SET (COPY_LIBS_DESTINATION RUNTIME) | |
|
78 | endif() | |
|
79 | ||
|
80 | add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD | |
|
81 | COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH} | |
|
82 | ) | |
|
83 | ||
|
70 | 84 | # Add the files to the list of files to be analyzed |
|
71 | 85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
72 | 86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
73 | 87 | # Vera++ exclusion files |
|
74 | 88 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
75 | 89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
76 | 90 | |
|
77 | 91 | # |
|
78 | 92 | # Compile the tests |
|
79 | 93 | # |
|
80 | 94 | IF(BUILD_TESTS) |
|
81 | 95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
82 | 96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
83 | 97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
84 | 98 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
99 | list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) | |
|
85 | 100 | |
|
86 | 101 | SET(TARGETS_COV) |
|
87 | 102 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
88 | 103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
89 | 104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
90 | 105 | |
|
91 | 106 | # Add to the list of sources files all the sources in the same |
|
92 | 107 | # directory that aren't another test |
|
93 | 108 | FILE (GLOB currentTestSources |
|
94 | 109 | ${testDirectory}/*.c |
|
95 | 110 | ${testDirectory}/*.cpp |
|
96 | 111 | ${testDirectory}/*.h) |
|
97 | 112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
98 | 113 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
99 | 114 | |
|
100 | 115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
101 | 116 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
102 | 117 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
103 |
TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} |
|
|
118 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) | |
|
104 | 119 | qt5_use_modules(${testName} Test) |
|
105 | 120 | |
|
106 | 121 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
107 | 122 | |
|
108 |
SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${ |
|
|
123 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES}) | |
|
109 | 124 | set(Coverage_NAME ${testName}) |
|
110 | 125 | if(UNIX) |
|
111 | 126 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
112 | 127 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
113 | 128 | endif(UNIX) |
|
114 | 129 | |
|
115 | 130 | ENDFOREACH( testFile ) |
|
116 | 131 | |
|
117 | 132 | add_custom_target(coverage) |
|
118 | 133 | |
|
119 | 134 | FOREACH( target_cov ${TARGETS_COV} ) |
|
120 | 135 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
121 | 136 | ENDFOREACH( target_cov ) |
|
122 | 137 | |
|
123 | 138 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
124 | 139 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
125 | 140 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
126 | 141 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
127 | 142 | |
|
128 | 143 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
129 | 144 | ENDIF(BUILD_TESTS) |
|
130 | 145 | |
|
131 | 146 | # |
|
132 | 147 | # Set the files that must be formatted by clang-format. |
|
133 | 148 | # |
|
134 | 149 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
135 | 150 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
136 | 151 | |
|
137 | 152 | # |
|
138 | 153 | # Set the directories that doxygen must browse to generate the |
|
139 | 154 | # documentation. |
|
140 | 155 | # |
|
141 | 156 | # Source directories: |
|
142 | 157 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
143 | 158 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
144 | 159 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
145 | 160 | # Source directories to exclude from the documentation generation |
|
146 | 161 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
147 | 162 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
148 | 163 | |
|
149 | 164 | # |
|
150 | 165 | # Set the directories with the sources to analyze and propagate the |
|
151 | 166 | # modification to the parent scope |
|
152 | 167 | # |
|
153 | 168 | # Source directories to analyze: |
|
154 | 169 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
155 | 170 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
156 | 171 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
157 | 172 | # Source directories to exclude from the analysis |
|
158 | 173 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
159 | 174 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,66 +1,73 | |||
|
1 | 1 | |
|
2 | qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep']) | |
|
3 | catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep']) | |
|
4 | ||
|
5 | ||
|
2 | 6 | core_moc_headers = [ |
|
7 | 'include/Catalogue/CatalogueController.h', | |
|
3 | 8 | 'include/Data/IDataProvider.h', |
|
4 | 9 | 'include/DataSource/DataSourceController.h', |
|
5 | 10 | 'include/DataSource/DataSourceItemAction.h', |
|
6 | 11 | 'include/Network/NetworkController.h', |
|
7 | 12 | 'include/Time/TimeController.h', |
|
8 | 13 | 'include/Variable/Variable.h', |
|
9 | 14 | 'include/Variable/VariableCacheController.h', |
|
10 | 15 | 'include/Variable/VariableController.h', |
|
11 | 16 | 'include/Variable/VariableAcquisitionWorker.h', |
|
12 | 17 | 'include/Variable/VariableSynchronizationGroup.h', |
|
13 | 18 | 'include/Variable/VariableModel.h', |
|
14 | 19 | 'include/Visualization/VisualizationController.h' |
|
15 | 20 | ] |
|
16 | 21 | |
|
17 | 22 | |
|
18 | 23 | core_moc_files = qt5.preprocess(moc_headers : core_moc_headers) |
|
19 | 24 | |
|
20 | 25 | core_sources = [ |
|
21 | 26 | 'src/Common/DateUtils.cpp', |
|
22 | 27 | 'src/Common/StringUtils.cpp', |
|
23 | 28 | 'src/Common/MimeTypesDef.cpp', |
|
29 | 'src/Catalogue/CatalogueController.cpp', | |
|
24 | 30 | 'src/Data/ScalarSeries.cpp', |
|
25 | 31 | 'src/Data/SpectrogramSeries.cpp', |
|
26 | 32 | 'src/Data/DataSeriesIterator.cpp', |
|
27 | 33 | 'src/Data/ArrayDataIterator.cpp', |
|
28 | 34 | 'src/Data/VectorSeries.cpp', |
|
29 | 35 | 'src/Data/OptionalAxis.cpp', |
|
30 | 36 | 'src/Data/DataSeriesUtils.cpp', |
|
31 | 37 | 'src/DataSource/DataSourceController.cpp', |
|
32 | 38 | 'src/DataSource/DataSourceItem.cpp', |
|
33 | 39 | 'src/DataSource/DataSourceItemAction.cpp', |
|
34 | 40 | 'src/DataSource/DataSourceItemMergeHelper.cpp', |
|
35 | 41 | 'src/Network/NetworkController.cpp', |
|
36 | 42 | 'src/Plugin/PluginManager.cpp', |
|
37 | 43 | 'src/Settings/SqpSettingsDefs.cpp', |
|
38 | 44 | 'src/Time/TimeController.cpp', |
|
39 | 45 | 'src/Variable/Variable.cpp', |
|
40 | 46 | 'src/Variable/VariableCacheController.cpp', |
|
41 | 47 | 'src/Variable/VariableController.cpp', |
|
42 | 48 | 'src/Variable/VariableAcquisitionWorker.cpp', |
|
43 | 49 | 'src/Variable/VariableSynchronizationGroup.cpp', |
|
44 | 50 | 'src/Variable/VariableModel.cpp', |
|
45 | 51 | 'src/Visualization/VisualizationController.cpp' |
|
46 | 52 | ] |
|
47 | 53 | |
|
48 | 54 | core_inc = include_directories(['include', '../plugin/include']) |
|
49 | 55 | |
|
50 | 56 | sciqlop_core_lib = library('sciqlopcore', |
|
51 | 57 | core_sources, |
|
52 | 58 | core_moc_files, |
|
53 | 59 | cpp_args : '-DCORE_LIB', |
|
54 | 60 | include_directories : core_inc, |
|
55 | dependencies : [qt5core, qt5network], | |
|
61 | dependencies : [qt5core, qt5network, catalogueapi_dep], | |
|
56 | 62 | install : true |
|
57 | 63 | ) |
|
58 | 64 | |
|
59 | 65 | |
|
60 | 66 | sciqlop_core = declare_dependency(link_with : sciqlop_core_lib, |
|
61 | 67 | include_directories : core_inc, |
|
62 | dependencies : [qt5core, qt5network]) | |
|
68 | dependencies : [qt5core, qt5network, catalogueapi_dep]) | |
|
69 | ||
|
63 | 70 | |
|
64 | 71 | |
|
65 | 72 | subdir('tests') |
|
66 | 73 |
@@ -1,188 +1,203 | |||
|
1 | 1 | #include "SqpApplication.h" |
|
2 | 2 | |
|
3 | #include <Catalogue/CatalogueController.h> | |
|
3 | 4 | #include <Data/IDataProvider.h> |
|
4 | 5 | #include <DataSource/DataSourceController.h> |
|
5 | 6 | #include <DragAndDrop/DragDropHelper.h> |
|
6 | 7 | #include <Network/NetworkController.h> |
|
7 | 8 | #include <QThread> |
|
8 | 9 | #include <Time/TimeController.h> |
|
9 | 10 | #include <Variable/Variable.h> |
|
10 | 11 | #include <Variable/VariableController.h> |
|
11 | 12 | #include <Variable/VariableModel.h> |
|
12 | 13 | #include <Visualization/VisualizationController.h> |
|
13 | 14 | |
|
14 | 15 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
15 | 16 | |
|
16 | 17 | class SqpApplication::SqpApplicationPrivate { |
|
17 | 18 | public: |
|
18 | 19 | SqpApplicationPrivate() |
|
19 | 20 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
20 | 21 | m_VariableController{std::make_unique<VariableController>()}, |
|
21 | 22 | m_TimeController{std::make_unique<TimeController>()}, |
|
22 | 23 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
23 | 24 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
24 | 25 | m_DragDropHelper{std::make_unique<DragDropHelper>()}, |
|
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, | |
|
25 | 27 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
26 | 28 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
27 | 29 | { |
|
28 | 30 | // /////////////////////////////// // |
|
29 | 31 | // Connections between controllers // |
|
30 | 32 | // /////////////////////////////// // |
|
31 | 33 | |
|
32 | 34 | // VariableController <-> DataSourceController |
|
33 | 35 | connect(m_DataSourceController.get(), |
|
34 | 36 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
35 | 37 | std::shared_ptr<IDataProvider>)), |
|
36 | 38 | m_VariableController.get(), |
|
37 | 39 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
38 | 40 | std::shared_ptr<IDataProvider>))); |
|
39 | 41 | |
|
40 | 42 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
41 | 43 | m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
42 | 44 | |
|
43 | 45 | // VariableController <-> VisualizationController |
|
44 | 46 | connect(m_VariableController.get(), |
|
45 | 47 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
46 | 48 | m_VisualizationController.get(), |
|
47 | 49 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
48 | 50 | |
|
49 | 51 | connect(m_VariableController.get(), |
|
50 | 52 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), |
|
51 | 53 | m_VisualizationController.get(), |
|
52 | 54 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
53 | 55 | |
|
54 | 56 | |
|
55 | 57 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
56 | 58 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
57 | 59 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
58 | 60 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
59 | 61 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
60 | 62 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
61 | 63 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
62 | 64 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
65 | m_CatalogueController->moveToThread(&m_CatalogueControllerThread); | |
|
66 | m_CatalogueControllerThread.setObjectName("CatalogueControllerThread"); | |
|
63 | 67 | |
|
64 | 68 | |
|
65 | 69 | // Additionnal init |
|
66 | 70 | m_VariableController->setTimeController(m_TimeController.get()); |
|
67 | 71 | } |
|
68 | 72 | |
|
69 | 73 | virtual ~SqpApplicationPrivate() |
|
70 | 74 | { |
|
71 | 75 | m_DataSourceControllerThread.quit(); |
|
72 | 76 | m_DataSourceControllerThread.wait(); |
|
73 | 77 | |
|
74 | 78 | m_NetworkControllerThread.quit(); |
|
75 | 79 | m_NetworkControllerThread.wait(); |
|
76 | 80 | |
|
77 | 81 | m_VariableControllerThread.quit(); |
|
78 | 82 | m_VariableControllerThread.wait(); |
|
79 | 83 | |
|
80 | 84 | m_VisualizationControllerThread.quit(); |
|
81 | 85 | m_VisualizationControllerThread.wait(); |
|
86 | ||
|
87 | m_CatalogueControllerThread.quit(); | |
|
88 | m_CatalogueControllerThread.wait(); | |
|
82 | 89 | } |
|
83 | 90 | |
|
84 | 91 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
85 | 92 | std::unique_ptr<VariableController> m_VariableController; |
|
86 | 93 | std::unique_ptr<TimeController> m_TimeController; |
|
87 | 94 | std::unique_ptr<NetworkController> m_NetworkController; |
|
88 | 95 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
96 | std::unique_ptr<CatalogueController> m_CatalogueController; | |
|
89 | 97 | QThread m_DataSourceControllerThread; |
|
90 | 98 | QThread m_NetworkControllerThread; |
|
91 | 99 | QThread m_VariableControllerThread; |
|
92 | 100 | QThread m_VisualizationControllerThread; |
|
101 | QThread m_CatalogueControllerThread; | |
|
93 | 102 | |
|
94 | 103 | std::unique_ptr<DragDropHelper> m_DragDropHelper; |
|
95 | 104 | |
|
96 | 105 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; |
|
97 | 106 | SqpApplication::PlotsCursorMode m_PlotCursorMode; |
|
98 | 107 | }; |
|
99 | 108 | |
|
100 | 109 | |
|
101 | 110 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
102 | 111 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
103 | 112 | { |
|
104 | 113 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
105 | 114 | |
|
106 | 115 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
107 | 116 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
108 | 117 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
109 | 118 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
110 | 119 | |
|
111 | 120 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
112 | 121 | &NetworkController::initialize); |
|
113 | 122 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
114 | 123 | &NetworkController::finalize); |
|
115 | 124 | |
|
116 | 125 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
117 | 126 | &VariableController::initialize); |
|
118 | 127 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
119 | 128 | &VariableController::finalize); |
|
120 | 129 | |
|
121 | 130 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
122 | 131 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
123 | 132 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
124 | 133 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
125 | 134 | |
|
135 | connect(&impl->m_CatalogueControllerThread, &QThread::started, | |
|
136 | impl->m_CatalogueController.get(), &CatalogueController::initialize); | |
|
137 | connect(&impl->m_CatalogueControllerThread, &QThread::finished, | |
|
138 | impl->m_CatalogueController.get(), &CatalogueController::finalize); | |
|
139 | ||
|
126 | 140 | impl->m_DataSourceControllerThread.start(); |
|
127 | 141 | impl->m_NetworkControllerThread.start(); |
|
128 | 142 | impl->m_VariableControllerThread.start(); |
|
129 | 143 | impl->m_VisualizationControllerThread.start(); |
|
144 | impl->m_CatalogueControllerThread.start(); | |
|
130 | 145 | } |
|
131 | 146 | |
|
132 | 147 | SqpApplication::~SqpApplication() |
|
133 | 148 | { |
|
134 | 149 | } |
|
135 | 150 | |
|
136 | 151 | void SqpApplication::initialize() |
|
137 | 152 | { |
|
138 | 153 | } |
|
139 | 154 | |
|
140 | 155 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
141 | 156 | { |
|
142 | 157 | return *impl->m_DataSourceController; |
|
143 | 158 | } |
|
144 | 159 | |
|
145 | 160 | NetworkController &SqpApplication::networkController() noexcept |
|
146 | 161 | { |
|
147 | 162 | return *impl->m_NetworkController; |
|
148 | 163 | } |
|
149 | 164 | |
|
150 | 165 | TimeController &SqpApplication::timeController() noexcept |
|
151 | 166 | { |
|
152 | 167 | return *impl->m_TimeController; |
|
153 | 168 | } |
|
154 | 169 | |
|
155 | 170 | VariableController &SqpApplication::variableController() noexcept |
|
156 | 171 | { |
|
157 | 172 | return *impl->m_VariableController; |
|
158 | 173 | } |
|
159 | 174 | |
|
160 | 175 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
161 | 176 | { |
|
162 | 177 | return *impl->m_VisualizationController; |
|
163 | 178 | } |
|
164 | 179 | |
|
165 | 180 | DragDropHelper &SqpApplication::dragDropHelper() noexcept |
|
166 | 181 | { |
|
167 | 182 | return *impl->m_DragDropHelper; |
|
168 | 183 | } |
|
169 | 184 | |
|
170 | 185 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const |
|
171 | 186 | { |
|
172 | 187 | return impl->m_PlotInterractionMode; |
|
173 | 188 | } |
|
174 | 189 | |
|
175 | 190 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) |
|
176 | 191 | { |
|
177 | 192 | impl->m_PlotInterractionMode = mode; |
|
178 | 193 | } |
|
179 | 194 | |
|
180 | 195 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const |
|
181 | 196 | { |
|
182 | 197 | return impl->m_PlotCursorMode; |
|
183 | 198 | } |
|
184 | 199 | |
|
185 | 200 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) |
|
186 | 201 | { |
|
187 | 202 | impl->m_PlotCursorMode = mode; |
|
188 | 203 | } |
General Comments 0
You need to be logged in to leave comments.
Login now