Clean up SDL/CMakeLists, clean up Blackberry build process, further reduce memory allocation (needed for Dev Alpha)

This commit is contained in:
Sacha 2012-11-14 02:20:01 +10:00
parent 6b51afb5fd
commit 8c9f9ae1cf
5 changed files with 34 additions and 54 deletions

View File

@ -226,13 +226,13 @@ u8* MemArena::Find4GBBase()
}
return base;
#else
void* base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE,
void* base = mmap(0, 0x5000000, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0);
if (base == MAP_FAILED) {
PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno));
PanicAlert("Failed to map 100 MB of memory space: %s", strerror(errno));
return 0;
}
munmap(base, 0x10000000);
munmap(base, 0x5000000);
return static_cast<u8*>(base);
#endif
#endif

View File

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 2.6)
project (PPSSPP)
find_package(PkgConfig)
find_package(PNG REQUIRED)
pkg_check_modules(SDL sdl)
@ -12,45 +11,46 @@ if (APPLE)
include_directories(/usr/X11/include)
endif()
# TODO: Rely on compiler define instead. __BLACKBERRY__ ?
# TODO: Rely on compiler define instead. __QNX__ __QNXNTO__ ?
if (BLACKBERRY)
add_definitions(-DBLACKBERRY)
if (BLACKBERRY GREATER 10)
if (NOT BLACKBERRY LESS 10.0)
add_definitions(-DBLACKBERRY10)
endif()
endif()
# TODO: Desktop can use GLES too. -D USING_GLES2 ?
if (NOT ARM)
include(FindOpenGL)
endif()
include(FindOpenGL)
include(FindSDL)
add_definitions(-g)
# add_definitions(-O2)
add_definitions(-Wall)
if (0) # RELEASE
add_definitions(-O2)
else() # DEBUG
add_definitions(-g)
add_definitions(-DUSE_PROFILER)
add_definitions(-D_DEBUG)
endif()
add_definitions(-DSDL)
add_definitions(-Wno-multichar)
add_definitions(-fno-strict-aliasing)
add_definitions(-DUSE_PROFILER)
add_definitions(-D_DEBUG)
if (UNIX)
if (NOT APPLE) # can't build the SDL .m file with -std=gnu++0x
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
endif()
# Apple can't build the SDL .m file with -std=gnu++0x
if (UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
endif()
include_directories(..)
include_directories(../Common)
include_directories(../native)
include_directories(../native/ext/libzip)
include_directories(/opt/local/include)
include_directories(/usr/local/include)
include_directories(${SDL_INCLUDE_DIR})
include_directories(${PNG_INCLUDE_DIR})
link_directories(/usr/local/lib)
link_directories(/opt/local/lib)
link_directories(/usr/X11/lib)
if (UNIX AND NOT ARM)
include_directories(/opt/local/include /usr/local/include)
link_directories(/usr/local/lib /opt/local/lib /usr/X11/lib)
endif()
add_subdirectory(../native/base base)
add_subdirectory(../native/gfx gfx)
@ -74,15 +74,15 @@ add_subdirectory(../Common Common)
add_subdirectory(../GPU GPU)
add_subdirectory(../Core Core)
set(LIBS ${LIBS} ${SDL_LIBRARY} file lin ${PNG_LIBRARY} z gfx gfx_es2 image stb_image mixer net ui profiler timeutil file zip base lin vjson stb_vorbis sha1 jsonwriter common core gpu kirk)
set(LIBS ${LIBS} ${SDL_LIBRARY} ${PNG_LIBRARY} z gfx gfx_es2 image stb_image mixer net ui profiler timeutil file zip base lin vjson stb_vorbis sha1 jsonwriter common core gpu kirk)
# TODO: Blackberry specific libs
if(BLACKBERRY)
set(LIBS ${LIBS} bps screen socket EGL GLESv2)
else()
set(LIBS ${LIBS} ${OPENGL_LIBRARIES} GLEW etcdec)
endif()
# TODO: Why is cross-platform UI in ../android/jni?
set(FILES
../android/jni/NativeApp.cpp
../android/jni/EmuScreen.cpp
@ -92,6 +92,7 @@ set(FILES
../android/jni/ui_atlas.cpp
)
# Platform setup
if(BLACKBERRY)
set(FILES ${FILES} ../native/base/BlackberryMain.cpp)
else()

View File

@ -2,16 +2,15 @@
BUILD_TYPE=Release
if type "arm-unknown-nto-qnx8.0.0eabi-cpp" >/dev/null 2>&1; then
BB_OS=10.0.9
echo "Building for Blackberry 10.0"
elif type "arm-unknown-nto-qnx6.5.0eabi-cpp" >/dev/null 2>&1; then
BB_OS=2.1.0
echo "Building for Blackberry 2.1"
if [ -f ${QNX_TARGET}/usr/include/bps/vibration.h ]; then
BB_OS=10.0
elif [ -f ${QNX_TARGET}/usr/include/bps/virtualkeyboard.h ]; then
BB_OS=2.1
else
echo "Could not find your Blackberry NDK. Please source bbndk-env.sh"
exit
exit 1
fi
echo "Building for Blackberry ${BB_OS}"
if [ -z "$PPSSPP_ROOT" ]; then
@ -24,7 +23,6 @@ PKG_CONFIG_PATH=${PROJECT_ROOT}/install/lib/pkgconfig
PKG_CONFIG_LIBDIR=${PROJECT_ROOT}/install/lib/pkgconfig
SDL_PROJECT=${PROJECT_ROOT}/SDL
SDLMIXER_PROJECT=${PROJECT_ROOT}/SDL_mixer
while true; do
case "$1" in
@ -43,9 +41,6 @@ while true; do
echo "Dependency Paths (defaults are under project root): "
echo " --sdl PATH SDL 1.2 project directory (default is SDL)"
echo " --tco PATH TouchControlOverlay project directory (default is TouchControlOverlay)"
echo " --sdl_mixer PATH SDL_mixer project directory (default is SDL_mixer)"
echo " --ogg PATH ogg project directory (default is ogg)"
echo " --vorbis PATH vorbis project directory (default is vorbis)"
exit 0
;;
-d | --debug ) BUILD_TYPE=Debug; shift ;;
@ -53,10 +48,7 @@ while true; do
-p | --project-root ) PROJECT_ROOT="$2"; shift 2 ;;
--pkg-config ) PKG_CONFIG_PATH="$2"; PKG_CONFIG_LIBDIR="$2"; shift 2 ;;
--sdl ) SDL_PROJECT="$2"; shift 2 ;;
--sdl_mixer ) SDLMIXER_PROJECT="$2"; shift 2 ;;
--tco ) TCO_PROJECT="$2"; shift 2 ;;
--ogg ) OGG_PROJECT="$2"; shift 2 ;;
--vorbis ) VORBIS_PROJECT="$2"; shift 2 ;;
-- ) shift; break ;;
* ) break ;;
esac
@ -65,18 +57,9 @@ done
if [ -z "$SDL_PROJECT" ]; then
SDL_PROJECT="$PROJECT_ROOT/SDL"
fi
if [ -z "$SDLMIXER_PROJECT" ]; then
SDLMIXER_PROJECT="$PROJECT_ROOT/SDL_mixer"
fi
if [ -z "$TCO_PROJECT" ]; then
TCO_PROJECT="$PROJECT_ROOT/TouchControlOverlay"
fi
if [ -z "$OGG_PROJECT" ]; then
OGG_PROJECT="$PROJECT_ROOT/ogg"
fi
if [ -z "$VORBIS_PROJECT" ]; then
VORBIS_PROJECT="$PROJECT_ROOT/vorbis"
fi
export PKG_CONFIG_PATH
export PKG_CONFIG_LIBDIR
@ -88,13 +71,9 @@ cmake \
-DCMAKE_SYSTEM_NAME=QNX \
-DCMAKE_C_COMPILER="${QNX_HOST}/usr/bin/ntoarmv7-gcc" \
-DCMAKE_CXX_COMPILER="${QNX_HOST}/usr/bin/ntoarmv7-g++" \
-DTHREADS_PTHREAD_ARG="" \
-DSDL_INCLUDE_DIR="${SDL_PROJECT}/include" \
-DSDL_LIBRARY="${SDL_PROJECT}/Device-${BUILD_TYPE}/libSDL12.so;${TCO_PROJECT}/Device-${BUILD_TYPE}/libTouchControlOverlay.so" \
-DSDL_FOUND=ON \
-DSDLMIXER_INCLUDE_DIR="${SDLMIXER_PROJECT}" \
-DSDLMIXER_LIBRARY="${SDLMIXER_PROJECT}/Device-${BUILD_TYPE}/libSDL_mixer.so;${OGG_PROJECT}/Device-${BUILD_TYPE}/libogg.so;${VORBIS_PROJECT}/Device-${BUILD_TYPE}/libvorbis.so" \
-DSDLMIXER_FOUND=ON \
-DPNG_LIBRARY="${QNX_TARGET}/armle-v7/usr/lib/libpng.so" \
-DPNG_PNG_INCLUDE_DIR="${QNX_TARGET}/usr/include" \
-DBLACKBERRY=${BB_OS} \

View File

@ -290,7 +290,7 @@ FileSelectScreen::FileSelectScreen(const FileSelectScreenOptions &options) : opt
void FileSelectScreen::updateListing() {
listing_.clear();
getFilesInDir(currentDirectory_.c_str(), &listing_, options_.filter.c_str());
getFilesInDir(currentDirectory_.c_str(), &listing_, options_.filter);
g_Config.currentDirectory = currentDirectory_;
list_.contentChanged();
}

View File

@ -68,7 +68,7 @@ public:
struct FileSelectScreenOptions {
std::string filter; // Enforced extension filter. Case insensitive, extensions separated by ":".
char* filter; // Enforced extension filter. Case insensitive, extensions separated by ":".
bool allowChooseDirectory;
int folderIcon;
std::map<std::string, int> iconMapping;