Permalink
Browse files

fix some cmake stuff. add uninstall support

change plugin names, load changed names, don't install static libs, etc
  • Loading branch information...
1 parent 6c946fa commit 69e9cda5e6a8d1a15ed906b2331e6a84344f5abc @lfranchi lfranchi committed Mar 18, 2011
View
@@ -85,6 +85,18 @@ MESSAGE("add checks for libmad, libvorbis and libflac. Make sure they are instal
MESSAGE("")
MESSAGE("-----------------------------------------------------------------------------")
+SET( INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
+
+# make uninstall support
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+
IF( NOT APPLE )
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
View
@@ -0,0 +1,21 @@
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)
View
@@ -232,6 +232,8 @@ IF( APPLE )
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Frameworks/Sparkle.framework")
ENDIF(HAVE_SPARKLE)
+ELSEIF( APPLE )
+ install( TARGETS tomahawk RUNTIME DESTINATION bin )
ENDIF( APPLE )
INCLUDE( "CPack.txt" )
View
@@ -17,4 +17,5 @@
#cmakedefine LIBLASTFM_FOUND
#cmakedefine GLOOX_FOUND
+#cmakedefine INSTALL_PREFIX
#endif // CONFIG_H_IN
@@ -305,6 +305,7 @@ set( libUI ${libUI}
)
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ..
+ ${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}/..
View
@@ -11,6 +11,7 @@
#include "sourcelist.h"
#include "tomahawksettings.h"
+#include "config.h"
SipHandler::SipHandler( QObject* parent )
: QObject( parent )
@@ -60,10 +61,8 @@ SipHandler::findPlugins()
}
#endif
- QDir libDir( appDir );
- libDir.cdUp();
- libDir.cd( "lib" );
-
+ QDir libDir( CMAKE_INSTALL_PREFIX "/lib" );
+
QDir lib64Dir( appDir );
lib64Dir.cdUp();
lib64Dir.cd( "lib64" );
@@ -72,9 +71,9 @@ SipHandler::findPlugins()
foreach ( const QDir& pluginDir, pluginDirs )
{
qDebug() << "Checking directory for plugins:" << pluginDir;
- foreach ( QString fileName, pluginDir.entryList( QDir::Files ) )
+ foreach ( QString fileName, pluginDir.entryList( QStringList() << "*tomahawk_sip*.so" << "*tomahawk_sip*.dylib" << "*tomahawk_sip*.dll", QDir::Files ) )
{
- if ( fileName.startsWith( "libsip_" ) )
+ if ( fileName.startsWith( "libtomahawk_sip" ) )
{
const QString path = pluginDir.absoluteFilePath( fileName );
if ( !paths.contains( path ) )
@@ -21,7 +21,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
)
qt4_wrap_cpp( jabberMoc ${jabberHeaders} )
-add_library( sip_jabber SHARED ${jabberSources} ${jabberMoc} )
+add_library( tomahawk_sipjabber SHARED ${jabberSources} ${jabberMoc} )
IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -32,7 +32,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
)
ENDIF( WIN32 )
-target_link_libraries( sip_jabber
+target_link_libraries( tomahawk_sipjabber
${QT_LIBRARIES}
${GLOOX_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
@@ -43,4 +43,4 @@ IF( APPLE )
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
ENDIF( APPLE )
-install( TARGETS sip_jabber DESTINATION lib )
+install( TARGETS tomahawk_sipjabber LIBRARY DESTINATION lib )
@@ -22,7 +22,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
)
qt4_wrap_cpp( jabberMoc ${jabberHeaders} )
-add_library( sip_jreen SHARED ${jabberSources} ${jabberMoc} )
+add_library( tomahawk_sipjreen SHARED ${jabberSources} ${jabberMoc} )
IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -33,7 +33,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
)
ENDIF( WIN32 )
-target_link_libraries( sip_jreen
+target_link_libraries( tomahawk_sipjreen
${QT_LIBRARIES}
${LIBJREEN_LIBRARY}
${OS_SPECIFIC_LINK_LIBRARIES}
@@ -43,4 +43,4 @@ IF( APPLE )
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
ENDIF( APPLE )
-install( TARGETS sip_jreen DESTINATION lib )
+install( TARGETS tomahawk_sipjreen LIBRARY DESTINATION lib )
@@ -28,7 +28,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
qt4_wrap_cpp( twitterMoc ${twitterHeaders} )
qt4_wrap_ui( twitterUI_H ${twitterUI} )
-add_library( sip_twitter SHARED ${twitterUI_H} ${twitterSources} ${twitterMoc} )
+add_library( tomahawk_siptwitter SHARED ${twitterUI_H} ${twitterSources} ${twitterMoc} )
IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -40,7 +40,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
)
ENDIF( WIN32 )
-target_link_libraries( sip_twitter
+target_link_libraries( tomahawk_siptwitter
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
tomahawklib
@@ -50,4 +50,4 @@ IF( APPLE )
SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
ENDIF( APPLE )
-install( TARGETS sip_twitter DESTINATION lib )
+install( TARGETS tomahawk_siptwitter LIBRARY DESTINATION lib )
@@ -20,7 +20,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
)
qt4_wrap_cpp( zeroconfMoc ${zeroconfHeaders} )
-add_library( sip_zeroconf SHARED ${zeroconfSources} ${zeroconfMoc} )
+add_library( tomahawk_sipzeroconf SHARED ${zeroconfSources} ${zeroconfMoc} )
IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -31,7 +31,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
)
ENDIF( WIN32 )
-target_link_libraries( sip_zeroconf
+target_link_libraries( tomahawk_sipzeroconf
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
tomahawklib
@@ -41,4 +41,4 @@ IF( APPLE )
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
ENDIF( APPLE )
-install( TARGETS sip_zeroconf DESTINATION lib )
+install( TARGETS tomahawk_sipzeroconf LIBRARY DESTINATION lib )
View
@@ -34,6 +34,8 @@
#include "audio/audioengine.h"
#include "utils/xspfloader.h"
+#include "config.h"
+
#ifndef TOMAHAWK_HEADLESS
#include "tomahawkwindow.h"
#include "settingsdialog.h"
@@ -253,7 +255,6 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
setupPipeline();
qDebug() << "Init Servent.";
startServent();
- //loadPlugins();
if( arguments().contains( "--http" ) || TomahawkSettings::instance()->value( "network/http", true ).toBool() )
{
@@ -454,44 +455,6 @@ TomahawkApp::startServent()
}
}
-
-void
-TomahawkApp::loadPlugins()
-{
- // look in same dir as executable for plugins
- QDir dir( TomahawkApp::instance()->applicationDirPath() );
- QStringList filters;
- filters << "*.so" << "*.dll" << "*.dylib";
-
- QStringList files = dir.entryList( filters );
- foreach( const QString& filename, files )
- {
- qDebug() << "Attempting to load" << QString( "%1/%2" ).arg( dir.absolutePath() ).arg( filename );
-
- QPluginLoader loader( dir.absoluteFilePath( filename ) );
- if ( QObject* inst = loader.instance() )
- {
- TomahawkPlugin* pluginst = qobject_cast<TomahawkPlugin *>(inst);
- if ( !pluginst )
- continue;
-
- PluginAPI* api = new PluginAPI( Pipeline::instance() );
- TomahawkPlugin* plugin = pluginst->factory( api );
- qDebug() << "Loaded Plugin:" << plugin->name();
- qDebug() << plugin->description();
- m_plugins.append( plugin );
-
- // plugins responsibility to register itself as a resolver/collection
- // all we need to do is create an instance of it.
- }
- else
- {
- qDebug() << "PluginLoader failed to create instance:" << filename << " Err:" << loader.errorString();
- }
- }
-}
-
-
void
TomahawkApp::setupSIP()
{
@@ -46,6 +46,6 @@ ENDIF()
# )
#TARGET_LINK_LIBRARIES(portfwd-demo portfwd)
-INSTALL(TARGETS portfwd ARCHIVE DESTINATION lib)
+# INSTALL(TARGETS portfwd ARCHIVE DESTINATION lib)
#INSTALL(TARGETS portfwd-demo RUNTIME DESTINATION bin)
#INSTALL(DIRECTORY include/portfwd DESTINATION include PATTERN "*~" EXCLUDE)
@@ -38,4 +38,6 @@ target_link_libraries( rtaudio
${AUDIO_LIBS}
)
+IF(WIN32)
INSTALL(TARGETS rtaudio ARCHIVE DESTINATION lib)
+ENDIF()

0 comments on commit 69e9cda

Please sign in to comment.