Merge branch 'master' of git://github.com/kivy/kivy-ios

This commit is contained in:
Richard Larkin 2016-11-22 11:23:31 +02:00
commit 2802db393c
2 changed files with 9 additions and 10 deletions
toolchain.py
tools/templates/{{ cookiecutter.project_name }}-ios

View file

@ -1145,7 +1145,7 @@ Xcode:
def distclean(self): def distclean(self):
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Clean the build, download and dist") description="Clean the build, download, and dist")
args = parser.parse_args(sys.argv[2:]) args = parser.parse_args(sys.argv[2:])
ctx = Context() ctx = Context()
if exists(ctx.build_dir): if exists(ctx.build_dir):
@ -1175,7 +1175,7 @@ Xcode:
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Create a new xcode project") description="Create a new xcode project")
parser.add_argument("name", help="Name of your project") parser.add_argument("name", help="Name of your project")
parser.add_argument("directory", help="Directory where your project live") parser.add_argument("directory", help="Directory where your project lives")
args = parser.parse_args(sys.argv[2:]) args = parser.parse_args(sys.argv[2:])
from cookiecutter.main import cookiecutter from cookiecutter.main import cookiecutter
@ -1185,6 +1185,7 @@ Xcode:
"title": args.name, "title": args.name,
"project_name": args.name.lower(), "project_name": args.name.lower(),
"domain_name": "org.kivy.{}".format(args.name.lower()), "domain_name": "org.kivy.{}".format(args.name.lower()),
"kivy_dir": dirname(realpath(__file__)),
"project_dir": realpath(args.directory), "project_dir": realpath(args.directory),
"version": "1.0.0", "version": "1.0.0",
"dist_dir": ctx.dist_dir, "dist_dir": ctx.dist_dir,

View file

@ -5,10 +5,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
//#include <python2.7/Python.h> #include "{{ cookiecutter.kivy_dir }}/dist/root/python/include/python2.7/Python.h"
//#include <Python.h> #include "{{ cookiecutter.kivy_dir }}/dist/include/common/sdl2/SDL_main.h"
#include "../dist/root/python/include/python2.7/Python.h"
#include "../dist/include/common/sdl2/SDL_main.h"
#include <dlfcn.h> #include <dlfcn.h>
void export_orientation(); void export_orientation();
@ -23,14 +21,14 @@ int main(int argc, char *argv[]) {
chdir("YourApp"); chdir("YourApp");
// Special environment to prefer .pyo, and don't write bytecode if .py are found // 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. // because the process will not have a write attribute on the device.
putenv("PYTHONOPTIMIZE=2"); putenv("PYTHONOPTIMIZE=2");
putenv("PYTHONDONTWRITEBYTECODE=1"); putenv("PYTHONDONTWRITEBYTECODE=1");
putenv("PYTHONNOUSERSITE=1"); putenv("PYTHONNOUSERSITE=1");
putenv("PYTHONPATH=."); putenv("PYTHONPATH=.");
//putenv("PYTHONVERBOSE=1"); //putenv("PYTHONVERBOSE=1");
// Kivy environment to prefer some implementation on ios platform // Kivy environment to prefer some implementation on iOS platform
putenv("KIVY_BUILD=ios"); putenv("KIVY_BUILD=ios");
putenv("KIVY_NO_CONFIG=1"); putenv("KIVY_NO_CONFIG=1");
putenv("KIVY_NO_FILELOG=1"); putenv("KIVY_NO_FILELOG=1");
@ -52,7 +50,7 @@ int main(int argc, char *argv[]) {
Py_Initialize(); Py_Initialize();
PySys_SetArgv(argc, argv); PySys_SetArgv(argc, argv);
// If other modules are using thread, we need to initialize them before. // If other modules are using the thread, we need to initialize them before.
PyEval_InitThreads(); PyEval_InitThreads();
// Add an importer for builtin modules // Add an importer for builtin modules
@ -78,7 +76,7 @@ int main(int argc, char *argv[]) {
[pool release]; [pool release];
// Look like the app still runn even when we leaved here. // Look like the app still runs even when we left here.
exit(ret); exit(ret);
return ret; return ret;
} }