Getting linux export working

This commit is contained in:
vandomej 2025-09-10 16:40:21 -07:00
parent 45ffb51cb9
commit 41288b6693
6 changed files with 85 additions and 52 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
# will have compiled files and executables # will have compiled files and executables
debug/ debug/
target/ target/
ai_fighter/Package/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

View file

@ -9,6 +9,7 @@
"Microsoft.VisualStudio.Component.Windows11SDK.22621", "Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Workload.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.ManagedDesktop", "Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.NativeCrossPlat",
"Microsoft.VisualStudio.Workload.NativeDesktop", "Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.NativeGame" "Microsoft.VisualStudio.Workload.NativeGame"
] ]

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<LinuxPlatform>
<AdditionalCompilerArguments>-fopenmp</AdditionalCompilerArguments>
<AdditionalLinkerArguments>-fopenmp</AdditionalLinkerArguments>
</LinuxPlatform>
</BuildConfiguration>
</Configuration>

View file

@ -1,5 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved. // Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.IO; using System.IO;
using UnrealBuildTool; using UnrealBuildTool;
@ -11,12 +12,9 @@ public class NeuralNetworkAIController : ModuleRules
PublicIncludePaths.AddRange( PublicIncludePaths.AddRange(
new string[] { new string[] {
// ... add public include paths required here ...
Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include") Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include")
} }
); );
PublicSystemLibraryPaths.Add(Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include"));
PrivateIncludePaths.AddRange( PrivateIncludePaths.AddRange(
new string[] { new string[] {
@ -24,7 +22,6 @@ public class NeuralNetworkAIController : ModuleRules
} }
); );
PublicDependencyModuleNames.AddRange( PublicDependencyModuleNames.AddRange(
new string[] new string[]
{ {
@ -33,7 +30,6 @@ public class NeuralNetworkAIController : ModuleRules
} }
); );
PrivateDependencyModuleNames.AddRange( PrivateDependencyModuleNames.AddRange(
new string[] new string[]
{ {
@ -45,15 +41,39 @@ public class NeuralNetworkAIController : ModuleRules
} }
); );
DynamicallyLoadedModuleNames.AddRange( DynamicallyLoadedModuleNames.AddRange(
new string[] new string[]
{ {
// ... add any modules that your module loads dynamically here ... // ... add any modules that your module loads dynamically here ...
//Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "bin", "fann.dll")
} }
); );
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "lib", "fann.lib")); // FANN Library configuration - MULTI-PLATFORM SUPPORT
string FannPath = Path.Combine(ModuleDirectory, "ThirdParty", "FANN");
string IncludePath = Path.Combine(FannPath, "include");
string LibraryPath = Path.Combine(FannPath, "lib");
PublicIncludePaths.Add(IncludePath);
if (Target.Platform == UnrealTargetPlatform.Win64)
{
// Windows linking
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "fann.lib"));
// Add runtime dependencies for Windows DLLs
string DllPath = Path.Combine(FannPath, "bin", "fann.dll");
RuntimeDependencies.Add(DllPath);
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
// Linux linking - using static library (recommended)
string LinuxLibraryPath = Path.Combine(LibraryPath, "Linux", "x86_64-unknown-linux-gnu");
PublicAdditionalLibraries.Add(Path.Combine(LinuxLibraryPath, "libfann.a"));
// Alternative: If using shared library (.so)
// string SoPath = Path.Combine(LinuxLibraryPath, "libfann.so");
//PublicAdditionalLibraries.Add(SoPath);
//RuntimeDependencies.Add("$(BinaryOutputDir)/libfann.so", SoPath);
}
} }
} }

View file

@ -8,7 +8,9 @@ public class AI_Fight_SimTarget : TargetRules
public AI_Fight_SimTarget(TargetInfo Target) : base(Target) public AI_Fight_SimTarget(TargetInfo Target) : base(Target)
{ {
Type = TargetType.Game; Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2; DefaultBuildSettings = BuildSettingsVersion.V5;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
CppStandard = CppStandardVersion.Cpp20;
ExtraModuleNames.AddRange( new string[] { "AI_Fight_Sim" } ); ExtraModuleNames.AddRange( new string[] { "AI_Fight_Sim" } );
} }

View file

@ -1,7 +1,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Engine/GameInstance.h" #include "Engine/GameInstance.h"
#include "Misc/FileHelper.h" #include "Misc/FileHelper.h"
#include "HAL/PlatformFilemanager.h" #include "HAL/PlatformFileManager.h"
#include "NeuralNetworkCommandLineParsing.generated.h" #include "NeuralNetworkCommandLineParsing.generated.h"
UCLASS() UCLASS()