Use PKGCONFIG instead of manually specifying LIBS for Linux

- The advantage is that this method automatically includes additional
  dependencies of LIBS (e.g. libupnp needs -lixml).
- Also if some distribution moves headers to non default locations the
  correct locations get added by PKGCONFIG
This commit is contained in:
AsamK 2015-09-05 23:48:24 +02:00
parent b8e3a434cf
commit 66b9557833
8 changed files with 34 additions and 38 deletions

View File

@ -168,5 +168,3 @@ SOURCES += \
bitdht/bdquerymgr.cc \
util/bdbloom.cc \
bitdht/bdfriendlist.cc \

View File

@ -2,8 +2,10 @@
TEMPLATE = lib
CONFIG += staticlib
CONFIG += create_prl
CONFIG -= qt
TARGET = resapi
TARGET_PRL = libresapi
DESTDIR = lib
CONFIG += libmicrohttpd
@ -26,6 +28,12 @@ win32{
}
libmicrohttpd{
linux {
CONFIG += link_pkgconfig
PKGCONFIG *= libmicrohttpd
} else {
LIBS *= -lmicrohttpd
}
SOURCES += \
api/ApiServerMHD.cpp

View File

@ -120,8 +120,7 @@ HEADERS += $$PUBLIC_HEADERS
################################# Linux ##########################################
linux-* {
# These two lines fixe compilation on ubuntu natty. Probably a ubuntu packaging error.
INCLUDEPATH += $$system(pkg-config --cflags glib-2.0 | sed -e "s/-I//g")
CONFIG += link_pkgconfig
OPENPGPSDK_DIR = ../../openpgpsdk/src
DEPENDPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
@ -131,14 +130,9 @@ linux-* {
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
SSL_DIR = /usr/include/openssl
UPNP_DIR = /usr/include/upnp
DEPENDPATH += . $${SSL_DIR} $${UPNP_DIR}
INCLUDEPATH += . $${SSL_DIR} $${UPNP_DIR}
contains(CONFIG, NO_SQLCIPHER) {
DEFINES *= NO_SQLCIPHER
LIBS *= -lsqlite3
PKGCONFIG *= sqlite3
} else {
SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
isEmpty(SQLCIPHER_OK) {
@ -151,7 +145,7 @@ linux-* {
error("libsqlcipher is not installed and libsqlcipher.a not found. SQLCIPHER is necessary for encrypted database, to build with unencrypted database, run: qmake CONFIG+=NO_SQLCIPHER")
}
} else {
LIBS *= -lsqlcipher
PKGCONFIG *= sqlcipher
}
}
@ -163,7 +157,7 @@ linux-* {
CONFIG += upnp_libupnp
# Check if the systems libupnp has been Debian-patched
system(grep -E 'char[[:space:]]+PublisherUrl' $${UPNP_DIR}/upnp.h >/dev/null 2>&1) {
system(grep -E 'char[[:space:]]+PublisherUrl' /usr/include/upnp/upnp.h >/dev/null 2>&1) {
# Normal libupnp
} else {
# Patched libupnp or new unreleased version
@ -171,10 +165,10 @@ linux-* {
}
DEFINES *= UBUNTU
INCLUDEPATH += /usr/include/glib-2.0/ /usr/lib/glib-2.0/include
LIBS *= -lgnome-keyring
LIBS *= -lssl -lupnp -lixml
LIBS *= -lcrypto -lz -lpthread
PKGCONFIG *= gnome-keyring-1
PKGCONFIG *= libssl libupnp
PKGCONFIG *= libcrypto zlib
LIBS *= -lpthread -ldl
}
unix {

View File

@ -81,12 +81,9 @@ TRANSLATIONS += \
lang/FeedReader_zh_CN.ts
linux-* {
LIBXML2_DIR = /usr/include/libxml2
CONFIG += link_pkgconfig
DEPENDPATH += $${LIBXML2_DIR}
INCLUDEPATH += $${LIBXML2_DIR}
LIBS += -lcurl -lxml2 -lxslt
PKGCONFIG *= libcurl libxml-2.0 libxslt
}
win32 {
@ -102,4 +99,3 @@ openbsd-* {
LIBS += -lcurl -lxml2 -lxslt
}

View File

@ -21,10 +21,11 @@ INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
linux-* {
CONFIG += link_pkgconfig
# Necessary for openSUSE
PKGCONFIG += libavcodec libavutil
PKGCONFIG += speex speexdsp
PKGCONFIG += opencv
} else {
LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
}
win32 {
@ -103,5 +104,3 @@ TRANSLATIONS += \
lang/VOIP_sv.ts \
lang/VOIP_tr.ts \
lang/VOIP_zh_CN.ts
LIBS += -lspeex -lspeexdsp -lavcodec -lavutil

View File

@ -1,8 +1,10 @@
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
TEMPLATE = app
QT += network xml
CONFIG += qt gui uic qrc resources idle bitdht
CONFIG += link_prl
TARGET = RetroShare06
# Plz never commit the .pro with these flags enabled.
# Use this flag when developping new features only.
@ -34,9 +36,6 @@ CONFIG += gxsgui
#CONFIG += framecatcher
#CONFIG += blogs
TEMPLATE = app
TARGET = RetroShare06
DEFINES += RS_RELEASE_VERSION
RCC_DIR = temp/qrc
UI_DIR = temp/ui
@ -61,15 +60,16 @@ INCLUDEPATH *= retroshare-gui
################################# Linux ##########################################
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
linux-* {
CONFIG += link_pkgconfig
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lX11 -lXss
PKGCONFIG *= x11 xscrnsaver
LIBS *= -rdynamic -ldl
LIBS *= -rdynamic
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
DEFINES *= UBUNTU
}
@ -289,7 +289,7 @@ wikipoos {
DEPENDPATH += ../../libresapi/src
INCLUDEPATH += ../../libresapi/src
PRE_TARGETDEPS *= ../../libresapi/src/lib/libresapi.a
LIBS += ../../libresapi/src/lib/libresapi.a -lmicrohttpd
LIBS += ../../libresapi/src/lib/libresapi.a
# Input
HEADERS += rshare.h \

View File

@ -27,7 +27,7 @@ linux-* {
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS *= -rdynamic -ldl
LIBS *= -rdynamic
}
unix {
@ -169,7 +169,7 @@ introserver {
webui {
DEFINES *= ENABLE_WEBUI
PRE_TARGETDEPS *= ../../libresapi/src/lib/libresapi.a
LIBS += ../../libresapi/src/lib/libresapi.a -lmicrohttpd
LIBS += ../../libresapi/src/lib/libresapi.a
DEPENDPATH += ../../libresapi/src
INCLUDEPATH += ../../libresapi/src
HEADERS += \

View File

@ -15,8 +15,9 @@ debug {
################################# Linux ##########################################
linux-* {
DESTDIR = lib
LIBS *= -lglib-2.0
CONFIG += link_pkgconfig
PKGCONFIG *= glib-2.0
}
linux-g++ {