Made BGFX compile for Apple GCC 4.2

This commit is contained in:
Miodrag Milanovic 2015-02-15 13:46:18 +01:00
parent 9aa024b206
commit d3e2122a2b
5 changed files with 36 additions and 5 deletions

View File

@ -95,11 +95,16 @@ inline ReadBitstream::ReadBitstream( const uint8_t* buffer, size_t bufferSize )
}
}
#if defined(__GNUC__) || defined(_MSC_VER)
#define U64(val) val##ULL
#else
#define U64(val) val
#endif
RBS_INLINE uint32_t ReadBitstream::Read( uint32_t bitCount )
{
uint64_t mask = ( uint64_t( 1 ) << bitCount ) - 1;
uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : 0xFFFFFFFFFFFFFFFF ) ) & mask );
uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : U64(0xFFFFFFFFFFFFFFFF) ) ) & mask );
if ( m_bitsLeft < bitCount )
{

View File

@ -13,10 +13,14 @@
BX_PRAGMA_DIAGNOSTIC_PUSH();
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4245) // error C4245: '=' : conversion from 'int' to 'FT_UInt', signed/unsigned mismatch
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#pragma push_macro("interface")
#endif
#undef interface
#include <freetype/freetype.h>
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#pragma pop_macro("interface")
#endif
BX_PRAGMA_DIAGNOSTIC_POP();
#include "../common.h"

View File

@ -428,6 +428,7 @@ struct FONScontext
void* errorUptr;
};
#if 0
static void* fons__tmpalloc(size_t size, void* up)
{
unsigned char* ptr;
@ -453,6 +454,7 @@ static void fons__tmpfree(void* ptr, void* up)
// empty
}
#endif
// Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.

View File

@ -61,7 +61,11 @@
# if BX_COMPILER_CLANG && (BX_PLATFORM_OSX || BX_PLATFORM_IOS)
# define BX_THREAD /* not supported right now */
# else
# define BX_THREAD __thread
# if (__GNUC__ == 4) && (__GNUC_MINOR__ <= 2)
# define BX_THREAD /* not supported right now */
# else
# define BX_THREAD __thread
# endif // __GNUC__ <= 4.2
# endif // BX_COMPILER_CLANG
# define BX_ATTRIBUTE(_x) __attribute__( (_x) )
# if BX_COMPILER_MSVC_COMPATIBLE
@ -134,7 +138,7 @@
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x)
#endif // BX_COMPILER_CLANG
#if BX_COMPILER_GCC
#if BX_COMPILER_GCC && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC() _Pragma("GCC diagnostic push")
# define BX_PRAGMA_DIAGNOSTIC_POP_GCC() _Pragma("GCC diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x) _Pragma(BX_STRINGIZE(GCC diagnostic ignored _x) )
@ -169,8 +173,13 @@
#endif // BX_COMPILER_
///
#define BX_TYPE_IS_POD(_type) (!__is_class(_type) || __is_pod(_type) )
#if defined(__GNUC__) && defined(__is_pod)
# define BX_TYPE_IS_POD(t) __is_pod(t)
#elif defined(_MSC_VER)
# define BX_TYPE_IS_POD(t) (!__is_class(t) || __is_pod(t))
#else
# define BX_TYPE_IS_POD(t) false
#endif
///
#define BX_CLASS_NO_DEFAULT_CTOR(_class) \
private: _class()

View File

@ -641,6 +641,11 @@ BGFXOBJS = \
# $(LIBOBJ)/bgfx/common/entry/entry_windows.o \
# $(LIBOBJ)/bgfx/common/entry/input.o \
ifeq ($(TARGETOS),macosx)
BGFXOBJS += $(LIBOBJ)/bgfx/glcontext_eagl.o
BGFXOBJS += $(LIBOBJ)/bgfx/glcontext_nsgl.o
endif
$(OBJ)/libbgfx.a: $(BGFXOBJS)
BGFXINC = -I$(3RDPARTY)/bgfx/include -I$(3RDPARTY)/bgfx/3rdparty -I$(3RDPARTY)/bx/include -I$(3RDPARTY)/bgfx/3rdparty/khronos
@ -675,3 +680,9 @@ $(LIBOBJ)/bgfx/common/%.o: $(3RDPARTY)/bgfx/examples/common/%.cpp | $(OSPREBUILD
@echo Compiling $<...
$(CC) $(CDEFS) $(CCOMFLAGS) $(BGFXINC) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -c $< -o $@
ifeq ($(TARGETOS),macosx)
$(LIBOBJ)/bgfx/%.o: $(3RDPARTY)/bgfx/src/%.mm | $(OSPREBUILD)
@echo Objective-C compiling $<...
$(CC) $(CDEFS) $(COBJFLAGS) $(CCOMFLAGS) $(BGFXINC) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -c $< -o $@
endif