Fix Android compilation

This commit is contained in:
Gioacchino Mazzurco 2018-01-22 11:09:00 +01:00
parent bc0990e3c8
commit b95e3380c0
3 changed files with 31 additions and 0 deletions

View File

@ -145,8 +145,17 @@ build_libmicrohttpd()
cd ..
}
build_rapidjson()
{
B_dir="rapidjson-1.1.0"
[ -f $B_dir.tar.gz ] || wget -O $B_dir.tar.gz https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
tar -xf $B_dir.tar.gz
cp -r rapidjson-1.1.0/include/rapidjson/ "${SYSROOT}/usr/include/rapidjson"
}
build_toolchain
build_bzlib
build_openssl
build_sqlite
build_libupnp
build_rapidjson

View File

@ -199,7 +199,27 @@ template<> bool RsTypeSerializer::to_JSON( const std::string& memberName, \
SIMPLE_TO_JSON_DEF(bool)
SIMPLE_TO_JSON_DEF(int32_t)
#ifdef __ANDROID__
template<> bool RsTypeSerializer::to_JSON( const std::string& memberName,
const time_t& member, RsJson& jDoc )
{
rapidjson::Document::AllocatorType& allocator = jDoc.GetAllocator();
rapidjson::Value key;
key.SetString(memberName.c_str(), memberName.length(), allocator);
int64_t tValue = member;
rapidjson::Value value(tValue);
jDoc.AddMember(key, value, allocator);
return true;
}
#else
SIMPLE_TO_JSON_DEF(time_t)
#endif
SIMPLE_TO_JSON_DEF(uint8_t)
SIMPLE_TO_JSON_DEF(uint16_t)
SIMPLE_TO_JSON_DEF(uint32_t)

View File

@ -36,6 +36,8 @@
#include "serialiser/rsserializable.h"
#include <rapidjson/document.h>
#include <typeinfo> // for typeid
/** INTERNAL ONLY helper to avoid copy paste code for std::{vector,list,set}<T>
* Can't use a template function because T is needed for const_cast */