Android buildfix + cleanup

This commit is contained in:
Henrik Rydgard 2013-02-04 20:19:00 +01:00
parent 0737021858
commit 7a36619174
3 changed files with 47 additions and 7 deletions

View File

@ -39,6 +39,12 @@
#include "FileUtil.h"
#include "../ext/snappy/snappy-c.h"
#ifndef _MSC_VER
namespace std {
using tr1::is_pointer;
}
#endif
template <class T>
struct LinkedListItem : public T
{
@ -49,7 +55,12 @@ struct LinkedListItem : public T
class PointerWrap
{
// This makes it a compile error if you forget to define DoState() on non-POD.
// Which also can be a problem, for example struct tm is non-POD on linux, for whatever reason...
#ifdef _MSC_VER
template<typename T, bool isPOD = std::is_pod<T>::value, bool isPointer = std::is_pointer<T>::value>
#else
template<typename T, bool isPOD = __is_pod(T), bool isPointer = std::is_pointer<T>::value>
#endif
struct DoHelper
{
static void DoArray(PointerWrap *p, T *x, int count)
@ -108,7 +119,7 @@ public:
}
(*ptr) += size;
}
template<class K, class T>
void Do(std::map<K, T *> &x)
{
@ -242,6 +253,14 @@ public:
DoVector(x, dv);
}
template<class T>
void DoPOD(std::vector<T> &x)
{
T dv;
DoVectorPOD(x, dv);
}
template<class T>
void Do(std::vector<T> &x, T &default_val)
{
@ -257,6 +276,16 @@ public:
if (vec_size > 0)
DoArray(&x[0], vec_size);
}
template<class T>
void DoVectorPOD(std::vector<T> &x, T &default_val)
{
u32 vec_size = (u32)x.size();
Do(vec_size);
x.resize(vec_size, default_val);
if (vec_size > 0)
DoArray(&x[0], vec_size);
}
// Store deques.
template<class T>
@ -317,6 +346,7 @@ public:
Do(*itr);
}
// Store STL sets.
template <class T>
void Do(std::set<T *> &x)
@ -421,11 +451,16 @@ public:
void DoArray(T *x, int count) {
DoHelper<T>::DoArray(this, x, count);
}
template<class T>
void Do(T &x) {
DoHelper<T>::Do(this, x);
}
template<class T>
void DoPOD(T &x) {
DoHelper<T>::Do(this, x);
}
template<class T>
void DoPointer(T* &x, T*const base) {

View File

@ -15,6 +15,11 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ChunkFile.h"
#include "FileUtil.h"
#include "DirectoryFileSystem.h"
#ifdef _WIN32
#include <windows.h>
#include <sys/stat.h>
@ -25,9 +30,6 @@
#include <ctype.h>
#endif
#include "FileUtil.h"
#include "DirectoryFileSystem.h"
#if HOST_IS_CASE_SENSITIVE

View File

@ -5,7 +5,9 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native_audio
LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi -std=gnu++0x
LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi
# yes, it's really CPPFLAGS for C++
LOCAL_CPPFLAGS := -std=gnu++0x
NATIVE := ../../native
LOCAL_SRC_FILES := \
$(NATIVE)/android/native-audio-so.cpp
@ -25,7 +27,8 @@ NATIVE := ../../native
SRC := ../..
LOCAL_CFLAGS := -DUSE_PROFILER -DARM -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math
LOCAL_CXXFLAGS := -std=gnu++0x
# yes, it's really CPPFLAGS for C++
LOCAL_CPPFLAGS := -std=gnu++0x
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../Common \
$(LOCAL_PATH)/../.. \