aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-09-08 14:53:41 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-09-08 14:53:41 +0000
commitf5d91da6bed3743ed544facd898fd17b10df9110 (patch)
tree590c496d438c26cabb00837d7935540018b1db5d
parentbfcd52034d3b0a10f3fae5812bdc2a2943700fe8 (diff)
downloadqmmp-f5d91da6bed3743ed544facd898fd17b10df9110.tar.gz
qmmp-f5d91da6bed3743ed544facd898fd17b10df9110.tar.bz2
qmmp-f5d91da6bed3743ed544facd898fd17b10df9110.zip
added custom library path
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@144 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--CMakeLists.txt1
-rw-r--r--lib/CMakeLists.txt10
-rw-r--r--lib/constants.h29
-rw-r--r--lib/decoder.cpp2
-rw-r--r--lib/lib.pro21
-rw-r--r--lib/output.cpp3
-rw-r--r--lib/qmmp/Input/ffmpeg/CMakeLists.txt2
-rw-r--r--lib/qmmp/Input/ffmpeg/ffmpeg.pro6
-rw-r--r--lib/qmmp/Input/flac/CMakeLists.txt2
-rw-r--r--lib/qmmp/Input/flac/flac.pro6
-rw-r--r--lib/qmmp/Input/mad/CMakeLists.txt2
-rw-r--r--lib/qmmp/Input/mad/mad.pro6
-rw-r--r--lib/qmmp/Input/mpc/CMakeLists.txt2
-rw-r--r--lib/qmmp/Input/mpc/mpc.pro7
-rw-r--r--lib/qmmp/Input/vorbis/CMakeLists.txt2
-rw-r--r--lib/qmmp/Input/vorbis/vorbis.pro6
-rw-r--r--lib/qmmp/Output/alsa/CMakeLists.txt2
-rw-r--r--lib/qmmp/Output/alsa/alsa.pro7
-rw-r--r--lib/qmmp/Output/jack/CMakeLists.txt2
-rw-r--r--lib/qmmp/Output/jack/jack.pro7
-rw-r--r--lib/qmmp/Output/oss/CMakeLists.txt2
21 files changed, 86 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1403f8cb8..0ecd753d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,4 @@
+SET(LIB_DIR "lib" CACHE STRING "library path")
add_subdirectory(lib)
add_subdirectory(lib/qmmp)
add_subdirectory(src)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 25c54ee8e..ce8cba005 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -51,8 +51,14 @@ QT4_WRAP_CPP(libqmmp_MOC_SRCS ${libqmmp_MOC_HDRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES config.h)
+
+EXEC_PROGRAM(echo ${CMAKE_CURRENT_BINARY_DIR} ARGS "\"#ifndef CONFIG_H\"" > ./config.h)
+EXEC_PROGRAM(echo ${CMAKE_CURRENT_BINARY_DIR} ARGS "\"#define CONFIG_H\"" >> ./config.h)
+EXEC_PROGRAM(echo ${CMAKE_CURRENT_BINARY_DIR} ARGS "\"#define LIB_DIR \\\"/${LIB_DIR}\\\"\"" >> ./config.h)
+EXEC_PROGRAM(echo ${CMAKE_CURRENT_BINARY_DIR} ARGS "\"#endif\"" >> ./config.h)
+
ADD_LIBRARY(qmmp SHARED ${libqmmp_SRCS} ${libqmmp_MOC_SRCS})
target_link_libraries(qmmp ${QT_LIBRARIES} curl)
-install(TARGETS qmmp LIBRARY DESTINATION lib)
-
+install(TARGETS qmmp LIBRARY DESTINATION ${LIB_DIR})
diff --git a/lib/constants.h b/lib/constants.h
index 468dc08c1..ee558f3a9 100644
--- a/lib/constants.h
+++ b/lib/constants.h
@@ -1,21 +1,14 @@
-// Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
-//
-// Use, modification and distribution is allowed without limitation,
-// warranty, or liability of any kind.
-//
+#ifndef CONSTANTS_H
+#define CONSTANTS_H
-#ifndef __constants_h
-#define __constants_h
+#ifdef Q_OS_UNIX
+#include "config.h"
+#endif
-#define VERSION "MQ3 Release Fourteen"
+#define VERSION "0.2.0"
-#if defined(Q_OS_UNIX)
-//# include "../config.h"
-# ifndef INSTALLDIR
-# define INSTALLDIR "/usr/local"
-# endif
-#elif defined( Q_OS_WIN32 )
-# define INSTALLDIR "c:/depot/mq3/main"
+#ifndef LIB_DIR
+#define LIB_DIR "/lib"
#endif
const unsigned int historySize = 100;
@@ -23,8 +16,4 @@ const unsigned int globalBlockSize = 2 * 1024; //2*1024
const unsigned int globalBufferSize = globalBlockSize * 32;
const unsigned int groupOpenTimeout = 750;
-#if defined( Q_OS_WIN32 )
-#define BUFFERBLOCKS 16
-#endif
-
-#endif // __constants_h
+#endif // CONSTANTS_H
diff --git a/lib/decoder.cpp b/lib/decoder.cpp
index 02983d78b..be8821535 100644
--- a/lib/decoder.cpp
+++ b/lib/decoder.cpp
@@ -57,7 +57,7 @@ static void checkFactories()
QDir pluginsDir (qApp->applicationDirPath());
pluginsDir.cdUp();
- pluginsDir.cd("lib/qmmp/Input");
+ pluginsDir.cd("./"LIB_DIR"/qmmp/Input");
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
{
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
diff --git a/lib/lib.pro b/lib/lib.pro
index 152c548e6..0df692ccd 100644
--- a/lib/lib.pro
+++ b/lib/lib.pro
@@ -27,7 +27,7 @@ SOURCES += recycler.cpp \
soundcore.cpp \
streamreader.cpp \
downloader.cpp \
- filetag.cpp
+ filetag.cpp
TARGET = qmmp
CONFIG += release \
@@ -38,5 +38,22 @@ link_pkgconfig
TEMPLATE = lib
PKGCONFIG += libcurl
-target.path = /lib
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+
+unix{
+LINE1 = $$sprintf(echo \"%1ifndef CONFIG_H\" > ./config.h, $$LITERAL_HASH)
+LINE2 = $$sprintf(echo \"%1define CONFIG_H\" >> ./config.h, $$LITERAL_HASH)
+LINE3 = $$sprintf(echo \"%1define LIB_DIR \\\"%2\\\"\" >> ./config.h, $$LITERAL_HASH, $$LIB_DIR)
+LINE4 = $$sprintf(echo \"%1endif\" >> ./config.h, $$LITERAL_HASH)
+system($$LINE1)
+system($$LINE2)
+system($$LINE3)
+system($$LINE4)
+QMAKE_CLEAN += ./config.h
+}
+
+target.path = $$LIB_DIR
INSTALLS += target
diff --git a/lib/output.cpp b/lib/output.cpp
index 0d0e4de99..285fa98c5 100644
--- a/lib/output.cpp
+++ b/lib/output.cpp
@@ -10,6 +10,7 @@
#include <QApplication>
#include <QTimer>
+#include "constants.h"
#include "output.h"
#include "visualization.h"
@@ -30,7 +31,7 @@ static void checkFactories()
QDir pluginsDir ( qApp->applicationDirPath() );
pluginsDir.cdUp();
- pluginsDir.cd ( "lib/qmmp/Output" );
+ pluginsDir.cd ( "./"LIB_DIR"/qmmp/Output" );
foreach ( QString fileName, pluginsDir.entryList ( QDir::Files ) )
{
QPluginLoader loader ( pluginsDir.absoluteFilePath ( fileName ) );
diff --git a/lib/qmmp/Input/ffmpeg/CMakeLists.txt b/lib/qmmp/Input/ffmpeg/CMakeLists.txt
index 31f8520b4..6d912fd0e 100644
--- a/lib/qmmp/Input/ffmpeg/CMakeLists.txt
+++ b/lib/qmmp/Input/ffmpeg/CMakeLists.txt
@@ -90,5 +90,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(ffmpeg SHARED ${libffmpeg_SRCS} ${libffmpeg_MOC_SRCS} ${libffmpeg_UIS_H}
${libffmpeg_RCC_SRCS})
target_link_libraries(ffmpeg ${QT_LIBRARIES} -lqmmp ${LIBAVCODEC_LINK_FLAGS} ${LIBAVFORMAT_LINK_FLAGS} ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
-install(TARGETS ffmpeg DESTINATION lib/qmmp/Input)
+install(TARGETS ffmpeg DESTINATION ${LIB_DIR}/qmmp/Input)
diff --git a/lib/qmmp/Input/ffmpeg/ffmpeg.pro b/lib/qmmp/Input/ffmpeg/ffmpeg.pro
index db96d3464..30d425ae2 100644
--- a/lib/qmmp/Input/ffmpeg/ffmpeg.pro
+++ b/lib/qmmp/Input/ffmpeg/ffmpeg.pro
@@ -19,5 +19,9 @@ DEFINES += __STDC_CONSTANT_MACROS
PKGCONFIG += libavcodec libavformat
#TRANSLATIONS = translations/ffmpeg_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Input
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+target.path = $$LIB_DIR/qmmp/Input
INSTALLS += target
diff --git a/lib/qmmp/Input/flac/CMakeLists.txt b/lib/qmmp/Input/flac/CMakeLists.txt
index 6d9a49b80..33d972a6c 100644
--- a/lib/qmmp/Input/flac/CMakeLists.txt
+++ b/lib/qmmp/Input/flac/CMakeLists.txt
@@ -82,5 +82,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(flac SHARED ${libflac_SRCS} ${libflac_MOC_SRCS} ${libflac_UIS_H}
${libflac_RCC_SRCS})
target_link_libraries(flac ${QT_LIBRARIES} -lqmmp ${FLAC_LINK_FLAGS} ${FLAC_CFLAGS} ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
-install(TARGETS flac DESTINATION lib/qmmp/Input)
+install(TARGETS flac DESTINATION ${LIB_DIR}/qmmp/Input)
diff --git a/lib/qmmp/Input/flac/flac.pro b/lib/qmmp/Input/flac/flac.pro
index 618123e36..3847cd196 100644
--- a/lib/qmmp/Input/flac/flac.pro
+++ b/lib/qmmp/Input/flac/flac.pro
@@ -23,6 +23,10 @@ LIBS += -lqmmp -L/usr/lib -I/usr/include
PKGCONFIG += taglib flac
#TRANSLATIONS = translations/flac_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Input
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+target.path = $$LIB_DIR/qmmp/Input
INSTALLS += target
diff --git a/lib/qmmp/Input/mad/CMakeLists.txt b/lib/qmmp/Input/mad/CMakeLists.txt
index ed6400c59..98b636d61 100644
--- a/lib/qmmp/Input/mad/CMakeLists.txt
+++ b/lib/qmmp/Input/mad/CMakeLists.txt
@@ -87,4 +87,4 @@ ADD_LIBRARY(mad SHARED ${libmad_SRCS} ${libmad_MOC_SRCS} ${libmad_UIS_H}
${libmad_RCC_SRCS})
target_link_libraries(mad ${QT_LIBRARIES} -lqmmp ${MAD_LINK_FLAGS} ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
-install(TARGETS mad DESTINATION lib/qmmp/Input)
+install(TARGETS mad DESTINATION ${LIB_DIR}/qmmp/Input)
diff --git a/lib/qmmp/Input/mad/mad.pro b/lib/qmmp/Input/mad/mad.pro
index f98863515..fd81524ae 100644
--- a/lib/qmmp/Input/mad/mad.pro
+++ b/lib/qmmp/Input/mad/mad.pro
@@ -26,5 +26,9 @@ LIBS += -lqmmp
PKGCONFIG += taglib mad
#TRANSLATIONS = translations/mad_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Input
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+target.path = $$LIB_DIR/qmmp/Input
INSTALLS += target
diff --git a/lib/qmmp/Input/mpc/CMakeLists.txt b/lib/qmmp/Input/mpc/CMakeLists.txt
index 3b11922df..341f615f8 100644
--- a/lib/qmmp/Input/mpc/CMakeLists.txt
+++ b/lib/qmmp/Input/mpc/CMakeLists.txt
@@ -76,7 +76,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(mpc SHARED ${libmpc_SRCS} ${libmpc_MOC_SRCS} ${libmpc_UIS_H}
${libmpc_RCC_SRCS})
target_link_libraries(mpc ${QT_LIBRARIES} -lqmmp -lmpcdec ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
-install(TARGETS mpc DESTINATION lib/qmmp/Input)
+install(TARGETS mpc DESTINATION ${LIB_DIR}/qmmp/Input)
# clean remaining files
diff --git a/lib/qmmp/Input/mpc/mpc.pro b/lib/qmmp/Input/mpc/mpc.pro
index 4b279bcc7..93c7a5d38 100644
--- a/lib/qmmp/Input/mpc/mpc.pro
+++ b/lib/qmmp/Input/mpc/mpc.pro
@@ -18,5 +18,10 @@ LIBS += -lqmmp -L/usr/lib -lmpcdec -I/usr/include
PKGCONFIG += taglib
#TRANSLATIONS = translations/mpc_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Input
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+
+target.path = $$LIB_DIR/qmmp/Input
INSTALLS += target
diff --git a/lib/qmmp/Input/vorbis/CMakeLists.txt b/lib/qmmp/Input/vorbis/CMakeLists.txt
index 4633220f4..e814b8c1c 100644
--- a/lib/qmmp/Input/vorbis/CMakeLists.txt
+++ b/lib/qmmp/Input/vorbis/CMakeLists.txt
@@ -93,4 +93,4 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(vorbis SHARED ${libvorbis_SRCS} ${libvorbis_MOC_SRCS} ${libvorbis_UIS_H}
${libvorbis_RCC_SRCS})
target_link_libraries(vorbis ${QT_LIBRARIES} -lqmmp ${VORBIS_LINK_FLAGS} ${VORBISFILE_LINK_FLAGS} ${OGG_LINK_FLAGS} ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
-install(TARGETS vorbis DESTINATION lib/qmmp/Input)
+install(TARGETS vorbis DESTINATION ${LIB_DIR}/qmmp/Input)
diff --git a/lib/qmmp/Input/vorbis/vorbis.pro b/lib/qmmp/Input/vorbis/vorbis.pro
index ada5a9ecb..89f393f54 100644
--- a/lib/qmmp/Input/vorbis/vorbis.pro
+++ b/lib/qmmp/Input/vorbis/vorbis.pro
@@ -23,5 +23,9 @@ LIBS += -lqmmp -L/usr/lib
PKGCONFIG += taglib ogg vorbisfile vorbis
#TRANSLATIONS = translations/vorbis_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Input
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+target.path = $$LIB_DIR/qmmp/Input
INSTALLS += target
diff --git a/lib/qmmp/Output/alsa/CMakeLists.txt b/lib/qmmp/Output/alsa/CMakeLists.txt
index 987c6b5d3..f543879fd 100644
--- a/lib/qmmp/Output/alsa/CMakeLists.txt
+++ b/lib/qmmp/Output/alsa/CMakeLists.txt
@@ -61,5 +61,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(alsa SHARED ${libalsa_SRCS} ${libalsa_MOC_SRCS} ${libalsa_UIS_H}
${libalsa_RCC_SRCS})
target_link_libraries(alsa ${QT_LIBRARIES} -lqmmp -lasound)
-install(TARGETS alsa DESTINATION lib/qmmp/Output)
+install(TARGETS alsa DESTINATION ${LIB_DIR}/qmmp/Output)
diff --git a/lib/qmmp/Output/alsa/alsa.pro b/lib/qmmp/Output/alsa/alsa.pro
index 06ef0b6ce..b1dbee703 100644
--- a/lib/qmmp/Output/alsa/alsa.pro
+++ b/lib/qmmp/Output/alsa/alsa.pro
@@ -22,5 +22,10 @@ LIBS += -lqmmp -lasound
FORMS += settingsdialog.ui
#TRANSLATIONS = translations/alsa_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Output
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+
+target.path = $$LIB_DIR/qmmp/Output
INSTALLS += target
diff --git a/lib/qmmp/Output/jack/CMakeLists.txt b/lib/qmmp/Output/jack/CMakeLists.txt
index a8e9b9d1a..81a476301 100644
--- a/lib/qmmp/Output/jack/CMakeLists.txt
+++ b/lib/qmmp/Output/jack/CMakeLists.txt
@@ -70,5 +70,5 @@ QT4_WRAP_CPP(libjack_MOC_SRCS ${libjack_MOC_HDRS})
ADD_LIBRARY(jack SHARED ${libjack_SRCS} ${libjack_MOC_SRCS} ${libjack_RCC_SRCS})
target_link_libraries(jack ${QT_LIBRARIES} -lqmmp ${JACK_LINK_FLAGS} ${SAMPLERATE_LINK_FLAGS})
-install(TARGETS jack DESTINATION lib/qmmp/Output)
+install(TARGETS jack DESTINATION ${LIB_DIR}/qmmp/Output)
diff --git a/lib/qmmp/Output/jack/jack.pro b/lib/qmmp/Output/jack/jack.pro
index 1e81bfc08..19c1d697b 100644
--- a/lib/qmmp/Output/jack/jack.pro
+++ b/lib/qmmp/Output/jack/jack.pro
@@ -22,5 +22,10 @@ LIBS += -lqmmp
PKGCONFIG += jack samplerate
#TRANSLATIONS = translations/jack_plugin_ru.ts
#RESOURCES = translations/translations.qrc
-target.path = /lib/qmmp/Output
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+
+target.path = $$LIB_DIR/qmmp/Output
INSTALLS += target
diff --git a/lib/qmmp/Output/oss/CMakeLists.txt b/lib/qmmp/Output/oss/CMakeLists.txt
index 0e44e5213..640327c48 100644
--- a/lib/qmmp/Output/oss/CMakeLists.txt
+++ b/lib/qmmp/Output/oss/CMakeLists.txt
@@ -63,5 +63,5 @@ QT4_WRAP_UI(liboss_UIS_H ${liboss_UIS})
ADD_LIBRARY(oss SHARED ${liboss_SRCS} ${liboss_MOC_SRCS} ${liboss_UIS_H})
target_link_libraries(oss ${QT_LIBRARIES} -lqmmp )
-install(TARGETS oss DESTINATION lib/qmmp/Output)
+install(TARGETS oss DESTINATION ${LIB_DIR}/qmmp/Output)