removing plugins for gold version (for mxe cross compiling)
parent
f77734e01c
commit
a6ff654ae3
|
@ -48,7 +48,6 @@ find_package(SDL 1.2.10 REQUIRED)
|
||||||
find_package(SDL_image 1.2 REQUIRED)
|
find_package(SDL_image 1.2 REQUIRED)
|
||||||
find_package(SDL_ttf 2.0 REQUIRED)
|
find_package(SDL_ttf 2.0 REQUIRED)
|
||||||
find_package(PNG 1.2 REQUIRED)
|
find_package(PNG 1.2 REQUIRED)
|
||||||
find_package(LTDL 2.4.2 REQUIRED)
|
|
||||||
find_package(Gettext REQUIRED)
|
find_package(Gettext REQUIRED)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
|
|
@ -160,8 +160,6 @@ ui/slider.cpp
|
||||||
ui/studio.cpp
|
ui/studio.cpp
|
||||||
ui/target.cpp
|
ui/target.cpp
|
||||||
ui/window.cpp
|
ui/window.cpp
|
||||||
plugins/pluginmanager.cpp
|
|
||||||
plugins/pluginloader.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LIBS
|
set(LIBS
|
||||||
|
@ -173,7 +171,6 @@ ${PNG_LIBRARIES}
|
||||||
${OPTIONAL_LIBS}
|
${OPTIONAL_LIBS}
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
${LTDL_LIBRARY}
|
|
||||||
CBot
|
CBot
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
// * This file is part of the COLOBOT source code
|
|
||||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
|
||||||
// *
|
|
||||||
// * This program is free software: you can redistribute it and/or modify
|
|
||||||
// * it under the terms of the GNU General Public License as published by
|
|
||||||
// * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// * (at your option) any later version.
|
|
||||||
// *
|
|
||||||
// * This program is distributed in the hope that it will be useful,
|
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// * GNU General Public License for more details.
|
|
||||||
// *
|
|
||||||
// * You should have received a copy of the GNU General Public License
|
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file plugins/plugininterface.h
|
|
||||||
* \brief Generic plugin interface
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
#define PLUGIN_INTERFACE(class_type) \
|
|
||||||
static class_type* Plugin##class_type; \
|
|
||||||
extern "C" void InstallPluginEntry() { Plugin##class_type = new class_type(); Plugin##class_type->InstallPlugin(); } \
|
|
||||||
extern "C" bool UninstallPluginEntry(std::string &reason) { bool result = Plugin##class_type->UninstallPlugin(reason); \
|
|
||||||
if (!result) \
|
|
||||||
return false; \
|
|
||||||
delete Plugin##class_type; \
|
|
||||||
return true; } \
|
|
||||||
extern "C" CPluginInterface* GetPluginInterfaceEntry() { return static_cast<CPluginInterface*>(Plugin##class_type); }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class CPluginInterface
|
|
||||||
*
|
|
||||||
* \brief Generic plugin interface. All plugins that will be managed by plugin manager have to derive from this class.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CPluginInterface {
|
|
||||||
public:
|
|
||||||
/** Function to get plugin name or description
|
|
||||||
* \return returns plugin name
|
|
||||||
*/
|
|
||||||
inline virtual std::string PluginName() { return "abc"; }
|
|
||||||
|
|
||||||
/** Function to get plugin version. 1 means version 0.01, 2 means 0.02 etc.
|
|
||||||
* \return number indicating plugin version
|
|
||||||
*/
|
|
||||||
inline virtual int PluginVersion() { return 0; }
|
|
||||||
|
|
||||||
/** Function to initialize plugin
|
|
||||||
*/
|
|
||||||
inline virtual void InstallPlugin() {}
|
|
||||||
|
|
||||||
/** Function called before removing plugin
|
|
||||||
*/
|
|
||||||
inline virtual bool UninstallPlugin(std::string &) { return true; }
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,124 +0,0 @@
|
||||||
// * This file is part of the COLOBOT source code
|
|
||||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
|
||||||
// *
|
|
||||||
// * This program is free software: you can redistribute it and/or modify
|
|
||||||
// * it under the terms of the GNU General Public License as published by
|
|
||||||
// * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// * (at your option) any later version.
|
|
||||||
// *
|
|
||||||
// * This program is distributed in the hope that it will be useful,
|
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// * GNU General Public License for more details.
|
|
||||||
// *
|
|
||||||
// * You should have received a copy of the GNU General Public License
|
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
|
|
||||||
#include "plugins/pluginloader.h"
|
|
||||||
|
|
||||||
|
|
||||||
CPluginLoader::CPluginLoader(std::string filename)
|
|
||||||
{
|
|
||||||
mInterface = nullptr;
|
|
||||||
mFilename = filename;
|
|
||||||
mLoaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string CPluginLoader::GetName()
|
|
||||||
{
|
|
||||||
if (mLoaded)
|
|
||||||
return mInterface->PluginName();
|
|
||||||
return "(not loaded)";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int CPluginLoader::GetVersion()
|
|
||||||
{
|
|
||||||
if (mLoaded)
|
|
||||||
return mInterface->PluginVersion();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginLoader::IsLoaded()
|
|
||||||
{
|
|
||||||
return mLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginLoader::UnloadPlugin()
|
|
||||||
{
|
|
||||||
if (!mLoaded) {
|
|
||||||
GetLogger()->Warn("Plugin %s is not loaded.\n");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool (*uninstall)(std::string &) = reinterpret_cast<bool (*)(std::string &)>( lt_dlsym(mHandle, "UninstallPluginEntry") );
|
|
||||||
if (!uninstall) {
|
|
||||||
GetLogger()->Error("Error getting UninstallPluginEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string reason;
|
|
||||||
if (!uninstall(reason)) {
|
|
||||||
GetLogger()->Error("Could not unload plugin %s: %s\n", mFilename.c_str(), reason.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
lt_dlclose(mHandle);
|
|
||||||
mLoaded = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginLoader::LoadPlugin()
|
|
||||||
{
|
|
||||||
if (mFilename.length() == 0) {
|
|
||||||
GetLogger()->Warn("No plugin filename specified.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mHandle = lt_dlopenext(mFilename.c_str());
|
|
||||||
if (!mHandle) {
|
|
||||||
GetLogger()->Error("Error loading plugin %s: %s\n", mFilename.c_str(), lt_dlerror());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void (*install)() = reinterpret_cast<void (*)()>( lt_dlsym(mHandle, "InstallPluginEntry") );
|
|
||||||
if (!install) {
|
|
||||||
GetLogger()->Error("Error getting InstallPluginEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPluginInterface* (*getInterface)() = reinterpret_cast<CPluginInterface* (*)()>( lt_dlsym(mHandle, "GetPluginInterfaceEntry") );
|
|
||||||
|
|
||||||
if (!getInterface) {
|
|
||||||
GetLogger()->Error("Error getting GetPluginInterfaceEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
install();
|
|
||||||
mInterface = getInterface();
|
|
||||||
mLoaded = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginLoader::SetFilename(std::string filename)
|
|
||||||
{
|
|
||||||
bool ok = true;
|
|
||||||
if (mLoaded)
|
|
||||||
ok = UnloadPlugin();
|
|
||||||
|
|
||||||
if (ok)
|
|
||||||
mFilename = filename;
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string CPluginLoader::GetFilename()
|
|
||||||
{
|
|
||||||
return mFilename;
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
// * This file is part of the COLOBOT source code
|
|
||||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
|
||||||
// *
|
|
||||||
// * This program is free software: you can redistribute it and/or modify
|
|
||||||
// * it under the terms of the GNU General Public License as published by
|
|
||||||
// * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// * (at your option) any later version.
|
|
||||||
// *
|
|
||||||
// * This program is distributed in the hope that it will be useful,
|
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// * GNU General Public License for more details.
|
|
||||||
// *
|
|
||||||
// * You should have received a copy of the GNU General Public License
|
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file plugins/pluginloader.h
|
|
||||||
* \brief Plugin loader interface
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
#include "common/logger.h"
|
|
||||||
|
|
||||||
#include "plugins/plugininterface.h"
|
|
||||||
|
|
||||||
#include <ltdl.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class CPluginLoader
|
|
||||||
*
|
|
||||||
* \brief Plugin loader interface. Plugin manager uses this class to load plugins.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CPluginLoader {
|
|
||||||
public:
|
|
||||||
/** Class contructor
|
|
||||||
* \param filename plugin filename
|
|
||||||
*/
|
|
||||||
CPluginLoader(std::string filename);
|
|
||||||
|
|
||||||
/** Function to get plugin name or description
|
|
||||||
* \return returns plugin name
|
|
||||||
*/
|
|
||||||
std::string GetName();
|
|
||||||
|
|
||||||
/** Function to get plugin version
|
|
||||||
* \return returns plugin version
|
|
||||||
*/
|
|
||||||
int GetVersion();
|
|
||||||
|
|
||||||
/** Function to unload plugin
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool UnloadPlugin();
|
|
||||||
|
|
||||||
/** Function to load plugin
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool LoadPlugin();
|
|
||||||
|
|
||||||
/** Function to check if plugin is loaded
|
|
||||||
* \return returns true if plugin is loaded
|
|
||||||
*/
|
|
||||||
bool IsLoaded();
|
|
||||||
|
|
||||||
/** Function to set plugin filename
|
|
||||||
* \return returns true on success. Action can fail if plugin was loaded and cannot be unloaded
|
|
||||||
*/
|
|
||||||
bool SetFilename(std::string);
|
|
||||||
|
|
||||||
/** Function to get plugin filename
|
|
||||||
* \return returns plugin filename
|
|
||||||
*/
|
|
||||||
std::string GetFilename();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
CPluginInterface* mInterface;
|
|
||||||
std::string mFilename;
|
|
||||||
lt_dlhandle mHandle;
|
|
||||||
bool mLoaded;
|
|
||||||
};
|
|
|
@ -1,132 +0,0 @@
|
||||||
// * This file is part of the COLOBOT source code
|
|
||||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
|
||||||
// *
|
|
||||||
// * This program is free software: you can redistribute it and/or modify
|
|
||||||
// * it under the terms of the GNU General Public License as published by
|
|
||||||
// * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// * (at your option) any later version.
|
|
||||||
// *
|
|
||||||
// * This program is distributed in the hope that it will be useful,
|
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// * GNU General Public License for more details.
|
|
||||||
// *
|
|
||||||
// * You should have received a copy of the GNU General Public License
|
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
|
|
||||||
#include "plugins/pluginmanager.h"
|
|
||||||
|
|
||||||
|
|
||||||
template<> CPluginManager* CSingleton<CPluginManager>::mInstance = nullptr;
|
|
||||||
|
|
||||||
|
|
||||||
CPluginManager::CPluginManager()
|
|
||||||
{
|
|
||||||
lt_dlinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CPluginManager::~CPluginManager()
|
|
||||||
{
|
|
||||||
UnloadAllPlugins();
|
|
||||||
lt_dlexit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CPluginManager::LoadFromProfile()
|
|
||||||
{
|
|
||||||
GetLogger()->Info("Trying to load from profile...\n");
|
|
||||||
std::vector< std::string > dirs = GetProfile().GetLocalProfileSection("Plugins", "Path");
|
|
||||||
std::vector< std::string > plugins = GetProfile().GetLocalProfileSection("Plugins", "File");
|
|
||||||
|
|
||||||
GetLogger()->Info("Path %d, files %d\n", dirs.size(), plugins.size());
|
|
||||||
for (std::string dir : dirs)
|
|
||||||
m_folders.insert(dir);
|
|
||||||
|
|
||||||
for (std::string plugin : plugins) {
|
|
||||||
GetLogger()->Info("Trying to load plugin %s...\n", plugin.c_str());
|
|
||||||
LoadPlugin(plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::LoadPlugin(std::string filename)
|
|
||||||
{
|
|
||||||
bool result = false;
|
|
||||||
CPluginLoader *loader = new CPluginLoader("");
|
|
||||||
for (std::string dir : m_folders) {
|
|
||||||
loader->SetFilename(dir + "/" + filename);
|
|
||||||
result = loader->LoadPlugin();
|
|
||||||
if (result) {
|
|
||||||
GetLogger()->Info("Plugin %s (%s) version %0.2f loaded!\n", filename.c_str(), loader->GetName().c_str(), loader->GetVersion() / 100.0f);
|
|
||||||
m_plugins.push_back(loader);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::UnloadPlugin(std::string filename)
|
|
||||||
{
|
|
||||||
std::vector<CPluginLoader *>::iterator it;
|
|
||||||
GetLogger()->Info("Trying to unload plugin %s...\n", filename.c_str());
|
|
||||||
for (it = m_plugins.begin(); it != m_plugins.end(); it++) {
|
|
||||||
CPluginLoader *plugin = *it;
|
|
||||||
if (NameEndsWith(plugin->GetFilename(), filename)) {
|
|
||||||
m_plugins.erase(it);
|
|
||||||
plugin->UnloadPlugin();
|
|
||||||
delete plugin;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::AddSearchDirectory(std::string dir)
|
|
||||||
{
|
|
||||||
m_folders.insert(dir);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::RemoveSearchDirectory(std::string dir)
|
|
||||||
{
|
|
||||||
m_folders.erase(dir);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::UnloadAllPlugins()
|
|
||||||
{
|
|
||||||
bool allOk = true;
|
|
||||||
std::vector<CPluginLoader *>::iterator it;
|
|
||||||
for (it = m_plugins.begin(); it != m_plugins.end(); it++) {
|
|
||||||
CPluginLoader *plugin = *it;
|
|
||||||
bool result;
|
|
||||||
|
|
||||||
GetLogger()->Info("Trying to unload plugin %s (%s)...\n", plugin->GetFilename().c_str(), plugin->GetName().c_str());
|
|
||||||
result = plugin->UnloadPlugin();
|
|
||||||
if (!result) {
|
|
||||||
allOk = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
delete plugin;
|
|
||||||
m_plugins.erase(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
return allOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CPluginManager::NameEndsWith(std::string filename, std::string ending)
|
|
||||||
{
|
|
||||||
if (filename.length() > ending.length()) {
|
|
||||||
std::string fileEnd = filename.substr(filename.length() - ending.length());
|
|
||||||
return (fileEnd == ending);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
// * This file is part of the COLOBOT source code
|
|
||||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
|
||||||
// *
|
|
||||||
// * This program is free software: you can redistribute it and/or modify
|
|
||||||
// * it under the terms of the GNU General Public License as published by
|
|
||||||
// * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// * (at your option) any later version.
|
|
||||||
// *
|
|
||||||
// * This program is distributed in the hope that it will be useful,
|
|
||||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// * GNU General Public License for more details.
|
|
||||||
// *
|
|
||||||
// * You should have received a copy of the GNU General Public License
|
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file plugins/pluginmanager.h
|
|
||||||
* \brief Plugin manager class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
#include "common/logger.h"
|
|
||||||
#include "common/profile.h"
|
|
||||||
|
|
||||||
#include "common/singleton.h"
|
|
||||||
|
|
||||||
#include "plugins/pluginloader.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <set>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class CPluginManager
|
|
||||||
*
|
|
||||||
* \brief Plugin manager class. Plugin manager can load plugins from colobot.ini or manually specified files.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CPluginManager : public CSingleton<CPluginManager> {
|
|
||||||
public:
|
|
||||||
CPluginManager();
|
|
||||||
~CPluginManager();
|
|
||||||
|
|
||||||
/** Function loads plugin list and path list from profile file
|
|
||||||
*/
|
|
||||||
void LoadFromProfile();
|
|
||||||
|
|
||||||
/** Function loads specified plugin
|
|
||||||
* \param filename plugin filename
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool LoadPlugin(std::string filename);
|
|
||||||
|
|
||||||
/** Function unloads specified plugin
|
|
||||||
* \param filename plugin filename
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool UnloadPlugin(std::string filename);
|
|
||||||
|
|
||||||
/** Function adds path to be checked when searching for plugin file. If path was already added it will be ignored
|
|
||||||
* \param dir plugin search path
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool AddSearchDirectory(std::string dir);
|
|
||||||
|
|
||||||
/** Function removes path from list
|
|
||||||
* \param dir plugin search path
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool RemoveSearchDirectory(std::string dir);
|
|
||||||
|
|
||||||
/** Function tries to unload all plugins
|
|
||||||
* \return returns true on success
|
|
||||||
*/
|
|
||||||
bool UnloadAllPlugins();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool NameEndsWith(std::string, std::string);
|
|
||||||
|
|
||||||
std::set< std::string > m_folders;
|
|
||||||
std::vector<CPluginLoader *> m_plugins;
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
|
||||||
set(CMAKE_BUILD_TYPE debug)
|
|
||||||
endif(NOT CMAKE_BUILD_TYPE)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic")
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
|
||||||
|
|
||||||
add_executable(manager_test manager_test.cpp ../../common/logger.cpp ../../common/profile.cpp ../../common/iman.cpp ../pluginmanager.cpp ../pluginloader.cpp)
|
|
||||||
|
|
||||||
include_directories(".")
|
|
||||||
include_directories("../../")
|
|
||||||
include_directories("../../../")
|
|
||||||
|
|
||||||
target_link_libraries(manager_test ${LTDL_LIBRARY})
|
|
|
@ -1,3 +0,0 @@
|
||||||
[Plugins]
|
|
||||||
Path=.
|
|
||||||
File=libopenalsound.so
|
|
|
@ -1,31 +0,0 @@
|
||||||
#include <common/logger.h>
|
|
||||||
#include <common/profile.h>
|
|
||||||
#include <common/iman.h>
|
|
||||||
#include <plugins/pluginmanager.h>
|
|
||||||
#include <sound/sound.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
new CLogger();
|
|
||||||
new CProfile();
|
|
||||||
new CInstanceManager();
|
|
||||||
CPluginManager *mgr = new CPluginManager();
|
|
||||||
|
|
||||||
if (!GetProfile()->InitCurrentDirectory()) {
|
|
||||||
GetLogger()->Error("Config not found!\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mgr->LoadFromProfile();
|
|
||||||
CSoundInterface *sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
|
|
||||||
|
|
||||||
if (!sound) {
|
|
||||||
GetLogger()->Error("Sound not loaded!\n");
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
sound->Create(true);
|
|
||||||
mgr->UnloadAllPlugins();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
#include "plugins/plugininterface.h"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -152,7 +150,7 @@ enum SoundNext
|
||||||
* \brief Sound plugin interface
|
* \brief Sound plugin interface
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class CSoundInterface : public CPluginInterface
|
class CSoundInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline CSoundInterface() {
|
inline CSoundInterface() {
|
||||||
|
|
Loading…
Reference in New Issue