mac build is fixed. please test linux and windows

This commit is contained in:
Devrim Yasar 2025-03-27 16:47:31 -05:00
parent c344bdb3b4
commit ddf8e4bfd7
13 changed files with 83 additions and 32 deletions

BIN
.DS_Store vendored

Binary file not shown.

3
.gitignore vendored
View File

@ -74,4 +74,5 @@ Intermediate/*
Plugins/**/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
DerivedDataCache/*
.DS_Store

View File

@ -11,36 +11,17 @@ DEFINE_LOG_CATEGORY(LogMujoco);
void FLuckyMujocoModule::StartupModule()
{
FString BaseDir = IPluginManager::Get().FindPlugin(TEXT("LuckyMujoco"))->GetBaseDir();
FString LibraryPath;
#if WITH_EDITOR
LibraryPath = FPaths::Combine(
*BaseDir, TEXT("Source/ThirdParty/Mujoco/bin/mujoco.dll"));
#endif
FString Library;
#if PLATFORM_WINDOWS
Library = "mujoco.dll";
#elif PLATFORM_MAC
Library = "mujoco.dylib";
#elif PLATFORM_LINUX
Library = "libmujoco.so";
#endif
if (WITH_EDITOR)
{
MujocoHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
}
else
{
MujocoHandle = !Library.IsEmpty() ? FPlatformProcess::GetDllHandle(*Library) : nullptr;
}
MujocoHandle = !Library.IsEmpty() ? FPlatformProcess::GetDllHandle(*Library) : nullptr;
if (MujocoHandle == nullptr)
{
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("MujocoLibraryError", "Failed to load Mujoco library. Please make sure that Mujoco is installed and the library is in the correct path."));
}
#endif
}
void FLuckyMujocoModule::ShutdownModule()

View File

@ -1,5 +1,6 @@
using System.IO;
using UnrealBuildTool;
using System;
public class Mujoco : ModuleRules
{
@ -16,16 +17,33 @@ public class Mujoco : ModuleRules
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
PublicDelayLoadDLLs.Add("mujoco.dylib");
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "lib", "mujoco.dylib"));
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "mujoco.dylib"), Path.Combine(ModuleDirectory, "lib", "mujoco.dylib"));
string DllPath = Path.Combine(ModuleDirectory, "lib", "mujoco.dylib");
string BinaryOutputDir = Path.Combine("$(BinaryOutputDir)", "lib");
string TargetOutputDir = Path.Combine("$(TargetOutputDir)", "lib");
PublicDelayLoadDLLs.Add(DllPath);
PublicAdditionalLibraries.Add(DllPath);
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "mujoco.dylib"), DllPath);
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "libmujoco.3.2.7.dylib"), DllPath);
// RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "../../../../", "MacOS/libmujoco.3.2.7.dylib"), DllPath);
// RuntimeDependencies.Add("$(BinaryOutputDir)/UnrealEditor.app/Contents/MacOS/libmujoco.3.2.7.dylib", DllPath);
// Console.WriteLine("$BinaryOutputDir:"+ BinaryOutputDir);
// Console.WriteLine("$TargetOutputDir:" + TargetOutputDir);
// Console.WriteLine("$Target.Name:"+ Target.Name);
RuntimeDependencies.Add($"$(BinaryOutputDir)/libmujoco.3.2.7.dylib", DllPath);
// throw new Exception("test");
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "lib", "libmujoco.so"));
PublicDelayLoadDLLs.Add("libmujoco.so");
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "libmujoco.so"), Path.Combine(ModuleDirectory, "lib", "libmujoco.so"));
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "libmujoco.so.3.2.7"), Path.Combine(ModuleDirectory, "lib", "libmujoco.so"));
{
string DllPath = Path.Combine(ModuleDirectory, "lib", "libmujoco.so");
PublicAdditionalLibraries.Add(DllPath);
PublicDelayLoadDLLs.Add(DllPath);
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "libmujoco.so"), DllPath);
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", "libmujoco.so.3.2.7"), DllPath);
}
}
}

52
mac_build.sh Normal file
View File

@ -0,0 +1,52 @@
#!/bin/bash
# Get the user's home directory
USER_HOME="$HOME"
# Set up Unreal Engine paths
UE_ROOT="/Users/Shared/Epic Games/UE_5.5"
UE_EDITOR="$UE_ROOT/Engine/Binaries/Mac/UnrealEditor.app/Contents/MacOS/UnrealEditor"
UE_UAT="$UE_ROOT/Engine/Build/BatchFiles/RunUAT.command"
# Set up project paths
PROJECT_ROOT="$(pwd)"
PROJECT_FILE="$PROJECT_ROOT/Luckyrobots.uproject"
ARCHIVE_DIR="$PROJECT_ROOT/Builds"
# Run the build command
"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" Turnkey \
-command=VerifySdk \
-platform=Mac \
-UpdateIfNeeded \
-EditorIO \
-EditorIOPort=59484 \
-project="$PROJECT_FILE" \
BuildCookRun \
-nop4 \
-utf8output \
-cook \
-project="$PROJECT_FILE" \
-target=Luckyrobots \
-unrealexe="$UE_EDITOR" \
-platform=Mac \
-installed \
-stage \
-archive \
-package \
-build \
-iterativecooking \
-pak \
-iostore \
-compressed \
-prereqs \
-archivedirectory="$ARCHIVE_DIR" \
-CrashReporter \
-clientconfig=Shipping \
# -nocompile \
# -nocompileuat \
# -nocompileeditor \
# -skipbuildeditor \
# enable these if you want to test build without pak and iostore (you're just testing the build)
# -skipiostore \
# -skippak \ (disable -pak and -iostore)

View File

@ -1 +0,0 @@
test