diff --git a/app/meson.build b/app/meson.build index 4e5b793..a509264 100644 --- a/app/meson.build +++ b/app/meson.build @@ -31,9 +31,8 @@ sciqlop_app = executable('sciqlop', app_sources, app_moc_files, rc, - link_with : [sciqlop_core, sciqlop_gui], - include_directories : [gui_inc, core_inc, app_inc], - dependencies : [qt5core, qt5printsupport, qt5gui, qt5widgets, qt5network], + include_directories : [ app_inc], + dependencies : [sciqlop_gui, sciqlop_core], install : true ) diff --git a/app/src/Main.cpp b/app/src/Main.cpp index 9cde88d..30db0fe 100644 --- a/app/src/Main.cpp +++ b/app/src/Main.cpp @@ -34,11 +34,8 @@ Q_LOGGING_CATEGORY(LOG_Main, "Main") namespace { -/// Name of the directory containing the plugins - -#if _WIN32 || _WIN64 const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); -#endif + } // namespace @@ -52,28 +49,32 @@ int main(int argc, char *argv[]) w.show(); // Loads plugins - auto pluginDir = QDir{sqpApp->applicationDirPath()}; + auto pluginDir = QDir{a.applicationDirPath()}; + auto pluginLookupPath = { + a.applicationDirPath(), + a.applicationDirPath() + "/" + PLUGIN_DIRECTORY_NAME, + a.applicationDirPath() + "/../lib64/SciQlop", + a.applicationDirPath() + "/../lib64/sciqlop", + a.applicationDirPath() + "/../lib/SciQlop", + a.applicationDirPath() + "/../lib/sciqlop", + a.applicationDirPath() + "/../plugins", + }; + #if _WIN32 || _WIN64 pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); pluginDir.cd(PLUGIN_DIRECTORY_NAME); #endif + PluginManager pluginManager{}; -#if __unix || __APPLE -#if __x86_64__ || __ppc64__ - if (!pluginDir.cd("../lib64/SciQlop")) { - pluginDir.cd("../lib64/sciqlop"); + for (auto &&path : pluginLookupPath) { + QDir directory{path}; + if (directory.exists()) { + qCDebug(LOG_Main()) + << QObject::tr("Plugin directory: %1").arg(directory.absolutePath()); + pluginManager.loadPlugins(directory); + } } -#else - if (!pluginDir.cd("../lib/SciQlop")) { - pluginDir.cd("../lib/sciqlop"); - } -#endif -#endif - qCDebug(LOG_Main()) << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath()); - - PluginManager pluginManager{}; - pluginManager.loadPlugins(pluginDir); return a.exec(); } diff --git a/core/meson.build b/core/meson.build index 18de2eb..bb77c2e 100644 --- a/core/meson.build +++ b/core/meson.build @@ -22,6 +22,7 @@ core_sources = [ 'src/Common/DateUtils.cpp', 'src/Data/ScalarSeries.cpp', 'src/Data/DataSeriesIterator.cpp', + 'src/Data/ArrayDataIterator.cpp', 'src/Data/VectorSeries.cpp', 'src/DataSource/DataSourceController.cpp', 'src/DataSource/DataSourceItem.cpp', @@ -42,14 +43,20 @@ core_sources = [ core_inc = include_directories(['include', '../plugin/include']) -sciqlop_core = library('sciqlopcore', +sciqlop_core_lib = library('sciqlopcore', core_sources, core_moc_files, cpp_args : '-DCORE_LIB', include_directories : core_inc, - dependencies : [qt5core, qt5widgets, qt5network], + dependencies : [qt5core, qt5network], install : true ) + +sciqlop_core = declare_dependency(link_with : sciqlop_core_lib, + include_directories : core_inc, + dependencies : [qt5core, qt5network]) + + subdir('tests') diff --git a/core/src/Plugin/PluginManager.cpp b/core/src/Plugin/PluginManager.cpp index 5609cfe..c1fa918 100644 --- a/core/src/Plugin/PluginManager.cpp +++ b/core/src/Plugin/PluginManager.cpp @@ -106,9 +106,15 @@ PluginManager::PluginManager() : impl{spimpl::make_unique_implloadPlugin(pluginInfo.absoluteFilePath()); + auto pluginInfoList + = pluginDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + for (auto entryInfo : qAsConst(pluginInfoList)) { + if (entryInfo.isDir()) { + this->loadPlugins(QDir{entryInfo.absoluteFilePath()}); + } + else if (QLibrary::isLibrary(entryInfo.absoluteFilePath())) { + impl->loadPlugin(entryInfo.absoluteFilePath()); + } } } diff --git a/core/tests/Variable/TestVariableController.cpp b/core/tests/Variable/TestVariableController.cpp new file mode 100644 index 0000000..1b278f1 --- /dev/null +++ b/core/tests/Variable/TestVariableController.cpp @@ -0,0 +1,72 @@ +#include +#include + +#include +#include