Fix MacOSX 10.10 Yosemite Compilation

by using retroshare.pri file like linux or windows,
 fixing namespace for unordered_set,
 fixing c++11 for ostream& operator<<,
 checking if ntohll and htonll already defined.
This commit is contained in:
Phenom 2015-12-21 17:25:02 +01:00
parent 8e9fe6d800
commit 86b559191e
11 changed files with 127 additions and 13 deletions

View file

@ -33,7 +33,11 @@
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#ifdef __MAC_10_10
#include <unordered_set>
#else
#include <tr1/unordered_set>
#endif
#include <iomanip>
#include <fstream>
#include <sys/stat.h>
@ -54,8 +58,11 @@ static const char FILE_CACHE_SEPARATOR_CHAR = '|' ;
****/
static RsMutex FIndexPtrMtx("FIndexPtrMtx") ;
#ifdef __MAC_10_10
std::unordered_set<void*> FileIndex::_pointers ;
#else
std::tr1::unordered_set<void*> FileIndex::_pointers ;
#endif
void FileIndex::registerEntry(void*p)
{
RsStackMutex m(FIndexPtrMtx) ;

View file

@ -27,7 +27,11 @@
#include <string>
#include <map>
#include <set>
#if __MAC_10_10
#include <unordered_set>
#else
#include <tr1/unordered_set>
#endif
#include <list>
#include <vector>
#include <stdint.h>
@ -246,7 +250,11 @@ class FileIndex
PersonEntry *root;
#ifdef __MAC_10_10
static std::unordered_set<void*> _pointers ;
#else
static std::tr1::unordered_set<void*> _pointers ;
#endif
static void registerEntry(void*p) ;
static void unregisterEntry(void*p) ;
static bool isValid(void*p) ;

View file

@ -266,6 +266,7 @@ mac {
DEFINES *= MINIUPNPC_VERSION=13
CONFIG += upnp_miniupnpc
CONFIG += c+11
# zeroconf disabled at the end of libretroshare.pro (but need the code)
#CONFIG += zeroconf
@ -274,13 +275,14 @@ mac {
# Beautiful Hack to fix 64bit file access.
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dfopen64=fopen -Dvstatfs64=vstatfs
UPNPC_DIR = /usr/local/include
#GPG_ERROR_DIR = ../../../../libgpg-error-1.7
#GPGME_DIR = ../../../../gpgme-1.1.8
INCLUDEPATH += . $${UPNPC_DIR}
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
LIBS += /usr/local/lib/libsqlcipher.a

View file

@ -47,7 +47,12 @@ template<int n> class t_RsFlags32
friend std::ostream& operator<<(std::ostream& o,const t_RsFlags32<n>& f) // friendly print with 0 and I
{
for(int i=31;i>=0;--i) { o << ( (f._bits&(1<<i))?"I":"0") ; if(i%8==0) o << " " ; }
for(int i=31;i>=0;--i) {
std::string res = f._bits&(1<<i)?"I":"0" ;
std::string blank = " " ;
o << res ;
if(i%8==0) o << blank ;
}
return o ;
}
private:

View file

@ -40,6 +40,7 @@
#define BIG_ENDIAN 4321
#endif
#ifndef ntohll
uint64_t ntohll(uint64_t x)
{
#ifdef BYTE_ORDER
@ -61,11 +62,13 @@ uint64_t ntohll(uint64_t x)
#endif
}
#endif
#ifndef htonll
uint64_t htonll(uint64_t x)
{
return ntohll(x);
}
#endif
void sockaddr_clear(struct sockaddr_in *addr)
{

View file

@ -58,8 +58,12 @@ int inet_aton(const char *name, struct in_addr *addr);
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
/* 64 bit conversions */
#ifndef ntohll
uint64_t ntohll(uint64_t x);
#endif
#ifndef htonll
uint64_t htonll(uint64_t x);
#endif
/* blank a network address */
void sockaddr_clear(struct sockaddr_in *addr);