Skip to content

Commit 3e8c409

Browse files
committed
feat: specify custom runtime library path
1 parent 9cc4baa commit 3e8c409

File tree

4 files changed

+71
-9
lines changed

4 files changed

+71
-9
lines changed

Source/Ecsact/Public/EcsactUnreal/Ecsact.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ auto FEcsactModule::Abort() -> void {
3636
}
3737

3838
auto FEcsactModule::LoadEcsactRuntime() -> void {
39-
auto ecsact_runtime_path = FPaths::Combine(
40-
FPaths::ProjectDir(),
41-
TEXT("Binaries/Win64/EcsactRuntime.dll")
42-
);
39+
const auto* settings = GetDefault<UEcsactSettings>();
40+
auto ecsact_runtime_path = settings->GetEcsactRuntimeLibraryPath();
4341
UE_LOG(Ecsact, Log, TEXT("Loading ecsact runtime %s"), *ecsact_runtime_path);
4442

4543
EcsactRuntimeHandle = FPlatformProcess::GetDllHandle(*ecsact_runtime_path);

Source/Ecsact/Public/EcsactUnreal/EcsactSettings.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
11
#include "EcsactUnreal/EcsactSettings.h"
2+
#include "Misc/Paths.h"
23

34
UEcsactSettings::UEcsactSettings() {
45
}
56

7+
auto UEcsactSettings::GetEcsactRuntimeLibraryPath() const -> FString {
8+
#if WITH_EDITORONLY_DATA
9+
if(bEnableBuild) {
10+
return FPaths::Combine(
11+
FPaths::ProjectDir(),
12+
TEXT("Binaries/Win64/EcsactRuntime.dll")
13+
);
14+
} else {
15+
if(!FPaths::IsRelative(CustomEcsactRuntimeLibraryPath)) {
16+
return CustomEcsactRuntimeLibraryPath;
17+
} else {
18+
return FPaths::Combine(
19+
FPaths::ProjectDir(),
20+
CustomEcsactRuntimeLibraryPath
21+
);
22+
}
23+
}
24+
#else
25+
return FPaths::Combine(
26+
FPaths::ProjectDir(),
27+
TEXT("Binaries/Win64/EcsactRuntime.dll")
28+
);
29+
#endif
30+
}
31+
632
#if WITH_EDITORONLY_DATA
733
auto UEcsactSettings::GetValidRecipes() const -> TArray<FString> {
834
return Recipes.FilterByPredicate([](const FString& recipe) -> bool {

Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,49 @@ class ECSACT_API UEcsactSettings : public UObject {
3232
UEcsactSettings();
3333

3434
#if WITH_EDITORONLY_DATA
35+
3536
UPROPERTY(EditAnywhere, Config, Category = "Build")
37+
bool bEnableBuild = false;
38+
39+
/**
40+
* This path is used when not using the built-in ecsact recipe build system.
41+
* (i.e. bEnableBuild is false)
42+
*/
43+
UPROPERTY(
44+
EditAnywhere,
45+
Config,
46+
Category = "Build",
47+
Meta = ( //
48+
EditCondition = "!bEnableBuild",
49+
EditConditionHides
50+
)
51+
)
52+
FString CustomEcsactRuntimeLibraryPath;
53+
54+
UPROPERTY(
55+
EditAnywhere,
56+
Config,
57+
Category = "Build",
58+
Meta = ( //
59+
EditCondition = "bEnableBuild",
60+
EditConditionHides
61+
)
62+
)
3663
EEcsactBuildReportFilter BuildReportFilter;
3764

38-
UPROPERTY(EditAnywhere, Config, Category = "Build")
65+
UPROPERTY(
66+
EditAnywhere,
67+
Config,
68+
Category = "Build",
69+
Meta = ( //
70+
EditCondition = "bEnableBuild",
71+
EditConditionHides
72+
)
73+
)
3974
TArray<FString> Recipes;
4075

76+
auto GetEcsactRuntimeLibraryPath() const -> FString;
77+
4178
auto GetValidRecipes() const -> TArray<FString>;
4279

4380
#endif

Source/EcsactEditor/Private/EcsactEditor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,11 @@ auto FEcsactEditorModule::RunCodegen() -> void {
406406
auto FEcsactEditorModule::RunBuild() -> void {
407407
const auto* settings = GetDefault<UEcsactSettings>();
408408

409-
auto ecsact_runtime_path = FPaths::Combine(
410-
FPaths::ProjectDir(),
411-
TEXT("Binaries/Win64/EcsactRuntime.dll")
412-
);
409+
if(!settings->bEnableBuild) {
410+
return;
411+
}
412+
413+
auto ecsact_runtime_path = settings->GetEcsactRuntimeLibraryPath();
413414
auto temp_dir = FPaths::ConvertRelativePathToFull(FPaths::Combine(
414415
FPaths::ProjectIntermediateDir(),
415416
"Temp",

0 commit comments

Comments
 (0)