update main.m to use pyo instead of py, avoid kivy logging, config, and use sdl for audio.

+ add sdl_mixer/libogg/libtremor
+ put everything in release state, with optimisation etc.
This commit is contained in:
Mathieu Virbel 2012-02-25 15:51:34 +01:00
parent f48eab1498
commit edcdf989e3
8 changed files with 67 additions and 28 deletions

2
.gitignore vendored
View file

@ -7,3 +7,5 @@ build/*
SDL/Xcode-iPhoneOS/SDL/build/
kivy/*
libtremor/*
libogg/*

View file

View file

@ -25,8 +25,12 @@ int main(int argc, char *argv[]) {
// Kivy environment to prefer some implementation on ios platform
putenv("KIVY_BUILD=ios");
putenv("KIVY_NO_CONFIG=1");
putenv("KIVY_NO_FILELOG=1");
putenv("KIVY_NO_CONSOLELOG=1");
putenv("KIVY_WINDOW=sdl");
putenv("KIVY_IMAGE=imageio");
putenv("KIVY_AUDIO=sdl");
NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
NSLog(@"PythonHome is: %s", (char *)[resourcePath UTF8String]);
@ -41,13 +45,13 @@ int main(int argc, char *argv[]) {
// Search and start main.py
const char * prog = [
[[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"py"] cStringUsingEncoding:
[[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"pyo"] cStringUsingEncoding:
NSUTF8StringEncoding];
NSLog(@"Running main.py: %s", prog);
NSLog(@"Running main.pyo: %s", prog);
FILE* fd = fopen(prog, "r");
if ( fd == NULL ) {
ret = 1;
NSLog(@"Unable to open main.py, abort.");
NSLog(@"Unable to open main.pyo, abort.");
} else {
ret = PyRun_SimpleFileEx(fd, prog, 1);
if (ret != 0)

View file

@ -24,5 +24,5 @@ make ios
# FIXME this part is build/cpu dependent :/
bd=build/lib.macosx-*/kivy
try $KIVYIOSROOT/biglink $BUILDROOT/lib/libkivy.a $bd $bd/graphics $bd/core/window $bd/core/text $bd/core/image
try $KIVYIOSROOT/biglink $BUILDROOT/lib/libkivy.a $bd $bd/graphics $bd/core/window $bd/core/text $bd/core/image $bd/core/audio
deduplicate $BUILDROOT/lib/libkivy.a

View file

@ -1,8 +1,8 @@
#!/bin/bash
. ./environment.sh
pushd SDL/Xcode-iPhoneOS/SDL
xcodebuild -project SDLiPhoneOS.xcodeproj -target libSDL -configuration Debug -sdk iphoneos5.0
xcodebuild -project SDLiPhoneOS.xcodeproj -target libSDL -configuration Release -sdk iphoneos5.0
popd
cp SDL/Xcode-iPhoneOS/SDL/build/Debug-iPhoneOS/libSDL.a $BUILDROOT/lib
cp SDL/Xcode-iPhoneOS/SDL/build/Release-iPhoneOS/libSDL.a $BUILDROOT/lib
cp -a SDL/include $BUILDROOT/include/SDL

View file

@ -11,14 +11,49 @@ if [ ! -d libtremor ]; then
svn co http://svn.xiph.org/trunk/Tremor tremor
cd ..
fi
if [ ! -d libogg ]; then
curl -L http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > .cache/libogg-1.3.0.tar.gz
tar xzf .cache/libogg-1.3.0.tar.gz
mv libogg-1.3.0 libogg
fi
if [ ! -f libogg/src/.libs/libogg.a ]; then
cd libogg
./configure --disable-shared \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no \
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS"
make
cd ..
fi
if [ ! -f libtremor/tremor/.libs/libvorbisidec.a ]; then
cd libtremor/tremor
echo > asm_arm.h
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS" \
ACLOCAL_FLAGS="-I /usr/local/share/aclocal" ./autogen.sh \
--disable-shared \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no \
--with-ogg-includes=../../libogg/include
make
cd ../..
fi
cp libogg/src/.libs/libogg.a $BUILDROOT/lib
cp libtremor/tremor/.libs/libvorbisidec.a $BUILDROOT/lib
if [ -f SDL_mixer/libSDL_mixer-arm7.a ]; then
exit 0;
fi
pushd SDL_mixer/Xcode-iOS
xcodebuild -project SDL_mixer.xcodeproj -configuration Debug
xcodebuild -project SDL_mixer.xcodeproj -configuration Release
popd
cp SDL_mixer/Xcode-iOS/build/Debug-iphoneos/libSDL_mixer.a $BUILDROOT/lib
cp SDL_mixer/Xcode-iOS/build/Release-iphoneos/libSDL_mixer.a $BUILDROOT/lib
cp -a SDL_mixer/SDL_mixer.h $BUILDROOT/include

View file

@ -7,25 +7,22 @@ if [ ! -f $CACHEROOT/SDL_ttf-$SDLTTF_VERSION.tar.gz ]; then
tar xzf $CACHEROOT/SDL_ttf-$SDLTTF_VERSION.tar.gz
fi
if [ -f SDL_ttf-$SDLTTF_VERSION/libSDL_ttf-arm7.a ]; then
exit 0;
if [ ! -f SDL_ttf-$SDLTTF_VERSION/.libs/libSDL_ttf.a ]; then
pushd SDL_ttf-$SDLTTF_VERSION
rm libSDL_ttf.la
./configure --prefix=/usr/local/iphone \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no \
--without-x \
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS"
make clean
make libSDL_ttf.la
popd
fi
pushd SDL_ttf-$SDLTTF_VERSION
rm libSDL_ttf.la
./configure --prefix=/usr/local/iphone \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no \
--without-x \
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS"
make clean
make libSDL_ttf.la
# copy to buildroot
cp .libs/libSDL_ttf.a $BUILDROOT/lib/libSDL_ttf.a
cp -a SDL_ttf.h $BUILDROOT/include
popd
cp SDL_ttf-$SDLTTF_VERSION/.libs/libSDL_ttf.a $BUILDROOT/lib/libSDL_ttf.a
cp -a SDL_ttf-$SDLTTF_VERSION/SDL_ttf.h $BUILDROOT/include

View file

@ -35,8 +35,9 @@ export ARM_CFLAGS="$ARM_CFLAGS -miphoneos-version-min=$SDKVER"
export ARM_LDFLAGS="-isysroot $SDKROOT"
export ARM_LDFLAGS="$ARM_LDFLAGS -miphoneos-version-min=$SDKVER"
# comment this line if you want debugging stuff
export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
# uncomment this line if you want debugging stuff
export ARM_CFLAGS="$ARM_CFLAGS -O3"
#export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
# create build directory if not found
try mkdir -p $BUILDROOT