mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:28:37 +02:00
segregated scripting/ plugins (re: permissions checkbox)
This commit is contained in:
parent
c5b2514e0e
commit
6ae75ecafe
4 changed files with 25 additions and 3 deletions
|
@ -7,7 +7,8 @@
|
||||||
#
|
#
|
||||||
macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN)
|
macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN)
|
||||||
set(${TARGET_NAME}_SHARED 1)
|
set(${TARGET_NAME}_SHARED 1)
|
||||||
setup_hifi_library(${ARGV})
|
set(PLUGIN_SUBFOLDER ${ARGN})
|
||||||
|
setup_hifi_library()
|
||||||
|
|
||||||
if (BUILD_CLIENT)
|
if (BUILD_CLIENT)
|
||||||
add_dependencies(interface ${TARGET_NAME})
|
add_dependencies(interface ${TARGET_NAME})
|
||||||
|
@ -27,6 +28,11 @@ macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN)
|
||||||
set(SERVER_PLUGIN_PATH "plugins")
|
set(SERVER_PLUGIN_PATH "plugins")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (PLUGIN_SUBFOLDER)
|
||||||
|
set(CLIENT_PLUGIN_PATH "${CLIENT_PLUGIN_PATH}/${PLUGIN_SUBFOLDER}")
|
||||||
|
set(SERVER_PLUGIN_PATH "${SERVER_PLUGIN_PATH}/${PLUGIN_SUBFOLDER}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
||||||
set(CLIENT_PLUGIN_FULL_PATH "${CMAKE_BINARY_DIR}/interface/${CLIENT_PLUGIN_PATH}/")
|
set(CLIENT_PLUGIN_FULL_PATH "${CMAKE_BINARY_DIR}/interface/${CLIENT_PLUGIN_PATH}/")
|
||||||
set(SERVER_PLUGIN_FULL_PATH "${CMAKE_BINARY_DIR}/assignment-client/${SERVER_PLUGIN_PATH}/")
|
set(SERVER_PLUGIN_FULL_PATH "${CMAKE_BINARY_DIR}/assignment-client/${SERVER_PLUGIN_PATH}/")
|
||||||
|
|
|
@ -110,6 +110,16 @@ int PluginManager::instantiate() {
|
||||||
pluginDir.setNameFilters(QStringList() << "libplugins_lib*.so");
|
pluginDir.setNameFilters(QStringList() << "libplugins_lib*.so");
|
||||||
#endif
|
#endif
|
||||||
auto candidates = pluginDir.entryList();
|
auto candidates = pluginDir.entryList();
|
||||||
|
|
||||||
|
if (_enableScriptingPlugins.get()) {
|
||||||
|
QDir scriptingPluginDir{ pluginDir };
|
||||||
|
scriptingPluginDir.cd("scripting");
|
||||||
|
qCDebug(plugins) << "Loading scripting plugins from " << scriptingPluginDir.path();
|
||||||
|
for (auto plugin : scriptingPluginDir.entryList()) {
|
||||||
|
candidates << "scripting/" + plugin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto plugin : candidates) {
|
for (auto plugin : candidates) {
|
||||||
qCDebug(plugins) << "Attempting plugin" << qPrintable(plugin);
|
qCDebug(plugins) << "Attempting plugin" << qPrintable(plugin);
|
||||||
QSharedPointer<QPluginLoader> loader(new QPluginLoader(pluginPath + plugin));
|
QSharedPointer<QPluginLoader> loader(new QPluginLoader(pluginPath + plugin));
|
||||||
|
@ -144,7 +154,9 @@ int PluginManager::instantiate() {
|
||||||
qCDebug(plugins) << " " << qPrintable(loader->errorString());
|
qCDebug(plugins) << " " << qPrintable(loader->errorString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else qWarning() << "pluginPath does not exit..." << pluginDir;
|
} else {
|
||||||
|
qWarning() << "pluginPath does not exit..." << pluginDir;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return loadedPlugins;
|
return loadedPlugins;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "Forward.h"
|
#include "Forward.h"
|
||||||
|
|
||||||
|
@ -70,6 +71,9 @@ private:
|
||||||
using LoaderList = QList<Loader>;
|
using LoaderList = QList<Loader>;
|
||||||
|
|
||||||
const LoaderList& getLoadedPlugins() const;
|
const LoaderList& getLoadedPlugins() const;
|
||||||
|
Setting::Handle<bool> _enableScriptingPlugins {
|
||||||
|
"private/enableScriptingPlugins", (bool)qgetenv("enableScriptingPlugins").toInt()
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: we should define this value in CMake, and then use CMake
|
// TODO: we should define this value in CMake, and then use CMake
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
set(TARGET_NAME KasenAPIExample)
|
set(TARGET_NAME KasenAPIExample)
|
||||||
setup_hifi_client_server_plugin()
|
setup_hifi_client_server_plugin(scripting)
|
||||||
link_hifi_libraries(shared plugins avatars networking graphics gpu)
|
link_hifi_libraries(shared plugins avatars networking graphics gpu)
|
||||||
|
|
Loading…
Reference in a new issue