Disable the native preset factory in libprojectm (which we didn't use anyway). Might fix the -ldl requirement and compilation failure on fedora 14.
This commit is contained in:
parent
42a20d6bcb
commit
8f87744d57
6
3rdparty/libprojectm/CMakeLists.txt
vendored
6
3rdparty/libprojectm/CMakeLists.txt
vendored
@ -21,9 +21,13 @@ set(USE_OPENMP ON)
|
||||
set(USE_NATIVE_GLEW OFF)
|
||||
set(USE_CG OFF)
|
||||
set(BUILD_PROJECTM_STATIC ON)
|
||||
set(DISABLE_NATIVE_PRESETS OFF)
|
||||
set(DISABLE_NATIVE_PRESETS ON)
|
||||
set(DISABLE_MILKDROP_PRESETS OFF)
|
||||
|
||||
if(DISABLE_NATIVE_PRESETS)
|
||||
ADD_DEFINITIONS(-DDISABLE_NATIVE_PRESETS)
|
||||
endif(DISABLE_NATIVE_PRESETS)
|
||||
|
||||
ADD_DEFINITIONS(-DCMAKE_INSTALL_PREFIX="\\\"${CMAKE_INSTALL_PREFIX}\\\"")
|
||||
|
||||
if (USE_NATIVE_GLEW)
|
||||
|
@ -1,23 +0,0 @@
|
||||
PROJECT(NativePresetFactory)
|
||||
cmake_minimum_required(VERSION 2.4.0)
|
||||
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
SET(NativePresetFactory_SOURCES NativePresetFactory.cpp)
|
||||
|
||||
if(WIN32)
|
||||
find_library(DL_LIBRARIES dl)
|
||||
endif(WIN32)
|
||||
|
||||
if(MSVC)
|
||||
SET (MATH_LIBRARIES )
|
||||
else(MSVC)
|
||||
SET (MATH_LIBRARIES m)
|
||||
endif(MSVC)
|
||||
|
||||
INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR} ${Renderer_SOURCE_DIR})
|
||||
ADD_LIBRARY(NativePresetFactory STATIC ${NativePresetFactory_SOURCES})
|
||||
SET_TARGET_PROPERTIES(NativePresetFactory PROPERTIES VERSION 2.00 SOVERSION 2)
|
||||
TARGET_LINK_LIBRARIES(NativePresetFactory Renderer ${MATH_LIBRARIES} ${DL_LIBRARIES})
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* MilkdropCompatability.hpp
|
||||
*
|
||||
* Created on: Jun 18, 2008
|
||||
* Author: pete
|
||||
*/
|
||||
|
||||
#ifndef MILKDROPCOMPATABILITY_HPP_
|
||||
#define MILKDROPCOMPATABILITY_HPP_
|
||||
|
||||
inline float sign(float a)
|
||||
{
|
||||
return a < 0.0 ? -1.0 : 1.0;
|
||||
}
|
||||
|
||||
inline float above(float a, float b)
|
||||
{
|
||||
return a > b ? 1 : 0;
|
||||
}
|
||||
inline float equal(float a, float b)
|
||||
{
|
||||
return a == b ? 1 : 0;
|
||||
}
|
||||
inline float below(float a, float b)
|
||||
{
|
||||
return a < b ? 1 : 0;
|
||||
}
|
||||
inline float min(float a, float b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
inline float max(float a, float b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
inline float if_milk(float a, float b, float c)
|
||||
{
|
||||
return (a==1.0) ? b : c;
|
||||
}
|
||||
#endif /* MILKDROPCOMPATABILITY_HPP_ */
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Preset.hpp
|
||||
*
|
||||
* Created on: Aug 5, 2008
|
||||
* Author: carm
|
||||
*/
|
||||
|
||||
#ifndef __NATIVE_PRESET_HPP_
|
||||
#define __NATIVE_PRESET_HPP_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "BeatDetect.hpp"
|
||||
#include "Pipeline.hpp"
|
||||
#include "PipelineContext.hpp"
|
||||
#include "Preset.hpp"
|
||||
|
||||
/// A templated preset class to build different various hard coded presets and
|
||||
/// compile them into object files to be loaded into a playlist
|
||||
template <class PipelineT>
|
||||
class NativePreset : public Preset {
|
||||
public:
|
||||
|
||||
inline NativePreset(const std::string & name=std::string(),
|
||||
const std::string & author = std::string()) : Preset(name, author) {}
|
||||
|
||||
virtual ~NativePreset() {}
|
||||
|
||||
inline PipelineT & pipeline() { return _pipeline; }
|
||||
inline virtual void Render(const BeatDetect &music, const PipelineContext &context) {
|
||||
_pipeline.Render(music, context);
|
||||
}
|
||||
|
||||
private:
|
||||
PipelineT _pipeline;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,119 +0,0 @@
|
||||
//
|
||||
// C++ Implementation: NativePresetFactory
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Carmelo Piccione <carmelo.piccione@gmail.com>, (C) 2008
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
# include <dlfcn.h>
|
||||
}
|
||||
|
||||
#include "NativePresetFactory.hpp"
|
||||
|
||||
typedef void Handle;
|
||||
typedef void DestroyFunctor(Preset*);
|
||||
typedef Preset * CreateFunctor(const char * url);
|
||||
|
||||
class LibraryPreset : public Preset {
|
||||
public:
|
||||
LibraryPreset(Preset * preset, DestroyFunctor * destroyFun) : Preset(preset->name(), preset->author()), _internalPreset(preset), _destroyFunctor(destroyFun) {}
|
||||
inline Pipeline & pipeline() { return _internalPreset->pipeline(); }
|
||||
inline virtual ~LibraryPreset() { _destroyFunctor(_internalPreset); }
|
||||
inline void Render(const BeatDetect &music, const PipelineContext &context) {
|
||||
return _internalPreset->Render(music, context);
|
||||
}
|
||||
private:
|
||||
Preset * _internalPreset;
|
||||
DestroyFunctor * _destroyFunctor;
|
||||
};
|
||||
|
||||
class PresetLibrary {
|
||||
|
||||
public:
|
||||
PresetLibrary(Handle * h, CreateFunctor * create, DestroyFunctor * destroy) :
|
||||
_handle(h), _createFunctor(create), _destroyFunctor(destroy) {}
|
||||
|
||||
Handle * handle() { return _handle; }
|
||||
CreateFunctor * createFunctor() { return _createFunctor; }
|
||||
DestroyFunctor * destroyFunctor() { return _destroyFunctor; }
|
||||
|
||||
~PresetLibrary() {
|
||||
dlclose(handle());
|
||||
}
|
||||
|
||||
private:
|
||||
Handle * _handle;
|
||||
CreateFunctor * _createFunctor;
|
||||
DestroyFunctor * _destroyFunctor;
|
||||
|
||||
};
|
||||
|
||||
NativePresetFactory::NativePresetFactory() {}
|
||||
|
||||
NativePresetFactory::~NativePresetFactory() {
|
||||
|
||||
for (PresetLibraryMap::iterator pos = _libraries.begin(); pos != _libraries.end(); ++pos) {
|
||||
std::cerr << "deleting preset library" << std::endl;
|
||||
delete(pos->second);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
PresetLibrary * NativePresetFactory::loadLibrary(const std::string & url) {
|
||||
|
||||
if (_libraries.count(url))
|
||||
return _libraries[url];
|
||||
|
||||
// load the preset library
|
||||
void* handle = dlopen(url.c_str(), RTLD_LAZY);
|
||||
if (!handle) {
|
||||
std::cerr << "[NativePresetFactory] Cannot load library: " << dlerror() << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
// reset errors
|
||||
dlerror();
|
||||
|
||||
// load the symbols
|
||||
CreateFunctor * create = (CreateFunctor*) dlsym(handle, "create");
|
||||
const char * dlsym_error = dlerror();
|
||||
if (dlsym_error) {
|
||||
std::cerr << "[NativePresetFactory] Cannot load symbol create: " << dlsym_error << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
DestroyFunctor * destroy = (DestroyFunctor*) dlsym(handle, "destroy");
|
||||
dlsym_error = dlerror();
|
||||
if (dlsym_error) {
|
||||
std::cerr << "[NativePresetFactory] Cannot load symbol destroy: " << dlsym_error << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::cerr << "[NativePresetFactory] creating preset library from url " << url << std::endl;
|
||||
|
||||
PresetLibrary * library = new PresetLibrary(handle, create, destroy);
|
||||
|
||||
_libraries.insert(std::make_pair(url, library));
|
||||
return library;
|
||||
}
|
||||
|
||||
|
||||
std::auto_ptr<Preset> NativePresetFactory::allocate
|
||||
(const std::string & url, const std::string & name, const std::string & author) {
|
||||
|
||||
PresetLibrary * library;
|
||||
|
||||
if ((library = loadLibrary(url)) == 0)
|
||||
return std::auto_ptr<Preset>(0);
|
||||
|
||||
return std::auto_ptr<Preset>(new LibraryPreset
|
||||
(library->createFunctor()(url.c_str()), library->destroyFunctor()));
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
//
|
||||
// C++ Interface: NativePresetFactory
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Carmelo Piccione <carmelo.piccione@gmail.com>, (C) 2008
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __NATIVE_PRESET_FACTORY_HPP
|
||||
#define __NATIVE_PRESET_FACTORY_HPP
|
||||
|
||||
#include <memory>
|
||||
#include "PresetFactory.hpp"
|
||||
|
||||
class PresetLibrary;
|
||||
|
||||
class NativePresetFactory : public PresetFactory {
|
||||
|
||||
public:
|
||||
|
||||
NativePresetFactory();
|
||||
|
||||
virtual ~NativePresetFactory();
|
||||
|
||||
virtual std::auto_ptr<Preset> allocate(const std::string & url, const std::string & name = std::string(),
|
||||
const std::string & author = std::string());
|
||||
|
||||
virtual std::string supportedExtensions() const { return "so"; }
|
||||
|
||||
private:
|
||||
PresetLibrary * loadLibrary(const std::string & url);
|
||||
typedef std::map<std::string, PresetLibrary*> PresetLibraryMap;
|
||||
PresetLibraryMap _libraries;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user