ensure that site it not touched, and indicate this build is an ios build + ensure threads are correctly initialized (for further extensions like ffmpeg)
This commit is contained in:
parent
3f8b91143d
commit
bc78020481
1 changed files with 8 additions and 6 deletions
14
app/main.m
14
app/main.m
|
@ -18,22 +18,24 @@ int main(int argc, char *argv[]) {
|
||||||
// because the process will not have write attribute on the device.
|
// because the process will not have write attribute on the device.
|
||||||
putenv("PYTHONOPTIMIZE=2");
|
putenv("PYTHONOPTIMIZE=2");
|
||||||
putenv("PYTHONDONTWRITEBYTECODE=1");
|
putenv("PYTHONDONTWRITEBYTECODE=1");
|
||||||
|
putenv("PYTHONNOUSERSITE=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_WINDOW=sdl");
|
putenv("KIVY_WINDOW=sdl");
|
||||||
putenv("KIVY_IMAGE=osxcoreimage");
|
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];
|
NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
|
||||||
NSLog(@"PythonHome is: %s", (char *)[resourcePath UTF8String]);
|
NSLog(@"PythonHome is: %s", (char *)[resourcePath UTF8String]);
|
||||||
Py_SetPythonHome((char *)[resourcePath UTF8String]);
|
Py_SetPythonHome((char *)[resourcePath UTF8String]);
|
||||||
|
|
||||||
|
NSLog(@"Initializing python");
|
||||||
|
Py_Initialize();
|
||||||
PySys_SetArgv(argc, argv);
|
PySys_SetArgv(argc, argv);
|
||||||
|
|
||||||
|
// If other modules are using thread, we need to initialize them before.
|
||||||
|
PyEval_InitThreads();
|
||||||
|
|
||||||
// Search and start main.py
|
// Search and start main.py
|
||||||
const char * prog = [
|
const char * prog = [
|
||||||
[[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"py"] cStringUsingEncoding:
|
[[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"py"] cStringUsingEncoding:
|
||||||
|
|
Loading…
Add table
Reference in a new issue