MacOSX buildfix. Doesn't run right yet though.

This commit is contained in:
Henrik Rydgård
2012-11-25 12:25:07 +01:00
parent ec25bfc9a4
commit fc453c979f
12 changed files with 57 additions and 31 deletions
+16 -10
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.8)
project(PPSSPP)
if(ANDROID OR BLACKBERRY)
if(ANDROID OR BLACKBERRY OR APPLE)
set(HEADLESS OFF)
elseif(NOT DEFINED HEADLESS)
set(HEADLESS ON)
@@ -68,13 +68,12 @@ if(ARM)
add_definitions(-DARM)
endif()
#add_definitions(-Wno-multichar)
#add_definitions(-fno-strict-aliasing)
#add_definitions(-DUSE_PROFILER)
if(NOT MSVC)
add_definitions(-D_XOPEN_SOURCE=600 -D__BSD_VISIBLE=1)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
add_definitions(-fno-strict-aliasing)
if(NOT APPLE)
add_definitions(-D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
endif()
if(BLACKBERRY)
add_definitions(-D_QNX_SOURCE=1 -D_C99=1)
@@ -89,7 +88,7 @@ if(NOT MSVC)
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
@@ -825,14 +824,21 @@ if(SDL_FOUND)
if(APPLE)
set(SDL_Main
SDL/SDLMain.h
SDL/SDLMain.m)
SDL/SDLMain.mm
native/base/PCMain.cpp)
else()
set(SDL_Main
native/base/PCMain.cpp)
endif()
add_executable(PPSSPPSDL ${SDL_Main} ${NativeAppSource})
target_link_libraries(PPSSPPSDL ${LinkCommon})
if(APPLE)
find_library(COCOA_LIBRARY Cocoa)
target_link_libraries(PPSSPPSDL ${COCOA_LIBRARY} ${LinkCommon})
else()
target_link_libraries(PPSSPPSDL ${LinkCommon})
endif()
endif()
file(INSTALL ${AndroidAssets} DESTINATION assets)
+4
View File
@@ -24,6 +24,10 @@
#include <windows.h>
#endif
// strcasecmp
#ifdef __APPLE__
#include <strings.h>
#endif
#include <string>
#include "FileSearch.h"
+13 -2
View File
@@ -26,15 +26,26 @@
#include <errno.h>
#include <stdio.h>
#endif
#ifdef __APPLE__
#include <sys/types.h>
#include <sys/mman.h>
#endif
#include <stdlib.h>
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
#include <unistd.h>
#ifdef __APPLE__
#define PAGE_MASK (4096-1)
#else
#define PAGE_MASK (getpagesize() - 1)
#endif
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
#endif
// This is purposely not a full wrapper for virtualalloc/mmap, but it
// provides exactly the primitive operations that Dolphin needs.
@@ -64,7 +75,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
// (unsigned long)size);
#if defined(__FreeBSD__)
if (ptr == MAP_FAILED)
{
@@ -72,7 +83,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#else
if (ptr == NULL)
{
#endif
#endif
PanicAlert("Failed to allocate executable memory");
}
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
+1 -2
View File
@@ -83,11 +83,10 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces)
{
std::ostringstream oss;
oss << std::setfill('0') << std::hex;
for (int line = 0; size; ++data, --size)
{
oss << std::setw(2) << (int)*data;
if (line_len == ++line)
{
oss << '\n';
+4
View File
@@ -62,6 +62,10 @@
#define M_SQRT1_2 0.707106781186547524401f
#endif
#ifdef __APPLE__
using std::isnan;
#endif
void ApplyPrefixST(float *v, u32 data, VectorSize size)
{
// Possible optimization shortcut:
+2 -2
View File
@@ -590,12 +590,12 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff)
case GE_CMD_MINZ:
gstate_c.zMin = getFloat24(data) / 65535.f;
DEBUG_LOG(G3D, "DL MinZ: %i", gstate_c.zMin);
DEBUG_LOG(G3D, "DL MinZ: %f", gstate_c.zMin);
break;
case GE_CMD_MAXZ:
gstate_c.zMax = getFloat24(data) / 65535.f;
DEBUG_LOG(G3D, "DL MaxZ: %i", gstate_c.zMax);
DEBUG_LOG(G3D, "DL MaxZ: %f", gstate_c.zMax);
break;
case GE_CMD_FRAMEBUFPTR:
+7 -9
View File
@@ -237,9 +237,9 @@ struct GPUgstate
float viewMatrix[12];
float projMatrix[16];
float tgenMatrix[12];
float boneMatrix[8*12];
float boneMatrix[12 * 8]; // Eight bone matrices.
inline bool isModeThrough() const { return vertType & GE_VTYPE_THROUGH; }
inline bool isModeThrough() const { return (vertType & GE_VTYPE_THROUGH) != 0; }
inline bool isModeClear() const { return clearmode & 1; }
inline bool isCullEnabled() const { return cullfaceEnable & 1; }
inline u8 getCullMode() const { return cullmode & 1; }
@@ -266,7 +266,7 @@ struct GPUStateCache
float lightpos[4][3];
float lightdir[4][3];
float lightatt[4][3];
Color4 lightColor[3][4]; //ADS
Color4 lightColor[3][4]; //Amtient Diffuse Specular
float morphWeights[8];
// bezier patch subdivision
@@ -281,7 +281,7 @@ struct GPUStateCache
struct GPUStatistics
{
void reset() {
memset(this, 0, sizeof(this));
memset(this, 0, sizeof(*this));
}
void resetFrame() {
numDrawCalls = 0;
@@ -298,18 +298,17 @@ struct GPUStatistics
// Total statistics
int numFrames;
};
void InitGfxState();
void ShutdownGfxState();
void ReapplyGfxState();
// PSP uses a curious 24-bit float - it's basically the top 24 bits of a regular IEEE754 32-bit float.
// This is used for light positions, transform matrices, you name it.
inline float getFloat24(unsigned int data)
{
data<<=8;
data <<= 8;
float f;
memcpy(&f, &data, 4);
return f;
@@ -319,8 +318,7 @@ inline float getFloat24(unsigned int data)
inline unsigned int toFloat24(float f) {
unsigned int i;
memcpy(&i, &f, 4);
i >>= 8;
return i;
return i >> 8;
}
class GPUInterface;
+2
View File
@@ -33,6 +33,8 @@ run:
cmake path/to/ppsspp
make
Alternatively, run b.sh which will create the directory for you.
You can specify the -G parameter to cmake to choose a generator.
The `NMake Makefiles`, `Visual Studio 11` (projects + sln),
`GNU Makefiles` and `Unix Makefiles` generators have been tested.
+5 -4
View File
@@ -30,9 +30,9 @@ typedef struct CPSProcessSerNum
UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
extern "C" OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern "C" OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern "C" OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
@@ -350,7 +350,7 @@ static void CustomApplicationMain (int argc, char **argv)
# undef main
#endif
extern "C" {
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
@@ -379,3 +379,4 @@ int main (int argc, char **argv)
return 0;
}
} // extern "C"
+1
View File
@@ -1,2 +1,3 @@
cp -r android/assets .
mkdir -p build
(cd build; cmake .. && make -j3 $1; cd ..)
+1 -1
Submodule native updated: 62b5bc46d0...86ed7895d4