diff --git a/app/iOS-python-test.xcodeproj/project.pbxproj b/app/iOS-python-test.xcodeproj/project.pbxproj new file mode 100755 index 0000000..2f091db --- /dev/null +++ b/app/iOS-python-test.xcodeproj/project.pbxproj @@ -0,0 +1,342 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 010731C2137F20B800A8D3A0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 010731C1137F20B800A8D3A0 /* AudioToolbox.framework */; }; + 010731C4137F20C300A8D3A0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 010731C3137F20C300A8D3A0 /* QuartzCore.framework */; }; + 01532DAA137C099F0076F6BF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 01532DA9137C099F0076F6BF /* icon.png */; }; + 01790B81137E5ED900E037D1 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01790B7A137E5ED900E037D1 /* OpenGLES.framework */; }; + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 59994D8D148D48E300863906 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994D8C148D48E300863906 /* ImageIO.framework */; }; + 59994D90148D686900863906 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994D8F148D686900863906 /* libbz2.dylib */; }; + 59994D9E148E353000863906 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994D9D148E352F00863906 /* libz.dylib */; }; + 59994DAD148E558600863906 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994DA8148E558600863906 /* libfreetype.a */; }; + 59994DAE148E558600863906 /* libkivy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994DA9148E558600863906 /* libkivy.a */; }; + 59994DAF148E558600863906 /* libpython2.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994DAA148E558600863906 /* libpython2.7.a */; }; + 59994DB0148E558600863906 /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994DAB148E558600863906 /* libSDL_ttf.a */; }; + 59994DB1148E558600863906 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 59994DAC148E558600863906 /* libSDL.a */; }; + 59994DB3148E564400863906 /* lib in Resources */ = {isa = PBXBuildFile; fileRef = 59994DB2148E564400863906 /* lib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 010731C1137F20B800A8D3A0 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 010731C3137F20C300A8D3A0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 01532DA9137C099F0076F6BF /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; + 01790B7A137E5ED900E037D1 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* iOS-python-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS-python-test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 59994D8C148D48E300863906 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; + 59994D8F148D686900863906 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; }; + 59994D9D148E352F00863906 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + 59994DA8148E558600863906 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../build/lib/libfreetype.a; sourceTree = ""; }; + 59994DA9148E558600863906 /* libkivy.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkivy.a; path = ../build/lib/libkivy.a; sourceTree = ""; }; + 59994DAA148E558600863906 /* libpython2.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpython2.7.a; path = ../build/lib/libpython2.7.a; sourceTree = ""; }; + 59994DAB148E558600863906 /* libSDL_ttf.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL_ttf.a; path = ../build/lib/libSDL_ttf.a; sourceTree = ""; }; + 59994DAC148E558600863906 /* libSDL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL.a; path = ../build/lib/libSDL.a; sourceTree = ""; }; + 59994DB2148E564400863906 /* lib */ = {isa = PBXFileReference; lastKnownFileType = folder; name = lib; path = ../build/python/lib; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* iOS_python_test-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iOS_python_test-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 59994DAD148E558600863906 /* libfreetype.a in Frameworks */, + 59994DAE148E558600863906 /* libkivy.a in Frameworks */, + 59994DAF148E558600863906 /* libpython2.7.a in Frameworks */, + 59994DB0148E558600863906 /* libSDL_ttf.a in Frameworks */, + 59994DB1148E558600863906 /* libSDL.a in Frameworks */, + 59994D90148D686900863906 /* libbz2.dylib in Frameworks */, + 59994D9E148E353000863906 /* libz.dylib in Frameworks */, + 59994D8D148D48E300863906 /* ImageIO.framework in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 01790B81137E5ED900E037D1 /* OpenGLES.framework in Frameworks */, + 010731C2137F20B800A8D3A0 /* AudioToolbox.framework in Frameworks */, + 010731C4137F20C300A8D3A0 /* QuartzCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + ); + path = Classes; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* iOS-python-test.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 59994DB2148E564400863906 /* lib */, + 01532DA9137C099F0076F6BF /* icon.png */, + 8D1107310486CEB800E47090 /* iOS_python_test-Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 59994DA8148E558600863906 /* libfreetype.a */, + 59994DA9148E558600863906 /* libkivy.a */, + 59994DAA148E558600863906 /* libpython2.7.a */, + 59994DAB148E558600863906 /* libSDL_ttf.a */, + 59994DAC148E558600863906 /* libSDL.a */, + 59994D9D148E352F00863906 /* libz.dylib */, + 59994D8F148D686900863906 /* libbz2.dylib */, + 59994D8C148D48E300863906 /* ImageIO.framework */, + 010731C1137F20B800A8D3A0 /* AudioToolbox.framework */, + 010731C3137F20C300A8D3A0 /* QuartzCore.framework */, + 01790B7A137E5ED900E037D1 /* OpenGLES.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* iOS-python-test */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iOS-python-test" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "iOS-python-test"; + productName = "iOS-python-test"; + productReference = 1D6058910D05DD3D006BFB54 /* iOS-python-test.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iOS-python-test" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* iOS-python-test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 01532DAA137C099F0076F6BF /* icon.png in Resources */, + 59994DB3148E564400863906 /* lib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + CODE_SIGN_IDENTITY = "iPhone Developer: Mathieu Virbel (KSW92G7TX8)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "\"$(PROJECT_DIR)/../build/include\"", + "\"$(PROJECT_DIR)/../build/python/include\"", + ); + INFOPLIST_FILE = "iOS_python_test-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(PROJECT_DIR)/../build/lib\"", + ); + OTHER_LDFLAGS = "-all_load"; + PRODUCT_NAME = "iOS-python-test"; + PROVISIONING_PROFILE = "08F763D9-A549-403A-9BA2-FC25EE9AEFD6"; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer: Mathieu Virbel (KSW92G7TX8)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "\"$(PROJECT_DIR)/../build/include\"", + "\"$(PROJECT_DIR)/../build/python/include\"", + ); + INFOPLIST_FILE = "iOS_python_test-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(PROJECT_DIR)/../build/lib\"", + ); + OTHER_LDFLAGS = "-all_load"; + PRODUCT_NAME = "iOS-python-test"; + PROVISIONING_PROFILE = "08F763D9-A549-403A-9BA2-FC25EE9AEFD6"; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + STRIP_INSTALLED_PRODUCT = NO; + STRIP_STYLE = all; + TARGETED_DEVICE_FAMILY = 2; + USER_HEADER_SEARCH_PATHS = "/Users/dennda/dev/sdl-1.3/Xcode-iPhoneOS/SDL/build/Debug-iphoneos/usr/local/include/"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + STRIP_INSTALLED_PRODUCT = NO; + TARGETED_DEVICE_FAMILY = 2; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iOS-python-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iOS-python-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/app/iOS_python_test-Info.plist b/app/iOS_python_test-Info.plist new file mode 100644 index 0000000..8d4837f --- /dev/null +++ b/app/iOS_python_test-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UISupportedInterfaceOrientations~ipad + + + diff --git a/app/icon.png b/app/icon.png new file mode 100644 index 0000000..61653d2 Binary files /dev/null and b/app/icon.png differ diff --git a/app/main.m b/app/main.m new file mode 100644 index 0000000..db10daf --- /dev/null +++ b/app/main.m @@ -0,0 +1,58 @@ +// +// main.m +// iOS-python-test +// + +#import +#import +#include +#include "SDL/SDL_main.h" +#include + +int main(int argc, char *argv[]) { + int ret = 0; + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + // Special environment to prefer .pyo, and don't write bytecode if .py are found + // because the process will not have write attribute on the device. + putenv("PYTHONOPTIMIZE=2"); + putenv("PYTHONDONTWRITEBYTECODE=1"); + + // Kivy environment to prefer some implementation on ios platform + putenv("KIVY_WINDOW=sdl"); + putenv("KIVY_IMAGE=osxcoreimage"); + + NSLog(@"Initializing python"); + Py_Initialize(); + + // If other modules are using thread, we need to initialize them before. + PyEval_InitThreads(); + + NSString * resourcePath = [[NSBundle mainBundle] resourcePath]; + NSLog(@"PythonHome is: %s", (char *)[resourcePath UTF8String]); + Py_SetPythonHome((char *)[resourcePath UTF8String]); + PySys_SetArgv(argc, argv); + + // Search and start main.py + const char * prog = [ + [[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"py"] cStringUsingEncoding: + NSUTF8StringEncoding]; + NSLog(@"Running main.py: %s", prog); + FILE* fd = fopen(prog, "r"); + if ( fd == NULL ) { + ret = 1; + NSLog(@"Unable to open main.py, abort."); + } else { + ret = PyRun_SimpleFileEx(fd, prog, 1); + if (ret != 0) + NSLog(@"Application quit abnormally!"); + } + + Py_Finalize(); + NSLog(@"Leaving"); + + [pool release]; + + return ret; +}