Commit d8ee3e89 authored by Ludovic Fauvet's avatar Ludovic Fauvet

cmake: defines the vlmc plugins path using config.h

parent 009ebcb2
......@@ -76,17 +76,17 @@ SET (DEFAULT_INCLUDE_SUBDIR include)
SET (VLMC_BIN_SUBDIR ${DEFAULT_BIN_SUBDIR} CACHE STRING "Subdirectory where executables will be installed")
SET (VLMC_LIB_SUBDIR ${DEFAULT_LIB_SUBDIR} CACHE STRING "Subdirectory where libraries will be installed")
SET (VLMC_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING "Subdirectory where VLMC data will be installed")
SET (VLMC_SRC_SUBDIR ${DEFAULT_SRC_SUBDIR} CACHE STRING "Subdirectory where VLMC source is")
SET (VLMC_SRC_SUBDIR ${DEFAULT_SRC_SUBDIR} CACHE STRING "Subdirectory where VLMC source is")
SET (VLMC_INCLUDE_SUBDIR ${DEFAULT_INCLUDE_SUBDIR} CACHE STRING "Subdirectory where header files will be installed")
# full paths for the installation
SET (VLMC_BIN_DIR ${VLMC_BIN_SUBDIR})
SET (VLMC_LIB_DIR ${VLMC_LIB_SUBDIR})
SET (VLMC_INCLUDE_DIR ${VLMC_INCLUDE_SUBDIR})
SET (VLMC_DATA_DIR ${VLMC_DATA_SUBDIR}/vlmc/)
SET (VLMC_DOC_DIR ${VLMC_DATA_SUBDIR}/doc/vlmc/)
SET (VLMC_EFFECTS_DIR ${VLMC_LIB_SUBDIR}/vlmc/effects/)
SET (VLMC_DESKTOP_DIR ${VLMC_DATA_SUBDIR}/applications/)
SET (VLMC_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_BIN_SUBDIR})
SET (VLMC_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_LIB_SUBDIR})
SET (VLMC_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_INCLUDE_SUBDIR})
SET (VLMC_DATA_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/vlmc/)
SET (VLMC_DOC_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/doc/vlmc/)
SET (VLMC_EFFECTS_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_LIB_SUBDIR}/vlmc/effects/)
SET (VLMC_DESKTOP_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/applications/)
# manual page - makes sense only on unix systems
IF (UNIX)
......
#ifndef CONFIG_H
#define CONFIG_H
/* Absolute path to plugins */
#cmakedefine VLMC_EFFECTS_DIR "@VLMC_EFFECTS_DIR@"
#endif //CONFIG_H
......@@ -256,6 +256,8 @@ IF(WITH_CRASHHANDLER)
ADD_DEFINITIONS(-DDEBUG_CRASHHANDLER)
ENDIF(WITH_CRASHHANDLER)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
ADD_EXECUTABLE(vlmc ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS})
ADD_DEPENDENCIES(vlmc translations)
......
......@@ -22,28 +22,46 @@
*****************************************************************************/
#include "EffectPluginTypeManager.h"
#include "EffectPluginTypeLoader.h"
#include "config.h"
#include <QDebug>
#include <QDir>
#include <QStringList>
EffectPluginTypeManager::EffectPluginTypeManager( void ) : m_higherFreeId( 2 )
{
QStringList dirs;
qint32 plugins = 0;
dirs << "bin/effects/";
#ifdef VLMC_EFFECTS_DIR
dirs << VLMC_EFFECTS_DIR;
#endif
foreach ( QString path, dirs )
plugins += loadPlugins( path );
if ( plugins == 0 )
qWarning() << "No plugins found!";
}
qint32
EffectPluginTypeManager::loadPlugins( const QString &path )
{
QDir dir;
quint32 i;
quint32 size;
qint32 pluginsLoaded = 0;
QFileInfoList list;
EffectPluginTypeLoader* tmpEptl = NULL;
if ( dir.cd(PLUGINS_PATH) == false )
qDebug() << "Can't change dir to " << PLUGINS_PATH << "!";
else
if ( dir.cd( path ) )
{
list = dir.entryInfoList( QDir::Files );
size = list.size();
if ( list.empty() == true )
qDebug() << PLUGINS_PATH << " is empty of plugins!";
qDebug() << path << " is empty of plugins!";
else
for ( i = 0; i < size; ++i )
{
......@@ -61,11 +79,13 @@ EffectPluginTypeManager::EffectPluginTypeManager( void ) : m_higherFreeId( 2 )
qDebug() << list.at( i ).fileName() << " loaded.";
qDebug() << "---> Plugin name : " << tmpEptl->pluginName();
tmpEptl = NULL;
pluginsLoaded++;
}
else
qDebug() << list.at( i ).fileName() << " can't be loaded!";
}
}
return pluginsLoaded;
}
EffectPluginTypeManager::~EffectPluginTypeManager()
......
......@@ -24,8 +24,6 @@
#ifndef EFFECTPLUGINTYPEMANAGER_H_
#define EFFECTPLUGINTYPEMANAGER_H_
#define PLUGINS_PATH "bin/effects/"
#include <QMap>
class EffectPluginTypeLoader;
......@@ -39,6 +37,8 @@ class EffectPluginTypeManager
EffectPluginTypeManager( void );
~EffectPluginTypeManager();
qint32 loadPlugins( const QString &path );
IEffectPlugin* createIEffectPluginInstance( quint32 typeId ) const;
IEffectPlugin* createIEffectPluginInstance( const QString & typeName ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment