Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modify the code to support building iOS.
  • Loading branch information
cyberbibby committed Oct 24, 2018
commit a5b72984814b0036f968ae9d2a667345553e8ebe
4 changes: 2 additions & 2 deletions Source/UnrealEnginePython/Private/PyCommandlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ int32 UPyCommandlet::Main(const FString& CommandLine)
argv[i] = (wchar_t*)malloc(PyArgv[i].Len() + 1);
#if PLATFORM_MAC || PLATFORM_LINUX
wcsncpy(argv[i], *PyArgv[i].ReplaceEscapedCharWithChar(), PyArgv[i].Len() + 1);
#elif PLATFORM_ANDROID
#elif PLATFORM_ANDROID || PLATFORM_IOS
wcsncpy(argv[i], (const wchar_t *)*PyArgv[i].ReplaceEscapedCharWithChar(), PyArgv[i].Len() + 1);
#else
wcscpy_s(argv[i], PyArgv[i].Len() + 1, *PyArgv[i].ReplaceEscapedCharWithChar());
#endif
#else
argv[i] = (char*)malloc(PyArgv[i].Len() + 1);
#if PLATFORM_MAC || PLATFORM_LINUX || PLATFORM_ANDROID
#if PLATFORM_MAC || PLATFORM_LINUX || PLATFORM_ANDROID || PLATFORM_IOS
strncpy(argv[i], TCHAR_TO_UTF8(*PyArgv[i].ReplaceEscapedCharWithChar()), PyArgv[i].Len() + 1);
#else
strcpy_s(argv[i], PyArgv[i].Len() + 1, TCHAR_TO_UTF8(*PyArgv[i].ReplaceEscapedCharWithChar()));
Expand Down
2 changes: 1 addition & 1 deletion Source/UnrealEnginePython/Public/UnrealEnginePython.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#elif PLATFORM_LINUX
#include <Python.h>
#include <structmember.h>
#elif PLATFORM_ANDROID
#elif PLATFORM_ANDROID || PLATFORM_IOS
#include <Python.h>
#include <structmember.h>
#elif PLATFORM_WINDOWS
Expand Down
28 changes: 28 additions & 0 deletions Source/UnrealEnginePython/UnrealEnginePython.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public UnrealEnginePython(TargetInfo Target)
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
string PluginDirectory = Path.Combine(ModuleDirectory, "..", "..");

PublicIncludePaths.AddRange(
new string[] {
Expand Down Expand Up @@ -271,6 +272,33 @@ public UnrealEnginePython(TargetInfo Target)
AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", RelAPLPath));
}
#endif
else if (Target.Platform == UnrealTargetPlatform.IOS)
{
string PythonIOSLibsDirectory = Path.Combine(PluginDirectory, "python", "python36", "ios");

includePath = Path.Combine(PythonIOSLibsDirectory, "Python", "Headers");
PublicIncludePaths.Add(includePath);

PublicLibraryPaths.AddRange(
new string[] {
Path.Combine(PythonIOSLibsDirectory, "BZip2"),
Path.Combine(PythonIOSLibsDirectory, "OpenSSL"),
Path.Combine(PythonIOSLibsDirectory, "Python"),
Path.Combine(PythonIOSLibsDirectory, "XZ"),
});

string[] libraryPaths = new string[] {
Path.Combine(PythonIOSLibsDirectory, "BZip2", "libbzip2.a"),
Path.Combine(PythonIOSLibsDirectory, "OpenSSL", "libOpenSSL.a"),
Path.Combine(PythonIOSLibsDirectory, "Python", "libPython.a"),
Path.Combine(PythonIOSLibsDirectory, "XZ", "libxz.a"),
};

foreach (string libraryPath in libraryPaths)
{
PublicAdditionalLibraries.Add(libraryPath);
}
}

}

Expand Down