Multiple improvements to build process

Restructure and document retroshare.pri variables and helper functions
Link sqlite statically like other libraries on Android
qmake has multiple win32-* specs match them correctly
Move a buch of generic thing to retroshare.pri instead of having them replocated
  accross project specific .pro
Fix retroshare-gui too many symbols exported on windows liking error by adding
  QMAKE_LFLAGS+=-Wl,--exclude-libs,ALL
Rename retroshare-gui/src/util/win32.h because the name is too prone to
  confusion and build conflicts
libreasapi avoid usage of cretar_prl link_prl that seems unreliable on some
  platforms
libreasapi rename LIBRESAPI_QT to more understendable LIBRESAPI_SETTINGS
Use use_*.pri instead of copy pasting error prone qmake snippets around
Expose bitdht option to retroshare.pri
Add RS_THREAD_LIB qmake variable for better crossplatform support
Move debug and profiling generic options to retroshare.pri (avoid copy/pasting)
Remove Qt script module in qmake as it is not available anymore
This commit is contained in:
Gioacchino Mazzurco 2018-04-15 13:41:52 +02:00
parent b36cb1ef17
commit 4876a0ea3b
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
21 changed files with 502 additions and 466 deletions

View file

@ -2,30 +2,17 @@
TEMPLATE = lib
CONFIG += staticlib
CONFIG += create_prl
CONFIG -= qt
TARGET = retroshare
TARGET_PRL = libretroshare
DESTDIR = lib
#CONFIG += dsdv
retrotor {
DEFINES *= RETROTOR
CONFIG -= bitdht
} else {
CONFIG += bitdht
}
!include("use_libretroshare.pri"):error("Including")
# the dht stunner is used to obtain RS external ip addr. when it is natted
# this system is unreliable and rs supports a newer and better one (asking connected peers)
# CONFIG += useDhtStunner
profiling {
QMAKE_CXXFLAGS -= -fomit-frame-pointer
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
}
# treat warnings as error for better removing
#QMAKE_CFLAGS += -Werror
#QMAKE_CXXFLAGS += -Werror
@ -203,21 +190,11 @@ linux-* {
PKGCONFIG *= libssl libupnp
PKGCONFIG *= libcrypto zlib
LIBS *= -lpthread -ldl
}
no_sqlcipher:PKGCONFIG *= sqlite3
LIBS *= -ldl
linux-* {
DEFINES *= PLUGIN_DIR=\"\\\"$${PLUGIN_DIR}\\\"\"
DEFINES *= DATA_DIR=\"\\\"$${DATA_DIR}\\\"\"
## where to put the librarys interface
#include_rsiface.path = "$${INC_DIR}"
#include_rsiface.files = $$PUBLIC_HEADERS
#INSTALLS += include_rsiface
## where to put the shared library itself
#target.path = "$$LIB_DIR"
#INSTALLS *= target
}
linux-g++ {
@ -234,7 +211,7 @@ version_detail_bash_script {
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = $$PWD/version_detail.sh
}
win32 {
win32-* {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = $$PWD/version_detail.bat
@ -263,13 +240,11 @@ win32-x-g++ {
}
################################# Windows ##########################################
win32 {
win32-g++ {
QMAKE_CC = $${QMAKE_CXX}
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
# This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP)
DEFINES *= WINVER=0x0501
DEFINES *= STATICLIB
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
@ -289,15 +264,8 @@ win32 {
CONFIG += upnp_miniupnpc
no_sqlcipher {
PKGCONFIG *= sqlite3
LIBS += -lsqlite3
} else {
LIBS += -lsqlcipher
}
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
wLibs = ws2_32 gdi32 uuid iphlpapi crypt32 ole32 winmm
LIBS += $$linkDynamicLibs(wLibs)
}
################################# MacOSX ##########################################
@ -697,13 +665,16 @@ SOURCES += util/folderiterator.cc \
util/rsrecogn.cc \
util/rstime.cc
upnp_miniupnpc {
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
## Added for retrocompatibility remove ASAP
isEmpty(RS_UPNP_LIB) {
upnp_miniupnpc:RS_UPNP_LIB=miniupnpc
upnp_libupnp:RS_UPNP_LIB="upnp ixml threadutil"
}
upnp_libupnp {
equals(RS_UPNP_LIB, miniupnpc) {
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
} else {
HEADERS += upnp/UPnPBase.h upnp/upnphandler_linux.h
SOURCES += upnp/UPnPBase.cpp upnp/upnphandler_linux.cc
DEFINES *= RS_USE_LIBUPNP
@ -934,19 +905,13 @@ android-* {
DEFINES *= "fopen64=fopen"
DEFINES *= "fseeko64=fseeko"
DEFINES *= "ftello64=ftello"
LIBS *= -lbz2 -lupnp -lixml -lthreadutil -lsqlite3
## Static library are verysensible to order in command line, has to be in the
## end of file for this reason
## Static library are very susceptible to order in command line
sLibs = bz2 $$RS_UPNP_LIB $$RS_SQL_LIB ssl crypto
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lsqlcipher
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libsqlcipher.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
LIBS += $$linkStaticLibs(sLibs)
PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs)
HEADERS += util/androiddebug.h
}

View file

@ -0,0 +1,33 @@
DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src/))
INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src))
LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libretroshare/src/lib/)) -lretroshare
equals(TARGET, retroshare):equals(TEMPLATE, lib){
} else {
PRE_TARGETDEPS *= $$system_path($$clean_path($$OUT_PWD/../../libretroshare/src/lib/libretroshare.a))
}
!include("../../openpgpsdk/src/use_openpgpsdk.pri"):error("Including")
bitdht {
!include("../../libbitdht/src/use_libbitdht.pri"):error("Including")
}
sLibs =
mLibs = $$RS_SQL_LIB ssl crypto $$RS_THREAD_LIB $$RS_UPNP_LIB
dLibs =
linux-* {
mLibs += dl
}
static {
sLibs *= $$mLibs
} else {
dLibs *= $$mLibs
}
LIBS += $$linkStaticLibs(sLibs)
PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs)
LIBS += $$linkDynamicLibs(dLibs)