Merge pull request #221 from PhenomRetroShare/Fix_MacOSX.X_Plugin_Compilation

Fix compilation for plugins but miss RetroShare-gui library linking.
This commit is contained in:
defnax 2015-12-28 00:39:58 +01:00
commit d287a62318
6 changed files with 88 additions and 1 deletions

View File

@ -23,6 +23,9 @@ http://guide.macports.org/#installing.xcode
$sudo port -v selfupdate $sudo port -v selfupdate
$sudo port install openssl $sudo port install openssl
$sudo port install miniupnpc $sudo port install miniupnpc
###For VOIP Plugin:
$sudo port install speex-devel
$sudo port install opencv
###Get Your OSX SDK if missing: ###Get Your OSX SDK if missing:
https://github.com/phracker/MacOSX-SDKs https://github.com/phracker/MacOSX-SDKs

View File

@ -66,3 +66,18 @@ win32 {
for(bin, BIN_DIR):LIBS += -L"$$bin" for(bin, BIN_DIR):LIBS += -L"$$bin"
LIBS += -lpthread LIBS += -lpthread
} }
macx {
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
RCC_DIR = temp/qrc
UI_DIR = temp/ui
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
}

View File

@ -103,6 +103,28 @@ win32 {
INCLUDEPATH += . $$INC_DIR INCLUDEPATH += . $$INC_DIR
} }
macx {
DEFINES += CURL_STATICLIB LIBXML_STATIC LIBXSLT_STATIC LIBEXSLT_STATIC
XML2_FOUND =
for(inc, INC_DIR){
#message(Scanning $$inc)s
exists($$inc/libxml2){
isEmpty( XML2_FOUND) {
message(xml2 is first found here: $$inc .)
INC_DIR += "$$inc/libxml2"
XML2_FOUND = 1
}
}
}
DEPENDPATH += . $$INC_DIRs
INCLUDEPATH += . $$INC_DIR
LIBS = -lcurl -lxml2 -lxslt -lcrypto
error(Missing RetroShare-gui library. Remove Plugins from RetroShare.pro))
}
openbsd-* { openbsd-* {
LIBXML2_DIR = /usr/local/include/libxml2 LIBXML2_DIR = /usr/local/include/libxml2
} }

View File

@ -16,7 +16,7 @@ MOBILITY = multimedia
DEPENDPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src DEPENDPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
#################################### Windows ##################################### #################################### Linux #####################################
linux-* { linux-* {
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
@ -28,6 +28,8 @@ linux-* {
LIBS += -lspeex -lspeexdsp -lavcodec -lavutil LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
} }
#################################### Windows #####################################
win32 { win32 {
DEPENDPATH += . $$INC_DIR DEPENDPATH += . $$INC_DIR
@ -78,6 +80,41 @@ win32 {
LIBS += -lavifil32 -lavicap32 -lavcodec -lavutil -lswresample LIBS += -lavifil32 -lavicap32 -lavcodec -lavutil -lswresample
} }
#################################### MacOSX #####################################
macx {
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
#OPENCV_VERSION = "249"
USE_PRECOMPILED_LIBS =
for(lib, LIB_DIR) {
#message(Scanning $$lib)
exists( $$lib/opencv/libopencv_core*.dylib) {
isEmpty(USE_PRECOMPILED_LIBS) {
message(Get pre-compiled opencv libraries here:)
message($$lib)
LIBS += -L"$$lib/opencv"
LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc
USE_PRECOMPILED_LIBS = 1
}
}
exists( $$lib/libopencv_videoio*.dylib) {
message(videoio found in opencv libraries.)
message($$lib)
LIBS += -lopencv_videoio
}
}
isEmpty(USE_PRECOMPILED_LIBS) {
message(Use system opencv libraries.)
LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc
}
error(Missing RetroShare-gui library. Remove Plugins from RetroShare.pro))
}
# ffmpeg (and libavutil: https://github.com/ffms/ffms2/issues/11) # ffmpeg (and libavutil: https://github.com/ffms/ffms2/issues/11)
QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS

View File

@ -1,6 +1,10 @@
#include <iostream> #include <iostream>
#include <assert.h> #include <assert.h>
#ifdef __MACH__
#include <malloc/malloc.h>
#else
#include <malloc.h> #include <malloc.h>
#endif
#include <QByteArray> #include <QByteArray>
#include <QBuffer> #include <QBuffer>
@ -720,7 +724,12 @@ bool FFmpegVideo::decodeData(const RsVOIPDataChunk& chunk,QImage& image)
#if defined(__MINGW32__) #if defined(__MINGW32__)
unsigned char *tmp = (unsigned char*)_aligned_malloc(s + AV_INPUT_BUFFER_PADDING_SIZE, 16) ; unsigned char *tmp = (unsigned char*)_aligned_malloc(s + AV_INPUT_BUFFER_PADDING_SIZE, 16) ;
#else #else
#ifdef __MACH__
//Mac OS X appears to be 16-byte mem aligned.
unsigned char *tmp = (unsigned char*)malloc(s + AV_INPUT_BUFFER_PADDING_SIZE) ;
#else //MAC
unsigned char *tmp = (unsigned char*)memalign(16, s + AV_INPUT_BUFFER_PADDING_SIZE) ; unsigned char *tmp = (unsigned char*)memalign(16, s + AV_INPUT_BUFFER_PADDING_SIZE) ;
#endif //MAC
#endif //MINGW #endif //MINGW
if (tmp == NULL) { if (tmp == NULL) {
std::cerr << "FFmpegVideo::decodeData() Unable to allocate new buffer of size " << s << std::endl; std::cerr << "FFmpegVideo::decodeData() Unable to allocate new buffer of size " << s << std::endl;

View File

@ -45,6 +45,7 @@ macx {
LIB_DIR += "/opt/local/lib" LIB_DIR += "/opt/local/lib"
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10
QMAKE_MAC_SDK = macosx10.10 QMAKE_MAC_SDK = macosx10.10
CONFIG += c+11
} }
unfinished { unfinished {