Merge pull request #1235 from G10h4ck/build_improvements

Build improvements
This commit is contained in:
G10h4ck 2018-04-23 12:04:35 +02:00 committed by GitHub
commit 82eb42ad8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 533 additions and 495 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)

View file

@ -58,6 +58,15 @@ int inet_aton(const char *name, struct in_addr *addr);
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
/**
* Workaround for binary compatibility between Windows XP (which miss
* IPV6_V6ONLY define), and newer Windows that has it.
* @see http://lua-users.org/lists/lua-l/2013-04/msg00191.html
*/
#ifndef IPV6_V6ONLY
# define IPV6_V6ONLY 27
#endif
/* 64 bit conversions */
#ifndef ntohll
uint64_t ntohll(uint64_t x);