Eliminate lpx-paths.hpp, which contains hardwired paths.

This commit is contained in:
2026-02-25 17:22:26 -05:00
parent 816c3f6a0d
commit 56dc1319c1
4 changed files with 11 additions and 19 deletions

1
.gitignore vendored
View File

@@ -37,7 +37,6 @@ Binaries/**
User/** User/**
.vs/** .vs/**
Source/Integration/lpx-paths.hpp
luprex/build/** luprex/build/**

View File

@@ -1,7 +1,7 @@
#include "LockedWrapper.h" #include "LockedWrapper.h"
#include "lpx-drvutil.hpp" #include "lpx-drvutil.hpp"
#include "lpx-paths.hpp" #include "Misc/Paths.h"
using namespace LpxCommonTypes; using namespace LpxCommonTypes;
@@ -17,7 +17,13 @@ void FlxLockedWrapper::InitWrapper() {
// Already initialized. // Already initialized.
return; return;
} }
FString dll((const UTF8CHAR*)LUPREX_DLL_PATH); #if PLATFORM_LINUX
FString dll = FPaths::Combine(FPaths::ProjectDir(), TEXT("luprex/build/Linux/luprexlib.so"));
#elif PLATFORM_WINDOWS
FString dll = FPaths::Combine(FPaths::ProjectDir(), TEXT("luprex/build/Windows/luprexlib.dll"));
#else
#error "Unsupported platform"
#endif
UE_LOG(LogLuprex, Verbose, TEXT("Luprex DLL Path: %s"), *dll); UE_LOG(LogLuprex, Verbose, TEXT("Luprex DLL Path: %s"), *dll);
void* DLL = FPlatformProcess::GetDllHandle(*dll); void* DLL = FPlatformProcess::GetDllHandle(*dll);
if (DLL != nullptr) { if (DLL != nullptr) {

View File

@@ -2,7 +2,7 @@
#include "LuprexGameModeBase.h" #include "LuprexGameModeBase.h"
#include "lpx-drvutil.hpp" #include "lpx-drvutil.hpp"
#include "lpx-paths.hpp" #include "Misc/Paths.h"
#include "Tangible.h" #include "Tangible.h"
#include "TangibleManager.h" #include "TangibleManager.h"
#include "LuaCall.h" #include "LuaCall.h"
@@ -41,7 +41,8 @@ uint32 ALuprexGameModeBase::Run() {
if (lockedwrap->get_rescan_lua_source(lockedwrap.Get())) if (lockedwrap->get_rescan_lua_source(lockedwrap.Get()))
{ {
drvutil::ostringstream srcpak; drvutil::ostringstream srcpak;
std::string srcpakerr = drvutil::package_lua_source(LUPREX_ROOT_PATH, &srcpak); FString LuprexRoot = FPaths::Combine(FPaths::ProjectDir(), TEXT("luprex"));
std::string srcpakerr = drvutil::package_lua_source(TCHAR_TO_UTF8(*LuprexRoot), &srcpak);
if (!srcpakerr.empty()) if (!srcpakerr.empty())
{ {
FString FMessage((const UTF8CHAR *)(srcpakerr.c_str())); FString FMessage((const UTF8CHAR *)(srcpakerr.c_str()));

View File

@@ -247,19 +247,6 @@ def generate_buildconfiguration_xml():
target2.write_text(template) target2.write_text(template)
def generate_lpx_paths():
"""
Unreal needs to be able to find the Luprex DLL, and it also needs to find the
Lua source code. For now, we just compile some hardwired paths into the
binary. Someday we'll do something more sophisticated.
"""
target = Path(f"{INTEGRATION}/Source/Integration/lpx-paths.hpp")
line1 = f'#define LUPREX_DLL_PATH "{INTEGRATION}/luprex/build/{OS}/luprexlib.{DLL}"'
line2 = f'#define LUPREX_ROOT_PATH "{INTEGRATION}/luprex"'
code = line1 + "\n" + line2 + "\n"
target.unlink(missing_ok=True)
target.write_text(code)
def generate_integration_uproject(): def generate_integration_uproject():
""" """
@@ -406,7 +393,6 @@ if MODE == "code-workspace":
if MODE == "all": if MODE == "all":
unzip_unreal_engine_and_apply_patch() unzip_unreal_engine_and_apply_patch()
generate_buildconfiguration_xml() generate_buildconfiguration_xml()
generate_lpx_paths()
generate_integration_uproject() generate_integration_uproject()
run_unrealengine_setup_bat_replacement() run_unrealengine_setup_bat_replacement()
run_generateprojectfiles_in_sandbox() run_generateprojectfiles_in_sandbox()