Skip to content

Commit 69e9cda

Browse files
committed
fix some cmake stuff. add uninstall support
change plugin names, load changed names, don't install static libs, etc
1 parent 6c946fa commit 69e9cda

File tree

13 files changed

+59
-58
lines changed

13 files changed

+59
-58
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ MESSAGE("add checks for libmad, libvorbis and libflac. Make sure they are instal
8585
MESSAGE("")
8686
MESSAGE("-----------------------------------------------------------------------------")
8787

88+
SET( INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
89+
90+
# make uninstall support
91+
CONFIGURE_FILE(
92+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
93+
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
94+
IMMEDIATE @ONLY)
95+
96+
ADD_CUSTOM_TARGET(uninstall
97+
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
98+
99+
88100
IF( NOT APPLE )
89101
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
90102
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )

cmake_uninstall.cmake.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2+
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
3+
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4+
5+
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6+
STRING(REGEX REPLACE "\n" ";" files "${files}")
7+
FOREACH(file ${files})
8+
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
9+
IF(EXISTS "$ENV{DESTDIR}${file}")
10+
EXEC_PROGRAM(
11+
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12+
OUTPUT_VARIABLE rm_out
13+
RETURN_VALUE rm_retval
14+
)
15+
IF(NOT "${rm_retval}" STREQUAL 0)
16+
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
17+
ENDIF(NOT "${rm_retval}" STREQUAL 0)
18+
ELSE(EXISTS "$ENV{DESTDIR}${file}")
19+
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
20+
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
21+
ENDFOREACH(file)

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ IF( APPLE )
232232
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Frameworks/Sparkle.framework")
233233

234234
ENDIF(HAVE_SPARKLE)
235+
ELSEIF( APPLE )
236+
install( TARGETS tomahawk RUNTIME DESTINATION bin )
235237
ENDIF( APPLE )
236238

237239
INCLUDE( "CPack.txt" )

src/config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
#cmakedefine LIBLASTFM_FOUND
1818
#cmakedefine GLOOX_FOUND
1919

20+
#cmakedefine INSTALL_PREFIX
2021
#endif // CONFIG_H_IN

src/libtomahawk/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ set( libUI ${libUI}
305305
)
306306

307307
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ..
308+
${CMAKE_CURRENT_SOURCE_DIR}
308309
${QT_INCLUDE_DIR}
309310
${LIBECHONEST_INCLUDE_DIR}
310311
${LIBECHONEST_INCLUDE_DIR}/..

src/sip/SipHandler.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "sourcelist.h"
1212
#include "tomahawksettings.h"
1313

14+
#include "config.h"
1415

1516
SipHandler::SipHandler( QObject* parent )
1617
: QObject( parent )
@@ -60,10 +61,8 @@ SipHandler::findPlugins()
6061
}
6162
#endif
6263

63-
QDir libDir( appDir );
64-
libDir.cdUp();
65-
libDir.cd( "lib" );
66-
64+
QDir libDir( CMAKE_INSTALL_PREFIX "/lib" );
65+
6766
QDir lib64Dir( appDir );
6867
lib64Dir.cdUp();
6968
lib64Dir.cd( "lib64" );
@@ -72,9 +71,9 @@ SipHandler::findPlugins()
7271
foreach ( const QDir& pluginDir, pluginDirs )
7372
{
7473
qDebug() << "Checking directory for plugins:" << pluginDir;
75-
foreach ( QString fileName, pluginDir.entryList( QDir::Files ) )
74+
foreach ( QString fileName, pluginDir.entryList( QStringList() << "*tomahawk_sip*.so" << "*tomahawk_sip*.dylib" << "*tomahawk_sip*.dll", QDir::Files ) )
7675
{
77-
if ( fileName.startsWith( "libsip_" ) )
76+
if ( fileName.startsWith( "libtomahawk_sip" ) )
7877
{
7978
const QString path = pluginDir.absoluteFilePath( fileName );
8079
if ( !paths.contains( path ) )

src/sip/jabber/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
2121
)
2222

2323
qt4_wrap_cpp( jabberMoc ${jabberHeaders} )
24-
add_library( sip_jabber SHARED ${jabberSources} ${jabberMoc} )
24+
add_library( tomahawk_sipjabber SHARED ${jabberSources} ${jabberMoc} )
2525

2626
IF( WIN32 )
2727
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -32,7 +32,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
3232
)
3333
ENDIF( WIN32 )
3434

35-
target_link_libraries( sip_jabber
35+
target_link_libraries( tomahawk_sipjabber
3636
${QT_LIBRARIES}
3737
${GLOOX_LIBRARIES}
3838
${OS_SPECIFIC_LINK_LIBRARIES}
@@ -43,4 +43,4 @@ IF( APPLE )
4343
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
4444
ENDIF( APPLE )
4545

46-
install( TARGETS sip_jabber DESTINATION lib )
46+
install( TARGETS tomahawk_sipjabber LIBRARY DESTINATION lib )

src/sip/jreen/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
2222
)
2323

2424
qt4_wrap_cpp( jabberMoc ${jabberHeaders} )
25-
add_library( sip_jreen SHARED ${jabberSources} ${jabberMoc} )
25+
add_library( tomahawk_sipjreen SHARED ${jabberSources} ${jabberMoc} )
2626

2727
IF( WIN32 )
2828
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -33,7 +33,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
3333
)
3434
ENDIF( WIN32 )
3535

36-
target_link_libraries( sip_jreen
36+
target_link_libraries( tomahawk_sipjreen
3737
${QT_LIBRARIES}
3838
${LIBJREEN_LIBRARY}
3939
${OS_SPECIFIC_LINK_LIBRARIES}
@@ -43,4 +43,4 @@ IF( APPLE )
4343
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
4444
ENDIF( APPLE )
4545

46-
install( TARGETS sip_jreen DESTINATION lib )
46+
install( TARGETS tomahawk_sipjreen LIBRARY DESTINATION lib )

src/sip/twitter/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
2828

2929
qt4_wrap_cpp( twitterMoc ${twitterHeaders} )
3030
qt4_wrap_ui( twitterUI_H ${twitterUI} )
31-
add_library( sip_twitter SHARED ${twitterUI_H} ${twitterSources} ${twitterMoc} )
31+
add_library( tomahawk_siptwitter SHARED ${twitterUI_H} ${twitterSources} ${twitterMoc} )
3232

3333
IF( WIN32 )
3434
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -40,7 +40,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
4040
)
4141
ENDIF( WIN32 )
4242

43-
target_link_libraries( sip_twitter
43+
target_link_libraries( tomahawk_siptwitter
4444
${QT_LIBRARIES}
4545
${OS_SPECIFIC_LINK_LIBRARIES}
4646
tomahawklib
@@ -50,4 +50,4 @@ IF( APPLE )
5050
SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
5151
ENDIF( APPLE )
5252

53-
install( TARGETS sip_twitter DESTINATION lib )
53+
install( TARGETS tomahawk_siptwitter LIBRARY DESTINATION lib )

src/sip/zeroconf/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
2020
)
2121

2222
qt4_wrap_cpp( zeroconfMoc ${zeroconfHeaders} )
23-
add_library( sip_zeroconf SHARED ${zeroconfSources} ${zeroconfMoc} )
23+
add_library( tomahawk_sipzeroconf SHARED ${zeroconfSources} ${zeroconfMoc} )
2424

2525
IF( WIN32 )
2626
SET( OS_SPECIFIC_LINK_LIBRARIES
@@ -31,7 +31,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
3131
)
3232
ENDIF( WIN32 )
3333

34-
target_link_libraries( sip_zeroconf
34+
target_link_libraries( tomahawk_sipzeroconf
3535
${QT_LIBRARIES}
3636
${OS_SPECIFIC_LINK_LIBRARIES}
3737
tomahawklib
@@ -41,4 +41,4 @@ IF( APPLE )
4141
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
4242
ENDIF( APPLE )
4343

44-
install( TARGETS sip_zeroconf DESTINATION lib )
44+
install( TARGETS tomahawk_sipzeroconf LIBRARY DESTINATION lib )

src/tomahawkapp.cpp

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "audio/audioengine.h"
3535
#include "utils/xspfloader.h"
3636

37+
#include "config.h"
38+
3739
#ifndef TOMAHAWK_HEADLESS
3840
#include "tomahawkwindow.h"
3941
#include "settingsdialog.h"
@@ -253,7 +255,6 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
253255
setupPipeline();
254256
qDebug() << "Init Servent.";
255257
startServent();
256-
//loadPlugins();
257258

258259
if( arguments().contains( "--http" ) || TomahawkSettings::instance()->value( "network/http", true ).toBool() )
259260
{
@@ -454,44 +455,6 @@ TomahawkApp::startServent()
454455
}
455456
}
456457

457-
458-
void
459-
TomahawkApp::loadPlugins()
460-
{
461-
// look in same dir as executable for plugins
462-
QDir dir( TomahawkApp::instance()->applicationDirPath() );
463-
QStringList filters;
464-
filters << "*.so" << "*.dll" << "*.dylib";
465-
466-
QStringList files = dir.entryList( filters );
467-
foreach( const QString& filename, files )
468-
{
469-
qDebug() << "Attempting to load" << QString( "%1/%2" ).arg( dir.absolutePath() ).arg( filename );
470-
471-
QPluginLoader loader( dir.absoluteFilePath( filename ) );
472-
if ( QObject* inst = loader.instance() )
473-
{
474-
TomahawkPlugin* pluginst = qobject_cast<TomahawkPlugin *>(inst);
475-
if ( !pluginst )
476-
continue;
477-
478-
PluginAPI* api = new PluginAPI( Pipeline::instance() );
479-
TomahawkPlugin* plugin = pluginst->factory( api );
480-
qDebug() << "Loaded Plugin:" << plugin->name();
481-
qDebug() << plugin->description();
482-
m_plugins.append( plugin );
483-
484-
// plugins responsibility to register itself as a resolver/collection
485-
// all we need to do is create an instance of it.
486-
}
487-
else
488-
{
489-
qDebug() << "PluginLoader failed to create instance:" << filename << " Err:" << loader.errorString();
490-
}
491-
}
492-
}
493-
494-
495458
void
496459
TomahawkApp::setupSIP()
497460
{

thirdparty/libportfwd/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ ENDIF()
4646
# )
4747
#TARGET_LINK_LIBRARIES(portfwd-demo portfwd)
4848

49-
INSTALL(TARGETS portfwd ARCHIVE DESTINATION lib)
49+
# INSTALL(TARGETS portfwd ARCHIVE DESTINATION lib)
5050
#INSTALL(TARGETS portfwd-demo RUNTIME DESTINATION bin)
5151
#INSTALL(DIRECTORY include/portfwd DESTINATION include PATTERN "*~" EXCLUDE)

thirdparty/rtaudio/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ target_link_libraries( rtaudio
3838
${AUDIO_LIBS}
3939
)
4040

41+
IF(WIN32)
4142
INSTALL(TARGETS rtaudio ARCHIVE DESTINATION lib)
43+
ENDIF()

0 commit comments

Comments
 (0)