add PREFIX option for qmake
This commit is contained in:
parent
f713544958
commit
b31fbb2b3f
61
guh.pro
61
guh.pro
@ -45,27 +45,8 @@ coverage {
|
|||||||
message("Building coverage.")
|
message("Building coverage.")
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build tests
|
!isEmpty(PREFIX) {
|
||||||
!disabletesting {
|
message("Install guhd to $$PREFIX")
|
||||||
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.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contains(DEFINES, GPIO433){
|
contains(DEFINES, GPIO433){
|
||||||
@ -76,40 +57,46 @@ contains(DEFINES, GPIO433){
|
|||||||
|
|
||||||
contains(DEFINES, SNAPPY){
|
contains(DEFINES, SNAPPY){
|
||||||
message("Building Ubuntu snappy package.")
|
message("Building Ubuntu snappy package.")
|
||||||
|
isEmpty(PREFIX) {
|
||||||
|
INSTALLDIR = ""
|
||||||
|
} else {
|
||||||
|
INSTALLDIR = $$PREFIX
|
||||||
|
}
|
||||||
|
|
||||||
meta.files = meta/package.yaml \
|
meta.files = meta/package.yaml \
|
||||||
meta/readme.md \
|
meta/readme.md \
|
||||||
meta/guh-logo.svg \
|
meta/guh-logo.svg \
|
||||||
meta/license.txt \
|
meta/license.txt \
|
||||||
meta/packLibs.sh
|
meta/packLibs.sh
|
||||||
meta.path = /meta/
|
meta.path = $$INSTALLDIR/meta/
|
||||||
|
|
||||||
wrapper.files = meta/guhd-wrapper.sh
|
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
|
# # We need to bring our own Qt libs, at least for now
|
||||||
qtlibs.files = /usr/lib/arm-linux-gnueabihf/libQt5Network.so.5 \
|
# qtlibs.files = /usr/lib/arm-linux-gnueabihf/libQt5Network.so.5 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libQt5Sql.so.5 \
|
# /usr/lib/arm-linux-gnueabihf/libQt5Sql.so.5 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 \
|
# /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libQt5Test.so.5 \
|
# /usr/lib/arm-linux-gnueabihf/libQt5Test.so.5 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 \
|
# /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libicui18n.so.52 \
|
# /usr/lib/arm-linux-gnueabihf/libicui18n.so.52 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libicuuc.so.52 \
|
# /usr/lib/arm-linux-gnueabihf/libicuuc.so.52 \
|
||||||
/usr/lib/arm-linux-gnueabihf/libicudata.so.52
|
# /usr/lib/arm-linux-gnueabihf/libicudata.so.52
|
||||||
qtlibs.path = /usr/lib/
|
# qtlibs.path = /usr/lib/
|
||||||
|
|
||||||
# install sqlite driver
|
# install sqlite driver
|
||||||
sqlplugin.files = /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlite.so
|
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
|
# install guhd.conf
|
||||||
guhdconf.files = data/config/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
|
# command to pack libs for snappy package
|
||||||
packlibs.depends = libguh server
|
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
|
QMAKE_EXTRA_TARGETS += packlibs
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,13 @@ DEFINES += LIBGUH_LIBRARY
|
|||||||
|
|
||||||
QMAKE_LFLAGS += -fPIC
|
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
|
INSTALLS += target
|
||||||
|
|
||||||
contains(DEFINES, BLUETOOTH_LE) {
|
contains(DEFINES, BLUETOOTH_LE) {
|
||||||
|
|||||||
@ -5,6 +5,10 @@ function packLib()
|
|||||||
echo -e "\nCopy dependencies for ${1}"
|
echo -e "\nCopy dependencies for ${1}"
|
||||||
deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/')
|
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
|
#Copy the deps
|
||||||
for dep in $deps
|
for dep in $deps
|
||||||
do
|
do
|
||||||
@ -13,14 +17,17 @@ done
|
|||||||
}
|
}
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
if [ -d ./dependencies ]; then
|
|
||||||
echo "Clean dependency folder"
|
if [ -z $1 ]; then
|
||||||
rm -rf ./dependencies/*
|
echo "usage: $0 <prefix>"
|
||||||
else
|
exit 1
|
||||||
mkdir -v ./dependencies
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
packLib libguh/libguh.so ./dependencies
|
if [ -d $1 ]; then
|
||||||
packLib server/guhd ./dependencies
|
echo "Clean dependency folder"
|
||||||
|
rm -rf $1/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
packLib ./libguh/libguh.so $1
|
||||||
|
packLib ./server/guhd $1
|
||||||
|
|
||||||
# TODO: pack qt plugin sqlite driver lib
|
|
||||||
|
|||||||
@ -17,5 +17,11 @@ infofile.input = JSONFILES
|
|||||||
|
|
||||||
QMAKE_EXTRA_COMPILERS += infofile
|
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
|
INSTALLS += target
|
||||||
|
|||||||
@ -5,7 +5,13 @@ TEMPLATE = app
|
|||||||
|
|
||||||
INCLUDEPATH += ../libguh jsonrpc
|
INCLUDEPATH += ../libguh jsonrpc
|
||||||
|
|
||||||
target.path = /usr/bin
|
isEmpty(PREFIX) {
|
||||||
|
INSTALLDIR = /usr/bin
|
||||||
|
} else {
|
||||||
|
INSTALLDIR = $$PREFIX/usr/bin/
|
||||||
|
}
|
||||||
|
|
||||||
|
target.path = $$INSTALLDIR
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|
||||||
QT += sql xml
|
QT += sql xml
|
||||||
|
|||||||
@ -17,5 +17,11 @@ SOURCES += ../guhtestbase.cpp \
|
|||||||
HEADERS += ../guhtestbase.h \
|
HEADERS += ../guhtestbase.h \
|
||||||
../mocktcpserver.h
|
../mocktcpserver.h
|
||||||
|
|
||||||
target.path = /usr/tests
|
isEmpty(PREFIX) {
|
||||||
|
INSTALLDIR = /usr/tests/
|
||||||
|
} else {
|
||||||
|
INSTALLDIR = $$PREFIX/usr/tests
|
||||||
|
}
|
||||||
|
|
||||||
|
target.path = $$INSTALLDIR
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|||||||
Reference in New Issue
Block a user