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
debug/
target/
ai_fighter/Package/
# 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

View file

@ -9,6 +9,7 @@
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.NativeCrossPlat",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"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,59 +1,79 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.IO;
using UnrealBuildTool;
public class NeuralNetworkAIController : ModuleRules
{
public NeuralNetworkAIController(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
public NeuralNetworkAIController(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include")
PublicIncludePaths.AddRange(
new string[] {
Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include")
}
);
PublicSystemLibraryPaths.Add(Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "include"));
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
// 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");
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
PublicIncludePaths.Add(IncludePath);
if (Target.Platform == UnrealTargetPlatform.Win64)
{
// Windows linking
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "fann.lib"));
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
//Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "bin", "fann.dll")
}
);
// 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"));
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "ThirdParty", "FANN", "lib", "fann.lib"));
// 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,8 +8,10 @@ public class AI_Fight_SimTarget : TargetRules
public AI_Fight_SimTarget(TargetInfo Target) : base(Target)
{
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 "Engine/GameInstance.h"
#include "Misc/FileHelper.h"
#include "HAL/PlatformFilemanager.h"
#include "HAL/PlatformFileManager.h"
#include "NeuralNetworkCommandLineParsing.generated.h"
UCLASS()