Skip to content

Commit 2d0e344

Browse files
author
Roberto De Ioris
committed
improved build system for embedded python installation
1 parent 658f398 commit 2d0e344

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎Source/UnrealEnginePython/UnrealEnginePython.Build.cs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public UnrealEnginePython(TargetInfo Target)
206206
{
207207
if (pythonHome == "")
208208
{
209-
pythonHome = DiscoverPythonPath(windowsKnownPaths);
209+
pythonHome = DiscoverPythonPath(windowsKnownPaths, "Win64");
210210
if (pythonHome == "")
211211
{
212212
throw new System.Exception("Unable to find Python installation");
@@ -222,7 +222,7 @@ public UnrealEnginePython(TargetInfo Target)
222222
{
223223
if (pythonHome == "")
224224
{
225-
pythonHome = DiscoverPythonPath(macKnownPaths);
225+
pythonHome = DiscoverPythonPath(macKnownPaths, "Mac");
226226
if (pythonHome == "")
227227
{
228228
throw new System.Exception("Unable to find Python installation");
@@ -270,10 +270,11 @@ private bool IsPathRelative(string Path)
270270
return !IsRooted;
271271
}
272272

273-
private string DiscoverPythonPath(string[] knownPaths)
273+
private string DiscoverPythonPath(string[] knownPaths, string binaryPath)
274274
{
275275
// insert the PYTHONHOME content as the first known path
276276
List<string> paths = new List<string>(knownPaths);
277+
paths.Insert(0, Path.Combine(ModuleDirectory, "../../Binaries", binaryPath));
277278
string environmentPath = System.Environment.GetEnvironmentVariable("PYTHONHOME");
278279
if (!string.IsNullOrEmpty(environmentPath))
279280
paths.Insert(0, environmentPath);
@@ -304,7 +305,9 @@ private string DiscoverPythonPath(string[] knownPaths)
304305

305306
private string DiscoverLinuxPythonIncludesPath()
306307
{
307-
foreach (string path in linuxKnownIncludesPaths)
308+
List<string> paths = new List<string>(linuxKnownIncludesPaths);
309+
paths.Insert(0, Path.Combine(ModuleDirectory, "../../Binaries", "Linux", "include"));
310+
foreach (string path in paths)
308311
{
309312
string headerFile = Path.Combine(path, "Python.h");
310313
if (File.Exists(headerFile))
@@ -317,6 +320,9 @@ private string DiscoverLinuxPythonIncludesPath()
317320

318321
private string DiscoverLinuxPythonLibsPath()
319322
{
323+
List<string> paths = new List<string>(linuxKnownLibsPaths);
324+
paths.Insert(0, Path.Combine(ModuleDirectory, "../../Binaries", "Linux", "lib"));
325+
paths.Insert(0, Path.Combine(ModuleDirectory, "../../Binaries", "Linux", "lib64"));
320326
foreach (string path in linuxKnownLibsPaths)
321327
{
322328
if (File.Exists(path))

0 commit comments

Comments
 (0)