Fixed mouse grab issue, added EnginePatch, improvements to build-everything

This commit is contained in:
2024-11-05 20:26:39 -05:00
parent 29dc91e43c
commit bf5e3e7a2a
3 changed files with 70 additions and 135 deletions

View File

@@ -7,7 +7,7 @@
# - Hardwiring paths into Source/Integration/lpx-paths.hpp
# - Generating Integration.uproject
# - Generating Integration.code-workspace
# - Patching LogMacros.cpp in UnrealEngine repository
# - Applies patch to Unreal Engine source.
# - Running Setup.sh in the UnrealEngine repository
# - Building luprex
# - Building ShaderCompileWorker
@@ -22,7 +22,7 @@
# It's much faster to edit and recompile using the IDE.
#
import sys, os, json, shutil
import sys, os, json, shutil, subprocess
from pathlib import Path
#
@@ -37,6 +37,10 @@ def writefile(fn, str):
with open(fn, "w") as f:
f.write(str)
def shell(cmd):
print("Running:", cmd)
subprocess.run(cmd, shell=True, check=True)
#
# These are some directory paths that we will need.
#
@@ -61,7 +65,6 @@ Path(f"Makefile").unlink(missing_ok=True)
Path(f"Source/Integration/lpx-paths.hpp").unlink(missing_ok=True)
Path(f"{UNREALENGINE}/Engine/Saved/UnrealBuildTool").mkdir(parents=True, exist_ok=True)
Path(f"{UNREALENGINE}/Engine/Saved/UnrealBuildTool/BuildConfiguration.xml").unlink(missing_ok=True)
Path(f"{UNREALENGINE}/Engine/Source/Runtime/Core/Private/Logging/LogMacros.cpp").unlink(missing_ok=True)
#
# Write BuildConfiguration.xml
@@ -81,11 +84,16 @@ writefile("Source/Integration/lpx-paths.hpp", f"""
""")
#
# Write LogMacros.cpp
# Apply patch to the unreal engine source.
# Restore any affected sourcefiles before applying patch.
#
LOGMACROS=readfile("EnginePatches/LogMacros.cpp")
writefile(f"{UNREALENGINE}/Engine/Source/Runtime/Core/Private/Logging/LogMacros.cpp", LOGMACROS)
os.chdir(UNREALENGINE)
print("Applying patch to Unreal Engine...")
shell("git checkout HEAD Engine/Source/Runtime/ApplicationCore/Private/Linux/LinuxPlatformApplicationMisc.cpp")
shell("git checkout HEAD Engine/Source/Runtime/Core/Private/Logging/LogMacros.cpp")
shell(f"git apply {INTEGRATION}/EnginePatches/EnginePatch")
os.chdir(INTEGRATION)
#
# Write Integration.uproject.
@@ -101,17 +109,14 @@ with open("Integration.uproject", "w") as rewritten:
#
os.chdir(UNREALENGINE)
print("Running setup.sh...")
os.system("./Setup.sh")
shell("./Setup.sh")
os.chdir(INTEGRATION)
#
# Use UnrealBuildTool to generate a rough draft of Integration.code-workspace.
#
BUILDPROJECTFILES = f'{UNREALENGINE}/GenerateProjectFiles.sh -projectfiles -project="{INTEGRATION}/Integration.uproject" -game'
print(BUILDPROJECTFILES)
os.system(BUILDPROJECTFILES)
shell(f'{UNREALENGINE}/GenerateProjectFiles.sh -projectfiles -project="{INTEGRATION}/Integration.uproject" -game')
#
# Load the rough Integration.code-workspace into RAM, then delete the rough draft.
@@ -190,7 +195,7 @@ with open("Integration.code-workspace", "w") as rewritten:
os.chdir(f"{INTEGRATION}/luprex")
print("Building luprex...")
os.system("make")
shell("make")
os.chdir(INTEGRATION)
#
@@ -199,7 +204,7 @@ os.chdir(INTEGRATION)
os.chdir(UNREALENGINE)
print("Building ShaderCompileWorker...")
os.system("Engine/Build/BatchFiles/Linux/Build.sh ShaderCompileWorker Linux Shipping -waitmutex")
shell("Engine/Build/BatchFiles/Linux/Build.sh ShaderCompileWorker Linux Shipping -waitmutex")
Path("Engine/Binaries/Linux/ShaderCompileWorker").unlink(missing_ok=True)
shutil.copyfile("Engine/Binaries/Linux/ShaderCompileWorker-Linux-Shipping", "Engine/Binaries/Linux/ShaderCompileWorker")
os.chdir(INTEGRATION)