add PREFIX option for qmake

pull/135/head
Simon Stürz 2015-07-13 21:05:37 +02:00 committed by Michael Zanetti
parent f713544958
commit b31fbb2b3f
6 changed files with 67 additions and 49 deletions

61
guh.pro
View File

@ -45,27 +45,8 @@ coverage {
message("Building coverage.")
}
# Build tests
!disabletesting {
message("Building guh with tests")
SUBDIRS += tests
DEFINES += TESTING_ENABLED
} else {
message("Building guh without tests")
}
# Bluetooth LE support
contains(DEFINES, BLUETOOTH_LE) {
message("Bluetooth LE enabled.")
} else {
message("Bluetooth LE disabled (Qt $${QT_VERSION} < 5.4.0).")
}
# Websocket support
contains(DEFINES, WEBSOCKET){
message("Building guh with websocket.")
} else {
message("Building guh without websocket.")
!isEmpty(PREFIX) {
message("Install guhd to $$PREFIX")
}
contains(DEFINES, GPIO433){
@ -76,40 +57,46 @@ contains(DEFINES, GPIO433){
contains(DEFINES, SNAPPY){
message("Building Ubuntu snappy package.")
isEmpty(PREFIX) {
INSTALLDIR = ""
} else {
INSTALLDIR = $$PREFIX
}
meta.files = meta/package.yaml \
meta/readme.md \
meta/guh-logo.svg \
meta/license.txt \
meta/packLibs.sh
meta.path = /meta/
meta.path = $$INSTALLDIR/meta/
wrapper.files = meta/guhd-wrapper.sh
wrapper.path = /usr/bin/
wrapper.path = $$INSTALLDIR/usr/bin/
# We need to bring our own Qt libs, at least for now
qtlibs.files = /usr/lib/arm-linux-gnueabihf/libQt5Network.so.5 \
/usr/lib/arm-linux-gnueabihf/libQt5Sql.so.5 \
/usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 \
/usr/lib/arm-linux-gnueabihf/libQt5Test.so.5 \
/usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 \
/usr/lib/arm-linux-gnueabihf/libicui18n.so.52 \
/usr/lib/arm-linux-gnueabihf/libicuuc.so.52 \
/usr/lib/arm-linux-gnueabihf/libicudata.so.52
qtlibs.path = /usr/lib/
# # We need to bring our own Qt libs, at least for now
# qtlibs.files = /usr/lib/arm-linux-gnueabihf/libQt5Network.so.5 \
# /usr/lib/arm-linux-gnueabihf/libQt5Sql.so.5 \
# /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 \
# /usr/lib/arm-linux-gnueabihf/libQt5Test.so.5 \
# /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 \
# /usr/lib/arm-linux-gnueabihf/libicui18n.so.52 \
# /usr/lib/arm-linux-gnueabihf/libicuuc.so.52 \
# /usr/lib/arm-linux-gnueabihf/libicudata.so.52
# qtlibs.path = /usr/lib/
# install sqlite driver
sqlplugin.files = /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlite.so
sqlplugin.path = /usr/lib/qt5/plugins/sqldrivers/
sqlplugin.path = $$INSTALLDIR/usr/lib/qt5/plugins/sqldrivers/
# install guhd.conf
guhdconf.files = data/config/guhd.conf
guhdconf.path = /config/
guhdconf.path = $$INSTALLDIR/config/
INSTALLS += meta wrapper qtlibs sqlplugin guhdconf
INSTALLS += meta wrapper guhdconf sqlplugin
# command to pack libs for snappy package
packlibs.depends = libguh server
packlibs.commands = $$top_srcdir/meta/packLibs.sh $$top_srcdir
packlibs.commands = $$top_srcdir/meta/packLibs.sh $$INSTALLDIR/usr/lib/
QMAKE_EXTRA_TARGETS += packlibs

View File

@ -8,7 +8,13 @@ DEFINES += LIBGUH_LIBRARY
QMAKE_LFLAGS += -fPIC
target.path = /usr/lib
# define installation path
isEmpty(PREFIX) {
INSTALLDIR = /usr/lib/
} else {
INSTALLDIR = $$PREFIX/usr/lib/
}
target.path = $$INSTALLDIR
INSTALLS += target
contains(DEFINES, BLUETOOTH_LE) {

View File

@ -5,6 +5,10 @@ function packLib()
echo -e "\nCopy dependencies for ${1}"
deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/')
#Check if the paths are vaild
[[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1
[[ -d $2 ]] || echo -e "No such directory $2 "&& mkdir -pv "$2"
#Copy the deps
for dep in $deps
do
@ -13,14 +17,17 @@ done
}
#################################################
if [ -d ./dependencies ]; then
echo "Clean dependency folder"
rm -rf ./dependencies/*
else
mkdir -v ./dependencies
if [ -z $1 ]; then
echo "usage: $0 <prefix>"
exit 1
fi
packLib libguh/libguh.so ./dependencies
packLib server/guhd ./dependencies
if [ -d $1 ]; then
echo "Clean dependency folder"
rm -rf $1/*
fi
packLib ./libguh/libguh.so $1
packLib ./server/guhd $1
# TODO: pack qt plugin sqlite driver lib

View File

@ -17,5 +17,11 @@ infofile.input = JSONFILES
QMAKE_EXTRA_COMPILERS += infofile
target.path = /usr/lib/guh/plugins/
isEmpty(PREFIX) {
INSTALLDIR = /usr/lib/guh/plugins/
} else {
INSTALLDIR = $$PREFIX/usr/lib/guh/plugins/
}
target.path = $$INSTALLDIR
INSTALLS += target

View File

@ -5,7 +5,13 @@ TEMPLATE = app
INCLUDEPATH += ../libguh jsonrpc
target.path = /usr/bin
isEmpty(PREFIX) {
INSTALLDIR = /usr/bin
} else {
INSTALLDIR = $$PREFIX/usr/bin/
}
target.path = $$INSTALLDIR
INSTALLS += target
QT += sql xml

View File

@ -17,5 +17,11 @@ SOURCES += ../guhtestbase.cpp \
HEADERS += ../guhtestbase.h \
../mocktcpserver.h
target.path = /usr/tests
isEmpty(PREFIX) {
INSTALLDIR = /usr/tests/
} else {
INSTALLDIR = $$PREFIX/usr/tests
}
target.path = $$INSTALLDIR
INSTALLS += target